From 20187919e373d2352bc553b7b413ca21426f637c Mon Sep 17 00:00:00 2001
From: Tim Plunkett <git@plnktt.com>
Date: Thu, 5 May 2011 13:00:22 -0400
Subject: [PATCH] Issue #850728 by bleen18, tim.plunkett: Added Bartik template.php cleanups.

---
 themes/bartik/template.php |   47 +++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/themes/bartik/template.php b/themes/bartik/template.php
index d523a0a..d3d6d85 100644
--- a/themes/bartik/template.php
+++ b/themes/bartik/template.php
@@ -44,18 +44,10 @@ function bartik_process_page(&$variables) {
   if (module_exists('color')) {
     _color_page_alter($variables);
   }
-  // Always print the site name and slogan, but if they are toggled off, we'll
-  // just hide them visually.
-  $variables['hide_site_name']   = theme_get_setting('toggle_name') ? FALSE : TRUE;
-  $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
-  if ($variables['hide_site_name']) {
-    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
-    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
-  }
-  if ($variables['hide_site_slogan']) {
-    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
-    $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
-  }
+
+  // Set the options that apply to both page and maintenance page.
+  _bartik_process_page($variables);
+
   // Since the title and the shortcut link are both block level elements,
   // positioning them next to each other is much simpler with a wrapper div.
   if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
@@ -87,18 +79,8 @@ function bartik_preprocess_maintenance_page(&$variables) {
  * Override or insert variables into the maintenance page template.
  */
 function bartik_process_maintenance_page(&$variables) {
-  // Always print the site name and slogan, but if they are toggled off, we'll
-  // just hide them visually.
-  $variables['hide_site_name']   = theme_get_setting('toggle_name') ? FALSE : TRUE;
-  $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
-  if ($variables['hide_site_name']) {
-    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
-    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
-  }
-  if ($variables['hide_site_slogan']) {
-    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
-    $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
-  }
+  // Set the options that apply to both page and maintenance page.
+  _bartik_process_page($variables);
 }
 
 /**
@@ -150,3 +132,20 @@ function bartik_field__taxonomy_term_reference($variables) {
 
   return $output;
 }
+
+/**
+ * Helper function for handling the site name and slogan.
+ */
+function _bartik_process_page(&$variables) {
+  // Check to see if the site name or slogan should be hidden.
+  $variables['hide_site_name']   = theme_get_setting('toggle_name') ? FALSE : TRUE;
+  $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
+  if ($variables['hide_site_name']) {
+    // If the site name is hidden, it will be empty, so we rebuild it.
+    $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
+  }
+  if ($variables['hide_site_slogan']) {
+    // If the site slogan is hidden, it will be empty, so we rebuild it.
+    $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
+  }
+}
-- 
1.7.3.2

