PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Quản lý công ty du lịch khách sạn PHP/sgncnew/libraries/joomla/document/html/renderer/head.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 162 lines | 111 code | 13 blank | 38 comment | 4 complexity | 38aca4a5b9f810e07b7b31dcc7ed0b1b MD5 | raw file
  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. // Check to ensure this file is within the rest of the framework
  15. defined('JPATH_BASE') or die();
  16. /**
  17. * JDocument head renderer
  18. *
  19. * @package Joomla.Framework
  20. * @subpackage Document
  21. * @since 1.5
  22. */
  23. class JDocumentRendererHead extends JDocumentRenderer
  24. {
  25. /**
  26. * Renders the document head and returns the results as a string
  27. *
  28. * @access public
  29. * @param string $name (unused)
  30. * @param array $params Associative array of values
  31. * @return string The output of the script
  32. */
  33. function render( $head = null, $params = array(), $content = null )
  34. {
  35. ob_start();
  36. echo $this->fetchHead($this->_doc);
  37. $contents = ob_get_contents();
  38. ob_end_clean();
  39. return $contents;
  40. }
  41. /**
  42. * Generates the head html and return the results as a string
  43. *
  44. * @access public
  45. * @return string
  46. */
  47. function fetchHead(&$document)
  48. {
  49. // Trigger the onBeforeCompileHead event.
  50. $app = &JFactory::getApplication();
  51. $app->triggerEvent('onBeforeCompileHead');
  52. // get line endings
  53. $lnEnd = $document->_getLineEnd();
  54. $tab = $document->_getTab();
  55. $tagEnd = ' />';
  56. $strHtml = '';
  57. // Generate base tag (need to happen first)
  58. $base = $document->getBase();
  59. if(!empty($base)) {
  60. $strHtml .= $tab.'<base href="'.$document->getBase().'" />'.$lnEnd;
  61. }
  62. // Generate META tags (needs to happen as early as possible in the head)
  63. foreach ($document->_metaTags as $type => $tag)
  64. {
  65. foreach ($tag as $name => $content)
  66. {
  67. if ($type == 'http-equiv') {
  68. $strHtml .= $tab.'<meta http-equiv="'.$name.'" content="'.$content.'"'.$tagEnd.$lnEnd;
  69. } elseif ($type == 'standard') {
  70. $strHtml .= $tab.'<meta name="'.$name.'" content="'.str_replace('"',"'",$content).'"'.$tagEnd.$lnEnd;
  71. }
  72. }
  73. }
  74. $strHtml .= $tab.'<meta name="description" content="'.$document->getDescription().'" />'.$lnEnd;
  75. $strHtml .= $tab.'<meta name="generator" content="'.$document->getGenerator().'" />'.$lnEnd;
  76. $strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;
  77. // Generate link declarations
  78. foreach ($document->_links as $link) {
  79. $strHtml .= $tab.$link.$tagEnd.$lnEnd;
  80. }
  81. // Generate stylesheet links
  82. foreach ($document->_styleSheets as $strSrc => $strAttr )
  83. {
  84. $strHtml .= $tab . '<link rel="stylesheet" href="'.$strSrc.'" type="'.$strAttr['mime'].'"';
  85. if (!is_null($strAttr['media'])){
  86. $strHtml .= ' media="'.$strAttr['media'].'" ';
  87. }
  88. if ($temp = JArrayHelper::toString($strAttr['attribs'])) {
  89. $strHtml .= ' '.$temp;;
  90. }
  91. $strHtml .= $tagEnd.$lnEnd;
  92. }
  93. // Generate stylesheet declarations
  94. foreach ($document->_style as $type => $content)
  95. {
  96. $strHtml .= $tab.'<style type="'.$type.'">'.$lnEnd;
  97. // This is for full XHTML support.
  98. if ($document->_mime == 'text/html' ) {
  99. $strHtml .= $tab.$tab.'<!--'.$lnEnd;
  100. } else {
  101. $strHtml .= $tab.$tab.'<![CDATA['.$lnEnd;
  102. }
  103. $strHtml .= $content . $lnEnd;
  104. // See above note
  105. if ($document->_mime == 'text/html' ) {
  106. $strHtml .= $tab.$tab.'-->'.$lnEnd;
  107. } else {
  108. $strHtml .= $tab.$tab.']]>'.$lnEnd;
  109. }
  110. $strHtml .= $tab.'</style>'.$lnEnd;
  111. }
  112. // Generate script file links
  113. foreach ($document->_scripts as $strSrc => $strType) {
  114. $strHtml .= $tab.'<script type="'.$strType.'" src="'.$strSrc.'"></script>'.$lnEnd;
  115. }
  116. // Generate script declarations
  117. foreach ($document->_script as $type => $content)
  118. {
  119. $strHtml .= $tab.'<script type="'.$type.'">'.$lnEnd;
  120. // This is for full XHTML support.
  121. if ($document->_mime != 'text/html' ) {
  122. $strHtml .= $tab.$tab.'<![CDATA['.$lnEnd;
  123. }
  124. $strHtml .= $content.$lnEnd;
  125. // See above note
  126. if ($document->_mime != 'text/html' ) {
  127. $strHtml .= $tab.$tab.'// ]]>'.$lnEnd;
  128. }
  129. $strHtml .= $tab.'</script>'.$lnEnd;
  130. }
  131. foreach($document->_custom as $custom) {
  132. $strHtml .= $tab.$custom.$lnEnd;
  133. }
  134. return $strHtml;
  135. }
  136. }