From 08428284d6a05298f00cfb51bb00b130e84c242e Mon Sep 17 00:00:00 2001 From: Garret Walliman Date: Fri, 21 Feb 2014 11:44:47 -0700 Subject: [PATCH] WEBSPARK-127 --- template.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/template.php b/template.php index ef4cc5b..1c039f6 100644 --- a/template.php +++ b/template.php @@ -81,9 +81,18 @@ function openasu_bootstrap_preprocess_page(&$variables) { // Parse sitename for color $variables['site_name_first'] = ''; $variables['site_name_last'] = ''; - $middle = strrpos(substr($variables['site_name'], 0, floor(strlen($variables['site_name']) / 2)), ' ') + 1; - $variables['site_name_first'] = substr($variables['site_name'], 0, $middle); // "The Quick : Brown Fox " - $variables['site_name_last'] = substr($variables['site_name'], $middle); // "Jumped Over The Lazy / Dog" + if (strpos($variables['site_name'], ' ') !== FALSE) + { + $site_name_words = explode(" ", $variables['site_name']); + $middle = floor(count($site_name_words) / 2); + $variables['site_name_first'] = implode(" ", array_slice($site_name_words, 0, $middle)); + $variables['site_name_last'] = implode(" ", array_slice($site_name_words, $middle, count($site_name_words) - $middle)); + } + else + { + $variables['site_name_last'] = $variables['site_name']; + } + // Build the navicon if applicable if (!theme_get_setting('hide_local_menu_navicon', 'openasu_bootstrap')) {