Clean this up a bit.
authorJan Schneider <jan@horde.org>
Thu, 9 Dec 2010 11:05:16 +0000 (12:05 +0100)
committerJan Schneider <jan@horde.org>
Thu, 9 Dec 2010 11:05:16 +0000 (12:05 +0100)
horde/templates/common-header.inc

index 5f8ca3a..690f386 100644 (file)
@@ -1,23 +1,33 @@
 <?php
+
+header('Content-type: text/html; charset=UTF-8');
+
+$html_attr = $body_attr = '';
 if (isset($GLOBALS['language'])) {
-    header('Content-type: text/html; charset=UTF-8');
     header('Vary: Accept-Language');
+    $html_attr .= ' lang="' . strtr($GLOBALS['language'], '_', '-') . '"';
+}
+if ($hi = Horde_Util::nonInputVar('htmlId')) {
+    $html_attr .= ' id="' . $hi . '"';
+}
+if ($bc = Horde_Util::nonInputVar('bodyClass')) {
+    $body_attr .= ' class="' . $bc . '"';
+}
+if ($bi = Horde_Util::nonInputVar('bodyId')) {
+    $body_attr .= ' id="' . $bi . '"';
 }
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
-<?php
-echo (!empty($GLOBALS['language']) ? '<html lang="' . strtr($GLOBALS['language'], '_', '-') . '"' : '<html')
-    . (($hi = Horde_Util::nonInputVar('htmlId')) ? ' id="' . $hi . '"' : '')
-    . '>';
-?>
-<head>
-<?php
 
 $page_title = $GLOBALS['registry']->get('name');
 if (!empty($title)) {
     $page_title .= ' :: ' . $title;
 }
 
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
+<html<?php echo $html_attr ?>>
+<head>
+<?php
+
 Horde::outputMetaTags();
 
 if (!$GLOBALS['browser']->isMobile()) {
@@ -32,4 +42,4 @@ if (!$GLOBALS['browser']->isMobile()) {
 <title><?php echo htmlspecialchars($page_title) ?></title>
 </head>
 
-<body<?php if ($bc = Horde_Util::nonInputVar('bodyClass')) echo ' class="' . $bc . '"' ?><?php if ($bi = Horde_Util::nonInputVar('bodyId')) echo ' id="' . $bi . '"'; ?>>
+<body<?php echo $body_attr ?>>