Skip to content

Commit

Permalink
MDL-78806 core: Remove redundant site name
Browse files Browse the repository at this point in the history
MDL-78806 core: Remove redundant site name on page titles

* With the site name now being appended to the page titles, there
is no need to manually append the page titles.
  • Loading branch information
junpataleta committed Sep 9, 2023
1 parent 143a3bf commit 49393a1
Show file tree
Hide file tree
Showing 43 changed files with 62 additions and 63 deletions.
2 changes: 1 addition & 1 deletion admin/category.php
Expand Up @@ -132,7 +132,7 @@
}

$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_title(implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($buttons) {
$PAGE->set_button($buttons);
Expand Down
4 changes: 2 additions & 2 deletions admin/index.php
Expand Up @@ -224,7 +224,7 @@
$strlicense = get_string('license');

$PAGE->navbar->add($strlicense);
$PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
$PAGE->set_title($strinstallation . moodle_page::TITLE_SEPARATOR . 'Moodle ' . $CFG->target_release, false);
$PAGE->set_heading($strinstallation);
$PAGE->set_cacheable(false);

Expand Down Expand Up @@ -811,7 +811,7 @@

if (!has_capability('moodle/site:config', $context)) {
// Do not throw exception display an empty page with administration menu if visible for current user.
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('home'));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->footer();
Expand Down
2 changes: 1 addition & 1 deletion admin/searchreindex.php
Expand Up @@ -44,7 +44,7 @@

// Start page output.
$heading = get_string('gradualreindex', 'search', '');
$PAGE->set_title($PAGE->title . ': ' . $heading);
$PAGE->set_title($areaname . ' - ' . get_string('gradualreindex', 'search', ''));
$PAGE->navbar->add($heading);
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
Expand Down
2 changes: 1 addition & 1 deletion admin/settings.php
Expand Up @@ -131,7 +131,7 @@

$visiblepathtosection = array_reverse($settingspage->visiblepath);

$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_title(implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/filetypes/delete.php
Expand Up @@ -46,7 +46,7 @@
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
$PAGE->set_primary_active_tab('siteadminnode');
$PAGE->set_secondary_active_tab('server');

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/filetypes/edit.php
Expand Up @@ -107,7 +107,7 @@
$PAGE->navbar->add($oldextension ? s($oldextension) : $title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);

// Display the page.
echo $OUTPUT->header();
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/filetypes/index.php
Expand Up @@ -34,7 +34,7 @@
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/index.php'));
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);

$renderer = $PAGE->get_renderer('tool_filetypes');

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/filetypes/revert.php
Expand Up @@ -46,7 +46,7 @@
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);

// Display the page.
echo $OUTPUT->header();
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/mobile/logout.php
Expand Up @@ -56,7 +56,7 @@
$PAGE->set_url(new \moodle_url('/'.$CFG->admin.'/tool/mobile/logout.php'));
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);

// Display the page.
echo $OUTPUT->header();
Expand Down
2 changes: 1 addition & 1 deletion auth/ldap/ntlmsso_attempt.php
Expand Up @@ -26,7 +26,7 @@
// when we've already left the page that set the timer.
$loginsite = get_string("loginsite");
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();

Expand Down
2 changes: 1 addition & 1 deletion auth/ldap/ntlmsso_finish.php
Expand Up @@ -26,7 +26,7 @@
// here (and not add 3 more secs).
$loginsite = get_string("loginsite");
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1',
Expand Down
2 changes: 1 addition & 1 deletion auth/shibboleth/login.php
Expand Up @@ -55,7 +55,7 @@
$PAGE->set_url('/auth/shibboleth/login.php');
$PAGE->set_context(context_system::instance());
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
$PAGE->set_pagelayout('login');

Expand Down
6 changes: 3 additions & 3 deletions blog/edit.php
Expand Up @@ -143,7 +143,7 @@
'sesskey' => sesskey(),
'courseid' => $courseid);
$optionsno = array('userid' => $entry->userid, 'courseid' => $courseid);
$PAGE->set_title("$SITE->shortname: $strblogs");
$PAGE->set_title($strblogs);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

Expand All @@ -164,11 +164,11 @@
}
} else if ($action == 'add') {
$editmodetitle = $strblogs . ': ' . get_string('addnewentry', 'blog');
$PAGE->set_title("$SITE->shortname: $editmodetitle");
$PAGE->set_title($editmodetitle);
$PAGE->set_heading(fullname($USER));
} else if ($action == 'edit') {
$editmodetitle = $strblogs . ': ' . get_string('editentry', 'blog');
$PAGE->set_title("$SITE->shortname: $editmodetitle");
$PAGE->set_title($editmodetitle);
$PAGE->set_heading(fullname($USER));
}

Expand Down
2 changes: 1 addition & 1 deletion blog/external_blog_edit.php
Expand Up @@ -138,7 +138,7 @@
$PAGE->navbar->add(get_string('addnewexternalblog', 'blog'));

$PAGE->set_heading(fullname($USER));
$PAGE->set_title("$SITE->shortname: $strblogs: $strexternalblogs");
$PAGE->set_title("$strblogs: $strexternalblogs");

echo $OUTPUT->header();
echo $OUTPUT->heading($strformheading, 2);
Expand Down
2 changes: 1 addition & 1 deletion blog/external_blogs.php
Expand Up @@ -67,7 +67,7 @@
$blogs = $DB->get_records('blog_external', array('userid' => $USER->id));

$PAGE->set_heading(fullname($USER));
$PAGE->set_title("$SITE->shortname: $strblogs: $strexternalblogs");
$PAGE->set_title("$strblogs: $strexternalblogs");
$PAGE->set_pagelayout('standard');

echo $OUTPUT->header();
Expand Down
19 changes: 11 additions & 8 deletions blog/lib.php
Expand Up @@ -716,9 +716,10 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Note: if action is set to 'add' or 'edit', we do this at the end.
if (empty($entryid) && empty($modid) && empty($courseid) && empty($userid) && !in_array($action, array('edit', 'add'))) {
$PAGE->navbar->add($strblogentries, $blogurl);
$PAGE->set_title($site->fullname);
$strsiteblog = get_string('siteblogheading', 'blog');
$PAGE->set_title($strsiteblog);
$PAGE->set_heading($site->fullname);
$headers['heading'] = get_string('siteblogheading', 'blog');
$headers['heading'] = $strsiteblog;
}

// Case 2: only entryid is requested, ignore all other filters. courseid is used to give more contextual information.
Expand All @@ -742,9 +743,10 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu

$blogurl->remove_params('userid');
$PAGE->navbar->add($entry->subject, $blogurl);
$PAGE->set_title("$shortname: " . fullname($user) . ": $entry->subject");
$blogentryby = get_string('blogentrybyuser', 'blog', fullname($user));
$PAGE->set_title($entry->subject . moodle_page::TITLE_SEPARATOR . $blogentryby);
$PAGE->set_heading("$shortname: " . fullname($user) . ": $entry->subject");
$headers['heading'] = get_string('blogentrybyuser', 'blog', fullname($user));
$headers['heading'] = $blogentryby;

// We ignore tag and search params.
if (empty($action) || !$CFG->useblogassociations) {
Expand All @@ -758,17 +760,18 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu

$shortname = format_string($site->shortname, true, array('context' => context_course::instance(SITEID)));
$blogurl->param('userid', $userid);
$PAGE->set_title("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
$PAGE->set_title(fullname($user) . ": " . get_string('blog', 'blog'));
$PAGE->set_heading("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
$headers['heading'] = get_string('userblog', 'blog', fullname($user));
$headers['strview'] = get_string('viewuserentries', 'blog', fullname($user));

} else if (!$CFG->useblogassociations && empty($userid) && !in_array($action, array('edit', 'add'))) {
// Case 4: No blog associations, no userid.

$PAGE->set_title($site->fullname);
$strsiteblog = get_string('siteblogheading', 'blog');
$PAGE->set_title($strsiteblog);
$PAGE->set_heading($site->fullname);
$headers['heading'] = get_string('siteblogheading', 'blog');
$headers['heading'] = $strsiteblog;
} else if (!empty($userid) && !empty($modid) && empty($entryid)) {
// Case 5: Blog entries associated with an activity by a specific user (courseid ignored).

Expand All @@ -781,7 +784,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$PAGE->navbar->add(fullname($user), "$CFG->wwwroot/user/view.php?id=$user->id");
$PAGE->navbar->add($strblogentries, $blogurl);

$PAGE->set_title("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
$PAGE->set_title(fullname($user) . ': ' . get_string('blogentries', 'blog') . moodle_page::TITLE_SEPARATOR . $cm->name);
$PAGE->set_heading("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));

$a = new stdClass();
Expand Down
2 changes: 1 addition & 1 deletion blog/preferences.php
Expand Up @@ -95,7 +95,7 @@
$strpreferences = get_string('preferences');
$strblogs = get_string('blogs', 'blog');

$title = "$site->shortname: $strblogs : $strpreferences";
$title = "$strblogs : $strpreferences";
$PAGE->set_title($title);
$PAGE->set_heading(fullname($USER));

Expand Down
2 changes: 1 addition & 1 deletion calendar/delete.php
Expand Up @@ -92,7 +92,7 @@

$PAGE->navbar->add($strcalendar, $viewcalendarurl);
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$title);
$PAGE->set_title($strcalendar.': '.$title);
$PAGE->set_heading($COURSE->fullname);
if ($course) {
$PAGE->set_secondary_navigation(false);
Expand Down
4 changes: 2 additions & 2 deletions course/delete.php
Expand Up @@ -57,7 +57,7 @@
$strdeletingcourse = get_string("deletingcourse", "", $courseshortname);

$PAGE->navbar->add($strdeletingcourse);
$PAGE->set_title("$SITE->shortname: $strdeletingcourse");
$PAGE->set_title($strdeletingcourse);
$PAGE->set_heading($SITE->fullname);

echo $OUTPUT->header();
Expand All @@ -77,7 +77,7 @@
$strdeletecheck = get_string("deletecheck", "", $courseshortname);

$PAGE->navbar->add($strdeletecheck);
$PAGE->set_title("$SITE->shortname: $strdeletecheck");
$PAGE->set_title($strdeletecheck);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

Expand Down
2 changes: 1 addition & 1 deletion course/edit.php
Expand Up @@ -235,7 +235,7 @@
$PAGE->navbar->add(get_string('coursemgmt', 'admin'), $managementurl);

$pagedesc = $straddnewcourse;
$title = "$site->shortname: $straddnewcourse";
$title = $straddnewcourse;
$fullname = format_string($category->name);
$PAGE->navbar->add($pagedesc);
}
Expand Down
2 changes: 1 addition & 1 deletion course/editcategory.php
Expand Up @@ -72,7 +72,7 @@
} else {
$context = context_system::instance();
$fullname = $SITE->fullname;
$title = "$SITE->shortname: $strtitle";
$title = $strtitle;
$PAGE->set_secondary_active_tab('courses');
}

Expand Down
6 changes: 3 additions & 3 deletions course/renderer.php
Expand Up @@ -1662,13 +1662,13 @@ public function course_category($category) {
if (core_course_category::is_simple_site()) {
// There is only one category in the system, do not display link to it.
$strfulllistofcourses = get_string('fulllistofcourses');
$this->page->set_title("$site->shortname: $strfulllistofcourses");
$this->page->set_title($strfulllistofcourses);
} else if (!$coursecat->id || !$coursecat->is_uservisible()) {
$strcategories = get_string('categories');
$this->page->set_title("$site->shortname: $strcategories");
$this->page->set_title($strcategories);
} else {
$strfulllistofcourses = get_string('fulllistofcourses');
$this->page->set_title("$site->shortname: $strfulllistofcourses");
$this->page->set_title($strfulllistofcourses);
}

// Print current category description
Expand Down
4 changes: 2 additions & 2 deletions course/search.php
Expand Up @@ -86,10 +86,10 @@

if (empty($searchcriteria)) {
// no search criteria specified, print page with just search form
$PAGE->set_title("$site->fullname : $strsearch");
$PAGE->set_title($strsearch);
} else {
// this is search results page
$PAGE->set_title("$site->fullname : $strsearchresults");
$PAGE->set_title($strsearchresults);
// Link to manage search results should be visible if user have system or category level capability
if ((can_edit_in_category() || !empty($usercatlist))) {
$aurl = new moodle_url('/course/management.php', $searchcriteria);
Expand Down
2 changes: 1 addition & 1 deletion h5p/libraries.php
Expand Up @@ -39,7 +39,7 @@
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->set_title("$SITE->shortname: " . $pagetitle);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($SITE->fullname);

$h5pfactory = new \core_h5p\factory();
Expand Down
2 changes: 1 addition & 1 deletion h5p/overview.php
Expand Up @@ -35,7 +35,7 @@
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->set_title("$SITE->shortname: " . $pagetitle);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($SITE->fullname);

echo $OUTPUT->header();
Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -101,7 +101,7 @@
$PAGE->set_pagetype('site-index');
$PAGE->set_docs_path('');
$editing = $PAGE->user_is_editing();
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('home'));
$PAGE->set_heading($SITE->fullname);
$PAGE->set_secondary_active_tab('coursehome');

Expand Down
2 changes: 1 addition & 1 deletion lib/adminlib.php
Expand Up @@ -8830,7 +8830,7 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
$PAGE->set_button($OUTPUT->single_button($url, $caption, 'get'));
}

$PAGE->set_title("$SITE->shortname: " . implode(": ", $visiblepathtosection));
$PAGE->set_title(implode(": ", $visiblepathtosection));
$PAGE->set_heading($SITE->fullname);

if ($hassiteconfig && empty($options['nosearch'])) {
Expand Down
6 changes: 1 addition & 5 deletions lib/pagelib.php
Expand Up @@ -1702,11 +1702,7 @@ protected function starting_output() {
'/settings.php?section=maintenancemode">' . get_string('maintenancemode', 'admin') .
'</a> ' . $this->button);

$title = $this->title;
if ($title) {
$title .= ' - ';
}
$this->set_title($title . get_string('maintenancemode', 'admin'));
$this->set_title(get_string('maintenancemode', 'admin'));
}

$this->initialise_standard_body_classes();
Expand Down
1 change: 0 additions & 1 deletion lib/weblib.php
Expand Up @@ -3197,7 +3197,6 @@ function print_maintenance_message() {

$PAGE->set_pagetype('maintenance-message');
$PAGE->set_pagelayout('maintenance');
$PAGE->set_title(strip_tags($SITE->fullname));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('sitemaintenance', 'admin'));
Expand Down
4 changes: 2 additions & 2 deletions login/index.php
Expand Up @@ -244,7 +244,7 @@
$passwordchangeurl = $CFG->wwwroot.'/login/change_password.php';
}
$days2expire = $userauth->password_expire($USER->username);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading("$site->fullname");
if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
echo $OUTPUT->header();
Expand Down Expand Up @@ -361,7 +361,7 @@
redirect(new moodle_url('/login/index.php'));
}

$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading("$site->fullname");

echo $OUTPUT->header();
Expand Down
4 changes: 2 additions & 2 deletions login/logout.php
Expand Up @@ -45,7 +45,7 @@
redirect($redirect);

} else if (!confirm_sesskey($sesskey)) {
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('logout'));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('logoutconfirm'), new moodle_url($PAGE->url, array('sesskey'=>sesskey())), $CFG->wwwroot.'/');
Expand All @@ -61,4 +61,4 @@

require_logout();

redirect($redirect);
redirect($redirect);
2 changes: 1 addition & 1 deletion message/output/popup/notifications.php
Expand Up @@ -51,7 +51,7 @@

// Display page header.
$title = get_string('notifications', 'message');
$PAGE->set_title("{$SITE->shortname}: " . $title);
$PAGE->set_title($title);
$PAGE->set_heading(fullname($user));

// Grab the renderer.
Expand Down

0 comments on commit 49393a1

Please sign in to comment.