当前位置: 首页>>代码示例>>PHP>>正文


PHP JDocumentHtml::getMediaVersion方法代码示例

本文整理汇总了PHP中JDocumentHtml::getMediaVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP JDocumentHtml::getMediaVersion方法的具体用法?PHP JDocumentHtml::getMediaVersion怎么用?PHP JDocumentHtml::getMediaVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDocumentHtml的用法示例。


在下文中一共展示了JDocumentHtml::getMediaVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchHead


//.........这里部分代码省略.........
         }
         $buffer .= $tagEnd . $lnEnd;
     }
     // Generate stylesheet declarations
     foreach ($document->_style as $type => $content) {
         $buffer .= $tab . '<style';
         if (!is_null($type) && (!$document->isHtml5() || !in_array($type, $defaultCssMimes))) {
             $buffer .= ' type="' . $type . '"';
         }
         $buffer .= '>' . $lnEnd;
         // This is for full XHTML support.
         if ($document->_mime != 'text/html') {
             $buffer .= $tab . $tab . '/*<![CDATA[*/' . $lnEnd;
         }
         $buffer .= $content . $lnEnd;
         // See above note
         if ($document->_mime != 'text/html') {
             $buffer .= $tab . $tab . '/*]]>*/' . $lnEnd;
         }
         $buffer .= $tab . '</style>' . $lnEnd;
     }
     // Generate scripts options
     $scriptOptions = $document->getScriptOptions();
     if (!empty($scriptOptions)) {
         $buffer .= $tab . '<script type="application/json" class="joomla-script-options new">';
         $prettyPrint = JDEBUG && defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false;
         $jsonOptions = json_encode($scriptOptions, $prettyPrint);
         $jsonOptions = $jsonOptions ? $jsonOptions : '{}';
         $buffer .= $jsonOptions;
         $buffer .= '</script>' . $lnEnd;
     }
     $defaultJsMimes = array('text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript');
     $html5NoValueAttributes = array('defer', 'async');
     $mediaVersion = $document->getMediaVersion();
     // Generate script file links
     foreach ($document->_scripts as $src => $attribs) {
         // Check if script uses IE conditional statements.
         $conditional = isset($attribs['options']) && isset($attribs['options']['conditional']) ? $attribs['options']['conditional'] : null;
         // Check if script uses media version.
         if (strpos($src, '?') === false && isset($attribs['options']) && isset($attribs['options']['version']) && $attribs['options']['version']) {
             $src .= '?' . ($attribs['options']['version'] === 'auto' ? $mediaVersion : $attribs['options']['version']);
         }
         $buffer .= $tab;
         // This is for IE conditional statements support.
         if (!is_null($conditional)) {
             $buffer .= '<!--[if ' . $conditional . ']>';
         }
         $buffer .= '<script src="' . $src . '"';
         // Add script tag attributes.
         foreach ($attribs as $attrib => $value) {
             // Don't add the 'options' attribute. This attribute is for internal use (version, conditional, etc).
             if ($attrib === 'options') {
                 continue;
             }
             // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C.
             if (in_array($attrib, array('type', 'mime')) && $document->isHtml5() && in_array($value, $defaultJsMimes)) {
                 continue;
             }
             // Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C.
             if ($attrib === 'mime') {
                 $attrib = 'type';
             } elseif (in_array($attrib, array('defer', 'async')) && $value === true) {
                 $value = $attrib;
             }
             // Add attribute to script tag output.
             $buffer .= ' ' . htmlspecialchars($attrib, ENT_COMPAT, 'UTF-8');
开发者ID:eshiol,项目名称:joomla-cms,代码行数:67,代码来源:head.php


注:本文中的JDocumentHtml::getMediaVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。