Project

General

Profile

Bug #22247 » rfc13758-inlineJS_v5.diff

Administrator Admin, 2010-04-30 15:21

View differences:

typo3/sysext/cms/tslib/class.tslib_pagegen.php (Arbeitskopie)
$pageRenderer->addJsFooterInlineCode('TS_inlineFooter', $inlineFooterJs, $GLOBALS['TSFE']->config['config']['minifyJS']);
}
} elseif ($GLOBALS['TSFE']->config['config']['removeDefaultJS'] === 'external') {
// put default and inlineJS in external file
/*
This would also remove inlineJS from *_INT Objects to external files.
Because at this very point *_INT Objects only have placeholder instead of "results",
moving such place holders to external file would
a, break the JS file (no correct syntax)
b, the JS needed would never get included to the page
Therefore *_INT InlineJS must not be moved to external file but kept internal
*/
$inlineJSint = '';
self::stripIntObjectPlaceholder($inlineJS, $inlineJSint);
$pageRenderer->addJsInlineCode('TS_inlineJSint', $inlineJSint, $GLOBALS['TSFE']->config['config']['minifyJS']);
$pageRenderer->addJsFile(TSpagegen::inline2TempFile($scriptJsCode . $inlineJS, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
if ($inlineFooterJs) {
$inlineFooterJSint = '';
self::stripIntObjectPlaceholder($inlineFooterJS, $inlineFooterJSint);
$pageRenderer->addJsFooterInlineCode('TS_inlineFooterJSint', $inlineFooterJSint, $GLOBALS['TSFE']->config['config']['minifyJS']);
$pageRenderer->addJsFooterFile(TSpagegen::inline2TempFile($inlineFooterJs, 'js'), 'text/javascript', $GLOBALS['TSFE']->config['config']['minifyJS']);
}
} else {
......
*************************/
/**
* Searches for placeholder created from *_INT cObjects, removes them from
* $searchString and merges them to $intObjects
*
* @param string $searchString the String which should be cleaned from int-object markers
* @param string $intObjects the String the found int-placeholders are moved to (for further processing)
*/
protected static function stripIntObjectPlaceholder(&$searchString, &$intObjects) {
$tempArray = array();
preg_match_all('/\<\!--INT_SCRIPT.[a-z0-9]*--\>/', $searchString, $tempArray);
$searchString = preg_replace('/\<\!--INT_SCRIPT.[a-z0-9]*--\>/', '', $searchString);
$intObjects = implode('', $tempArray[0]);
}
/**
* Writes string to a temporary file named after the md5-hash of the string
*
* @param string CSS styles / JavaScript to write to file.
(3-3/4)