Feature #17267 » feature-005536-cObj.patch
t3lib/interfaces/interface.t3lib_cobjgetsinglehook.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2007 Ingo Renner <ingo@typo3.org>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
* A copy is found in the textfile GPL.txt and important notices to the license
|
||
* from the author is found in LICENSE.txt distributed with these scripts.
|
||
*
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
|
||
|
||
/**
|
||
* interface for classes which hook into tslib_content and do additional cObjGetSingle processing
|
||
*
|
||
* @author Ingo Renner <ingo@typo3.org>
|
||
* @package TYPO3
|
||
* @subpackage t3lib
|
||
*/
|
||
interface t3lib_contentObjectGetSingleHook {
|
||
|
||
/**
|
||
* Renders content objects, that are _not_ defined in the core
|
||
*
|
||
* @param string $name The content object name, eg. "TEXT" or "USER" or "IMAGE"
|
||
* @param array $configuration The array with TypoScript properties for the content object
|
||
* @param string $TSkey A string label used for the internal debugging tracking.
|
||
* @param object $parentObject
|
||
* @return string cObject output
|
||
*/
|
||
public function getSingleContentObject($name, $configuration, $TSkey, $parentObject);
|
||
|
||
}
|
||
|
||
?>
|
t3lib/interfaces/interface.t3lib_getdatahook.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2007 Ingo Renner <ingo@typo3.org>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
* A copy is found in the textfile GPL.txt and important notices to the license
|
||
* from the author is found in LICENSE.txt distributed with these scripts.
|
||
*
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
|
||
|
||
/**
|
||
* interface for classes which hook into tslib_content and do additional getData processing
|
||
*
|
||
* @author Ingo Renner <ingo@typo3.org>
|
||
* @package TYPO3
|
||
* @subpackage t3lib
|
||
*/
|
||
interface t3lib_getDataHook {
|
||
|
||
/**
|
||
* Extends the getData()-Method of tslib_cObj to process more/other commands
|
||
*
|
||
* @param string $string Full content of getData-request e.g. "TSFE:id // field:title // field:uid"
|
||
* @param array $fields Current field-array
|
||
* @param string $sectionValue Currently examined section-value of above getData request e.g. "field:title"
|
||
* @param string $returnValue Current returnValue that was processed so far by getData
|
||
* @param object $parentObject Parent Object of type cObj
|
||
* @return string Result
|
||
*/
|
||
public function getDataExtension($string, $fields, $sectionValue, $returnValue, $parentObject);
|
||
|
||
}
|
||
|
||
?>
|
t3lib/interfaces/interface.t3lib_stdwraphook.php (revision 0) | ||
---|---|---|
<?php
|
||
/***************************************************************
|
||
* Copyright notice
|
||
*
|
||
* (c) 2007 Ingo Renner <ingo@typo3.org>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
* free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 2 of the License, or
|
||
* (at your option) any later version.
|
||
*
|
||
* The GNU General Public License can be found at
|
||
* http://www.gnu.org/copyleft/gpl.html.
|
||
* A copy is found in the textfile GPL.txt and important notices to the license
|
||
* from the author is found in LICENSE.txt distributed with these scripts.
|
||
*
|
||
*
|
||
* This script is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
|
||
|
||
/**
|
||
* interface for classes which hook into tslib_content and do additional stdWrap processing
|
||
*
|
||
* @author Ingo Renner <ingo@typo3.org>
|
||
* @package TYPO3
|
||
* @subpackage t3lib
|
||
*/
|
||
interface t3lib_stdWrapHook {
|
||
|
||
/**
|
||
* Hook for modifying $content before core's stdWrap does anything
|
||
*
|
||
* @param string $content Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
|
||
* @param array $configuration TypoScript "stdWrap properties".
|
||
* @param object $parentObject
|
||
* @return string Further processed $content
|
||
*/
|
||
public function stdWrapPreProcess($content, $configuration, $parentObject);
|
||
|
||
/**
|
||
* Hook for modifying $content after core's stdWrap has processed setContentToCurrent, setCurrent, lang, data, field, current, cObject, numRows, filelist and/or preUserFunc
|
||
*
|
||
* @param string $content Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
|
||
* @param array $configuration TypoScript "stdWrap properties".
|
||
* @param object $parentObject
|
||
* @return string Further processed $content
|
||
*/
|
||
public function stdWrapOverride($content, $configuration, $parentObject);
|
||
|
||
/**
|
||
* Hook for modifying $content after core's stdWrap has processed override, preIfEmptyListNum, ifEmpty, ifBlank, listNum, trim and/or more (nested) stdWraps
|
||
*
|
||
* @param string $content Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
|
||
* @param array $configuration TypoScript "stdWrap properties".
|
||
* @param object $parentObject
|
||
* @return string Further processed $content
|
||
*/
|
||
public function stdWrapProcess($content, $configuration, $parentObject);
|
||
|
||
/**
|
||
* Hook for modifying $content after core's stdWrap has processed anything but debug
|
||
*
|
||
* @param string $content Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
|
||
* @param array $configuration TypoScript "stdWrap properties".
|
||
* @param object $parentObject
|
||
* @return string Further processed $content
|
||
*/
|
||
public function stdWrapPostProcess($content, $configuration, $parentObject);
|
||
|
||
}
|
||
|
||
?>
|
typo3/sysext/cms/tslib/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
|
||
private $stdWrapHookObjects = array(); // Containig hook objects 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']['stdWrap'])) {
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) {
|
||
$hookObject = &t3lib_div::getUserObj($classData);
|
||
if(!($hookObject instanceof t3lib_stdWrapHook)) {
|
||
throw new UnexpectedValueException('$hookObject must implement interface t3lib_stdWrapHook', 1195043965);
|
||
}
|
||
$this->stdWrapHookObjects[] = $hookObject;
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
... | ... | |
* @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 $classData) {
|
||
$hookObject = &t3lib_div::getUserObj($classData);
|
||
if(!($hookObject instanceof t3lib_contentObjectGetSingleHook)) {
|
||
throw new UnexpectedValueException('$hookObject must implement interface t3lib_contentObjectGetSingleHook', 1195043731);
|
||
}
|
||
$content .= $hookObject->getSingleContentObject($name, $conf, $TSkey, $this);
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
function stdWrap($content,$conf) {
|
||
if (is_array($conf)) {
|
||
foreach($this->stdWrapHookObjects as $hookObject) {
|
||
$content = $hookObject->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->stdWrapHookObjects as $hookObject) {
|
||
$content = $hookObject->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->stdWrapHookObjects as $hookObject) {
|
||
$content = $hookObject->stdWrapProcess($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->stdWrapHookObjects as $hookObject) {
|
||
$content = $hookObject->stdWrapPostProcess($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']['getData'])) {
|
||
foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) {
|
||
$hookObject = &t3lib_div::getUserObj($classData);
|
||
if(!($hookObject instanceof t3lib_getDataHook)) {
|
||
throw new UnexpectedValueException('$hookObject must implement interface t3lib_getDataHook', 1195044480);
|
||
}
|
||
$retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
|
||
}
|
||
}
|
||
}
|
||
return $retVal;
|
||
}
|
||