diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-24 03:30:59 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-24 03:30:59 +0000 |
commit | 5eaf3e033fda5864b93b864ba2e97038ae2cec51 (patch) | |
tree | dd00739f0e52323c502e561343da8175d0580928 /includes/theme.inc | |
parent | bb9e871f7c4e941cebed10844a01bbc221e44364 (diff) | |
download | brdo-5eaf3e033fda5864b93b864ba2e97038ae2cec51.tar.gz brdo-5eaf3e033fda5864b93b864ba2e97038ae2cec51.tar.bz2 |
#655742 by sun, jide: Add template variable for outputting HTML HEAD title safely.
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 887ed23ce..4d8e054d7 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2194,14 +2194,18 @@ function template_preprocess_html(&$variables) { // Construct page title. if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), check_plain(variable_get('site_name', 'Drupal'))); + $head_title = array( + 'title' => strip_tags(drupal_get_title()), + 'name' => check_plain(variable_get('site_name', 'Drupal')), + ); } else { - $head_title = array(check_plain(variable_get('site_name', 'Drupal'))); + $head_title = array('name' => check_plain(variable_get('site_name', 'Drupal'))); if (variable_get('site_slogan', '')) { - $head_title[] = filter_xss_admin(variable_get('site_slogan', '')); + $head_title['slogan'] = filter_xss_admin(variable_get('site_slogan', '')); } } + $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); // Populate the page template suggestions. @@ -2419,18 +2423,22 @@ function template_preprocess_maintenance_page(&$variables) { // Construct page title if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + $head_title = array( + 'title' => strip_tags(drupal_get_title()), + 'name' => variable_get('site_name', 'Drupal'), + ); } else { - $head_title = array(variable_get('site_name', 'Drupal')); + $head_title = array('name' => variable_get('site_name', 'Drupal')); if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); + $head_title['slogan'] = variable_get('site_slogan', ''); } } // set the default language if necessary $language = isset($GLOBALS['language']) ? $GLOBALS['language'] : language_default(); + $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); $variables['base_path'] = base_path(); $variables['front_page'] = url(); |