Commit 54d76f75 authored by Dries's avatar Dries
Browse files

- Pass theme objects by reference, avoids creating copies and lets called
  functions to store data in the theme (patch by Mike Krus).
parent c683ab5f
......@@ -9,25 +9,31 @@ function image($name) {
return "misc/$name";
}
function user($region, $theme) {
function user($region, &$theme) {
global $user;
if ($user->uid) {
// Display account settings:
$output .= "<div width=\"125\">\n";
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
$links = module_invoke($name, "link", "menu");
foreach ($links as $link) $content .= "$link<br />\n";
foreach ($links as $link) {
$output .= "$link<br />\n";
}
}
}
if (user_access("access administration pages")) {
$content .= "<br />\n";
$content .= "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a><BR>\n";
$output .= "<br />\n";
$output .= "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a><BR>\n";
}
$theme->box($user->name, $content, $region);
$output .= "</div>";
$theme->box($user->name, $output, $region);
}
else {
$output .= "<div align=\"center\">\n";
......@@ -46,10 +52,6 @@ function user($region, $theme) {
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $user, $id;
if ($user->uid) {
$output .= form_item(t("Node rating"), node_moderation($id) ." <input type=\"submit\" name=\"op\" value=\"". t("Update ratings") ."\" />", 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) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", 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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment