diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-12-15 21:19:42 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-12-15 21:19:42 +0000 |
commit | 2b17b3a96693d74d81f212b330a5ea89c6db0c26 (patch) | |
tree | 46a3ef3aff0b2ff7c40e1b0afc617941be1a36d7 | |
parent | 5628256e6979335a58e7f9f873037873f24dae27 (diff) | |
download | brdo-2b17b3a96693d74d81f212b330a5ea89c6db0c26.tar.gz brdo-2b17b3a96693d74d81f212b330a5ea89c6db0c26.tar.bz2 |
- Patch #13907 by Neil: less ways to set the page title.
* Less logic in theme code.
* Encourages use of the menu system.
* Easier to find where a title or breadcrumb comes from in other people's code because there are less places to look. Look in menu and then grep for the appropriate set function. Looking for calls to theme_page() is hard because there are too many of them.
* Very slightly more efficient.
33 files changed, 128 insertions, 111 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ed1bf42b5..65f3ac59c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,8 +1,6 @@ Drupal x.x.x, xxxx-xx-xx ------------------------ -- blocks: - * reorganized the block configuration page. - search: * added UTF-8 support to make it work with all languages. * improved search indexing. @@ -12,6 +10,7 @@ Drupal x.x.x, xxxx-xx-xx - flood control mechanism: * added a mechanism to throttle certain operations. - usability: + * refactored the block configuration pages. * refactored the statistics and log pages. * refactored the throttle module configuration. * added a 'add child page' link to book pages. diff --git a/includes/common.inc b/includes/common.inc index 7416c17e9..097ab84c2 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -176,7 +176,8 @@ function drupal_not_found() { } if ($status != MENU_FOUND) { - print theme('page', '', t('Page not found')); + drupal_set_title(t('Page not found')); + print theme('page', ''); } } @@ -195,7 +196,8 @@ function drupal_access_denied() { } if ($status != MENU_FOUND) { - print theme('page', message_access(), t('Access denied')); + drupal_set_title(t('Access denied')); + print theme('page', message_access()); } } diff --git a/includes/theme.inc b/includes/theme.inc index 09de82652..ae93fd605 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -337,23 +337,10 @@ function theme_get_styles() { * * @param $content * A string to display in the main content area of the page. - * @param $title - * The title of the page, if different from that provided by the menu system. - * @param $breadcrumb - * The breadcrumb trail for the page, if different from that provided by the - * menu system. Use menu_set_location() instead, if possible. * @return * A string containing the entire HTML page. */ -function theme_page($content, $title = NULL, $breadcrumb = NULL) { - if (isset($title)) { - drupal_set_title($title); - } - - if (isset($breadcrumb)) { - drupal_set_breadcrumb($breadcrumb); - } - +function theme_page($content) { $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; $output .= '<html xmlns="http://www.w3.org/1999/xhtml">'; $output .= '<head>'; diff --git a/modules/blog.module b/modules/blog.module index fceb01867..2a3388550 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -141,7 +141,7 @@ function blog_page_user($uid) { $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1)); if ($account->uid) { - $title = t("%name's blog", array('%name' => $account->name)); + drupal_set_title($title = t("%name's blog", array('%name' => $account->name))); if (($account->uid == $user->uid) && user_access('edit own blog')) { $output = '<li>'. l(t('Post new blog entry.'), "node/add/blog") .'</li>'; @@ -165,7 +165,7 @@ function blog_page_user($uid) { $output .= theme('xml_icon', url("blog/feed/$account->uid")); drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/feed/$account->uid") .'" />'); - print theme('page', $output, $title); + print theme('page', $output); } else { drupal_not_found(); diff --git a/modules/blog/blog.module b/modules/blog/blog.module index fceb01867..2a3388550 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -141,7 +141,7 @@ function blog_page_user($uid) { $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1)); if ($account->uid) { - $title = t("%name's blog", array('%name' => $account->name)); + drupal_set_title($title = t("%name's blog", array('%name' => $account->name))); if (($account->uid == $user->uid) && user_access('edit own blog')) { $output = '<li>'. l(t('Post new blog entry.'), "node/add/blog") .'</li>'; @@ -165,7 +165,7 @@ function blog_page_user($uid) { $output .= theme('xml_icon', url("blog/feed/$account->uid")); drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS - '. $title .'" href="'. url("blog/feed/$account->uid") .'" />'); - print theme('page', $output, $title); + print theme('page', $output); } else { drupal_not_found(); diff --git a/modules/book.module b/modules/book.module index 0909abbcf..3aa7c03bf 100644 --- a/modules/book.module +++ b/modules/book.module @@ -291,7 +291,8 @@ function book_outline() { $output .= form_submit(t('Add to book outline')); } - print theme('page', form($output), $node->title); + drupal_set_title($node->title); + print theme('page', form($output)); } } } diff --git a/modules/book/book.module b/modules/book/book.module index 0909abbcf..3aa7c03bf 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -291,7 +291,8 @@ function book_outline() { $output .= form_submit(t('Add to book outline')); } - print theme('page', form($output), $node->title); + drupal_set_title($node->title); + print theme('page', form($output)); } } } diff --git a/modules/comment.module b/modules/comment.module index 6822fd8f4..67197bbdb 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -124,7 +124,7 @@ function comment_menu($may_cache) { $access = user_access('post comments'); $items[] = array('path' => 'comment/reply', 'title' => t('reply to comment'), 'callback' => 'comment_reply', 'access' => $access, 'type' => MENU_CALLBACK); - $items[] = array('path' => 'comment/edit', 'title' => t('edit your comment'), + $items[] = array('path' => 'comment/edit', 'title' => t('edit comment'), 'callback' => 'comment_edit', 'access' => $access, 'type' => MENU_CALLBACK); $items[] = array('path' => 'comment', 'title' => t('reply to comment'), @@ -341,7 +341,10 @@ function comment_edit($cid) { $comment = drupal_unpack($comment); $comment->name = $comment->uid ? $comment->registered_name : $comment->name; if (comment_access('edit', $comment)) { - print theme('page', comment_preview(object2array($comment)), t('Edit comment')); + print theme('page', comment_preview(object2array($comment))); + } + else { + drupal_access_denied(); } } @@ -356,13 +359,15 @@ function comment_reply($nid, $pid = NULL) { if ($_POST['op'] == t('Post comment')) { $edit = $_POST['edit']; comment_validate_form($edit); - print theme('page', comment_post($edit), t('Post comment')); + drupal_set_title(t('Post comment')); + print theme('page', comment_post($edit)); return; } else if ($_POST['op'] == t('Preview comment')) { $edit = $_POST['edit']; comment_validate_form($edit); - print theme('page', comment_preview($edit), t('Preview comment')); + drupal_set_title(t('Preview comment')); + print theme('page', comment_preview($edit)); return; } @@ -397,7 +402,8 @@ function comment_reply($nid, $pid = NULL) { $output .= theme('box', t('Reply'), t('You are not authorized to view comments.')); } - print theme('page', $output, t('Add new comment')); + drupal_set_title(t('Add new comment')); + print theme('page', $output); } function comment_validate_form($edit) { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 6822fd8f4..67197bbdb 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -124,7 +124,7 @@ function comment_menu($may_cache) { $access = user_access('post comments'); $items[] = array('path' => 'comment/reply', 'title' => t('reply to comment'), 'callback' => 'comment_reply', 'access' => $access, 'type' => MENU_CALLBACK); - $items[] = array('path' => 'comment/edit', 'title' => t('edit your comment'), + $items[] = array('path' => 'comment/edit', 'title' => t('edit comment'), 'callback' => 'comment_edit', 'access' => $access, 'type' => MENU_CALLBACK); $items[] = array('path' => 'comment', 'title' => t('reply to comment'), @@ -341,7 +341,10 @@ function comment_edit($cid) { $comment = drupal_unpack($comment); $comment->name = $comment->uid ? $comment->registered_name : $comment->name; if (comment_access('edit', $comment)) { - print theme('page', comment_preview(object2array($comment)), t('Edit comment')); + print theme('page', comment_preview(object2array($comment))); + } + else { + drupal_access_denied(); } } @@ -356,13 +359,15 @@ function comment_reply($nid, $pid = NULL) { if ($_POST['op'] == t('Post comment')) { $edit = $_POST['edit']; comment_validate_form($edit); - print theme('page', comment_post($edit), t('Post comment')); + drupal_set_title(t('Post comment')); + print theme('page', comment_post($edit)); return; } else if ($_POST['op'] == t('Preview comment')) { $edit = $_POST['edit']; comment_validate_form($edit); - print theme('page', comment_preview($edit), t('Preview comment')); + drupal_set_title(t('Preview comment')); + print theme('page', comment_preview($edit)); return; } @@ -397,7 +402,8 @@ function comment_reply($nid, $pid = NULL) { $output .= theme('box', t('Reply'), t('You are not authorized to view comments.')); } - print theme('page', $output, t('Add new comment')); + drupal_set_title(t('Add new comment')); + print theme('page', $output); } function comment_validate_form($edit) { diff --git a/modules/drupal.module b/modules/drupal.module index b19cb7ba4..a3494a29a 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -199,7 +199,7 @@ function drupal_menu($may_cache) { * Menu callback; print Drupal-authentication-specific information from user/help. */ function drupal_page_help() { - print theme('page', drupal_help('user/help#drupal'), t('Drupal')); + print theme('page', drupal_help('user/help#drupal')); } /** diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index b19cb7ba4..a3494a29a 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -199,7 +199,7 @@ function drupal_menu($may_cache) { * Menu callback; print Drupal-authentication-specific information from user/help. */ function drupal_page_help() { - print theme('page', drupal_help('user/help#drupal'), t('Drupal')); + print theme('page', drupal_help('user/help#drupal')); } /** diff --git a/modules/filter.module b/modules/filter.module index cc4ccfbcf..ed7ee3a83 100644 --- a/modules/filter.module +++ b/modules/filter.module @@ -671,7 +671,7 @@ function filter_tips_long() { else { $output = theme('filter_tips', _filter_tips(-1, true)); } - print theme('page', $output, t('Compose Tips')); + print theme('page', $output); } /** diff --git a/modules/filter/filter.module b/modules/filter/filter.module index cc4ccfbcf..ed7ee3a83 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -671,7 +671,7 @@ function filter_tips_long() { else { $output = theme('filter_tips', _filter_tips(-1, true)); } - print theme('page', $output, t('Compose Tips')); + print theme('page', $output); } /** diff --git a/modules/forum.module b/modules/forum.module index 39353f5ef..ef1f44e8c 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -487,7 +487,8 @@ function forum_page($tid = 0) { print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page); } else { - print theme('page', forum_help('admin/settings/forum'), t('Warning')); + drupal_set_title(t('Warning')); + print theme('page', forum_help('admin/settings/forum')); } } @@ -501,7 +502,7 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p // forum list, topics list, topic browser and 'add new topic' link $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', '')); - $title = $vocabulary->name; + drupal_set_title($title = $vocabulary->name); // Breadcrumb navigation: $breadcrumb = array(); @@ -554,11 +555,11 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p $output .= '</div>'; } else { - $title = t('No forums defined'); + drupal_set_title(t('No forums defined')); $output = ''; } - print theme('page', $output, $title); + print theme('page', $output); } /** diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 39353f5ef..ef1f44e8c 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -487,7 +487,8 @@ function forum_page($tid = 0) { print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page); } else { - print theme('page', forum_help('admin/settings/forum'), t('Warning')); + drupal_set_title(t('Warning')); + print theme('page', forum_help('admin/settings/forum')); } } @@ -501,7 +502,7 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p // forum list, topics list, topic browser and 'add new topic' link $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', '')); - $title = $vocabulary->name; + drupal_set_title($title = $vocabulary->name); // Breadcrumb navigation: $breadcrumb = array(); @@ -554,11 +555,11 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p $output .= '</div>'; } else { - $title = t('No forums defined'); + drupal_set_title(t('No forums defined')); $output = ''; } - print theme('page', $output, $title); + print theme('page', $output); } /** diff --git a/modules/node.module b/modules/node.module index 60e52d6df..90309765c 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1514,7 +1514,8 @@ function node_page() { if (is_numeric(arg(1))) { $node = node_load(array('nid' => arg(1)), $_GET['revision']); if ($node->nid) { - print theme('page', node_show($node, arg(2)), $node->title); + drupal_set_title($node->title); + print theme('page', node_show($node, arg(2))); } else { drupal_not_found(); @@ -1523,17 +1524,20 @@ function node_page() { break; case t('Preview'): $edit = node_validate($edit); - print theme('page', node_preview($edit), t('Preview')); + drupal_set_title(t('Preview')); + print theme('page', node_preview($edit)); break; case t('Submit'): drupal_set_title(t('Submit')); print theme('page', node_submit($edit)); break; case t('Delete'): - print theme('page', node_delete($edit), t('Delete')); + drupal_set_title(t('Delete')); + print theme('page', node_delete($edit)); break; default: - print theme('page', node_page_default(), ''); + drupal_set_title(''); + print theme('page', node_page_default()); } } diff --git a/modules/node/node.module b/modules/node/node.module index 60e52d6df..90309765c 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1514,7 +1514,8 @@ function node_page() { if (is_numeric(arg(1))) { $node = node_load(array('nid' => arg(1)), $_GET['revision']); if ($node->nid) { - print theme('page', node_show($node, arg(2)), $node->title); + drupal_set_title($node->title); + print theme('page', node_show($node, arg(2))); } else { drupal_not_found(); @@ -1523,17 +1524,20 @@ function node_page() { break; case t('Preview'): $edit = node_validate($edit); - print theme('page', node_preview($edit), t('Preview')); + drupal_set_title(t('Preview')); + print theme('page', node_preview($edit)); break; case t('Submit'): drupal_set_title(t('Submit')); print theme('page', node_submit($edit)); break; case t('Delete'): - print theme('page', node_delete($edit), t('Delete')); + drupal_set_title(t('Delete')); + print theme('page', node_delete($edit)); break; default: - print theme('page', node_page_default(), ''); + drupal_set_title(''); + print theme('page', node_page_default()); } } diff --git a/modules/path.module b/modules/path.module index c8a3caff2..43b2d0ec2 100644 --- a/modules/path.module +++ b/modules/path.module @@ -107,14 +107,14 @@ function path_admin_edit($pid = 0) { } elseif ($pid) { $alias = path_load($pid); - $title = $alias['dst']; + drupal_set_title($alias['dst']); $output = path_form(path_load($pid)); } else { $output = path_form(); } - print theme('page', $output, $title); + print theme('page', $output); } /** diff --git a/modules/path/path.module b/modules/path/path.module index c8a3caff2..43b2d0ec2 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -107,14 +107,14 @@ function path_admin_edit($pid = 0) { } elseif ($pid) { $alias = path_load($pid); - $title = $alias['dst']; + drupal_set_title($alias['dst']); $output = path_form(path_load($pid)); } else { $output = path_form(); } - print theme('page', $output, $title); + print theme('page', $output); } /** diff --git a/modules/poll.module b/modules/poll.module index bb9505962..9294224e3 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -357,7 +357,8 @@ function poll_view_results(&$node, $main, $page, $block) { */ function poll_results() { if ($node = node_load(array('nid' => arg(1)))) { - print theme('page', node_show($node, 0), $node->title); + drupal_set_title($node->title); + print theme('page', node_show($node, 0)); } else { drupal_not_found(); diff --git a/modules/poll/poll.module b/modules/poll/poll.module index bb9505962..9294224e3 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -357,7 +357,8 @@ function poll_view_results(&$node, $main, $page, $block) { */ function poll_results() { if ($node = node_load(array('nid' => arg(1)))) { - print theme('page', node_show($node, 0), $node->title); + drupal_set_title($node->title); + print theme('page', node_show($node, 0)); } else { drupal_not_found(); diff --git a/modules/profile.module b/modules/profile.module index df6e9fa2e..37bb21556 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -113,7 +113,8 @@ function profile_browse() { } $output .= '</div>'; - print theme('page', $output, $title); + drupal_set_title($title); + print theme('page', $output); } else if ($name && !$field->id) { drupal_not_found(); @@ -136,7 +137,8 @@ function profile_browse() { $output .= '</div>'; $output .= theme('pager', NULL, 20); - print theme('page', $output, t('user list')); + drupal_set_title(t('user list')); + print theme('page', $output); } } @@ -457,7 +459,8 @@ function profile_admin_add($type) { $data = array('name' => 'profile_'); } - print theme('page', _profile_field_form($type, $data), t('Add new %type', array('%type' => _profile_field_types($type)))); + drupal_set_title(t('Add new %type', array('%type' => _profile_field_types($type)))); + print theme('page', _profile_field_form($type, $data)); } /** @@ -484,7 +487,8 @@ function profile_admin_edit($fid) { $data = db_fetch_array(db_query('SELECT * FROM {profile_fields} WHERE fid = %d', $fid)); } - print theme('page', _profile_field_form($data['type'], $data), t('Edit %type', array('%type' => $data['type']))); + drupal_set_title(t('Edit %type', array('%type' => $data['type']))); + print theme('page', _profile_field_form($data['type'], $data)); } /** diff --git a/modules/profile/profile.module b/modules/profile/profile.module index df6e9fa2e..37bb21556 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -113,7 +113,8 @@ function profile_browse() { } $output .= '</div>'; - print theme('page', $output, $title); + drupal_set_title($title); + print theme('page', $output); } else if ($name && !$field->id) { drupal_not_found(); @@ -136,7 +137,8 @@ function profile_browse() { $output .= '</div>'; $output .= theme('pager', NULL, 20); - print theme('page', $output, t('user list')); + drupal_set_title(t('user list')); + print theme('page', $output); } } @@ -457,7 +459,8 @@ function profile_admin_add($type) { $data = array('name' => 'profile_'); } - print theme('page', _profile_field_form($type, $data), t('Add new %type', array('%type' => _profile_field_types($type)))); + drupal_set_title(t('Add new %type', array('%type' => _profile_field_types($type)))); + print theme('page', _profile_field_form($type, $data)); } /** @@ -484,7 +487,8 @@ function profile_admin_edit($fid) { $data = db_fetch_array(db_query('SELECT * FROM {profile_fields} WHERE fid = %d', $fid)); } - print theme('page', _profile_field_form($data['type'], $data), t('Edit %type', array('%type' => $data['type']))); + drupal_set_title(t('Edit %type', array('%type' => $data['type']))); + print theme('page', _profile_field_form($data['type'], $data)); } /** diff --git a/modules/search.module b/modules/search.module index 9cdc34431..fe70f94ba 100644 --- a/modules/search.module +++ b/modules/search.module @@ -496,7 +496,7 @@ function search_view() { $output .= $results; - print theme('page', $output, t('Search')); + print theme('page', $output); } else { drupal_access_denied(); diff --git a/modules/search/search.module b/modules/search/search.module index 9cdc34431..fe70f94ba 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -496,7 +496,7 @@ function search_view() { $output .= $results; - print theme('page', $output, t('Search')); + print theme('page', $output); } else { drupal_access_denied(); diff --git a/modules/statistics.module b/modules/statistics.module index d5b9f1546..7e9204f20 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -184,7 +184,8 @@ function statistics_node_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), $node->title); + drupal_set_title($node->title); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -211,7 +212,8 @@ function statistics_user_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $account->name); + drupal_set_title($account->name); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -222,7 +224,6 @@ function statistics_user_tracker() { * Menu callback; presents the "Recent hits" page. */ function statistics_recent_hits($type = 'all', $id = 0) { - $header = array( array('data' => t('Timestamp'), 'field' => 'a.timestamp', 'sort' => 'desc'), array('data' => t('Page'), 'field' => 'a.path'), @@ -245,7 +246,7 @@ function statistics_recent_hits($type = 'all', $id = 0) { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), t('Recent hits')); + print theme('page', theme('table', $header, $rows)); } /** @@ -269,7 +270,8 @@ function statistics_top_pages() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -294,7 +296,8 @@ function statistics_top_users() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -303,7 +306,7 @@ function statistics_top_users() { function statistics_top_referrers() { $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%' AND url <> '' GROUP BY url"; $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%'"; - $title = t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))); + drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $header = array( array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'), @@ -321,7 +324,7 @@ function statistics_top_referrers() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $title); + print theme('page', theme('table', $header, $rows)); } /** diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index d5b9f1546..7e9204f20 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -184,7 +184,8 @@ function statistics_node_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), $node->title); + drupal_set_title($node->title); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -211,7 +212,8 @@ function statistics_user_tracker() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $account->name); + drupal_set_title($account->name); + print theme('page', theme('table', $header, $rows)); } else { drupal_not_found(); @@ -222,7 +224,6 @@ function statistics_user_tracker() { * Menu callback; presents the "Recent hits" page. */ function statistics_recent_hits($type = 'all', $id = 0) { - $header = array( array('data' => t('Timestamp'), 'field' => 'a.timestamp', 'sort' => 'desc'), array('data' => t('Page'), 'field' => 'a.path'), @@ -245,7 +246,7 @@ function statistics_recent_hits($type = 'all', $id = 0) { $rows[] = array(array('data' => $pager, 'colspan' => '4')); } - print theme('page', theme('table', $header, $rows), t('Recent hits')); + print theme('page', theme('table', $header, $rows)); } /** @@ -269,7 +270,8 @@ function statistics_top_pages() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -294,7 +296,8 @@ function statistics_top_users() { $rows[] = array(array('data' => $pager, 'colspan' => '2')); } - print theme('page', theme('table', $header, $rows), t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + drupal_set_title(t('Top users in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); + print theme('page', theme('table', $header, $rows)); } /** @@ -303,7 +306,7 @@ function statistics_top_users() { function statistics_top_referrers() { $query = "SELECT url, COUNT(url) AS hits, MAX(timestamp) AS last FROM {accesslog} WHERE url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%' AND url <> '' GROUP BY url"; $query_cnt = "SELECT COUNT(DISTINCT(url)) FROM {accesslog} WHERE url <> '' AND url NOT LIKE '%". db_escape_string($_SERVER['HTTP_HOST']) ."%'"; - $title = t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))); + drupal_set_title(t('Top referrers in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200))))); $header = array( array('data' => t('Hits'), 'field' => 'hits', 'sort' => 'desc'), @@ -321,7 +324,7 @@ function statistics_top_referrers() { $rows[] = array(array('data' => $pager, 'colspan' => '3')); } - print theme('page', theme('table', $header, $rows), $title); + print theme('page', theme('table', $header, $rows)); } /** diff --git a/modules/taxonomy.module b/modules/taxonomy.module index c231a327d..cb1de14cc 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -906,7 +906,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { while ($term = db_fetch_object($result)) { $names[] = $term->name; } - $title = implode(', ', $names); + drupal_set_title($title = implode(', ', $names)); switch ($op) { case 'page': @@ -924,7 +924,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed")); - print theme('page', $output, $title); + print theme('page', $output); break; case 'feed': diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index c231a327d..cb1de14cc 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -906,7 +906,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { while ($term = db_fetch_object($result)) { $names[] = $term->name; } - $title = implode(', ', $names); + drupal_set_title($title = implode(', ', $names)); switch ($op) { case 'page': @@ -924,7 +924,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $operator, $depth, TRUE)); $output .= theme('xml_icon', url("taxonomy/term/$str_tids/$depth/feed")); - print theme('page', $output, $title); + print theme('page', $output); break; case 'feed': diff --git a/modules/user.module b/modules/user.module index a07fa5fef..e60a6bda2 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1169,7 +1169,8 @@ function user_edit($category = 'account') { } $output = form($output, 'post', 0, array('enctype' => 'multipart/form-data')); - print theme('page', $output, $account->name); + drupal_set_title($account->name); + print theme('page', $output); } function user_view($uid = 0) { @@ -1186,7 +1187,8 @@ function user_view($uid = 0) { } } - print theme('page', theme('user_profile', $account, $fields), $account->name); + drupal_set_title($account->name); + print theme('page', theme('user_profile', $account, $fields)); } else { drupal_not_found(); diff --git a/modules/user/user.module b/modules/user/user.module index a07fa5fef..e60a6bda2 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1169,7 +1169,8 @@ function user_edit($category = 'account') { } $output = form($output, 'post', 0, array('enctype' => 'multipart/form-data')); - print theme('page', $output, $account->name); + drupal_set_title($account->name); + print theme('page', $output); } function user_view($uid = 0) { @@ -1186,7 +1187,8 @@ function user_view($uid = 0) { } } - print theme('page', theme('user_profile', $account, $fields), $account->name); + drupal_set_title($account->name); + print theme('page', theme('user_profile', $account, $fields)); } else { drupal_not_found(); diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index b6c979311..78d0cc5e3 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -15,15 +15,7 @@ function chameleon_features() { 'toggle_secondary_links'); } -function chameleon_page($content, $title = NULL, $breadcrumb = NULL) { - if (isset($title)) { - drupal_set_title($title); - } - - if (isset($breadcrumb)) { - drupal_set_breadcrumb($breadcrumb); - } - +function chameleon_page($content) { $language = $GLOBALS['locale']; $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; diff --git a/themes/engines/xtemplate/xtemplate.engine b/themes/engines/xtemplate/xtemplate.engine index b92c2d959..389f3266e 100644 --- a/themes/engines/xtemplate/xtemplate.engine +++ b/themes/engines/xtemplate/xtemplate.engine @@ -109,14 +109,7 @@ function xtemplate_comment($comment, $links = 0) { return $output; } -function xtemplate_page($content, $title = NULL, $breadcrumb = NULL) { - if (isset($title)) { - drupal_set_title($title); - } - if (isset($breadcrumb)) { - drupal_set_breadcrumb($breadcrumb); - } - +function xtemplate_page($content) { global $xtemplate; $xtemplate->template->assign(array( |