0) || (isset($htmlErrorList) && $htmlErrorList != '')); } //-------------------------------------------------- // If an error has occurred, we should replace the // page title - useful for screen reader users, // to inform them of a problem if ($GLOBALS['tplErrorOccurred']) { $GLOBALS['tplPageTitle'] = ' - An error has occurred'; } //-------------------------------------------------- // Folder if (isset($GLOBALS['webAddressBase'])) { $urlAssetsFolder = $GLOBALS['webAddressBase']; } else { $urlAssetsFolder = $GLOBALS['webAddress']; } //-------------------------------------------------- // Create the skip links $GLOBALS['tplAccessKeys'] = array(); $GLOBALS['tplAccessKeys']['skipToErr'] = returnSubmittedValue('accessKeySkipToErr', 'COOKIE'); $GLOBALS['tplAccessKeys']['skipToCont'] = returnSubmittedValue('accessKeySkipToCont', 'COOKIE'); $GLOBALS['tplAccessKeys']['skipToNav'] = returnSubmittedValue('accessKeySkipToNav', 'COOKIE'); if ($GLOBALS['tplAccessKeys']['skipToErr'] == '') $GLOBALS['tplAccessKeys']['skipToErr'] = 'e'; if ($GLOBALS['tplAccessKeys']['skipToCont'] == '') $GLOBALS['tplAccessKeys']['skipToCont'] = '1'; if ($GLOBALS['tplAccessKeys']['skipToNav'] == '') $GLOBALS['tplAccessKeys']['skipToNav'] = '2'; $GLOBALS['tplSkipLinksHtml'] = '' . "\n"; //-------------------------------------------------- // JavaScript //-------------------------------------------------- // Build the JS HTML code - taking that the user // has not disabled it. $jsDisable = returnSubmittedValue('jsDisable', 'COOKIE'); if ($jsDisable != 'true') { if (count($GLOBALS['tplJavaScriptFiles']) > 0) { $GLOBALS['tplJavaScriptHtml'] = '' . "\n\t"; } foreach (array_unique($GLOBALS['tplJavaScriptFiles']) as $file) { $GLOBALS['tplJavaScriptHtml'] .= '' . "\n\t"; } } //-------------------------------------------------- // CSS //-------------------------------------------------- // Setup the css files for this site: // mediaNormal - the normal media type // mediaSelected - the selected media type // default - is used by default // altTitle - if set, provided to browser as alt // altSticky - set true to keep over page loads // accessKey - the html access key used in links if (!isset($cssLinks)) { if (isset($GLOBALS['cssLinks'])) { $cssLinks = $GLOBALS['cssLinks']; } else { $cssLinks = array( 'core' => array(), 'print' => array(), 'high' => array(), ); } } if (isset($cssLinks['core'])) { $cssLinks['core'] = array_merge(array( 'mediaNormal' => 'all', 'mediaSelected' => 'all', 'showDefault' => true, 'altTitle' => '', 'altSticky' => false, 'accessKey' => 'n', 'files' => array(), ), $cssLinks['core']); } if (isset($cssLinks['print'])) { $cssLinks['print'] = array_merge(array( 'mediaNormal' => 'print', 'mediaSelected' => 'print,screen', 'showDefault' => true, 'altTitle' => 'Print', 'altSticky' => false, 'accessKey' => 'p', 'files' => array(), ), $cssLinks['print']); } if (isset($cssLinks['high'])) { $cssLinks['high'] = array_merge(array( 'mediaNormal' => 'screen,screen', 'mediaSelected' => 'screen,screen', 'showDefault' => false, 'altTitle' => 'High Contrast', 'altSticky' => true, 'accessKey' => 'h', 'files' => array(), ), $cssLinks['high']); } if (isset($cssLinksExtra)) { $cssLinks = array_merge($cssLinks, $cssLinksExtra); } //-------------------------------------------------- // Version Number $version = intval(isset($GLOBALS['tplCssVersion']) ? $GLOBALS['tplCssVersion'] : 0); //-------------------------------------------------- // Return the required values for this script $styleSheetGet = returnSubmittedValue('styleSheetName', 'GET'); $styleSheetCookie = returnSubmittedValue('styleSheetName', 'COOKIE'); //-------------------------------------------------- // Decide on the style sheets to use //-------------------------------------------------- // If the 'normal' style sheet has been selected, // then this indicates a need for a reset if ($styleSheetGet == 'normal' || $styleSheetCookie == 'normal') { $styleSheetGet = ''; $styleSheetCookie = ''; cookie::delete('styleSheetName'); } //-------------------------------------------------- // Check that the get/cookie references a style // sheet and that the cookie is a valid sticky // option if (!isset($cssLinks[$styleSheetGet])) { $styleSheetGet = ''; } if (!isset($cssLinks[$styleSheetCookie]) || $cssLinks[$styleSheetCookie]['altSticky'] != true) { $styleSheetCookie = ''; } //-------------------------------------------------- // If a style sheet has been specified through // the GET request, then store it in a cookie, // otherwise get the style sheet name from // the cookie if ($styleSheetGet != '') { $styleSheetName = $styleSheetGet; if ($cssLinks[$styleSheetName]['altSticky'] == true) { cookie::set('styleSheetName', $styleSheetName); } } else { $styleSheetName = $styleSheetCookie; } //-------------------------------------------------- // Return the name of the root (first) folder if (isset($GLOBALS['tplFolder'][0]) && $GLOBALS['tplFolder'][0] != '') { $rootFolders = $GLOBALS['tplFolder']; } else { $rootFolders = array('home'); } //-------------------------------------------------- // Build an array of style sheet files foreach ($cssLinks as $cssFileName => $cInfo) { $cssLinks[$cssFileName]['files'] = array(); $file = '/a/css/global/' . $cssFileName . '.css'; if (is_file(ROOT . $file)) { $cssLinks[$cssFileName]['files'][] = $file; } } $buildUpAddress = '/a/css/'; foreach ($rootFolders as $f) { if ($f != '') { $buildUpAddress .= $f . '/'; foreach ($cssLinks as $cssFileName => $cInfo) { $file = $buildUpAddress . $cssFileName . '.css'; if (is_file(ROOT . $file)) { $cssLinks[$cssFileName]['files'][] = $file; } } } } //-------------------------------------------------- // Create the HTML in an 'easy to insert' var $GLOBALS['tplCssLinksHtml'] = ''; foreach ($cssLinks as $cssFileName => $cInfo) { if ($cInfo['showDefault'] == true || $styleSheetName == $cssFileName) { foreach ($cInfo['files'] as $file) { $GLOBALS['tplCssLinksHtml'] .= '' . "\n\t"; } } } if ($GLOBALS['tplCssLinksHtml'] != '') { $GLOBALS['tplCssLinksHtml'] .= "\n\t"; } foreach ($cssLinks as $cssFileName => $cInfo) { if ($cInfo['altTitle'] != '' && $styleSheetName != $cssFileName) { foreach ($cInfo['files'] as $file) { $GLOBALS['tplCssLinksHtml'] .= '' . "\n\t"; } } } //-------------------------------------------------- // Create the $queryString which can be // added to the beginning of the style sheet // switcher url's $GLOBALS['tplCssSwitcherQuery'] = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''); $GLOBALS['tplCssSwitcherQuery'] = preg_replace('/styleSheetName=[^&]*&/', '', $GLOBALS['tplCssSwitcherQuery']); $GLOBALS['tplCssSwitcherQuery'] = preg_replace('/(^|&)styleSheetName=[^&]*$/', '', $GLOBALS['tplCssSwitcherQuery']); if ($GLOBALS['tplCssSwitcherQuery'] != '') { $GLOBALS['tplCssSwitcherQuery'] .= '&'; } //-------------------------------------------------- // Create the style sheet switcher code //-------------------------------------------------- // Start $GLOBALS['tplCssSwitcherHtml'] = '' . "\n"; //-------------------------------------------------- // Kill the assets if this browser is not supported. //-------------------------------------------------- // A list of browsers which will be harmed by // the CSS or JS if (!isset($browserBlackList)) { $browserBlackList = array(); $browserBlackList[] = '/MSIE [1-4]\./'; $browserBlackList[] = '/MSIE.*; Mac_PowerPC/'; $browserBlackList[] = '/Netscape\/[4-7]\./'; } //-------------------------------------------------- // Run the test if (isset($_SERVER['HTTP_USER_AGENT'])) { foreach ($browserBlackList as $browserRegExp) { if (preg_match($browserRegExp, $_SERVER['HTTP_USER_AGENT'])) { $GLOBALS['tplCssLinksHtml'] = ''; $GLOBALS['tplJavaScriptHtml'] = ''; $GLOBALS['tplExtraHeadHtml'] = ''; $GLOBALS['tplSkipLinksHtml'] = ''; $GLOBALS['tplCssSwitcherHtml'] = ''; } } } //-------------------------------------------------- // Send the XML prolog if we are in XML mode if ($GLOBALS['pageMimeType'] == 'application/xhtml+xml') { // echo '' . "\n"; } ?>