203 protected $metaCharsetTag =
'<meta http-equiv="Content-Type" content="text/html; charset=|" />';
229 <link rel="icon" href="%1$s"%2$s />';
335 self::JQUERY_VERSION_LATEST
344 'google' =>
'//ajax.googleapis.com/ajax/libs/jquery/%1$s/jquery%2$s.js',
345 'msn' =>
'//ajax.aspnetcdn.com/ajax/jQuery/jquery-%1$s%2$s.js',
346 'jquery' =>
'http://code.jquery.com/jquery-%1$s%2$s.js' 374 protected $addScriptaculousModules = array(
'builder' => FALSE,
'effects' => FALSE,
'dragdrop' => FALSE,
'controls' => FALSE,
'slider' => FALSE);
491 $this->inlineJavascriptWrap = array(
492 '<script type="text/javascript">' . LF .
'/*<![CDATA[*/' . LF,
493 '/*]]>*/' . LF .
'</script>' . LF
495 $this->inlineCssWrap = array(
496 '<style type="text/css">' . LF .
'/*<![CDATA[*/' . LF .
'<!-- ' . LF,
497 '-->' . LF .
'/*]]>*/' . LF .
'</style>' . LF
507 $this->templateFile =
'EXT:core/Resources/Private/Templates/PageRenderer.html';
508 $this->jsFiles = array();
509 $this->jsFooterFiles = array();
510 $this->jsInline = array();
511 $this->jsFooterInline = array();
512 $this->jsLibs = array();
513 $this->cssFiles = array();
514 $this->cssInline = array();
515 $this->metaTags = array();
516 $this->inlineComments = array();
517 $this->headerData = array();
518 $this->footerData = array();
519 $this->extOnReadyCode = array();
520 $this->jQueryVersions = array();
546 $this->renderXhtml = $enable;
577 $this->languageDependencies = array();
580 if (in_array($this->lang, $this->locales->getLocales())) {
582 foreach ($this->locales->getLocaleDependencies($this->lang) as $language) {
583 $this->languageDependencies[] = $language;
655 $this->templateFile = $file;
675 $this->bodyContent = $content;
685 $this->requireJsPath = $path;
695 $this->prototypePath = $path;
705 $this->scriptaculousPath = $path;
715 $this->extCorePath = $path;
725 $this->extJsPath = $path;
735 $this->svgPath = $path;
750 $this->moveJsFromHeaderToFooter = TRUE;
759 $this->moveJsFromHeaderToFooter = FALSE;
768 $this->compressJavascript = TRUE;
777 $this->compressJavascript = FALSE;
786 $this->compressCss = TRUE;
795 $this->compressCss = FALSE;
804 $this->concatenateFiles = TRUE;
813 $this->concatenateFiles = FALSE;
822 $this->concatenateJavascript = TRUE;
831 $this->concatenateJavascript = FALSE;
840 $this->concatenateCss = TRUE;
849 $this->concatenateCss = FALSE;
858 $this->removeLineBreaksFromTemplate = TRUE;
867 $this->removeLineBreaksFromTemplate = FALSE;
877 $this->compressJavascript = FALSE;
878 $this->compressCss = FALSE;
879 $this->concatenateFiles = FALSE;
880 $this->removeLineBreaksFromTemplate = FALSE;
883 $this->enableJqueryDebug = TRUE;
1140 if (!in_array($meta, $this->metaTags)) {
1141 $this->metaTags[] = $meta;
1152 if (!in_array($comment, $this->inlineComments)) {
1153 $this->inlineComments[] = $comment;
1164 if (!in_array($data, $this->headerData)) {
1165 $this->headerData[] = $data;
1176 if (!in_array($data, $this->footerData)) {
1177 $this->footerData[] = $data;
1194 public function addJsLibrary($name, $file, $type =
'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1196 $type =
'text/javascript';
1198 if (!in_array(strtolower($name), $this->jsLibs)) {
1199 $this->jsLibs[strtolower($name)] = array(
1202 'section' => self::PART_HEADER,
1203 'compress' => $compress,
1204 'forceOnTop' => $forceOnTop,
1205 'allWrap' => $allWrap,
1206 'excludeFromConcatenation' => $excludeFromConcatenation,
1207 'splitChar' => $splitChar
1225 public function addJsFooterLibrary($name, $file, $type =
'text/javascript', $compress = FALSE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1227 $type =
'text/javascript';
1229 if (!in_array(strtolower($name), $this->jsLibs)) {
1230 $this->jsLibs[strtolower($name)] = array(
1233 'section' => self::PART_FOOTER,
1234 'compress' => $compress,
1235 'forceOnTop' => $forceOnTop,
1236 'allWrap' => $allWrap,
1237 'excludeFromConcatenation' => $excludeFromConcatenation,
1238 'splitChar' => $splitChar
1255 public function addJsFile($file, $type =
'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1257 $type =
'text/javascript';
1259 if (!isset($this->jsFiles[$file])) {
1260 if (strpos($file,
'ajax.php?') !== FALSE) {
1263 $this->jsFiles[$file] = array(
1266 'section' => self::PART_HEADER,
1267 'compress' => $compress,
1268 'forceOnTop' => $forceOnTop,
1269 'allWrap' => $allWrap,
1270 'excludeFromConcatenation' => $excludeFromConcatenation,
1271 'splitChar' => $splitChar
1288 public function addJsFooterFile($file, $type =
'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1290 $type =
'text/javascript';
1292 if (!isset($this->jsFiles[$file])) {
1293 if (strpos($file,
'ajax.php?') !== FALSE) {
1296 $this->jsFiles[$file] = array(
1299 'section' => self::PART_FOOTER,
1300 'compress' => $compress,
1301 'forceOnTop' => $forceOnTop,
1302 'allWrap' => $allWrap,
1303 'excludeFromConcatenation' => $excludeFromConcatenation,
1304 'splitChar' => $splitChar
1319 if (!isset($this->jsInline[$name]) && !empty($block)) {
1320 $this->jsInline[$name] = array(
1321 'code' => $block . LF,
1322 'section' => self::PART_HEADER,
1323 'compress' => $compress,
1324 'forceOnTop' => $forceOnTop
1339 if (!isset($this->jsInline[$name]) && !empty($block)) {
1340 $this->jsInline[$name] = array(
1341 'code' => $block . LF,
1342 'section' => self::PART_FOOTER,
1343 'compress' => $compress,
1344 'forceOnTop' => $forceOnTop
1357 if (!in_array($block, $this->extOnReadyCode)) {
1359 array_unshift($this->extOnReadyCode, $block);
1361 $this->extOnReadyCode[] = $block;
1372 public function addExtDirectCode(array $filterNamespaces = array()) {
1373 if ($this->extDirectCodeAdded) {
1376 $this->extDirectCodeAdded = TRUE;
1377 if (count($filterNamespaces) === 0) {
1378 $filterNamespaces = array(
'TYPO3');
1385 'extDirect_timeoutHeader' =>
$GLOBALS[
'TSFE']->sL(
'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
1386 'extDirect_timeoutMessage' =>
$GLOBALS[
'TSFE']->sL(
'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
1390 'extDirect_timeoutHeader' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutHeader'),
1391 'extDirect_timeoutMessage' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_misc.xlf:extDirect_timeoutMessage')
1394 $token = ($api =
'');
1401 $api = $extDirect->getApiPhp($filterNamespaces);
1409 TYPO3.ExtDirectToken = "' . $token .
'"; 1410 for (var api in Ext.app.ExtDirectAPI) { 1411 var provider = Ext.Direct.addProvider(Ext.app.ExtDirectAPI[api]); 1412 provider.on("beforecall", function(provider, transaction, meta) { 1413 if (transaction.data) { 1414 transaction.data[transaction.data.length] = TYPO3.ExtDirectToken; 1416 transaction.data = [TYPO3.ExtDirectToken]; 1420 provider.on("call", function(provider, transaction, meta) { 1421 if (transaction.isForm) { 1422 transaction.params.securityToken = TYPO3.ExtDirectToken; 1428 var extDirectDebug = function(message, header, group) { 1429 var TYPO3ViewportInstance = null; 1431 if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") { 1432 TYPO3ViewportInstance = top.TYPO3.Backend; 1433 } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") { 1434 TYPO3ViewportInstance = TYPO3.Backend; 1437 if (TYPO3ViewportInstance !== null) { 1438 TYPO3ViewportInstance.DebugConsole.addTab(message, header, group); 1439 } else if (typeof console === "object") { 1440 console.log(message); 1442 document.write(message); 1446 Ext.Direct.on("exception", function(event) { 1447 if (event.code === Ext.Direct.exceptions.TRANSPORT && !event.where) { 1448 TYPO3.Flashmessage.display( 1449 TYPO3.Severity.error, 1450 TYPO3.l10n.localize("extDirect_timeoutHeader"), 1451 TYPO3.l10n.localize("extDirect_timeoutMessage"), 1456 if (event.code === "parse") { 1458 "<p>" + event.xhr.responseText + "<\\/p>", 1460 "ExtDirect - Exception" 1462 } else if (event.code === "router") { 1463 TYPO3.Flashmessage.display( 1464 TYPO3.Severity.error, 1469 } else if (event.where) { 1470 backtrace = "<p style=\\"margin-top: 20px;\\">" + 1471 "<strong>Backtrace:<\\/strong><br \\/>" + 1472 event.where.replace(/#/g, "<br \\/>#") + 1475 "<p>" + event.message + "<\\/p>" + backtrace, 1477 "ExtDirect - Exception" 1485 Ext.Direct.on("event", function(event, provider) { 1486 if (typeof event.debug !== "undefined" && event.debug !== "") { 1487 extDirectDebug(event.debug, event.method, "ExtDirect - Debug"); 1507 public function addCssFile($file, $rel =
'stylesheet', $media =
'all',
$title =
'', $compress = TRUE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1508 if (!isset($this->cssFiles[$file])) {
1509 $this->cssFiles[$file] = array(
1514 'compress' => $compress,
1515 'forceOnTop' => $forceOnTop,
1516 'allWrap' => $allWrap,
1517 'excludeFromConcatenation' => $excludeFromConcatenation,
1518 'splitChar' => $splitChar
1537 public function addCssLibrary($file, $rel =
'stylesheet', $media =
'all',
$title =
'', $compress = TRUE, $forceOnTop = FALSE, $allWrap =
'', $excludeFromConcatenation = FALSE, $splitChar =
'|') {
1538 if (!isset($this->cssLibs[$file])) {
1539 $this->cssLibs[$file] = array(
1544 'compress' => $compress,
1545 'forceOnTop' => $forceOnTop,
1546 'allWrap' => $allWrap,
1547 'excludeFromConcatenation' => $excludeFromConcatenation,
1548 'splitChar' => $splitChar
1563 if (!isset($this->cssInline[$name]) && !empty($block)) {
1564 $this->cssInline[$name] = array(
1566 'compress' => $compress,
1567 'forceOnTop' => $forceOnTop
1581 public function loadJquery($version = NULL, $source = NULL, $namespace = self::JQUERY_NAMESPACE_DEFAULT) {
1583 if ($version === NULL || $version ===
'latest') {
1584 $version = self::JQUERY_VERSION_LATEST;
1587 if ($source === NULL) {
1590 if ($source ===
'local' && !in_array($version, $this->availableLocalJqueryVersions)) {
1591 throw new \UnexpectedValueException(
'The requested jQuery version is not available in the local filesystem.', 1341505305);
1593 if (!preg_match(
'/^[a-zA-Z0-9]+$/', $namespace)) {
1594 throw new \UnexpectedValueException(
'The requested namespace contains non alphanumeric characters.', 1341571604);
1596 $this->jQueryVersions[$namespace] = array(
1597 'version' => $version,
1613 if (count($this->requireJsConfig) === 0) {
1615 $this->requireJsConfig[
'paths'] = array(
1616 'jquery-ui' =>
'contrib/jqueryui',
1617 'jquery' =>
'contrib/jquery' 1621 foreach ($loadedExtensions as $packageName) {
1622 $fullJsPath =
'EXT:' . $packageName .
'/Resources/Public/JavaScript/';
1625 $fullJsPath = rtrim($fullJsPath,
'/');
1632 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'RequireJS'][
'postInitializationModules'])) {
1633 $this->
addInlineSettingArray(
'RequireJS.PostInitializationModules',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'RequireJS'][
'postInitializationModules']);
1637 $this->addRequireJs = TRUE;
1680 $this->
addJsInlineCode(
'RequireJS-Module-' . $mainModuleName,
'require(["' . $mainModuleName .
'"]);');
1689 $this->addPrototype = TRUE;
1700 $this->addPrototype = TRUE;
1701 $this->addScriptaculous = TRUE;
1703 if ($modules ==
'all') {
1704 foreach ($this->addScriptaculousModules as $key => $value) {
1705 $this->addScriptaculousModules[$key] = TRUE;
1709 foreach ($mods as $mod) {
1710 if (isset($this->addScriptaculousModules[strtolower($mod)])) {
1711 $this->addScriptaculousModules[strtolower($mod)] = TRUE;
1726 public function loadExtJS($css = TRUE, $theme = TRUE, $adapter =
'') {
1730 case self::EXTJS_ADAPTER_YUI:
1731 $this->extJSadapter =
'yui/ext-yui-adapter.js';
1733 case self::EXTJS_ADAPTER_PROTOTYPE:
1734 $this->extJSadapter =
'prototype/ext-prototype-adapter.js';
1736 case self::EXTJS_ADAPTER_JQUERY:
1737 $this->extJSadapter =
'jquery/ext-jquery-adapter.js';
1741 $this->addExtJS = TRUE;
1742 $this->extJStheme = $theme;
1743 $this->extJScss = $css;
1762 $this->addExtCore = TRUE;
1771 $this->addSvg = TRUE;
1789 $this->
addMetaTag(
'<meta name="svg.render.forceflash" content="true" />');
1820 $this->inlineLanguageLabels[$key] = $value;
1833 $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $array);
1846 $index = md5($fileRef . $selectionPrefix . $stripFromSelectionName);
1847 if ($fileRef && !isset($this->inlineLanguageLabelFiles[$index])) {
1848 $this->inlineLanguageLabelFiles[$index] = array(
1849 'fileRef' => $fileRef,
1850 'selectionPrefix' => $selectionPrefix,
1851 'stripFromSelectionName' => $stripFromSelectionName,
1852 'errorMode' => $errorMode
1869 if (strpos($namespace,
'.')) {
1870 $parts = explode(
'.', $namespace);
1872 foreach ($parts as $part) {
1877 $this->inlineSettings[$namespace][$key] = $value;
1880 $this->inlineSettings[$key] = $value;
1896 if (strpos($namespace,
'.')) {
1897 $parts = explode(
'.', $namespace);
1899 foreach ($parts as $part) {
1902 $a = array_merge((array) $a, $array);
1904 $this->inlineSettings[$namespace] = array_merge((array) $this->inlineSettings[$namespace], $array);
1907 $this->inlineSettings = array_merge($this->inlineSettings, $array);
1918 $this->bodyContent .= $content;
1932 public function render($part = self::PART_COMPLETE) {
1935 $metaTags = implode(LF, $this->metaTags);
1943 return trim(\
TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray,
'###|###'));
1957 return trim(\
TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray,
'###|###'));
1972 $title = $this->title ? str_replace(
'|', htmlspecialchars($this->title), $this->titleTag) :
'';
1973 $markerArray = array(
1974 '<!-- ###TITLE' . $substituteHash .
'### -->' =>
$title,
1975 '<!-- ###CSS_LIBS' . $substituteHash .
'### -->' =>
$cssLibs,
1976 '<!-- ###CSS_INCLUDE' . $substituteHash .
'### -->' =>
$cssFiles,
1977 '<!-- ###CSS_INLINE' . $substituteHash .
'### -->' =>
$cssInline,
1978 '<!-- ###JS_INLINE' . $substituteHash .
'### -->' =>
$jsInline,
1979 '<!-- ###JS_INCLUDE' . $substituteHash .
'### -->' =>
$jsFiles,
1980 '<!-- ###JS_LIBS' . $substituteHash .
'### -->' =>
$jsLibs,
1981 '<!-- ###HEADERDATA' . $substituteHash .
'### -->' => implode(LF, $this->headerData),
1982 '<!-- ###FOOTERDATA' . $substituteHash .
'### -->' => implode(LF, $this->footerData),
1983 '<!-- ###JS_LIBS_FOOTER' . $substituteHash .
'### -->' =>
$jsFooterLibs,
1984 '<!-- ###JS_INCLUDE_FOOTER' . $substituteHash .
'### -->' =>
$jsFooterFiles,
1985 '<!-- ###JS_INLINE_FOOTER' . $substituteHash .
'### -->' =>
$jsFooterInline 1987 foreach ($markerArray as $placeHolder => $content) {
1988 $cachedPageContent = str_replace($placeHolder, $content, $cachedPageContent);
1991 return $cachedPageContent;
2003 $this->endingSlash =
' /';
2005 $this->metaCharsetTag = str_replace(
' />',
'>', $this->metaCharsetTag);
2006 $this->baseUrlTag = str_replace(
' />',
'>', $this->baseUrlTag);
2007 $this->shortcutTag = str_replace(
' />',
'>', $this->shortcutTag);
2008 $this->endingSlash =
'';
2020 if ($this->concatenateFiles || $this->concatenateJavascript || $this->concatenateCss) {
2024 if ($this->compressCss || $this->compressJavascript) {
2036 if ($this->moveJsFromHeaderToFooter) {
2064 $markerArray = array(
2065 'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,
2066 'HTMLTAG' => $this->htmlTag,
2067 'HEADTAG' => $this->headTag,
2068 'METACHARSET' => $this->charSet ? str_replace(
'|', htmlspecialchars($this->charSet), $this->metaCharsetTag) :
'',
2069 'INLINECOMMENT' => $this->inlineComments ? LF . LF .
'<!-- ' . LF . implode(LF, $this->inlineComments) .
'-->' . LF . LF :
'',
2070 'BASEURL' => $this->baseUrl ? str_replace(
'|', $this->baseUrl, $this->baseUrlTag) :
'',
2071 'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) :
'',
2078 'TITLE' => $this->title ? str_replace(
'|', htmlspecialchars($this->title), $this->titleTag) :
'',
2080 'HEADERDATA' => $this->headerData ? implode(LF, $this->headerData) :
'',
2081 'FOOTERDATA' => $this->footerData ? implode(LF, $this->footerData) :
'',
2085 'BODY' => $this->bodyContent
2087 $markerArray = array_map(
'trim', $markerArray);
2088 return $markerArray;
2098 $markerArray = array(
2099 'XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType,
2100 'HTMLTAG' => $this->htmlTag,
2101 'HEADTAG' => $this->headTag,
2102 'METACHARSET' => $this->charSet ? str_replace(
'|', htmlspecialchars($this->charSet), $this->metaCharsetTag) :
'',
2103 'INLINECOMMENT' => $this->inlineComments ? LF . LF .
'<!-- ' . LF . implode(LF, $this->inlineComments) .
'-->' . LF . LF :
'',
2104 'BASEURL' => $this->baseUrl ? str_replace(
'|', $this->baseUrl, $this->baseUrlTag) :
'',
2105 'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) :
'',
2106 'META' => implode(LF, $this->metaTags),
2107 'BODY' => $this->bodyContent,
2108 'TITLE' =>
'<!-- ###TITLE' . $substituteHash .
'### -->',
2109 'CSS_LIBS' =>
'<!-- ###CSS_LIBS' . $substituteHash .
'### -->',
2110 'CSS_INCLUDE' =>
'<!-- ###CSS_INCLUDE' . $substituteHash .
'### -->',
2111 'CSS_INLINE' =>
'<!-- ###CSS_INLINE' . $substituteHash .
'### -->',
2112 'JS_INLINE' =>
'<!-- ###JS_INLINE' . $substituteHash .
'### -->',
2113 'JS_INCLUDE' =>
'<!-- ###JS_INCLUDE' . $substituteHash .
'### -->',
2114 'JS_LIBS' =>
'<!-- ###JS_LIBS' . $substituteHash .
'### -->',
2115 'HEADERDATA' =>
'<!-- ###HEADERDATA' . $substituteHash .
'### -->',
2116 'FOOTERDATA' =>
'<!-- ###FOOTERDATA' . $substituteHash .
'### -->',
2117 'JS_LIBS_FOOTER' =>
'<!-- ###JS_LIBS_FOOTER' . $substituteHash .
'### -->',
2118 'JS_INCLUDE_FOOTER' =>
'<!-- ###JS_INCLUDE_FOOTER' . $substituteHash .
'### -->',
2119 'JS_INLINE_FOOTER' =>
'<!-- ###JS_INLINE_FOOTER' . $substituteHash .
'### -->' 2121 $markerArray = array_map(
'trim', $markerArray);
2122 return $markerArray;
2134 if ($this->removeLineBreaksFromTemplate) {
2135 $template = strtr($template, array(LF =>
'', CR =>
''));
2137 if ($part !== self::PART_COMPLETE) {
2138 $templatePart = explode(
'###BODY###', $template);
2139 $template = $templatePart[$part - 1];
2154 if ($this->addRequireJs) {
2158 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->requireJsPath .
'require.js')) .
'" type="text/javascript"></script>' . LF;
2161 if ($this->addSvg) {
2162 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->svgPath .
'svg.js')) .
'" data-path="' . $this->backPath . $this->svgPath .
'"' . ($this->
enableSvgDebug ?
' data-debug="true"' :
'') .
'></script>' . LF;
2165 if (!empty($this->jQueryVersions)) {
2166 foreach ($this->jQueryVersions as $namespace => $jQueryVersion) {
2167 $out .= $this->
renderJqueryScriptTag($jQueryVersion[
'version'], $jQueryVersion[
'source'], $namespace);
2170 if ($this->addPrototype) {
2171 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->prototypePath .
'prototype.js')) .
'" type="text/javascript"></script>' . LF;
2172 unset($this->jsFiles[$this->backPath . $this->prototypePath .
'prototype.js']);
2174 if ($this->addScriptaculous) {
2176 foreach ($this->addScriptaculousModules as $key => $value) {
2177 if ($this->addScriptaculousModules[$key]) {
2182 if (in_array(
'dragdrop', $mods) || in_array(
'controls', $mods)) {
2183 $mods = array_merge(array(
'effects'), $mods);
2187 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->scriptaculousPath . $module .
'.js')) .
'" type="text/javascript"></script>' . LF;
2188 unset($this->jsFiles[$this->backPath . $this->scriptaculousPath . $module .
'.js']);
2191 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->scriptaculousPath .
'scriptaculous.js')) .
'" type="text/javascript"></script>' . LF;
2192 unset($this->jsFiles[$this->backPath . $this->scriptaculousPath .
'scriptaculous.js']);
2195 if ($this->addExtCore && !$this->addExtJS) {
2196 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->extCorePath .
'ext-core' . ($this->
enableExtCoreDebug ?
'-debug' :
'') .
'.js')) .
'" type="text/javascript"></script>' . LF;
2197 unset($this->jsFiles[$this->backPath . $this->extCorePath .
'ext-core' . ($this->
enableExtCoreDebug ?
'-debug' :
'') .
'.js']);
2200 if ($this->addExtJS) {
2202 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->extJsPath .
'adapter/' . ($this->
enableExtJsDebug ? str_replace(
'.js',
'-debug.js', $this->extJSadapter) : $this->extJSadapter))) .
'" type="text/javascript"></script>' . LF;
2203 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $this->extJsPath .
'ext-all' . ($this->
enableExtJsDebug ?
'-debug' :
'') .
'.js')) .
'" type="text/javascript"></script>' . LF;
2206 $localeMap = $this->locales->getIsoMapping();
2207 $localeMap[
''] =
'en';
2208 $localeMap[
'default'] =
'en';
2210 $localeMap[
'gr'] =
'el_GR';
2212 $localeMap[
'no'] =
'no_BO';
2214 $localeMap[
'se'] =
'se_SV';
2217 $extJsLocaleFile = $this->extJsPath .
'locale/ext-lang-' . $extJsLang .
'.js';
2218 if (file_exists(PATH_typo3 . $extJsLocaleFile)) {
2219 $out .=
'<script src="' . $this->
processJsFile(($this->backPath . $extJsLocaleFile)) .
'" type="text/javascript" charset="utf-8"></script>' . LF;
2222 unset($this->jsFiles[$this->backPath . $this->extJsPath .
'ext-all.js'], $this->jsFiles[$this->backPath . $this->extJsPath .
'ext-all-debug.js']);
2224 if (count($this->inlineLanguageLabelFiles)) {
2225 foreach ($this->inlineLanguageLabelFiles as $languageLabelFile) {
2226 $this->
includeLanguageFileForInline($languageLabelFile[
'fileRef'], $languageLabelFile[
'selectionPrefix'], $languageLabelFile[
'stripFromSelectionName'], $languageLabelFile[
'errorMode']);
2229 $this->inlineLanguageLabelFiles = array();
2232 if ($this->inlineLanguageLabels) {
2233 $this->csConvObj->convArray($this->inlineLanguageLabels, $this->
getCharSet(),
'utf-8');
2235 if ($this->inlineSettings) {
2236 $this->csConvObj->convArray($this->inlineSettings, $this->
getCharSet(),
'utf-8');
2240 if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
2244 $inlineSettings .= $this->inlineLanguageLabels ?
'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) .
';' :
'';
2245 $inlineSettings .= $this->inlineSettings ?
'TYPO3.settings = ' . json_encode($this->inlineSettings) .
';' :
'';
2247 if ($this->addExtCore || $this->addExtJS) {
2250 if (count($this->extOnReadyCode)) {
2251 foreach ($this->extOnReadyCode as $block) {
2255 $out .= $this->inlineJavascriptWrap[0] .
' 2260 .
'Ext.onReady(function() {' 2264 . $this->inlineJavascriptWrap[1];
2265 $this->extOnReadyCode = array();
2268 $out .=
'<script src="' . $this->
processJsFile(($this->backPath .
'sysext/lang/Resources/Public/JavaScript/Typo3Lang.js')) .
'" type="text/javascript" charset="utf-8"></script>' . LF;
2270 if ($this->extJScss) {
2271 if (isset(
$GLOBALS[
'TBE_STYLES'][
'extJS'][
'all'])) {
2272 $this->
addCssLibrary($this->backPath .
$GLOBALS[
'TBE_STYLES'][
'extJS'][
'all'],
'stylesheet',
'all',
'', TRUE);
2274 $this->
addCssLibrary($this->backPath . $this->extJsPath .
'resources/css/ext-all-notheme.css',
'stylesheet',
'all',
'', TRUE);
2277 if ($this->extJStheme) {
2278 if (isset(
$GLOBALS[
'TBE_STYLES'][
'extJS'][
'theme'])) {
2279 $this->
addCssLibrary($this->backPath .
$GLOBALS[
'TBE_STYLES'][
'extJS'][
'theme'],
'stylesheet',
'all',
'', TRUE);
2281 $this->
addCssLibrary($this->backPath . $this->extJsPath .
'resources/css/xtheme-blue.css',
'stylesheet',
'all',
'', TRUE);
2289 $out .= $this->inlineJavascriptWrap[0] .
$inlineSettings . $this->inlineJavascriptWrap[1];
2299 $ajaxUrls = array();
2300 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'AJAX'] as $ajaxHandler => $_) {
2303 $this->inlineSettings[
'ajaxUrls'] = $ajaxUrls;
2316 case isset($this->jQueryCdnUrls[$source]):
2317 if ($this->enableJqueryDebug) {
2320 $minifyPart =
'.min';
2322 $jQueryFileName = sprintf($this->jQueryCdnUrls[$source], $version, $minifyPart);
2324 case $source ===
'local':
2325 $jQueryFileName = $this->backPath . $this->jQueryPath .
'jquery-' . rawurlencode($version);
2326 if ($this->enableJqueryDebug) {
2327 $jQueryFileName .=
'.js';
2329 $jQueryFileName .=
'.min.js';
2333 $jQueryFileName = $source;
2336 $scriptTag =
'<script src="' . htmlspecialchars($jQueryFileName) .
'" type="text/javascript"></script>' . LF;
2338 switch ($namespace) {
2339 case self::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT:
2342 case self::JQUERY_NAMESPACE_NONE:
2344 case self::JQUERY_NAMESPACE_DEFAULT:
2347 $scriptTag .=
GeneralUtility::wrapJS(
'var TYPO3 = TYPO3 || {}; TYPO3.' . $namespace .
' = jQuery.noConflict(true);') . LF;
2359 if (count($this->cssLibs)) {
2360 foreach ($this->cssLibs as $file => $properties) {
2363 $tag =
'<link rel="' . htmlspecialchars($properties[
'rel'])
2364 .
'" type="text/css" href="' . htmlspecialchars($file)
2365 .
'" media="' . htmlspecialchars($properties[
'media']) .
'"' 2366 . ($properties[
'title'] ?
' title="' . htmlspecialchars($properties[
'title']) .
'"' :
'')
2367 . $this->endingSlash .
'>';
2368 if ($properties[
'allWrap']) {
2369 $wrapArr = explode($properties[
'splitChar'] ?:
'|', $properties[
'allWrap'], 2);
2370 $tag = $wrapArr[0] . $tag . $wrapArr[1];
2373 if ($properties[
'forceOnTop']) {
2390 if (count($this->cssFiles)) {
2391 foreach ($this->cssFiles as $file => $properties) {
2394 $tag =
'<link rel="' . htmlspecialchars($properties[
'rel'])
2395 .
'" type="text/css" href="' . htmlspecialchars($file)
2396 .
'" media="' . htmlspecialchars($properties[
'media']) .
'"' 2397 . ($properties[
'title'] ?
' title="' . htmlspecialchars($properties[
'title']) .
'"' :
'')
2398 . $this->endingSlash .
'>';
2399 if ($properties[
'allWrap']) {
2400 $wrapArr = explode($properties[
'splitChar'] ?:
'|', $properties[
'allWrap'], 2);
2401 $tag = $wrapArr[0] . $tag . $wrapArr[1];
2404 if ($properties[
'forceOnTop']) {
2421 if (count($this->cssInline)) {
2422 foreach ($this->cssInline as $name => $properties) {
2423 $cssCode =
'/*' . htmlspecialchars($name) .
'*/' . LF . $properties[
'code'] . LF;
2424 if ($properties[
'forceOnTop']) {
2443 if (count($this->jsLibs)) {
2444 foreach ($this->jsLibs as $properties) {
2447 $tag =
'<script src="' . htmlspecialchars($properties[
'file']) .
'" type="' . htmlspecialchars($properties[
'type']) .
'"></script>';
2448 if ($properties[
'allWrap']) {
2449 $wrapArr = explode($properties[
'splitChar'] ?:
'|', $properties[
'allWrap'], 2);
2450 $tag = $wrapArr[0] . $tag . $wrapArr[1];
2453 if ($properties[
'forceOnTop']) {
2454 if ($properties[
'section'] === self::PART_HEADER) {
2460 if ($properties[
'section'] === self::PART_HEADER) {
2468 if ($this->moveJsFromHeaderToFooter) {
2483 if (count($this->jsFiles)) {
2484 foreach ($this->jsFiles as $file => $properties) {
2487 $tag =
'<script src="' . htmlspecialchars($file) .
'" type="' . htmlspecialchars($properties[
'type']) .
'"></script>';
2488 if ($properties[
'allWrap']) {
2489 $wrapArr = explode($properties[
'splitChar'] ?:
'|', $properties[
'allWrap'], 2);
2490 $tag = $wrapArr[0] . $tag . $wrapArr[1];
2493 if ($properties[
'forceOnTop']) {
2494 if ($properties[
'section'] === self::PART_HEADER) {
2500 if ($properties[
'section'] === self::PART_HEADER) {
2508 if ($this->moveJsFromHeaderToFooter) {
2523 if (count($this->jsInline)) {
2524 foreach ($this->jsInline as $name => $properties) {
2525 $jsCode =
'/*' . htmlspecialchars($name) .
'*/' . LF . $properties[
'code'] . LF;
2526 if ($properties[
'forceOnTop']) {
2527 if ($properties[
'section'] === self::PART_HEADER) {
2533 if ($properties[
'section'] === self::PART_HEADER) {
2542 $jsInline = $this->inlineJavascriptWrap[0] .
$jsInline . $this->inlineJavascriptWrap[1];
2547 if ($this->moveJsFromHeaderToFooter) {
2565 if (!isset($this->lang) || !isset($this->charSet)) {
2566 throw new \RuntimeException(
'Language and character encoding are not set.', 1284906026);
2568 $labelsFromFile = array();
2569 $allLabels = $this->
readLLfile($fileRef, $errorMode);
2571 $labelPattern =
'#^' . preg_quote($selectionPrefix,
'#') .
'(' . preg_quote($stripFromSelectionName,
'#') .
')?#';
2572 if ($allLabels !== FALSE) {
2574 if ($this->lang !==
'default' && isset($allLabels[$this->lang])) {
2575 $labels = array_merge($allLabels[
'default'], $allLabels[$this->lang]);
2577 $labels = $allLabels[
'default'];
2580 foreach ($labels as $label => $value) {
2581 if ($selectionPrefix ===
'') {
2582 $labelsFromFile[$label] = $value;
2583 } elseif (strpos($label, $selectionPrefix) === 0) {
2584 preg_replace($labelPattern,
'', $label);
2585 $labelsFromFile[$label] = $value;
2588 $this->inlineLanguageLabels = array_merge($this->inlineLanguageLabels, $labelsFromFile);
2600 if ($this->lang !==
'default') {
2601 $languages = array_reverse($this->languageDependencies);
2603 if (empty($languages)) {
2604 $languages[] =
'default';
2607 $languages = array(
'default');
2610 $localLanguage = array();
2611 foreach ($languages as $language) {
2612 $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->charSet, $errorMode);
2613 $localLanguage[
'default'] = $tempLL[
'default'];
2614 if (!isset($localLanguage[$this->lang])) {
2615 $localLanguage[
$this->lang] = $localLanguage[
'default'];
2617 if ($this->lang !==
'default' && isset($tempLL[$language])) {
2624 return $localLanguage;
2650 if ($this->concatenateFiles || $this->concatenateJavascript) {
2654 'jsLibs' => &$this->jsLibs,
2655 'jsFiles' => &$this->jsFiles,
2656 'jsFooterFiles' => &$this->jsFooterFiles,
2657 'headerData' => &$this->headerData,
2658 'footerData' => &$this->footerData
2662 $this->jsLibs = $this->
getCompressor()->concatenateJsFiles($this->jsLibs);
2663 $this->jsFiles = $this->
getCompressor()->concatenateJsFiles($this->jsFiles);
2664 $this->jsFooterFiles = $this->
getCompressor()->concatenateJsFiles($this->jsFooterFiles);
2675 if ($this->concatenateFiles || $this->concatenateCss) {
2679 'cssFiles' => &$this->cssFiles,
2680 'cssLibs' => &$this->cssLibs,
2681 'headerData' => &$this->headerData,
2682 'footerData' => &$this->footerData
2686 $cssOptions = array();
2687 if (TYPO3_MODE ===
'BE') {
2688 $cssOptions = array(
'baseDirectories' =>
$GLOBALS[
'TBE_TEMPLATE']->getSkinStylesheetDirectories());
2690 $this->cssLibs = $this->
getCompressor()->concatenateCssFiles($this->cssLibs, $cssOptions);
2691 $this->cssFiles = $this->
getCompressor()->concatenateCssFiles($this->cssFiles, $cssOptions);
2712 if ($this->compressCss) {
2716 'cssInline' => &$this->cssInline,
2717 'cssFiles' => &$this->cssFiles,
2718 'cssLibs' => &$this->cssLibs,
2719 'headerData' => &$this->headerData,
2720 'footerData' => &$this->footerData
2724 $this->cssLibs = $this->
getCompressor()->compressCssFiles($this->cssLibs);
2725 $this->cssFiles = $this->
getCompressor()->compressCssFiles($this->cssFiles);
2736 if ($this->compressJavascript) {
2740 'jsInline' => &$this->jsInline,
2741 'jsFooterInline' => &$this->jsFooterInline,
2742 'jsLibs' => &$this->jsLibs,
2743 'jsFiles' => &$this->jsFiles,
2744 'jsFooterFiles' => &$this->jsFooterFiles,
2745 'headerData' => &$this->headerData,
2746 'footerData' => &$this->footerData
2751 if (count($this->jsInline)) {
2752 foreach ($this->jsInline as $name => $properties) {
2753 if ($properties[
'compress']) {
2757 $this->compressError .=
'Error with minify JS Inline Block "' . $name .
'": ' . $error . LF;
2762 $this->jsLibs = $this->
getCompressor()->compressJsFiles($this->jsLibs);
2763 $this->jsFiles = $this->
getCompressor()->compressJsFiles($this->jsFiles);
2764 $this->jsFooterFiles = $this->
getCompressor()->compressJsFiles($this->jsFooterFiles);
2775 if ($this->compressor === NULL) {
2792 if ($this->compressJavascript) {
2793 $filename = $this->
getCompressor()->compressJsFile($filename);
2799 if ($this->compressJavascript) {
2800 $filename = $this->
getCompressor()->compressJsFile($filename);
2818 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-preProcess'])) {
2820 'jsLibs' => &$this->jsLibs,
2821 'jsFooterLibs' => &$this->jsFooterLibs,
2822 'jsFiles' => &$this->jsFiles,
2823 'jsFooterFiles' => &$this->jsFooterFiles,
2824 'cssFiles' => &$this->cssFiles,
2825 'headerData' => &$this->headerData,
2826 'footerData' => &$this->footerData,
2827 'jsInline' => &$this->jsInline,
2828 'jsFooterInline' => &$this->jsFooterInline,
2829 'cssInline' => &$this->cssInline
2831 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-preProcess'] as $hook) {
2843 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-postTransform'])) {
2845 'jsLibs' => &$this->jsLibs,
2846 'jsFooterLibs' => &$this->jsFooterLibs,
2847 'jsFiles' => &$this->jsFiles,
2848 'jsFooterFiles' => &$this->jsFooterFiles,
2849 'cssFiles' => &$this->cssFiles,
2850 'headerData' => &$this->headerData,
2851 'footerData' => &$this->footerData,
2852 'jsInline' => &$this->jsInline,
2853 'jsFooterInline' => &$this->jsFooterInline,
2854 'cssInline' => &$this->cssInline
2856 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-postTransform'] as $hook) {
2877 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-postProcess'])) {
2884 'headerData' => &$this->headerData,
2885 'footerData' => &$this->footerData,
2888 'xmlPrologAndDocType' => &$this->xmlPrologAndDocType,
2889 'htmlTag' => &$this->htmlTag,
2890 'headTag' => &$this->headTag,
2891 'charSet' => &$this->charSet,
2892 'metaCharsetTag' => &$this->metaCharsetTag,
2893 'shortcutTag' => &$this->shortcutTag,
2894 'inlineComments' => &$this->inlineComments,
2895 'baseUrl' => &$this->baseUrl,
2896 'baseUrlTag' => &$this->baseUrlTag,
2897 'favIcon' => &$this->favIcon,
2898 'iconMimeType' => &$this->iconMimeType,
2899 'titleTag' => &$this->titleTag,
2900 'title' => &$this->title,
2901 'metaTags' => &$this->metaTags,
2904 'bodyContent' => &$this->bodyContent
2906 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_pagerenderer.php'][
'render-postProcess'] as $hook) {
static minifyJavaScript($script, &$error='')
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
loadExtJS($css=TRUE, $theme=TRUE, $adapter='')
renderJavaScriptAndCssForProcessingOfUncachedContentObjects($cachedPageContent, $substituteHash)
addExtOnReadyCode($block, $forceOnTop=FALSE)
disableMoveJsFromHeaderToFooter()
renderPageWithUncachedObjects($substituteHash)
addInlineSettingArray($namespace, array $array)
getRemoveLineBreaksFromTemplate()
static getAjaxUrl($ajaxIdentifier, array $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getLoadedExtensionListArray()
getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash)
addJsLibrary($name, $file, $type='text/javascript', $compress=FALSE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
addAjaxUrlsToInlineSettings()
renderJqueryScriptTag($version, $source, $namespace)
const JQUERY_NAMESPACE_NONE
enableRemoveLineBreaksFromTemplate()
const EXTJS_ADAPTER_PROTOTYPE
addJsInlineCode($name, $block, $compress=TRUE, $forceOnTop=FALSE)
readLLfile($fileRef, $errorMode=0)
setXmlPrologAndDocType($xmlPrologAndDocType)
const JQUERY_NAMESPACE_DEFAULT
getInlineLanguageLabelFiles()
renderMainJavaScriptLibraries()
addCssInlineBlock($name, $block, $compress=FALSE, $forceOnTop=FALSE)
addInlineSetting($namespace, $key, $value)
addInlineComment($comment)
$moveJsFromHeaderToFooter
render($part=self::PART_COMPLETE)
loadRequireJsModule($mainModuleName)
__construct($templateFile='', $backPath=NULL)
const EXTJS_ADAPTER_JQUERY
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
getPreparedMarkerArray($jsLibs, $jsFiles, $jsFooterFiles, $cssLibs, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs, $metaTags)
const JQUERY_VERSION_LATEST
enableMoveJsFromHeaderToFooter()
setIconMimeType($iconMimeType)
static underscoredToUpperCamelCase($string)
getConcatenateJavascript()
static createVersionNumberedFilename($file, $forceQueryString=FALSE)
enableCompressJavascript()
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
includeLanguageFileForInline($fileRef, $selectionPrefix='', $stripFromSelectionName='', $errorMode=0)
$removeLineBreaksFromTemplate
addJsFile($file, $type='text/javascript', $compress=TRUE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
static locationHeaderUrl($path)
getTemplateForPart($part)
disableConcatenateJavascript()
disableRemoveLineBreaksFromTemplate()
executeRenderPostTransformHook()
setScriptaculousPath($path)
renderAdditionalJavaScriptLibraries()
getMoveJsFromHeaderToFooter()
addInlineLanguageLabel($key, $value)
disableConcatenateFiles()
enableConcatenateJavascript()
$inlineLanguageLabelFiles
$availableLocalJqueryVersions
getInlineLanguageLabels()
addInlineLanguageLabelFile($fileRef, $selectionPrefix='', $stripFromSelectionName='', $errorMode=0)
addJsFooterFile($file, $type='text/javascript', $compress=TRUE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
loadJquery($version=NULL, $source=NULL, $namespace=self::JQUERY_NAMESPACE_DEFAULT)
addJsFooterInlineCode($name, $block, $compress=TRUE, $forceOnTop=FALSE)
addJsFooterLibrary($name, $file, $type='text/javascript', $compress=FALSE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
static getRelativePath($sourcePath, $targetPath)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)
addCssFile($file, $rel='stylesheet', $media='all', $title='', $compress=TRUE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
addInlineLanguageLabelArray(array $array)
disableCompressJavascript()
const JQUERY_NAMESPACE_DEFAULT_NOCONFLICT
addCssLibrary($file, $rel='stylesheet', $media='all', $title='', $compress=TRUE, $forceOnTop=FALSE, $allWrap='', $excludeFromConcatenation=FALSE, $splitChar='|')
static resolveBackPath($pathStr)
doConcatenateJavaScript()
loadScriptaculous($modules='all')
executePostRenderHook(&$jsLibs, &$jsFiles, &$jsFooterFiles, &$cssLibs, &$cssFiles, &$jsInline, &$cssInline, &$jsFooterInline, &$jsFooterLibs)
addRequireJsConfiguration(array $configuration)
static wrapJS($string, $linebreak=TRUE)
setMetaCharsetTag($metaCharsetTag)