Index: typo3/sysext/cms/tslib/class.tslib_content.php
===================================================================
--- typo3/sysext/cms/tslib/class.tslib_content.php (revision 9006)
+++ typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
@@ -235,6 +235,174 @@
'center', 'right', 'left'
);
+/**
+ * stdWrap functions in their correct order
+ *
+ * @see stdWrap()
+ */
+ var $stdWrapOrder = array(
+ 'stdWrapPreProcess' => 1, // this is a placeholder for the first Hook
+ 'setContentToCurrent' => 1,
+ 'setContentToCurrent.' => 1,
+ 'setCurrent' => 1,
+ 'setCurrent.' => 1,
+ 'lang' => 1,
+ 'lang.' => 1,
+ 'data' => 1,
+ 'data.' => 1,
+ 'field' => 1,
+ 'field.' => 1,
+ 'current' => 1,
+ 'current.' => 1,
+ 'cObject' => 1,
+ 'cObject.' => 1,
+ 'numRows' => 1,
+ 'numRows.' => 1,
+ 'filelist' => 1,
+ 'filelist.' => 1,
+ 'preUserFunc' => 1,
+ 'preUserFunc.' => 1,
+ 'stdWrapOverride' => 1, // this is a placeholder for the second Hook
+ 'override' => 1,
+ 'override.' => 1,
+ 'preIfEmptyListNum' => 1,
+ 'preIfEmptyListNum.' => 1,
+ 'ifEmpty' => 1,
+ 'ifEmpty.' => 1,
+ 'ifBlank' => 1,
+ 'ifBlank.' => 1,
+ 'listNum' => 1,
+ 'listNum.' => 1,
+ 'trim' => 1,
+ 'trim.' => 1,
+ 'stdWrap' => 1,
+ 'stdWrap.' => 1,
+ 'stdWrapProcess' => 1, // this is a placeholder for the third Hook
+ 'required' => 1,
+ 'required.' => 1,
+ 'if' => 1,
+ 'if.' => 1,
+ 'fieldRequired' => 1,
+ 'fieldRequired.' => 1,
+ 'csConv' => 1,
+ 'csConv.' => 1,
+ 'parseFunc' => 1,
+ 'parseFunc.' => 1,
+ 'HTMLparser' => 1,
+ 'HTMLparser.' => 1,
+ 'split' => 1,
+ 'split.' => 1,
+ 'prioriCalc' => 1,
+ 'prioriCalc.' => 1,
+ 'char' => 1,
+ 'char.' => 1,
+ 'intval' => 1,
+ 'intval.' => 1,
+ 'numberFormat' => 1,
+ 'numberFormat.' => 1,
+ 'date' => 1,
+ 'date.' => 1,
+ 'strftime' => 1,
+ 'strftime.' => 1,
+ 'age' => 1,
+ 'age.' => 1,
+ 'case' => 1,
+ 'case.' => 1,
+ 'bytes' => 1,
+ 'bytes.' => 1,
+ 'substring' => 1,
+ 'substring.' => 1,
+ 'removeBadHTML' => 1,
+ 'removeBadHTML.' => 1,
+ 'cropHTML' => 1,
+ 'cropHTML.' => 1,
+ 'stripHtml' => 1,
+ 'stripHtml.' => 1,
+ 'crop' => 1,
+ 'crop.' => 1,
+ 'rawUrlEncode' => 1,
+ 'rawUrlEncode.' => 1,
+ 'htmlSpecualChars' => 1,
+ 'htmlSpecualChars.' => 1,
+ 'doubleBrTag' => 1,
+ 'doubleBrTag.' => 1,
+ 'br' => 1,
+ 'br.' => 1,
+ 'brTag' => 1,
+ 'brTag.' => 1,
+ 'encapsLines' => 1,
+ 'encapsLines.' => 1,
+ 'keywords' => 1,
+ 'keywords.' => 1,
+ 'innerWrap' => 1,
+ 'innerWrap.' => 1,
+ 'innerWrap2' => 1,
+ 'innerWrap2.' => 1,
+ 'fontTag' => 1,
+ 'fontTag.' => 1,
+ 'addParams' => 1,
+ 'addParams.' => 1,
+ 'textStyle' => 1,
+ 'textStyle.' => 1,
+ 'tableStyle' => 1,
+ 'tableStyle.' => 1,
+ 'filelink' => 1,
+ 'filelink.' => 1,
+ 'preCObject' => 1,
+ 'preCObject.' => 1,
+ 'postCObject' => 1,
+ 'postCObject.' => 1,
+ 'wrapAlign' => 1,
+ 'wrapAlign.' => 1,
+ 'typolink' => 1,
+ 'typolink.' => 1,
+ 'TCAselectItem' => 1,
+ 'TCAselectItem.' => 1,
+ 'space' => 1,
+ 'space.' => 1,
+ 'spaceBefore' => 1,
+ 'spaceBefore.' => 1,
+ 'spaceAfter' => 1,
+ 'spaceAfter.' => 1,
+ 'wrap' => 1,
+ 'wrap.' => 1,
+ 'noTrimWrap' => 1,
+ 'noTrimWrap.' => 1,
+ 'wrap2' => 1,
+ 'wrap2.' => 1,
+ 'dataWrap' => 1,
+ 'dataWrap.' => 1,
+ 'prepend' => 1,
+ 'prepend.' => 1,
+ 'append' => 1,
+ 'append.' => 1,
+ 'wrap3' => 1,
+ 'wrap3.' => 1,
+ 'outerWrap' => 1,
+ 'outerWrap.' => 1,
+ 'insertData' => 1,
+ 'insertData.' => 1,
+ 'offsetWrap' => 1,
+ 'offsetWrap.' => 1,
+ 'postUserFunc' => 1,
+ 'postUserFunc.' => 1,
+ 'postUserFuncInt' => 1,
+ 'postUserFuncInt.' => 1,
+ 'prefixComment' => 1,
+ 'prefixComment.' => 1,
+ 'editIcons' => 1,
+ 'editIcons.' => 1,
+ 'editPanel' => 1,
+ 'editPanel.' => 1,
+ 'stdWrapPostProcess' => 1, // this is a placeholder for the last Hook
+ 'debug' => 1,
+ 'debug.' => 1,
+ 'debugFunc' => 1,
+ 'debugFunc.' => 1,
+ 'debugData' => 1,
+ 'debugData.' => 1
+ );
+
/**
* Holds ImageMagick parameters and extensions used for compression
*
@@ -3891,443 +4059,1381 @@
$GLOBALS['TT']->setTSlogMessage('Cached from DB', 0);
}
}
-
- // Substitution/Merging:
- // Merging content types together, resetting
- $valueArr = array_merge($markContentArray, $subpartContentArray, $wrappedSubpartContentArray);
-
- $wSCA_reg = array();
- $content = '';
- // traversing the keyList array and merging the static and dynamic content
- foreach ($storeArr['k'] as $n => $keyN) {
- $content .= $storeArr['c'][$n];
- if (!is_array($valueArr[$keyN])) {
- $content .= $valueArr[$keyN];
- } else {
- $content .= $valueArr[$keyN][(intval($wSCA_reg[$keyN]) % 2)];
- $wSCA_reg[$keyN]++;
- }
+
+ // Substitution/Merging:
+ // Merging content types together, resetting
+ $valueArr = array_merge($markContentArray, $subpartContentArray, $wrappedSubpartContentArray);
+
+ $wSCA_reg = array();
+ $content = '';
+ // traversing the keyList array and merging the static and dynamic content
+ foreach ($storeArr['k'] as $n => $keyN) {
+ $content .= $storeArr['c'][$n];
+ if (!is_array($valueArr[$keyN])) {
+ $content .= $valueArr[$keyN];
+ } else {
+ $content .= $valueArr[$keyN][(intval($wSCA_reg[$keyN]) % 2)];
+ $wSCA_reg[$keyN]++;
+ }
+ }
+ $content .= $storeArr['c'][count($storeArr['k'])];
+
+ $GLOBALS['TT']->pull();
+ return $content;
+ }
+
+ /**
+ * Traverses the input $markContentArray array and for each key the marker
+ * by the same name (possibly wrapped and in upper case) will be
+ * substituted with the keys value in the array.
+ *
+ * This is very useful if you have a data-record to substitute in some
+ * content. In particular when you use the $wrap and $uppercase values to
+ * pre-process the markers. Eg. a key name like "myfield" could effectively
+ * be represented by the marker "###MYFIELD###" if the wrap value
+ * was "###|###" and the $uppercase boolean TRUE.
+ *
+ * @param string The content stream, typically HTML template content.
+ * @param array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content stream with the content.
+ * @param string A wrap value - [part 1] | [part 2] - for the markers before substitution
+ * @param boolean If set, all marker string substitution is done with upper-case markers.
+ * @param boolean If set, all unused marker are deleted.
+ * @return string The processed output stream
+ * @see substituteMarker(), substituteMarkerInObject(), TEMPLATE()
+ */
+ public function substituteMarkerArray($content, array $markContentArray, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE) {
+ return t3lib_parsehtml::substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
+ }
+
+ /**
+ * Substitute marker array in an array of values
+ *
+ * @param mixed If string, then it just calls substituteMarkerArray. If array(and even multi-dim) then for each key/value pair the marker array will be substituted (by calling this function recursively)
+ * @param array The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content string/array values.
+ * @return mixed The processed input variable.
+ * @see substituteMarker()
+ */
+ public function substituteMarkerInObject(&$tree, array $markContentArray) {
+ if (is_array($tree)) {
+ foreach ($tree as $key => $value) {
+ $this->substituteMarkerInObject($tree[$key], $markContentArray);
+ }
+ } else {
+ $tree = $this->substituteMarkerArray($tree, $markContentArray);
+ }
+
+ return $tree;
+ }
+
+ /**
+ * Adds elements to the input $markContentArray based on the values from
+ * the fields from $fieldList found in $row
+ *
+ * @param array array with key/values being marker-strings/substitution values.
+ * @param array An array with keys found in the $fieldList (typically a record) which values should be moved to the $markContentArray
+ * @param string A list of fields from the $row array to add to the $markContentArray array. If empty all fields from $row will be added (unless they are integers)
+ * @param boolean If set, all values added to $markContentArray will be nl2br()'ed
+ * @param string Prefix string to the fieldname before it is added as a key in the $markContentArray. Notice that the keys added to the $markContentArray always start and end with "###"
+ * @param boolean If set, all values are passed through htmlspecialchars() - RECOMMENDED to avoid most obvious XSS and maintain XHTML compliance.
+ * @return array The modified $markContentArray
+ */
+ public function fillInMarkerArray(array $markContentArray, array $row, $fieldList = '', $nl2br = TRUE, $prefix = 'FIELD_', $HSC = FALSE) {
+ if ($fieldList) {
+ $fArr = t3lib_div::trimExplode(',', $fieldList, 1);
+ foreach ($fArr as $field) {
+ $markContentArray['###' . $prefix . $field . '###'] = $nl2br ? nl2br($row[$field]) : $row[$field];
+ }
+ } else {
+ if (is_array($row)) {
+ foreach ($row as $field => $value) {
+ if (!t3lib_div::testInt($field)) {
+ if ($HSC) {
+ $value = htmlspecialchars($value);
+ }
+
+ $markContentArray['###' . $prefix . $field . '###'] = $nl2br ? nl2br($value) : $value;
+ }
+ }
+ }
+ }
+
+ return $markContentArray;
+ }
+
+ /***********************************************
+ *
+ * "stdWrap" + sub functions
+ *
+ ***********************************************/
+
+ /**
+ * The "stdWrap" function. This is the implementation of what is known as "stdWrap properties" in TypoScript.
+ * Basically "stdWrap" performs some processing of a value based on properties in the input $conf array(holding the TypoScript "stdWrap properties")
+ * See the link below for a complete list of properties and what they do. The order of the table with properties found in TSref (the link) follows the actual order of implementation in this function.
+ *
+ * If $this->alternativeData is an array it's used instead of the $this->data array in ->getData
+ *
+ * @param string Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
+ * @param array TypoScript "stdWrap properties".
+ * @return string The processed input value
+ * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=314&cHash=02ab044c7b
+ */
+ function stdWrap($content = '', $conf = array()) {
+ if(count($this->stdWrapHookObjects)) {
+ foreach ($this->stdWrapHookObjects as $hookObject) {
+ if(is_callable($hookObject->stdWrapPreProcess)) {
+ $conf['stdWrapPreProcess'] = 'stdWrapHookObject';
+ };
+ if(is_callable($hookObject->stdWrapOverride)) {
+ $conf['stdWrapOverride'] = 'stdWrapHookObject';
+ };
+ if(is_callable($hookObject->stdWrapProcess)) {
+ $conf['stdWrapProcess'] = 'stdWrapHookObject';
+ };
+ if(is_callable($hookObject->stdWrapPostProcess)) {
+ $conf['stdWrapPostProcess'] = 'stdWrapHookObject';
+ };
+ }
+ }
+ if (count($conf)) {
+ // check, which of the available stdWrap functions is needed for the current conf Array
+ // and keep only those but still in the same order
+ $sortedConf = array_intersect_key($this->stdWrapOrder,$conf);
+ // functions that should not make use of nested stdWrap function calls to avoid conflicts with internal TypoScript used by these functions
+ $stdWrapDisabledFunctions = 'cObject,preUserFunc,stdWrap,preCObject,postCObject,prepend,append,postUserFunc,postUserFuncInt';
+ // additional Array to check whether a function has already been executed
+ $isExecuted = array();
+ // additional switch to make sure 'required', 'if' and 'fieldRequired'
+ // will still stop rendering immediately in case they return false
+ $this->stopRendering = 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) {
+ $functionName = rtrim($stdWrapName,'.');
+ $functionProperties = $functionName.'.';
+ // if there is any code one the next level, check if it contains "official" stdWrap functions
+ // if yes, execute them first - will make each function stdWrap aware
+ // so additional stdWrap calls within the functions can be removed, since the result will be the same
+ // exception: the recursive stdWrap function and cObject will still be using their own stdWrap call, since it modifies the content and not a property
+ if( count($conf[$functionProperties]) &&
+ !t3lib_div::inList($stdWrapDisabledFunctions,$functionName)) {
+ if(array_intersect_key($this->stdWrapOrder,$conf[$functionProperties])) {
+ $conf[$functionName] = $this->stdWrap($conf[$functionName],$conf[$functionProperties]);
+ }
+ }
+ // get just that part of $conf that is needed for the particular function
+ $singleConf = array(
+ $functionName => $conf[$functionName],
+ $functionProperties => $conf[$functionProperties]
+ );
+
+ // in this special case 'spaceBefore' and 'spaceAfter' need additional stuff from 'space.''
+ if($functionName == 'spaceBefore' || $functionName == 'spaceAfter') {
+ $singleConf['space.'] = $conf['space.'];
+ }
+
+ // hand over the whole $conf array to the stdWrapHookObjects
+ if($conf[$functionName] == 'stdWrapHookObject') {
+ $singleConf = $conf;
+ }
+
+ // check if key is still containing something, since it might have been changed by next level stdWrap before
+ if($conf[$functionName] || $conf[$functionProperties]) {
+ //add both keys - with and without the dot - to the set of executed functions
+ $isExecuted[$functionName] = true;
+ $isExecuted[$functionProperties] = true;
+ // call the function with the prefix stdWrap_ to make sure nobody can execute functions just by adding their name to the TS Array
+ $functionName = 'stdWrap_'.$functionName;
+ $content = $this->$functionName(
+ $content,
+ $singleConf
+ );
+ }
+ }
+ }
+ }
+ return $content;
+ }
+
+ /**
+ * stdWrap pre process hook
+ * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
+ * this hook will execute functions before any other stdWrap function can modify anything
+ *
+ * @param string Input value undergoing processing in these functions.
+ * @param array All stdWrap properties, not just the ones for a particular function.
+ * @return string The processed input value
+ */
+ function stdWrap_stdWrapPreProcess($content = '', $conf = array()) {
+ foreach ($this->stdWrapHookObjects as $hookObject) {
+ $content = $hookObject->stdWrapPreProcess($content, $conf, $this);
+ }
+ return $content;
+ }
+
+ /**
+ * setContentToCurrent
+ * actually it just does the contrary: Sets the value of 'current' based on current content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for setContentToCurrent.
+ * @return string The processed input value
+ */
+ function stdWrap_setContentToCurrent($content = '', $conf = array()) {
+ $this->data[$this->currentValKey] = $content;
+ }
+
+ /**
+ * setCurrent
+ * Sets the value of 'current' based on the outcome of stdWrap operations
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for setCurrent.
+ * @return string The processed input value
+ */
+ function stdWrap_setCurrent($content = '', $conf = array()) {
+ $this->data[$this->currentValKey] = $conf['setCurrent'];
+ }
+
+ /**
+ * lang
+ * Translates content based on the language currently used by the FE
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for lang.
+ * @return string The processed input value
+ */
+ function stdWrap_lang($content = '', $conf = array()) {
+ if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
+ $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
+ }
+ return $content;
+ }
+
+ /**
+ * data
+ * Gets content from different sources based on getText functions, makes use of alternativeData, when set
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for data.
+ * @return string The processed input value
+ */
+ function stdWrap_data($content = '', $conf = array()) {
+ $content = $this->getData($conf['data'], is_array($this->alternativeData) ? $this->alternativeData : $this->data);
+ $this->alternativeData = ''; // This must be unset directly after
+ return $content;
+ }
+
+ /**
+ * field
+ * Gets content from a DB field
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for field.
+ * @return string The processed input value
+ */
+ function stdWrap_field($content = '', $conf = array()) {
+ $content = $this->getFieldVal($conf['field']);
+ return $content;
+ }
+
+ /**
+ * current
+ * Gets content that has been perviously set as 'current'
+ * Can be set via setContentToCurrent or setCurrent or will be set automatically i.e. inside the split function
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for current.
+ * @return string The processed input value
+ */
+ function stdWrap_current($content = '', $conf = array()) {
+ $content = $this->data[$this->currentValKey];
+ return $content;
+ }
+
+ /**
+ * cObject
+ * Will replace the content with the value of a any official TypoScript cObject
+ * like TEXT, COA, HMENU
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for cObject.
+ * @return string The processed input value
+ */
+ function stdWrap_cObject($content = '', $conf = array()) {
+ $content = $this->cObjGetSingle($conf['cObject'], $conf['cObject.'], '/stdWrap/.cObject');
+ return $content;
+ }
+
+ /**
+ * numRows
+ * Counts the number of returned records of a DB operation
+ * makes use of select internally
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for numRows.
+ * @return string The processed input value
+ */
+ function stdWrap_numRows($content = '', $conf = array()) {
+ $content = $this->numRows($conf['numRows.']);
+ return $content;
+ }
+
+ /**
+ * filelist
+ * Will create a list of files based on some additional parameters
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for filelist.
+ * @return string The processed input value
+ */
+ function stdWrap_filelist($content = '', $conf = array()) {
+ $content = $this->filelist($conf['filelist']);
+ return $content;
+ }
+
+ /**
+ * preUserFunc
+ * Will execute a user function before the content will be modified by any other stdWrap function
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for preUserFunc.
+ * @return string The processed input value
+ */
+ function stdWrap_preUserFunc($content = '', $conf = array()) {
+ $content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);
+ return $content;
+ }
+
+ /**
+ * stdWrap override hook
+ * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
+ * this hook will execute functions on existing content but still before the content gets modified or replaced
+ *
+ * @param string Input value undergoing processing in these functions.
+ * @param array All stdWrap properties, not just the ones for a particular function.
+ * @return string The processed input value
+ */
+ function stdWrap_stdWrapOverride($content = '', $conf = array()) {
+ foreach ($this->stdWrapHookObjects as $hookObject) {
+ $content = $hookObject->stdWrapOverride($content, $conf, $this);
+ }
+ return $content;
+ }
+
+ /**
+ * override
+ * Will override the current value of content with its own value'
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for override.
+ * @return string The processed input value
+ */
+ function stdWrap_override($content = '', $conf = array()) {
+ if (trim($conf['override'])) {
+ $content = $conf['override'];
+ }
+ return $content;
+ }
+
+ /**
+ * preIfEmptyListNum
+ * Gets a value off a CSV list before the following ifEmpty check
+ * Makes sure that the result of ifEmpty will be true in case the CSV does not contain a value at the position given by preIfEmptyListNum
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for preIfEmptyListNum.
+ * @return string The processed input value
+ */
+ function stdWrap_preIfEmptyListNum($content = '', $conf = array()) {
+ $content = $this->listNum($content, $conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['splitChar']);
+ return $content;
+ }
+
+ /**
+ * ifEmpty
+ * Will set content to a replacement value in case the trimmed value of content returns false
+ * 0 (zero) will be replaced as well
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for ifEmpty.
+ * @return string The processed input value
+ */
+ function stdWrap_ifEmpty($content = '', $conf = array()) {
+ if (!trim($content)) {
+ $content = $conf['ifEmpty'];
+ }
+ return $content;
+ }
+
+ /**
+ * ifBlank
+ * Will set content to a replacement value in case the trimmed value of content has no length
+ * 0 (zero) will not be replaced
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for ifBlank.
+ * @return string The processed input value
+ */
+ function stdWrap_ifBlank($content = '', $conf = array()){
+ if (!strlen(trim($content))) {
+ $content = $conf['ifBlank'];
+ }
+ return $content;
+ }
+
+ /**
+ * listNum
+ * Gets a value off a CSV list after ifEmpty check
+ * Might return an empty value in case the CSV does not contain a value at the position given by listNum
+ * Use preIfEmptyListNum to avoid that behaviour
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for listNum.
+ * @return string The processed input value
+ */
+ function stdWrap_listNum($content = '', $conf = array()) {
+ $content = $this->listNum($content, $conf['listNum'], $conf['listNum.']['splitChar']);
+ return $content;
+ }
+
+ /**
+ * trim
+ * Cuts off any whitespace at the beginning and the end of the content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for trim.
+ * @return string The processed input value
+ */
+ function stdWrap_trim($content = '', $conf = array()) {
+ $content = trim($content);
+ return $content;
+ }
+
+ /**
+ * stdWrap
+ * A recursive call of the stdWrap function set
+ * This enables the user to execute stdWrap functions in another than the predefined order
+ * It modifies the content, not the property
+ * while the new feature of chained stdWrap functions modifies the property and not the content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for stdWrap.
+ * @return string The processed input value
+ */
+ function stdWrap_stdWrap($content = '', $conf = array()) {
+ $content = $this->stdWrap($content,$conf['stdWrap.']);
+ return $content;
+ }
+
+ /**
+ * stdWrap process hook
+ * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
+ * this hook executes functions directly after the recursive stdWrap function call but still before the content gets modified
+ *
+ * @param string Input value undergoing processing in these functions.
+ * @param array All stdWrap properties, not just the ones for a particular function.
+ * @return string The processed input value
+ */
+ function stdWrap_stdWrapProcess($content = '', $conf = array()) {
+ foreach ($this->stdWrapHookObjects as $hookObject) {
+ $content = $hookObject->stdWrapProcess($content, $conf, $this);
+ }
+ return $content;
+ }
+
+ /**
+ * required
+ * Will immediately stop rendering and return an empty value
+ * when there is no content at this point
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for required.
+ * @return string The processed input value
+ */
+ function stdWrap_required($content = '', $conf = array()) {
+ if ((string) $content == '') {
+ $content = '';
+ $this->stopRendering = TRUE;
+ }
+ return $content;
+ }
+
+ /**
+ * if
+ * Will immediately stop rendering and return an empty value
+ * when the result of the checks returns false
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for if.
+ * @return string The processed input value
+ */
+ function stdWrap_if($content = '', $conf = array()) {
+ if (!$this->checkIf($conf['if.'])) {
+ $content = '';
+ $this->stopRendering = TRUE;
+ }
+ return $content;
+ }
+
+ /**
+ * fieldRequired
+ * Will immediately stop rendering and return an empty value
+ * when there is no content in the field given by fieldRequired
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for fieldRequired.
+ * @return string The processed input value
+ */
+ function stdWrap_fieldRequired($content = '', $conf = array()) {
+ if (!trim($this->data[$conf['fieldRequired']])) {
+ $content = '';
+ $this->stopRendering = TRUE;
+ }
+ return $content;
+ }
+
+ /**
+ * csConv
+ * Will convert the current chracter set of the content to the one given in csConv
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for csConv.
+ * @return string The processed input value
+ */
+ function stdWrap_csConv($content = '', $conf = array()) {
+ $content = $GLOBALS['TSFE']->csConv($content, $conf['csConv']);
+ return $content;
+ }
+
+ /**
+ * parseFunc
+ * Will parse the content based on functions given as stdWrap properties
+ * Heavily used together with RTE based content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for parseFunc.
+ * @return string The processed input value
+ */
+ function stdWrap_parseFunc($content = '', $conf = array()) {
+ $content = $this->parseFunc($content, $conf['parseFunc.'], $conf['parseFunc']);
+ return $content;
+ }
+
+ /**
+ * HTMLparser
+ * Will parse HTML content based on functions given as stdWrap properties
+ * Heavily used together with RTE based content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for HTMLparser.
+ * @return string The processed input value
+ */
+ function stdWrap_HTMLparser($content = '', $conf = array()) {
+ if (is_array($conf['HTMLparser.'])) {
+ $content = $this->HTMLparser_TSbridge($content, $conf['HTMLparser.']);
+ }
+ return $content;
+ }
+
+ /**
+ * split
+ * Will split the content by a given token and treat the results separately
+ * Automatically fills 'current' with a single result
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for split.
+ * @return string The processed input value
+ */
+ function stdWrap_split($content = '', $conf = array()) {
+ $content = $this->splitObj($content, $conf['split.']);
+ return $content;
+ }
+
+ /**
+ * prioriCalc
+ * Will use the content as a mathematical term and calculate the result
+ * Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for prioriCalc.
+ * @return string The processed input value
+ */
+ function stdWrap_prioriCalc($content = '', $conf = array()) {
+ $content = t3lib_div::calcParenthesis($content);
+ if ($conf['prioriCalc'] == 'intval')
+ $content = intval($content);
+ return $content;
+ }
+
+ /**
+ * char
+ * Will return a character based on its position within the current character set
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for char.
+ * @return string The processed input value
+ */
+ function stdWrap_char($content = '', $conf = array()) {
+ $content = chr(intval($conf['char']));
+ return $content;
+ }
+
+ /**
+ * intval
+ * Will return an integer value of the current content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for intval.
+ * @return string The processed input value
+ */
+ function stdWrap_intval($content = '', $conf = array()) {
+ $content = intval($content);
+ return $content;
+ }
+
+ /**
+ * numberFormat
+ * Will return a formatted number based on configuration given as stdWrap properties
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for numberFormat.
+ * @return string The processed input value
+ */
+ function stdWrap_numberFormat($content = '', $conf = array()) {
+ $content = $this->numberFormat($content, $conf['numberFormat.']);
+ return $content;
+ }
+
+ /**
+ * date
+ * Will return a formatted date based on configuration given according to PHP date/gmdate properties
+ * Will return gmdate when the property GMT returns true
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for date.
+ * @return string The processed input value
+ */
+ function stdWrap_date($content = '', $conf = array()) {
+ $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content));
+ return $content;
+ }
+
+ /**
+ * strftime
+ * Will return a formatted date based on configuration given according to PHP strftime/gmstrftime properties
+ * Will return gmstrftime when the property GMT returns true
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for strftime.
+ * @return string The processed input value
+ */
+ function stdWrap_strftime($content = '', $conf = array()) {
+ $content = ($conf['strftime.']['GMT'] ? gmstrftime($conf['strftime'], $content) : strftime($conf['strftime'], $content));
+ $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
+ if ($tmp_charset) {
+ $content = $GLOBALS['TSFE']->csConv($content, $tmp_charset);
+ }
+ return $content;
+ }
+
+ /**
+ * age
+ * Will return the age of a given timestamp based on configuration given by stdWrap properties
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for age.
+ * @return string The processed input value
+ */
+ function stdWrap_age($content = '', $conf = array()) {
+ $content = $this->calcAge($GLOBALS['EXEC_TIME'] - $content, $conf['age']);
+ return $content;
+ }
+
+ /**
+ * case
+ * Will transform the content to be upper or lower case only
+ * Leaves HTML tags untouched
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for case.
+ * @return string The processed input value
+ */
+ function stdWrap_case($content = '', $conf = array()) {
+ $content = $this->HTMLcaseshift($content, $conf['case']);
+ return $content;
+ }
+
+ /**
+ * bytes
+ * Will return the size of a given number in Bytes *
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for bytes.
+ * @return string The processed input value
+ */
+ function stdWrap_bytes($content = '', $conf = array()) {
+ $content = t3lib_div::formatSize($content, $conf['bytes.']['labels']);
+ return $content;
+ }
+
+ /**
+ * substring
+ * Will return a substring based on position information given by stdWrap properties
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for substring.
+ * @return string The processed input value
+ */
+ function stdWrap_substring($content = '', $conf = array()) {
+ $content = $this->substring($content, $conf['substring']);
+ return $content;
+ }
+
+ /**
+ * removeBadHTML
+ * Removes HTML tags based on stdWrap properties
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for removeBadHTML.
+ * @return string The processed input value
+ */
+ function stdWrap_removeBadHTML($content = '', $conf = array()) {
+ $content = $this->removeBadHTML($content, $conf['removeBadHTML.']);
+ return $content;
+ }
+
+ /**
+ * cropHTML
+ * Crops content to a given size while leaving HTML tags untouched
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for cropHTML.
+ * @return string The processed input value
+ */
+ function stdWrap_cropHTML($content = '', $conf = array()) {
+ $content = $this->cropHTML($content, $conf['cropHTML']);
+ return $content;
+ }
+
+ /**
+ * stripHtml
+ * Copmletely removes HTML tags from content
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for stripHtml.
+ * @return string The processed input value
+ */
+ function stdWrap_stripHtml($content = '', $conf = array()) {
+ $content = strip_tags($content);
+ return $content;
+ }
+
+ /**
+ * cropHTML
+ * Crops content to a given size without caring abhout HTML tags
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for crop.
+ * @return string The processed input value
+ */
+ function stdWrap_crop($content = '', $conf = array()) {
+ $content = $this->crop($content, $conf['crop']);
+ return $content;
+ }
+
+ /**
+ * rawUrlEncode
+ * Encodes content to be used within URLs
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for rawUrlEncode.
+ * @return string The processed input value
+ */
+ function stdWrap_rawUrlEncode($content = '', $conf = array()) {
+ $content = rawurlencode($content);
+ return $content;
+ }
+
+ /**
+ * htmlSpecialChars
+ * Transforms HTML tags to readable text by replacing special characters with their HTML entity
+ * When preserveEntities returns true, existing entities will be left untouched
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for htmlSpecalChars.
+ * @return string The processed input value
+ */
+ function stdWrap_htmlSpecialChars($content = '', $conf = array()) {
+ $content = htmlSpecialChars($content);
+ if ($conf['htmlSpecialChars.']['preserveEntities'])
+ $content = t3lib_div::deHSCentities($content);
+ return $content;
+ }
+
+ /**
+ * doubleBrTag
+ * Searches for double line breaks and replaces them with the given value
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for doubleBrTag.
+ * @return string The processed input value
+ */
+ function stdWrap_doubleBrTag($content = '', $conf = array()) {
+ $content = preg_replace("/\r?\n[\t ]*\r?\n/", $conf['doubleBrTag'], $content);
+ return $content;
+ }
+
+ /**
+ * br
+ * Searches for single line breaks and replaces them with a
tag
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for br.
+ * @return string The processed input value
+ */
+ function stdWrap_br($content = '', $conf = array()) {
+ $content = nl2br($content);
+ return $content;
+ }
+
+ /**
+ * brTag
+ * Searches for single line feeds and replaces them with the given value
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for brTag.
+ * @return string The processed input value
+ */
+ function stdWrap_brTag($content = '', $conf = array()) {
+ $content = str_replace(LF, $conf['brTag'], $content);
+ return $content;
+ }
+
+ /**
+ * encapsLines
+ * Modifies text blocks by searching for lines which are not surrounded by HTML tags yet
+ * and wrapping them with values given by stdWrap properties
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for erncapsLines.
+ * @return string The processed input value
+ */
+ function stdWrap_encapsLines($content = '', $conf = array()) {
+ $content = $this->encaps_lineSplit($content, $conf['encapsLines.']);
+ return $content;
+ }
+
+ /**
+ * keywords
+ * Transforms content into a CSV list to be used i.e. as keywords within a meta tag
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for keywords.
+ * @return string The processed input value
+ */
+ function stdWrap_keywords($content = '', $conf = array()) {
+ $content = $this->keywords($content);
+ return $content;
+ }
+
+ /**
+ * innerWrap
+ * First of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for innerWrap.
+ * @return string The processed input value
+ */
+ function stdWrap_innerWrap($content = '', $conf = array()) {
+ $content = $this->wrap($content, $conf['innerWrap']);
+ return $content;
+ }
+
+ /**
+ * innerWrap2
+ * Second of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for innerWrap2.
+ * @return string The processed input value
+ */
+ function stdWrap_innerWrap2($content = '', $conf = array()) {
+ $content = $this->wrap($content, $conf['innerWrap2']);
+ return $content;
+ }
+
+ /**
+ * fontTag
+ * A wrap formerly used to apply font tags to format the content
+ * Still used by lib.stdheader although real font tags are not state of the art anymore
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for fontTag.
+ * @return string The processed input value
+ */
+ function stdWrap_fontTag($content = '', $conf = array()) {
+ $content = $this->wrap($content, $conf['fontTag']);
+ return $content;
+ }
+
+ /**
+ * addParams
+ * Adds tag attributes to any content that is a tag
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for addParams.
+ * @return string The processed input value
+ */
+ function stdWrap_addParams($content = '', $conf = array()) {
+ $content = $this->addParams($content, $conf['addParams.']);
+ return $content;
+ }
+
+ /**
+ * textStyle
+ * Wraps content in font tags
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for textStyle.
+ * @return string The processed input value
+ */
+ function stdWrap_textStyle($content = '', $conf = array()) {
+ $content = $this->textStyle($content, $conf['textStyle.']);
+ return $content;
+ }
+
+ /**
+ * tableStyle
+ * Wraps content with table tags
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for tableStyle.
+ * @return string The processed input value
+ */
+ function stdWrap_tableStyle($content = '', $conf = array()) {
+ $content = $this->tableStyle($content, $conf['tableStyle.']);
+ return $content;
+ }
+
+ /**
+ * filelink
+ * Used to make lists of links to files
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for filelink.
+ * @return string The processed input value
+ */
+ function stdWrap_filelink($content = '', $conf = array()) {
+ $content = $this->filelink($content, $conf['filelink.']);
+ return $content;
+ }
+
+ /**
+ * preCObject
+ * A content object that is prepended to the current content but between the innerWraps and the rest of the wraps
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for preCObject.
+ * @return string The processed input value
+ */
+ function stdWrap_preCObject($content = '', $conf = array()) {
+ $content = $this->cObjGetSingle($conf['preCObject'], $conf['preCObject.'], '/stdWrap/.preCObject') . $content;
+ return $content;
+ }
+
+ /**
+ * postCObject
+ * A content object that is appended to the current content but between the innerWraps and the rest of the wraps
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for postCObject.
+ * @return string The processed input value
+ */
+ function stdWrap_postCObject($content = '', $conf = array()) {
+ $content .= $this->cObjGetSingle($conf['postCObject'], $conf['postCObject.'], '/stdWrap/.postCObject');
+ return $content;
+ }
+
+ /**
+ * wrapAlign
+ * Wraps content with a div container having the style attribute text-align set to the given value
+ * See wrap
+ *
+ * @param string Input value undergoing processing in this function.
+ * @param array stdWrap properties for wrapAlign.
+ * @return string The processed input value
+ */
+ function stdWrap_wrapAlign($content = '', $conf = array()) {
+ $wrapAlign = trim($conf['wrapAlign']);
+ if ($wrapAlign) {
+ $content = $this->wrap($content, '
' . htmlspecialchars($content) . ''; + return $content; + } + + /** + * debugFunc + * Will output the content in a debug table + * + * @param string Input value undergoing processing in this function. + * @param array stdWrap properties for debugFunc. + * @return string The processed input value + */ + function stdWrap_debugFunc($content = '', $conf = array()) { + debug($conf['debugFunc'] == 2 ? array( + $content + ) : $content); + return $content; } - - - - /*********************************************** - * - * "stdWrap" + sub functions - * - ***********************************************/ - - + /** - * The "stdWrap" function. This is the implementation of what is known as "stdWrap properties" in TypoScript. - * Basically "stdWrap" performs some processing of a value based on properties in the input $conf array(holding the TypoScript "stdWrap properties") - * See the link below for a complete list of properties and what they do. The order of the table with properties found in TSref (the link) follows the actual order of implementation in this function. - * - * If $this->alternativeData is an array it's used instead of the $this->data array in ->getData - * - * @param string Input value undergoing processing in this function. Possibly substituted by other values fetched from another source. - * @param array TypoScript "stdWrap properties". + * debugData + * Will output the data used by the current record in a debug table + * + * @param string Input value undergoing processing in this function. + * @param array stdWrap properties for debugData. * @return string The processed input value - * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=314&cHash=02ab044c7b */ - 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.']); - } - - // Getting data: - if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) { - $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']]; - } - if ($conf['data']) { - $content = $this->getData($conf['data'], is_array($this->alternativeData) ? $this->alternativeData : $this->data); - } - $this->alternativeData = ''; // This must be unset directly after - if ($conf['field']) { - $content = $this->getFieldVal($conf['field']); - } - if ($conf['current']) { - $content = $this->data[$this->currentValKey]; - } - if ($conf['cObject']) { - $content = $this->cObjGetSingle($conf['cObject'], $conf['cObject.'], '/stdWrap/.cObject'); - } - if ($conf['numRows.']) { - $content = $this->numRows($conf['numRows.']); - } - 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.']); - if (trim($override)) { - $content = $override; - } - } - if (isset($conf['preIfEmptyListNum']) || isset($conf['preIfEmptyListNum.']['stdWrap.'])) { - $preIfEmptyListNumber = isset($conf['preIfEmptyListNum.']['stdWrap.']) ? $this->stdWrap($conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['stdWrap.']) : $conf['preIfEmptyListNum']; - $content = $this->listNum($content, $preIfEmptyListNumber, $conf['preIfEmptyListNum.']['splitChar']); - } - if (!trim($content) && ($conf['ifEmpty'] || $conf['ifEmpty.'])) { - $content = $this->stdWrap($conf['ifEmpty'], $conf['ifEmpty.']); - } - if (!strlen(trim($content)) && ($conf['ifBlank'] || $conf['ifBlank.'])) { - $content = $this->stdWrap($conf['ifBlank'], $conf['ifBlank.']); - } - - // values... - if (isset($conf['listNum']) || isset($conf['listNum.']['stdWrap.'])) { - $listNumber = isset($conf['listNum.']['stdWrap.']) ? $this->stdWrap($conf['listNum'], $conf['listNum.']['stdWrap.']) : $conf['listNum']; - $content = $this->listNum($content, $listNumber, $conf['listNum.']['splitChar']); - } - - if ($conf['trim']) { - $content = trim($content); - } - - // 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 { - // Perform data processing: - if ($conf['csConv']) { - $content = $GLOBALS['TSFE']->csConv($content, $conf['csConv']); - } - if ($conf['parseFunc.'] || $conf['parseFunc']) { - $content = $this->parseFunc($content, $conf['parseFunc.'], $conf['parseFunc']); - } - if ($conf['HTMLparser'] && is_array($conf['HTMLparser.'])) { - $content = $this->HTMLparser_TSbridge($content, $conf['HTMLparser.']); - } - if ($conf['split.']) { - $content = $this->splitObj($content, $conf['split.']); - } - if ($conf['prioriCalc']) { - $content = t3lib_div::calcParenthesis($content); - if ($conf['prioriCalc'] == 'intval') - $content = intval($content); - } - if ((string) $conf['char'] != '') { - $content = chr(intval($conf['char'])); - } - if ($conf['intval']) { - $content = intval($content); - } - if ($conf['numberFormat.']) { - $content = $this->numberFormat($content, $conf['numberFormat.']); - } - if ($conf['date']) { - $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content)); - } - if ($conf['strftime']) { - $content = ($conf['strftime.']['GMT'] ? gmstrftime($conf['strftime'], $content) : strftime($conf['strftime'], $content)); - $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset; - if ($tmp_charset) { - $content = $GLOBALS['TSFE']->csConv($content, $tmp_charset); - } - } - if ($conf['age']) { - $content = $this->calcAge($GLOBALS['EXEC_TIME'] - $content, $conf['age']); - } - if ($conf['case']) { - $content = $this->HTMLcaseshift($content, $conf['case']); - } - if ($conf['bytes']) { - $content = t3lib_div::formatSize($content, $conf['bytes.']['labels']); - } - if ($conf['substring']) { - $content = $this->substring($content, $conf['substring']); - } - if ($conf['removeBadHTML']) { - $content = $this->removeBadHTML($content, $conf['removeBadHTML.']); - } - if ($conf['cropHTML']) { - $content = $this->cropHTML($content, $conf['cropHTML']); - } - if ($conf['stripHtml']) { - $content = strip_tags($content); - } - if ($conf['crop']) { - $content = $this->crop($content, $conf['crop']); - } - if ($conf['rawUrlEncode']) { - $content = rawurlencode($content); - } - if ($conf['htmlSpecialChars']) { - $content = htmlSpecialChars($content); - if ($conf['htmlSpecialChars.']['preserveEntities']) - $content = t3lib_div::deHSCentities($content); - } - - if ($conf['doubleBrTag']) { - $content = preg_replace("/\r?\n[\t ]*\r?\n/", $conf['doubleBrTag'], $content); - } - if ($conf['br']) { - $content = nl2br($content); - } - if ($conf['brTag']) { - $content = str_replace(LF, $conf['brTag'], $content); - } - if ($conf['encapsLines.']) { - $content = $this->encaps_lineSplit($content, $conf['encapsLines.']); - } - if ($conf['keywords']) { - $content = $this->keywords($content); - } - if ($conf['innerWrap'] || $conf['innerWrap.']) { - $content = $this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.'])); - } - if ($conf['innerWrap2'] || $conf['innerWrap2.']) { - $content = $this->wrap($content, $this->stdWrap($conf['innerWrap2'], $conf['innerWrap2.'])); - } - if ($conf['fontTag']) { - $content = $this->wrap($content, $conf['fontTag']); - } - if ($conf['addParams.']) { - $content = $this->addParams($content, $conf['addParams.']); - } - if ($conf['textStyle.']) { - $content = $this->textStyle($content, $conf['textStyle.']); - } - if ($conf['tableStyle.']) { - $content = $this->tableStyle($content, $conf['tableStyle.']); - } - if ($conf['filelink.']) { - $content = $this->filelink($content, $conf['filelink.']); - } - if ($conf['preCObject']) { - $content = $this->cObjGetSingle($conf['preCObject'], $conf['preCObject.'], '/stdWrap/.preCObject') . $content; - } - if ($conf['postCObject']) { - $content .= $this->cObjGetSingle($conf['postCObject'], $conf['postCObject.'], '/stdWrap/.postCObject'); - } - - if ($conf['wrapAlign'] || $conf['wrapAlign.']) { - $wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.'])); - if ($wrapAlign) { - $content = $this->wrap($content, '
' . htmlspecialchars($content) . ''; - } - if ($conf['debugFunc']) { - debug($conf['debugFunc'] == 2 ? array( - $content - ) : $content); - } - if ($conf['debugData']) { - echo '$cObj->data:'; - debug($this->data, '$cObj->data:'); - if (is_array($this->alternativeData)) { - echo '$cObj->alternativeData:'; - debug($this->alternativeData, '$this->alternativeData'); - } - } + function stdWrap_debugData($content = '', $conf = array()) { + debug($this->data, '$cObj->data:'); + if (is_array($this->alternativeData)) { + debug($this->alternativeData, '$this->alternativeData'); } return $content; }