Feature #17267 » 0005536_Hooks_for_Tslib_content.patch
class.tslib_content.php (working copy) | ||
---|---|---|
var $substMarkerCache=array(); // Caching substituteMarkerArrayCached function
|
||
var $recordRegister=array(); // Array that registers rendered content elements (or any table) to make sure they are not rendered recursively!
|
||
var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects
|
||
var $stdWrapHookObjectsArr = array(); // Containig hooks for stdWrap
|
||
/**
|
||
* Class constructor.
|
||
... | ... | |
$this->cObjHookObjectsArr[$classArr[0]] = &t3lib_div::getUserObj($classArr[1]);
|
||
}
|
||
}
|
||
if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrapExtension'])) {
|
||
foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrapExtension'] as $classArr) {
|
||
$this->stdWrapHookObjectsArr[] = &t3lib_div::getUserObj($classArr);
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
... | ... | |
* @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
|
||
*/
|
||
function cObjGetSingle($name,$conf,$TSkey='__') {
|
||
global $TYPO3_CONF_VARS;
|
||
$content='';
|
||
// Checking that the function is not called eternally. This is done by interrupting at a depth of 100
|
||
$GLOBALS['TSFE']->cObjectDepthCounter--;
|
||
... | ... | |
case 'MULTIMEDIA':
|
||
$content.=$this->MULTIMEDIA($conf);
|
||
break;
|
||
default:
|
||
// Call hook functions for extra processing
|
||
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classRef) {
|
||
$hookObj = &t3lib_div::getUserObj($classRef);
|
||
if (method_exists($hookObj, 'cObjGetSingleDefault')) {
|
||
$content.= $hookObj->cObjGetSingleDefault($name, $conf, $TSkey, $this);
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
function stdWrap($content,$conf) {
|
||
if (is_array($conf)) {
|
||
foreach ($this->stdWrapHookObjectsArr as $hookObj) {
|
||
if ( method_exists($hookObj, 'stdWrapPreProcess')) {
|
||
$content = $hookObj->stdWrapPreProcess($content,$conf, $this);
|
||
}
|
||
}
|
||
// Setting current value, if so
|
||
if ($conf['setContentToCurrent']){$this->data[$this->currentValKey]=$content;}
|
||
if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
|
||
... | ... | |
if ($conf['filelist'] || $conf['filelist.']) {$content=$this->filelist($this->stdWrap($conf['filelist'], $conf['filelist.']));}
|
||
if ($conf['preUserFunc']) {$content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);}
|
||
foreach ($this->stdWrapHookObjectsArr as $hookObj) {
|
||
if ( method_exists($hookObj, 'stdWrapOverride')) {
|
||
$content = $hookObj->stdWrapOverride($content,$conf, $this);
|
||
}
|
||
}
|
||
// Overriding values, evaluating conditions
|
||
if ($conf['override'] || $conf['override.']){
|
||
$override = $this->stdWrap($conf['override'], $conf['override.']);
|
||
... | ... | |
// Call stdWrap recursively
|
||
if ($conf['stdWrap.']) { $content=$this->stdWrap($content,$conf['stdWrap.']); }
|
||
foreach ($this->stdWrapHookObjectsArr as $hookObj) {
|
||
if ( method_exists($hookObj, 'stdWrapProcessing')) {
|
||
$content = $hookObj->stdWrapProcessing($content,$conf, $this);
|
||
}
|
||
}
|
||
if ( ($conf['required'] && (string)$content=='') || ($conf['if.'] && !$this->checkIf($conf['if.'])) || ($conf['fieldRequired'] && !trim($this->data[$conf['fieldRequired']])) ){
|
||
$content = '';
|
||
} else {
|
||
... | ... | |
if ($conf['editPanel'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editPanel($content, $conf['editPanel.']);}
|
||
}
|
||
foreach ($this->stdWrapHookObjectsArr as $hookObj) {
|
||
if ( method_exists($hookObj, 'stdWrapPostProcessing')) {
|
||
$content = $hookObj->stdWrapPostProcessing($content,$conf, $this);
|
||
}
|
||
}
|
||
//Debug:
|
||
if ($conf['debug']) {$content = '<pre>'.htmlspecialchars($content).'</pre>';}
|
||
if ($conf['debugFunc']) {debug($conf['debugFunc']==2?array($content):$content);}
|
||
... | ... | |
* @see getFieldVal()
|
||
*/
|
||
function getData($string,$fieldArray) {
|
||
global $TYPO3_CONF_VARS;
|
||
if (!is_array($fieldArray)) {
|
||
$fieldArray=$GLOBALS['TSFE']->page;
|
||
}
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getDataExtension'])) {
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getDataExtension'] as $classRef) {
|
||
$hookObj = &t3lib_div::getUserObj($classRef);
|
||
if (method_exists($hookObj, 'getDataExtension')) {
|
||
$retVal = $hookObj->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
return $retVal;
|
||
}
|
||