From 54d76f753beb8bdf8f5d5d95930f2cf608140f26 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 14 Oct 2001 07:47:11 +0000 Subject: - Pass theme objects by reference, avoids creating copies and lets called functions to store data in the theme (patch by Mike Krus). --- includes/theme.inc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index 95be767b9..5a01e0a91 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -9,25 +9,31 @@ class BaseTheme { return "misc/$name"; } - function user($region, $theme) { + function user($region, &$theme) { global $user; if ($user->uid) { // Display account settings: + $output .= "
\n"; + foreach (module_list() as $name) { if (module_hook($name, "link")) { $links = module_invoke($name, "link", "menu"); - foreach ($links as $link) $content .= "$link
\n"; + foreach ($links as $link) { + $output .= "$link
\n"; + } } } if (user_access("access administration pages")) { - $content .= "
\n"; - $content .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; + $output .= "
\n"; + $output .= "". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."
\n"; } - $theme->box($user->name, $content, $region); + $output .= "
"; + + $theme->box($user->name, $output, $region); } else { $output .= "
\n"; @@ -46,10 +52,6 @@ class BaseTheme { function comment_controls($threshold = 1, $mode = 3, $order = 1) { global $user, $id; - if ($user->uid) { - $output .= form_item(t("Node rating"), node_moderation($id) ." ", t("Nodes and comments can be moderated by assigning them a score: content with a high rating is made more visible.")); - } - $output .= form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." ", t("Select your prefered way to display the comments and click 'Update settings' to active your changes.")); if (user_access("post comment")) { @@ -85,7 +87,7 @@ function theme_init() { return new Theme(); } -function theme_blocks($region, $theme) { +function theme_blocks($region, &$theme) { global $id, $PHP_SELF, $user; switch (strrchr($PHP_SELF, "/")) { @@ -108,7 +110,7 @@ function theme_blocks($region, $theme) { } } -function theme_moderation_results($theme, $node, $region) { +function theme_moderation_results(&$theme, $node, $region) { foreach (explode(",", $node->users) as $vote) { if ($vote) { $data = explode("=", $vote); -- cgit v1.2.3