📄 class.tslib_content.php
字号:
*/ var $data = Array(); var $oldData = Array(); // Used for backup... var $alternativeData =''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap var $parameters = Array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags. var $currentValKey = 'currentValue_kidjls9dksoje'; var $currentRecord = ''; // This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered. var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query. var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering. var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering. var $parentRecord = array(); // If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj. var $regObj; // This may be set as a reference to the calling object of eg. cObjGetSingle. Anyway, just use it as you like. It's used in productsLib.inc for example. // internal var $INT_include=0; // Is set to 1 if the instance of this cObj is executed from a PHP_SCRIPT_INT -include script (see pagegen, bottom of document) var $checkPid_cache = Array(); // This is used by checkPid, that checks if pages are accessible. The $checkPid_cache['page_uid'] is set true or false upon this check featuring a caching function for the next request. var $checkPid_badDoktypeList = '255'; var $lastTypoLinkUrl=''; // This will be set by typoLink() to the url of the most recent link created. var $lastTypoLinkTarget=''; // DO. link target. 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 /** * Class constructor. * Well, it has to be called manually since it is not a real constructor function. * So after making an instance of the class, call this function and pass to it a database record and the tablename from where the record is from. That will then become the "current" record loaded into memory and accessed by the .fields property found in eg. stdWrap. * * @param array $data the record data that is rendered. * @param string $table the table that the data record is from. * @return void */ function start($data,$table='') { global $TYPO3_CONF_VARS; $this->data = $data; $this->currentRecord = $table ? $table.':'.$this->data['uid'] : ''; $this->parameters = Array(); if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) { foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) { $this->cObjHookObjectsArr[$classArr[0]] = &t3lib_div::getUserObj($classArr[1]); } } } /** * Sets the internal variable parentRecord with information about current record. * If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj. * * @param array $data: The record array * @param string $currentRecord: This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered. * @return void * @access private */ function setParent($data,$currentRecord) { $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord); } /*********************************************** * * CONTENT_OBJ: * ***********************************************/ /** * Returns the "current" value. * The "current" value is just an internal variable that can be used by functions to pass a single value on to another function later in the TypoScript processing. * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like. * The TSref will tell if functions are setting this value before calling some other object so that you know if it holds any special information. * * @return mixed The "current" value */ function getCurrentVal() { return $this->data[$this->currentValKey]; } /** * Sets the "current" value. * * @param mixed The variable that you want to set as "current" * @return void * @see getCurrentVal() */ function setCurrentVal($value) { $this->data[$this->currentValKey] = $value; } /** * Rendering of a "numerical array" of cObjects from TypoScript * Will call ->cObjGetSingle() for each cObject found and accumulate the output. * * @param array $setup: Array with cObjects as values. * @param string $addKey: A prefix for the debugging information * @return string Rendered output from the cObjects in the array. * @see cObjGetSingle() */ function cObjGet($setup,$addKey='') { if (is_array($setup)) { $sKeyArray=t3lib_TStemplate::sortedKeyList($setup); $content =''; foreach($sKeyArray as $theKey) { $theValue=$setup[$theKey]; if (intval($theKey) && !strstr($theKey,'.')) { $conf=$setup[$theKey.'.']; $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey); // Get the contentObject } } return $content; } } /** * Renders a content object * * @param string The content object name, eg. "TEXT" or "USER" or "IMAGE" * @param array The array with TypoScript properties for the content object * @param string A string label used for the internal debugging tracking. * @return string cObject output * @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='__') { $content=''; // Checking that the function is not called eternally. This is done by interrupting at a depth of 100 $GLOBALS['TSFE']->cObjectDepthCounter--; if ($GLOBALS['TSFE']->cObjectDepthCounter>0) { $name = trim($name); if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name); // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something') if (substr($name,0,1)=='<') { $key = trim(substr($name,1)); $cF = t3lib_div::makeInstance('t3lib_TSparser'); // $name and $conf is loaded with the referenced values. $old_conf=$conf; list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup); if (is_array($old_conf) && count($old_conf)) { $conf = $this->joinTSarrays($conf,$old_conf);// debug($conf); } // Getting the cObject $GLOBALS['TT']->incStackPointer(); $content.=$this->cObjGetSingle($name,$conf,$key); $GLOBALS['TT']->decStackPointer(); } else { $hooked = false; // Application defined cObjects foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) { if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) { $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this); $hooked = true; } } if (!$hooked && t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) { $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this); } elseif (!$hooked) { // Traditional Content Object branching: switch($name) { case 'COBJ_ARRAY': case 'COA': $content.=$this->COBJ_ARRAY($conf); break; case 'COA_INT': $content.=$this->COBJ_ARRAY($conf,'INT'); break; case 'HTML': $content.=$this->HTML($conf); break; case 'TEXT': $content.=$this->TEXT($conf); break; case 'CLEARGIF': $content.=$this->CLEARGIF($conf); break; case 'FILE': $content.=$this->FILE($conf); break; case 'IMAGE': $content.=$this->IMAGE($conf); break; case 'IMG_RESOURCE': $content.=$this->IMG_RESOURCE($conf); break; case 'IMGTEXT': $content.=$this->IMGTEXT($conf); break; case 'CONTENT': $content.=$this->CONTENT($conf); break; case 'RECORDS': $content.=$this->RECORDS($conf); break; case 'HMENU': $content.=$this->HMENU($conf); break; case 'CTABLE': $content.=$this->CTABLE($conf); break; case 'OTABLE': $content.=$this->OTABLE($conf); break; case 'COLUMNS': $content.=$this->COLUMNS($conf); break; case 'HRULER': $content.=$this->HRULER($conf); break; case 'CASE': $content.=$this->CASEFUNC($conf); break; case 'LOAD_REGISTER': case 'RESTORE_REGISTER': $this->LOAD_REGISTER($conf,$name); break; case 'FORM': $content.=$this->FORM($conf); break; case 'SEARCHRESULT': $content.=$this->SEARCHRESULT($conf); break; case 'PHP_SCRIPT': $content.=$this->PHP_SCRIPT($conf); break; case 'PHP_SCRIPT_EXT': $content.=$this->PHP_SCRIPT($conf,'EXT'); break; case 'PHP_SCRIPT_INT': $content.=$this->PHP_SCRIPT($conf,'INT'); break; case 'USER': $content.=$this->USER($conf); break; case 'USER_INT': $content.=$this->USER($conf,'INT'); break; case 'TEMPLATE': $content.=$this->TEMPLATE($conf); break; case 'EDITPANEL': if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);} break; case 'MULTIMEDIA': $content.=$this->MULTIMEDIA($conf); break; } } } if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content); } // Increasing on exit... $GLOBALS['TSFE']->cObjectDepthCounter++; return $content; } /******************************************** * * Functions rendering content objects (cObjects) * ********************************************/ /** * Rendering the cObject, HTML * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4 */ function HTML($conf) { return $this->stdWrap($conf['value'],$conf['value.']); } /** * Rendering the cObject, TEXT * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83 */ function TEXT($conf) { return $this->stdWrap($conf['value'],$conf); } /** * Rendering the cObject, CLEARGIF * * @param array Array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915 */ function CLEARGIF($conf) { $w = $this->stdWrap($conf['width'],$conf['width.']); $h = $this->stdWrap($conf['height'],$conf['height.']); $w = $w ? $w : 1; $h = $h ? $h : 1; $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />'; $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap); return $this->stdWrap($theValue,$conf['stdWrap.']); } /** * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT * * @param array Array of TypoScript properties * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached) * @return string Output
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -