Project

General

Profile

Bug #17070 » tslib_content.diff

Administrator Admin, 2007-08-02 15:20

View differences:

typo3/sysext/cms/tslib/class.tslib_content.php (revision )
$isExecuted = array();
// additional switch to make sure 'required', 'if' and 'fieldRequired'
// will still stop rendering immediately in case they return false
$this->stopRendering = false;
$this->stdWrapRecursionLevel++;
$this->stopRendering[$this->stdWrapRecursionLevel] = false;
// execute each funtion in the predefined order
foreach ($sortedConf as $stdWrapName => $enabled) {
// eliminate the second key of a pair 'key'|'key.' to make sure functions get called only once and check if rendering has been stopped
if (!$isExecuted[$stdWrapName] && !$this->stopRendering) {
if (!$isExecuted[$stdWrapName] && !$this->stopRendering[$this->stdWrapRecursionLevel]) {
$functionName = rtrim($stdWrapName, '.');
$functionProperties = $functionName . '.';
// if there is any code one the next level, check if it contains "official" stdWrap functions
......
);
}
}
unset($this->stopRendering[$this->stdWrapRecursionLevel]);
$this->stdWrapRecursionLevel--;
}
}
return $content;
......
public function stdWrap_required($content = '', $conf = array()) {
if ((string) $content == '') {
$content = '';
$this->stopRendering = TRUE;
$this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
}
return $content;
}
......
public function stdWrap_if($content = '', $conf = array()) {
if (!$this->checkIf($conf['if.'])) {
$content = '';
$this->stopRendering = TRUE;
$this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
}
return $content;
}
......
public function stdWrap_fieldRequired($content = '', $conf = array()) {
if (!trim($this->data[$conf['fieldRequired']])) {
$content = '';
$this->stopRendering = TRUE;
$this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
}
return $content;
}
(2-2/7)