Project

General

Profile

Bug #22393 ยป 14023_v1.diff

Administrator Admin, 2010-04-07 12:30

View differences:

typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
* @access private
* @see getData()
*/
function getGlobal($var, $source=NULL) {
$vars = explode('|', $var);
$c = count($vars);
$k = trim($vars[0]);
$theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
for ($a=1;$a<$c;$a++) {
if (!isset($theVar)) { break; }
function getGlobal($keyString, $source=NULL) {
$keyArray = explode('|', $keyString);
$levelsCount = count($keyArray);
$rootKey = trim($vars[0]);
$value = isset($source) ? $source[$rootKey] : $GLOBALS[$rootKey];
$key = trim($vars[$a]);
if (is_object($theVar)) {
$theVar = $theVar->$key;
} elseif (is_array($theVar)) {
$theVar = $theVar[$key];
for ($i=1;$i<$levelsCount;$i++) {
if (!isset($value)) { break; }
$currentKey = trim($keyArray[$i]);
if (is_object($value)) {
$value = $value->$currentKey;
} elseif (is_array($value)) {
$value = $value[$currentKey];
} else {
return '';
}
}
if (!is_array($theVar) && !is_object($theVar)) {
return $theVar;
if (!is_array($value) && !is_object($value)) {
return $value;
} else {
return '';
}
    (1-1/1)