Feature #22376 » 13998.diff
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
}
|
||
/**
|
||
* Function for static version numbers on files, based on the filemtime
|
||
* This will make the filename automaticall change when a file is changed, and by that re-cached by the browser
|
||
* If the file does not exist physically the original file passed to the function is returned without the timestamp
|
||
*
|
||
* @param string $file Relative path to file
|
||
* @return Relative path with version filename including the timestamp
|
||
* @author Lars Houmark <lars@typo3.org>
|
||
*/
|
||
public static function createVersionNumberedFile($file) {
|
||
|
||
// start by splitting up the querystring, the part after ? will break filemtime lookup / mainly done for scriptaculous
|
||
// it will be added back in the end...
|
||
$lookupFile = explode('?', $file);
|
||
$name = explode('.', $lookupFile[0]);
|
||
$extension = array_pop($name);
|
||
$path = self::resolveBackPath(self::dirname(PATH_thisScript) .'/'. $lookupFile[0]);
|
||
|
||
if (file_exists($path)) {
|
||
array_push($name, filemtime($path), $extension);
|
||
$fullName = implode('.', $name);
|
||
|
||
// if there was a querystring in the filename, we need to append it to the current string
|
||
$fullName .= $lookupFile[1] ? '?'. $lookupFile[1] : '';
|
||
|
||
} else {
|
||
// file was not found on given location, we will return the path given to this function
|
||
$fullName = $file;
|
||
}
|
||
|
||
return $fullName;
|
||
}
|
||
... | ... | |
/*************************
|
||
*
|
||
* DEBUG helper FUNCTIONS
|
t3lib/class.t3lib_pagerenderer.php (working copy) | ||
---|---|---|
if (count($this->cssFiles)) {
|
||
foreach ($this->cssFiles as $file => $properties) {
|
||
$file = htmlspecialchars(t3lib_div::resolveBackPath($file));
|
||
$file = (TYPO3_MODE == 'BE' ? t3lib_div::createVersionNumberedFile($file) : $file);
|
||
$tag = '<link rel="' . $properties['rel'] . '" type="text/css" href="' . $file . '" media="' . $properties['media'] . '"' . ($properties['title'] ? ' title="' . $properties['title'] . '"' : '') . ' />';
|
||
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
|
||
$tag = str_replace('|', $tag, $properties['allWrap']);
|
||
... | ... | |
$properties['file'] = htmlspecialchars(
|
||
t3lib_div::resolveBackPath($properties['file'])
|
||
);
|
||
$properties['file'] = (TYPO3_MODE == 'BE' ? t3lib_div::createVersionNumberedFile($properties['file']) : $properties['file']);
|
||
$tag = '<script src="' . $properties['file'] . '" type="' . $properties['type'] . '"></script>';
|
||
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
|
||
$tag = str_replace('|', $tag, $properties['allWrap']);
|
||
... | ... | |
if (count($this->jsFiles)) {
|
||
foreach ($this->jsFiles as $file => $properties) {
|
||
$file = htmlspecialchars(t3lib_div::resolveBackPath($file));
|
||
$file = (TYPO3_MODE == 'BE' ? t3lib_div::createVersionNumberedFile($file) : $file);
|
||
$tag = '<script src="' . $file . '" type="' . $properties['type'] . '"></script>';
|
||
if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
|
||
$tag = str_replace('|', $tag, $properties['allWrap']);
|
||
... | ... | |
$out = '';
|
||
if ($this->addPrototype) {
|
||
$out .= '<script src="' . $this->backPath . 'contrib/prototype/prototype.js" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . 'contrib/prototype/prototype.js') . '" type="text/javascript"></script>' . chr(10);
|
||
unset($this->jsFiles[$this->backPath . 'contrib/prototype/prototype.js']);
|
||
}
|
||
... | ... | |
if (count($mods)) {
|
||
$moduleLoadString = '?load=' . implode(',', $mods);
|
||
}
|
||
$out .= '<script src="' . $this->backPath . 'contrib/scriptaculous/scriptaculous.js' . $moduleLoadString . '" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . 'contrib/scriptaculous/scriptaculous.js' . $moduleLoadString) . '" type="text/javascript"></script>' . chr(10);
|
||
unset($this->jsFiles[$this->backPath . 'contrib/scriptaculous/scriptaculous.js' . $moduleLoadString]);
|
||
}
|
||
// include extCore
|
||
if ($this->addExtCore) {
|
||
$out .= '<script src="' . $this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . chr(10);
|
||
unset($this->jsFiles[$this->backPath . 'contrib/extjs/ext-core' . ($this->enableExtCoreDebug ? '-debug' : '') . '.js']);
|
||
}
|
||
// include extJS
|
||
if ($this->addExtJS) {
|
||
// use the base adapter all the time
|
||
$out .= '<script src="' . $this->backPath . 'contrib/extjs/adapter/' . ($this->enableExtJsDebug ? str_replace('.js', '-debug.js', $this->extJSadapter) : $this->extJSadapter) . '" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . $this->backPath . 'contrib/extjs/ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . 'contrib/extjs/adapter/' . ($this->enableExtJsDebug ? str_replace('.js', '-debug.js', $this->extJSadapter) : $this->extJSadapter)) . '" type="text/javascript"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . 'contrib/extjs/ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . chr(10);
|
||
// add extJS localization
|
||
$localeMap = $this->csConvObj->isoArray; // load standard ISO mapping and modify for use with ExtJS
|
||
... | ... | |
// TODO autoconvert file from UTF8 to current BE charset if necessary!!!!
|
||
$extJsLocaleFile = 'contrib/extjs/locale/ext-lang-' . $extJsLang . '.js';
|
||
if (file_exists(PATH_typo3 . $extJsLocaleFile)) {
|
||
$out .= '<script src="' . $this->backPath . $extJsLocaleFile . '" type="text/javascript" charset="utf-8"></script>' . chr(10);
|
||
$out .= '<script src="' . t3lib_div::createVersionNumberedFile($this->backPath . $extJsLocaleFile) . '" type="text/javascript" charset="utf-8"></script>' . chr(10);
|
||
}
|
||
typo3/alt_main.php (working copy) | ||
---|---|---|
$this->generateJScode();
|
||
$GLOBALS['TBE_TEMPLATE']->JScode= '
|
||
<script type="text/javascript" src="md5.js"></script>
|
||
<script type="text/javascript" src="../t3lib/jsfunc.evalfield.js"></script>
|
||
<script type="text/javascript" src="js/backend.js"></script>
|
||
<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFile('../t3lib/jsfunc.evalfield.js') . '"></script>
|
||
<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFile('js/backend.js') . '"></script>
|
||
';
|
||
$GLOBALS['TBE_TEMPLATE']->JScode.=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->mainJScode);
|
||
typo3/backend.php (working copy) | ||
---|---|---|
foreach($this->jsFilesAfterInline as $jsFile) {
|
||
$GLOBALS['TBE_TEMPLATE']->JScode .= '
|
||
<script type="text/javascript" src="' . $jsFile . '"></script>';
|
||
<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFile($jsFile) . '"></script>';
|
||
}
|
||
typo3/sysext/t3editor/classes/class.tx_t3editor.php (working copy) | ||
---|---|---|
// include editor-css
|
||
$content .= '<link href="' .
|
||
$GLOBALS['BACK_PATH'] .
|
||
t3lib_div::createVersionNumberedFile($GLOBALS['BACK_PATH'] .
|
||
t3lib_extmgm::extRelPath('t3editor') .
|
||
'res/css/t3editor.css' .
|
||
'res/css/t3editor.css') .
|
||
'" type="text/css" rel="stylesheet" />';
|
||
// include editor-js-lib
|
typo3/sysext/cms/tslib/class.tslib_content.php (working copy) | ||
---|---|---|
/*]]>*/
|
||
</script>
|
||
';
|
||
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js"></script>';
|
||
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'. t3lib_div::createVersionNumberedFile($GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js') . '"></script>';
|
||
return $JSPart;
|
||
}
|
||
typo3/sysext/cms/layout/db_layout.php (working copy) | ||
---|---|---|
$this->doc->setModuleTemplate('templates/db_layout.html');
|
||
// JavaScript:
|
||
$this->doc->JScode = '<script type="text/javascript" src="'.$BACK_PATH.'../t3lib/jsfunc.updateform.js"></script>';
|
||
$this->doc->JScode = '<script type="text/javascript" src="'. t3lib_div::createVersionNumberedFile($BACK_PATH.'../t3lib/jsfunc.updateform.js') . '"></script>';
|
||
$this->doc->JScode.= $this->doc->wrapScriptTags('
|
||
if (top.fsMod) top.fsMod.recentIds["web"] = '.intval($this->id).';
|
||
if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages'.intval($this->id).'_"+top.fsMod.currentBank; '.intval($this->id).';
|
typo3/sysext/recycler/mod1/index.php (working copy) | ||
---|---|---|
*/
|
||
protected function loadStylesheet($fileName) {
|
||
$fileName = t3lib_div::resolveBackPath($this->doc->backPath . $fileName);
|
||
$this->doc->JScode.= "\t" . '<link rel="stylesheet" type="text/css" href="' . $fileName . '" />' . "\n";
|
||
$this->doc->JScode.= "\t" . '<link rel="stylesheet" type="text/css" href="' . t3lib_div::createVersionNumberedFile($fileName) . '" />' . "\n";
|
||
}
|
||
/**
|
||
... | ... | |
*/
|
||
protected function loadJavaScript($fileName) {
|
||
$fileName = t3lib_div::resolveBackPath($this->doc->backPath . $fileName);
|
||
$this->doc->JScode.= "\t" . '<script language="javascript" type="text/javascript" src="' . $fileName . '"></script>' . "\n";
|
||
$this->doc->JScode.= "\t" . '<script language="javascript" type="text/javascript" src="' . t3lib_div::createVersionNumberedFile($fileName) . '"></script>' . "\n";
|
||
}
|
||
/**
|