<?php/** * Copyright (c) 2008 Kim Johansson * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. *//** * Check if we got a supplied title, a title in config/application.php * or if we should build one from the URL. */$useAppName = $this->config->item ( 'useApplicationName' );$title = '';/* Check if we have an appplication title. */if ( ( $appName = $this->config->item ( 'applicationName' ) ) !== false && $useAppName ) $title = $appName;elseif ( $useAppName ) $title = 'Default';/** * Check if we got any stylesheets to use. * If we have some in config/application.php use them too. */$css = array ( );/* Check config values. */if ( ( $configCssLinks = $this->config->item ( 'cssLinks' ) ) !== false ): foreach ( $configCssLinks as $item ): /* If item is not array, then it must be a link, make proper. */ if ( ! is_array ( $item ) ) $item = array ( 'href' => site_url ( $item ) ); /* If item has 'href' key, use that. */ elseif ( isset ( $item['href'] ) ) $item['href'] = site_url ( $item['href'] ); /* Blargh, stupid programmer sent me not valid data, skip. */ else continue; /* If we have no default media, */ if ( ! isset ( $item['media'] ) ) $item['media'] = 'all'; $css[] = $item; endforeach;endif;/* Check sent values. */if ( isset ( $cssLinks ) ): foreach ( $cssLinks as $item ): /* If item is not array, then it must be a link, make proper. */ if ( ! is_array ( $item ) ) $item = array ( 'href' => site_url ( $item ) ); /* Blargh, stupid programmer sent me not valid data, skip. */ else continue; /* If we have no default media, */ if ( ! isset ( $item['media'] ) ) $item['media'] = 'all'; $css[] = $item; endforeach;endif;/** * Check if we got any RSS-flows to announce. */$rss = array ( );/* Check config values. */if ( ( $configRSSValues = $this->config->item ( 'rssLinks' ) ) !== false ): foreach ( $configRSSValues as $item ): /* If item isn't an array, use it as the link and add default values. */ if ( ! is_array ( $item ) ) $item = array ( 'href' => $item, 'title' => '' ); /* If we have no link, continue. */ if ( ! isset ( $item['href'] ) ) continue; /* If we have a title. */ if ( ! isset ( $item['title'] ) ) $item['title'] = ''; $rss[] = $item; endforeach;endif;/** * Check if we got any Javascripts we should use. * If we have some in config/application.php use them too. */$js = array ( );/* Check config values. */if ( ( $configJSValues = $this->config->item ( 'jsLinks' ) ) !== false ): foreach ( $configJSValues as $item ): endforeach;endif;unset ( $configJSValues );/** * Check if we got any meta-things to use. */$meta = array ( );/* Check config values. */if ( ( $configMetaValues = $this->config->item ( 'metaInfo' ) ) !== false ):endif;?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html401/strict.dtd"><html> <head> <title><?=$title?></title> <!-- CSS --><?php foreach ( $css as $item ): ?> <link rel="Stylesheet" type="text/css" href="<?=site_url($item['href'])?>" media="<?=$item['media']?>"><?php endforeach; ?> <!-- JS --><?php foreach ( $js as $item ): ?> <script type="text/javascript" src="<?=site_url($item)?>"></script><?php endforeach; ?> <!-- RSS --><?php foreach ( $rss as $item ): ?> <link rel="alternate" href="<?=site_url($item['href'])?>" type="application/rss+xml" title="<?=$item['title']?>"><?php endforeach; ?> <!-- Other meta-info. --><?php foreach ( $meta as $item ): ?> <meta <?=$item['content']?>><?php endforeach; ?> </head> <body>