本文整理匯總了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');