Project

General

Profile

Feature #19399 ยป 9460.patch

Administrator Admin, 2008-12-21 21:52

View differences:

t3lib/class.t3lib_tstemplate.php (working copy)
}
/**
* Wrapper for _getFilename (original "getFileName" renamed) that extends the original functionality in two ways:
* 1. external resources can be included by specifying a url (e.g. http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js)
* 2. local resources can include a query part (e.g. fileadmin/lib.js?version=1)
*
* If the parameter is an absolute url (starting with a protocol specification (e.g. "http://") or a shash ("/")) it will be returned unaltered.
* Otherwise, the parameter value will be split into a url and an optional query part (?...), and _getFileName will be called with url as parameter.
* If the result of this call is non-empty the query part (if any) will be appended to form the final result.
*
* @param string Url or Typoscript "resource" data type value.
* @return string Url (possibly expanded from Typoscript resource)
* @see _getFileName()
*/
public function getFileName($fileFromSetup) {
$fileFromSetup = trim($fileFromSetup);
// Return unchanged if it's an absolute url (starting with protocol, e.g. "http://", or a slash ("/")).
if (preg_match('@^([a-z]+:/)?/@', $fileFromSetup)) {
return $fileFromSetup;
}
// Split into path and query
$parts = explode('?', $fileFromSetup, 2);
// Get filename using original method
$url = $this->_getFileName($parts[0]);
// Add query part if needed
if ($url && (count($parts) > 1)) {
$url .= '?'.$parts[1];
}
return $url;
}
/**
* Returns the reference to a 'resource' in TypoScript.
* This could be from the filesystem if '/' is found in the value $fileFromSetup, else from the resource-list
*
* @param string TypoScript "resource" data type value.
* @return string Resulting filename, if any.
*/
function getFileName($fileFromSetup) {
private function _getFileName($fileFromSetup) {
$file = trim($fileFromSetup);
if (!$file) {
return;
    (1-1/1)