/** * @param string $src * @param string $type * @param boolean $compress * @param boolean $forceOnTop * @param string $allWrap * @param boolean $excludeFromConcatenation * @param string $section * @param boolean $preventMarkupUpdateOnAjaxLoad * @param boolean $moveToExternalFile * @param boolean $noCache * @param string $name * * @return string */ public function render($src = "", $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE, $section = 'footer', $preventMarkupUpdateOnAjaxLoad = false, $moveToExternalFile = false, $noCache = false, $name = '') { $content = $this->renderChildren(); if ($this->ajaxDispatcher->getIsActive()) { if ($preventMarkupUpdateOnAjaxLoad) { $this->ajaxDispatcher->setPreventMarkupUpdateOnAjaxLoad(true); } // need to just echo the code in ajax call if (!$src) { if ($compress) { $content = $this->compressScript($content); } return \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content); } else { return '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>'; } } else { if ($this->isCached()) { if ($noCache) { if ($src) { $content = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>'; } else { if ($compress) { $content = $this->compressScript($content); } $content = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content); } $tslibFE = GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Tslib\\FE\\Hook'); /* @var $tslibFE \EssentialDots\ExtbaseHijax\Tslib\FE\Hook */ if ($section == 'footer') { $tslibFE->addNonCacheableFooterCode($name ? $name : md5($content), $content); } else { $tslibFE->addNonCacheableHeaderCode($name ? $name : md5($content), $content); } return ''; } else { if (!$src && $moveToExternalFile) { $src = 'typo3temp' . DIRECTORY_SEPARATOR . 'extbase_hijax' . DIRECTORY_SEPARATOR . md5($content) . '.js'; \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $src, $content); if ($GLOBALS['TSFE']) { if ($GLOBALS['TSFE']->baseUrl) { $src = $GLOBALS['TSFE']->baseUrl . $src; } elseif ($GLOBALS['TSFE']->absRefPrefix) { $src = $GLOBALS['TSFE']->absRefPrefix . $src; } } } if (!$src) { if ($section == 'footer') { $this->pageRenderer->addJsFooterInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop); } else { $this->pageRenderer->addJsInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop); } } else { if ($section == 'footer') { $this->pageRenderer->addJsFooterFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation); } else { $this->pageRenderer->addJsFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation); } } } } else { // additionalFooterData not possible in USER_INT if (!$src) { $GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content); } else { $GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>'; } } } return ''; }