| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: head.php 21074 2011-04-04 16:51:40Z dextercowley $ 4 * @package Joomla.Framework 5 * @subpackage Document 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is within the rest of the framework 16 defined('JPATH_BASE') or die(); 17 18 /** 19 * JDocument head renderer 20 * 21 * @package Joomla.Framework 22 * @subpackage Document 23 * @since 1.5 24 */ 25 class JDocumentRendererHead extends JDocumentRenderer 26 { 27 /** 28 * Renders the document head and returns the results as a string 29 * 30 * @access public 31 * @param string $name (unused) 32 * @param array $params Associative array of values 33 * @return string The output of the script 34 */ 35 function render( $head = null, $params = array(), $content = null ) 36 { 37 ob_start(); 38 39 echo $this->fetchHead($this->_doc); 40 41 $contents = ob_get_contents(); 42 ob_end_clean(); 43 44 return $contents; 45 } 46 47 /** 48 * Generates the head html and return the results as a string 49 * 50 * @access public 51 * @return string 52 */ 53 function fetchHead(&$document) 54 { 55 // Trigger the onBeforeCompileHead event. 56 $app = &JFactory::getApplication(); 57 $app->triggerEvent('onBeforeCompileHead'); 58 59 // get line endings 60 $lnEnd = $document->_getLineEnd(); 61 $tab = $document->_getTab(); 62 63 $tagEnd = ' />'; 64 65 $strHtml = ''; 66 67 // Generate base tag (need to happen first) 68 $base = $document->getBase(); 69 if(!empty($base)) { 70 $strHtml .= $tab.'<base href="'.$document->getBase().'" />'.$lnEnd; 71 } 72 73 // Generate META tags (needs to happen as early as possible in the head) 74 foreach ($document->_metaTags as $type => $tag) 75 { 76 foreach ($tag as $name => $content) 77 { 78 if ($type == 'http-equiv') { 79 $strHtml .= $tab.'<meta http-equiv="'.$name.'" content="'.$content.'"'.$tagEnd.$lnEnd; 80 } elseif ($type == 'standard') { 81 $strHtml .= $tab.'<meta name="'.$name.'" content="'.str_replace('"',"'",$content).'"'.$tagEnd.$lnEnd; 82 } 83 } 84 } 85 86 $strHtml .= $tab.'<meta name="description" content="'.$document->getDescription().'" />'.$lnEnd; 87 $strHtml .= $tab.'<meta name="generator" content="'.$document->getGenerator().'" />'.$lnEnd; 88 89 $strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd; 90 91 // Generate link declarations 92 foreach ($document->_links as $link) { 93 $strHtml .= $tab.$link.$tagEnd.$lnEnd; 94 } 95 96 // Generate stylesheet links 97 foreach ($document->_styleSheets as $strSrc => $strAttr ) 98 { 99 $strHtml .= $tab . '<link rel="stylesheet" href="'.$strSrc.'" type="'.$strAttr['mime'].'"'; 100 if (!is_null($strAttr['media'])){ 101 $strHtml .= ' media="'.$strAttr['media'].'" '; 102 } 103 if ($temp = JArrayHelper::toString($strAttr['attribs'])) { 104 $strHtml .= ' '.$temp;; 105 } 106 $strHtml .= $tagEnd.$lnEnd; 107 } 108 109 // Generate stylesheet declarations 110 foreach ($document->_style as $type => $content) 111 { 112 $strHtml .= $tab.'<style type="'.$type.'">'.$lnEnd; 113 114 // This is for full XHTML support. 115 if ($document->_mime == 'text/html' ) { 116 $strHtml .= $tab.$tab.'<!--'.$lnEnd; 117 } else { 118 $strHtml .= $tab.$tab.'<![CDATA['.$lnEnd; 119 } 120 121 $strHtml .= $content . $lnEnd; 122 123 // See above note 124 if ($document->_mime == 'text/html' ) { 125 $strHtml .= $tab.$tab.'-->'.$lnEnd; 126 } else { 127 $strHtml .= $tab.$tab.']]>'.$lnEnd; 128 } 129 $strHtml .= $tab.'</style>'.$lnEnd; 130 } 131 132 // Generate script file links 133 foreach ($document->_scripts as $strSrc => $strType) { 134 $strHtml .= $tab.'<script type="'.$strType.'" src="'.$strSrc.'"></script>'.$lnEnd; 135 } 136 137 // Generate script declarations 138 foreach ($document->_script as $type => $content) 139 { 140 $strHtml .= $tab.'<script type="'.$type.'">'.$lnEnd; 141 142 // This is for full XHTML support. 143 if ($document->_mime != 'text/html' ) { 144 $strHtml .= $tab.$tab.'<![CDATA['.$lnEnd; 145 } 146 147 $strHtml .= $content.$lnEnd; 148 149 // See above note 150 if ($document->_mime != 'text/html' ) { 151 $strHtml .= $tab.$tab.'// ]]>'.$lnEnd; 152 } 153 $strHtml .= $tab.'</script>'.$lnEnd; 154 } 155 156 foreach($document->_custom as $custom) { 157 $strHtml .= $tab.$custom.$lnEnd; 158 } 159 160 return $strHtml; 161 } 162 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |