593672b1981402b3b683c339008dbc7aa0fcec4f
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_content.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * This class contains all main TypoScript features.
30 * This includes the rendering of TypoScript content objects (cObjects).
31 * Is the backbone of TypoScript Template rendering.
32 *
33 * There are lots of functions you can use from your include-scripts.
34 * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
35 * When you call your own PHP-code typically through a USER or USER_INT cObject then it is this class that instantiates the object and calls the main method. Before it does so it will set (if you are using classes) a reference to itself in the internal variable "cObj" of the object. Thus you can access all functions and data from this class by $this->cObj->... from within you classes written to be USER or USER_INT content objects.
36 *
37 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
38 * @package TYPO3
39 * @subpackage tslib
40 */
41 class tslib_cObj {
42
43 var $align = array(
44 'center',
45 'right',
46 'left'
47 );
48
49 /**
50 * stdWrap functions in their correct order
51 *
52 * @see stdWrap()
53 */
54 var $stdWrapOrder = array(
55 'stdWrapPreProcess' => 'hook', // this is a placeholder for the first Hook
56 'cacheRead' => 'hook', // this is a placeholder for checking if the content is available in cache
57 'setContentToCurrent' => 'boolean',
58 'setContentToCurrent.' => 'array',
59 'setCurrent' => 'string',
60 'setCurrent.' => 'array',
61 'lang.' => 'array',
62 'data' => 'getText',
63 'data.' => 'array',
64 'field' => 'fieldName',
65 'field.' => 'array',
66 'current' => 'boolean',
67 'current.' => 'array',
68 'cObject' => 'cObject',
69 'cObject.' => 'array',
70 'numRows.' => 'array',
71 'filelist' => 'dir',
72 'filelist.' => 'array',
73 'preUserFunc' => 'functionName',
74 'stdWrapOverride' => 'hook', // this is a placeholder for the second Hook
75 'override' => 'string',
76 'override.' => 'array',
77 'preIfEmptyListNum' => 'listNum',
78 'preIfEmptyListNum.' => 'array',
79 'ifEmpty' => 'string',
80 'ifEmpty.' => 'array',
81 'ifBlank' => 'string',
82 'ifBlank.' => 'array',
83 'listNum' => 'listNum',
84 'listNum.' => 'array',
85 'trim' => 'boolean',
86 'trim.' => 'array',
87 'stdWrap' => 'stdWrap',
88 'stdWrap.' => 'array',
89 'stdWrapProcess' => 'hook', // this is a placeholder for the third Hook
90 'required' => 'boolean',
91 'required.' => 'array',
92 'if.' => 'array',
93 'fieldRequired' => 'fieldName',
94 'fieldRequired.' => 'array',
95 'csConv' => 'string',
96 'csConv.' => 'array',
97 'parseFunc' => 'objectpath',
98 'parseFunc.' => 'array',
99 'HTMLparser' => 'boolean',
100 'HTMLparser.' => 'array',
101 'split.' => 'array',
102 'replacement.' => 'array',
103 'prioriCalc' => 'boolean',
104 'prioriCalc.' => 'array',
105 'char' => 'integer',
106 'char.' => 'array',
107 'intval' => 'boolean',
108 'intval.' => 'array',
109 'hash' => 'string',
110 'hash.' => 'array',
111 'round' => 'boolean',
112 'round.' => 'array',
113 'numberFormat.' => 'array',
114 'expandList' => 'boolean',
115 'expandList.' => 'array',
116 'date' => 'dateconf',
117 'date.' => 'array',
118 'strftime' => 'strftimeconf',
119 'strftime.' => 'array',
120 'age' => 'boolean',
121 'age.' => 'array',
122 'case' => 'case',
123 'case.' => 'array',
124 'bytes' => 'boolean',
125 'bytes.' => 'array',
126 'substring' => 'parameters',
127 'substring.' => 'array',
128 'removeBadHTML' => 'boolean',
129 'removeBadHTML.' => 'array',
130 'cropHTML' => 'crop',
131 'cropHTML.' => 'array',
132 'stripHtml' => 'boolean',
133 'stripHtml.' => 'array',
134 'crop' => 'crop',
135 'crop.' => 'array',
136 'rawUrlEncode' => 'boolean',
137 'rawUrlEncode.' => 'array',
138 'htmlSpecialChars' => 'boolean',
139 'htmlSpecialChars.' => 'array',
140 'doubleBrTag' => 'string',
141 'doubleBrTag.' => 'array',
142 'br' => 'boolean',
143 'br.' => 'array',
144 'brTag' => 'string',
145 'brTag.' => 'array',
146 'encapsLines.' => 'array',
147 'keywords' => 'boolean',
148 'keywords.' => 'array',
149 'innerWrap' => 'wrap',
150 'innerWrap.' => 'array',
151 'innerWrap2' => 'wrap',
152 'innerWrap2.' => 'array',
153 'fontTag' => 'wrap',
154 'fontTag.' => 'array',
155 'addParams.' => 'array',
156 'textStyle.' => 'array',
157 'tableStyle.' => 'array',
158 'filelink.' => 'array',
159 'preCObject' => 'cObject',
160 'preCObject.' => 'array',
161 'postCObject' => 'cObject',
162 'postCObject.' => 'array',
163 'wrapAlign' => 'align',
164 'wrapAlign.' => 'array',
165 'typolink.' => 'array',
166 'TCAselectItem.' => 'array',
167 'space' => 'space',
168 'space.' => 'array',
169 'spaceBefore' => 'int',
170 'spaceBefore.' => 'array',
171 'spaceAfter' => 'int',
172 'spaceAfter.' => 'array',
173 'wrap' => 'wrap',
174 'wrap.' => 'array',
175 'noTrimWrap' => 'wrap',
176 'noTrimWrap.' => 'array',
177 'wrap2' => 'wrap',
178 'wrap2.' => 'array',
179 'dataWrap' => 'dataWrap',
180 'dataWrap.' => 'array',
181 'prepend' => 'cObject',
182 'prepend.' => 'array',
183 'append' => 'cObject',
184 'append.' => 'array',
185 'wrap3' => 'wrap',
186 'wrap3.' => 'array',
187 'orderedStdWrap' => 'stdWrap',
188 'orderedStdWrap.' => 'array',
189 'outerWrap' => 'wrap',
190 'outerWrap.' => 'array',
191 'insertData' => 'boolean',
192 'insertData.' => 'array',
193 'offsetWrap' => 'space',
194 'offsetWrap.' => 'array',
195 'postUserFunc' => 'functionName',
196 'postUserFuncInt' => 'functionName',
197 'prefixComment' => 'string',
198 'prefixComment.' => 'array',
199 'editIcons' => 'string',
200 'editIcons.' => 'array',
201 'editPanel' => 'boolean',
202 'editPanel.' => 'array',
203 'cacheStore' => 'hook', // this is a placeholder for storing the content in cache
204 'stdWrapPostProcess' => 'hook', // this is a placeholder for the last Hook
205 'debug' => 'boolean',
206 'debug.' => 'array',
207 'debugFunc' => 'boolean',
208 'debugFunc.' => 'array',
209 'debugData' => 'boolean',
210 'debugData.' => 'array'
211 );
212
213 /**
214 * Holds ImageMagick parameters and extensions used for compression
215 *
216 * @see IMGTEXT()
217 *
218 * 0= Default
219 * 1= Dont change! (removes all parameters for the image_object!!)
220 * 1x = GIFs
221 * 2x = JPGs
222 */
223 var $image_compression = array(
224 10 => array(
225 'params' => '', 'ext' => 'gif'
226 ),
227 11 => array(
228 'params' => '-colors 128', 'ext' => 'gif'
229 ),
230 12 => array(
231 'params' => '-colors 64', 'ext' => 'gif'
232 ),
233 13 => array(
234 'params' => '-colors 32', 'ext' => 'gif'
235 ),
236 14 => array(
237 'params' => '-colors 16', 'ext' => 'gif'
238 ),
239 15 => array(
240 'params' => '-colors 8', 'ext' => 'gif'
241 ),
242
243 20 => array(
244 'params' => '-quality 100', 'ext' => 'jpg'
245 ),
246 21 => array(
247 'params' => '-quality 90', 'ext' => 'jpg'
248 ),
249 22 => array(
250 'params' => '-quality 80', 'ext' => 'jpg'
251 ),
252 23 => array(
253 'params' => '-quality 70', 'ext' => 'jpg'
254 ),
255 24 => array(
256 'params' => '-quality 60', 'ext' => 'jpg'
257 ),
258 25 => array(
259 'params' => '-quality 50', 'ext' => 'jpg'
260 ),
261 26 => array(
262 'params' => '-quality 40', 'ext' => 'jpg'
263 ),
264 27 => array(
265 'params' => '-quality 30', 'ext' => 'jpg'
266 ),
267 28 => array(
268 'params' => '-quality 20', 'ext' => 'jpg'
269 ),
270
271 30 => array(
272 'params' => '-colors 256', 'ext' => 'png'
273 ),
274 31 => array(
275 'params' => '-colors 128', 'ext' => 'png'
276 ),
277 32 => array(
278 'params' => '-colors 64', 'ext' => 'png'
279 ),
280 33 => array(
281 'params' => '-colors 32', 'ext' => 'png'
282 ),
283 34 => array(
284 'params' => '-colors 16', 'ext' => 'png'
285 ),
286 35 => array(
287 'params' => '-colors 8', 'ext' => 'png'
288 ),
289 39 => array(
290 'params' => '', 'ext' => 'png'
291 ),
292 );
293
294 /**
295 * ImageMagick parameters for image effects
296 *
297 * @see IMGTEXT()
298 */
299 var $image_effects = array(
300 1 => '-rotate 90',
301 2 => '-rotate 270',
302 3 => '-rotate 180',
303 10 => '-colorspace GRAY',
304 11 => '-sharpen 70',
305 20 => '-normalize',
306 23 => '-contrast',
307 25 => '-gamma 1.3',
308 26 => '-gamma 0.8'
309 );
310
311 /**
312 * Loaded with the current data-record.
313 *
314 * If the instance of this class is used to render records from the database those records are found in this array.
315 * The function stdWrap has TypoScript properties that fetch field-data from this array.
316 * @see init()
317 */
318 var $data = array();
319 protected $table = '';
320 // Used for backup...
321 var $oldData = array();
322 // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap
323 var $alternativeData = '';
324 // Used by the parseFunc function and is loaded with tag-parameters when parsing tags.
325 var $parameters = array();
326 var $currentValKey = 'currentValue_kidjls9dksoje';
327 // This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation.
328 // Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered.
329 var $currentRecord = '';
330 // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query.
331 var $currentRecordTotal = 0;
332 // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering.
333 var $currentRecordNumber = 0;
334 // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering.
335 var $parentRecordNumber = 0;
336 // 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.
337 var $parentRecord = array();
338 // 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.
339 var $regObj;
340
341
342 // internal
343 // Is set to 1 if the instance of this cObj is executed from a *_INT plugin (see pagegen, bottom of document)
344 var $INT_include = 0;
345 // 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.
346 var $checkPid_cache = array();
347 var $checkPid_badDoktypeList = '255';
348 // This will be set by typoLink() to the url of the most recent link created.
349 var $lastTypoLinkUrl = '';
350 // DO. link target.
351 var $lastTypoLinkTarget = '';
352 var $lastTypoLinkLD = array();
353 // Caching substituteMarkerArrayCached function
354 var $substMarkerCache = array();
355 // array that registers rendered content elements (or any table) to make sure they are not rendered recursively!
356 var $recordRegister = array();
357 // Containig hooks for userdefined cObjects
358 var $cObjHookObjectsArr = array();
359 // Containing hook objects for stdWrap
360 protected $stdWrapHookObjects = array();
361 // Containing hook objects for getImgResource
362 protected $getImgResourceHookObjects;
363
364 /**
365 * @var array with members of tslib_content_abstract
366 */
367 protected $contentObjects = array();
368
369 /**
370 * @var t3lib_file_File Current file objects (during iterations over files)
371 */
372 protected $currentFile = NULL;
373
374 /**
375 * Set to TRUE by doConvertToUserIntObject() if USER object wants to become USER_INT
376 */
377 public $doConvertToUserIntObject = FALSE;
378
379 /**
380 * Indicates current object type. Can hold one of OBJECTTYPE_ constants or FALSE.
381 * The value is set and reset inside USER() function. Any time outside of
382 * USER() it is FALSE.
383 */
384 protected $userObjectType = FALSE;
385
386 /**
387 * Indicates that object type is USER.
388 *
389 * @see tslib_cObjh::$userObjectType
390 */
391 const OBJECTTYPE_USER_INT = 1;
392
393 /**
394 * Indicates that object type is USER.
395 *
396 * @see tslib_cObjh::$userObjectType
397 */
398 const OBJECTTYPE_USER = 2;
399
400 /**
401 * Class constructor.
402 * Well, it has to be called manually since it is not a real constructor function.
403 * 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.
404 *
405 * @param array $data The record data that is rendered.
406 * @param string $table The table that the data record is from.
407 * @return void
408 */
409 function start($data, $table = '') {
410 global $TYPO3_CONF_VARS;
411 t3lib_file_Service_BackwardsCompatibility_TslibContentAdapterService::modifyDBRow($data, $table);
412 $this->data = $data;
413 $this->table = $table;
414 $this->currentRecord = $table ? $table . ':' . $this->data['uid'] : '';
415 $this->parameters = array();
416 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
417 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
418 $this->cObjHookObjectsArr[$classArr[0]] = t3lib_div::getUserObj($classArr[1]);
419 }
420 }
421
422 $this->stdWrapHookObjects = array();
423 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) {
424 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) {
425 $hookObject = t3lib_div::getUserObj($classData);
426
427 if (!($hookObject instanceof tslib_content_stdWrapHook)) {
428 throw new UnexpectedValueException(
429 $classData . ' must implement interface tslib_content_stdWrapHook',
430 1195043965
431 );
432 }
433
434 $this->stdWrapHookObjects[] = $hookObject;
435 }
436 }
437
438 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'])) {
439 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'] as $classData) {
440 $postInitializationProcessor = t3lib_div::getUserObj($classData);
441
442 if (!($postInitializationProcessor instanceof tslib_content_PostInitHook)) {
443 throw new UnexpectedValueException(
444 $classData . ' must implement interface tslib_content_PostInitHook',
445 1274563549
446 );
447 }
448
449 $postInitializationProcessor->postProcessContentObjectInitialization($this);
450 }
451 }
452 }
453
454 /**
455 * Returns the current table
456 *
457 * @return string
458 */
459 public function getCurrentTable() {
460 return $this->table;
461 }
462
463 /**
464 * Clone helper.
465 *
466 * Resets the references to the TypoScript Content Object implementation
467 * objects of tslib_content_*. Otherwise they would still point to the
468 * original tslib_cObj instance's tslib_content_* instances, they in return
469 * would back-reference to the original tslib_cObj instance instead of the
470 * newly cloned tslib_cObj instance.
471 *
472 * @see http://bugs.typo3.org/view.php?id=16568
473 */
474 public function __clone() {
475 $this->contentObjects = array();
476 }
477
478 /**
479 * Serialization (sleep) helper.
480 *
481 * Removes properties of this object from serialization.
482 * This action is necessary, since there might be closures used
483 * in the accordant content objects (e.g. in FLUIDTEMPLATE) which
484 * cannot be serialized. It's fine to reset $this->contentObjects
485 * since elements will be recreated and are just a local cache,
486 * but not required for runtime logic and behaviour.
487 *
488 * @return array Names of the properties to be serialized
489 * @see http://forge.typo3.org/issues/36820
490 */
491 public function __sleep() {
492 // Use get_objects_vars() instead of
493 // a much more expensive Reflection:
494 $properties = get_object_vars($this);
495
496 if (isset($properties['contentObjects'])) {
497 unset($properties['contentObjects']);
498 }
499
500 return array_keys($properties);
501 }
502
503 /**
504 * Gets the 'getImgResource' hook objects.
505 * The first call initializes the accordant objects.
506 *
507 * @return array The 'getImgResource' hook objects (if any)
508 */
509 protected function getGetImgResourceHookObjects() {
510 if (!isset($this->getImgResourceHookObjects)) {
511 $this->getImgResourceHookObjects = array();
512
513 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) {
514 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) {
515 $hookObject = t3lib_div::getUserObj($classData);
516
517 if (!($hookObject instanceof tslib_cObj_getImgResourceHook)) {
518 throw new UnexpectedValueException(
519 '$hookObject must implement interface tslib_cObj_getImgResourceHook',
520 1218636383
521 );
522 }
523
524 $this->getImgResourceHookObjects[] = $hookObject;
525 }
526 }
527 }
528
529 return $this->getImgResourceHookObjects;
530 }
531
532 /**
533 * Sets the internal variable parentRecord with information about current record.
534 * 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.
535 *
536 * @param array $data The record array
537 * @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.
538 * @return void
539 * @access private
540 */
541 function setParent($data, $currentRecord) {
542 $this->parentRecord = array(
543 'data' => $data,
544 'currentRecord' => $currentRecord
545 );
546 }
547
548 /***********************************************
549 *
550 * CONTENT_OBJ:
551 *
552 ***********************************************/
553
554 /**
555 * Returns the "current" value.
556 * 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.
557 * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like.
558 * 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.
559 *
560 * @return mixed The "current" value
561 */
562 function getCurrentVal() {
563 return $this->data[$this->currentValKey];
564 }
565
566 /**
567 * Sets the "current" value.
568 *
569 * @param mixed $value The variable that you want to set as "current"
570 * @return void
571 * @see getCurrentVal()
572 */
573 function setCurrentVal($value) {
574 $this->data[$this->currentValKey] = $value;
575 }
576
577 /**
578 * Rendering of a "numerical array" of cObjects from TypoScript
579 * Will call ->cObjGetSingle() for each cObject found and accumulate the output.
580 *
581 * @param array $setup array with cObjects as values.
582 * @param string $addKey A prefix for the debugging information
583 * @return string Rendered output from the cObjects in the array.
584 * @see cObjGetSingle()
585 */
586 function cObjGet($setup, $addKey = '') {
587 if (is_array($setup)) {
588 $sKeyArray = t3lib_TStemplate::sortedKeyList($setup);
589 $content = '';
590 foreach ($sKeyArray as $theKey) {
591 $theValue = $setup[$theKey];
592 if (intval($theKey) && !strstr($theKey, '.')) {
593 $conf = $setup[$theKey . '.'];
594 $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); // Get the contentObject
595 }
596 }
597 return $content;
598 }
599 }
600
601 /**
602 * Renders a content object
603 *
604 * @param string $name The content object name, eg. "TEXT" or "USER" or "IMAGE"
605 * @param array $conf The array with TypoScript properties for the content object
606 * @param string $TSkey A string label used for the internal debugging tracking.
607 * @return string cObject output
608 */
609 function cObjGetSingle($name, $conf, $TSkey = '__') {
610 global $TYPO3_CONF_VARS;
611
612 $content = '';
613 // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
614 $GLOBALS['TSFE']->cObjectDepthCounter--;
615 if ($GLOBALS['TSFE']->cObjectDepthCounter > 0) {
616 $name = trim($name);
617 if ($GLOBALS['TT']->LR)
618 $GLOBALS['TT']->push($TSkey, $name);
619
620 // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
621 if (substr($name, 0, 1) == '<') {
622 $key = trim(substr($name, 1));
623 $cF = t3lib_div::makeInstance('t3lib_TSparser');
624 // $name and $conf is loaded with the referenced values.
625 $old_conf = $conf;
626 list ($name, $conf) = $cF->getVal($key, $GLOBALS['TSFE']->tmpl->setup);
627 if (is_array($old_conf) && count($old_conf)) {
628 $conf = $this->joinTSarrays($conf, $old_conf);
629 }
630 // Getting the cObject
631 $GLOBALS['TT']->incStackPointer();
632 $content .= $this->cObjGetSingle($name, $conf, $key);
633 $GLOBALS['TT']->decStackPointer();
634 } else {
635
636 $hooked = FALSE;
637 // Application defined cObjects
638 foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) {
639 if (($name === $cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
640 $content .= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
641 $hooked = TRUE;
642 }
643 }
644 if (!$hooked) {
645 $contentObject = $this->getContentObject($name);
646 if ($contentObject) {
647 $content .= $contentObject->render($conf);
648 } else {
649 // Call hook functions for extra processing
650 if ($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
651 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) {
652 $hookObject = t3lib_div::getUserObj($classData);
653
654 if (!($hookObject instanceof tslib_content_cObjGetSingleHook)) {
655 throw new UnexpectedValueException(
656 '$hookObject must implement interface tslib_content_cObjGetSingleHook',
657 1195043731
658 );
659 }
660 /** @var $hookObject tslib_content_cObjGetSingleHook */
661 $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this);
662 }
663 } else {
664 // Log error in AdminPanel
665 $warning = sprintf('Content Object "%s" does not exist', $name);
666 $GLOBALS['TT']->setTSlogMessage($warning, 2);
667 }
668 }
669 }
670 }
671 if ($GLOBALS['TT']->LR)
672 $GLOBALS['TT']->pull($content);
673 }
674 // Increasing on exit...
675 $GLOBALS['TSFE']->cObjectDepthCounter++;
676 return $content;
677 }
678
679 /**
680 * Returns a new content object of type $name.
681 *
682 * @param string $name
683 * @return tslib_content_abstract
684 */
685 public function getContentObject($name) {
686 $classMapping = array(
687 'TEXT' => 'Text',
688 'CASE' => 'Case',
689 'CLEARGIF' => 'ClearGif',
690 'COBJ_ARRAY' => 'ContentObjectArray',
691 'COA' => 'ContentObjectArray',
692 'COA_INT' => 'ContentObjectArrayInternal',
693 'USER' => 'User',
694 'USER_INT' => 'UserInternal',
695 'FILE' => 'File',
696 'FILES' => 'Files',
697 'IMAGE' => 'Image',
698 'IMG_RESOURCE' => 'ImageResource',
699 'IMGTEXT' => 'ImageText',
700 'CONTENT' => 'Content',
701 'RECORDS' => 'Records',
702 'HMENU' => 'HierarchicalMenu',
703 'CTABLE' => 'ContentTable',
704 'OTABLE' => 'OffsetTable',
705 'COLUMNS' => 'Columns',
706 'HRULER' => 'HorizontalRuler',
707 'CASEFUNC' => 'Case',
708 'LOAD_REGISTER' => 'LoadRegister',
709 'RESTORE_REGISTER' => 'RestoreRegister',
710 'FORM' => 'Form',
711 'SEARCHRESULT' => 'SearchResult',
712 'TEMPLATE' => 'Template',
713 'FLUIDTEMPLATE' => 'FluidTemplate',
714 'MULTIMEDIA' => 'Multimedia',
715 'MEDIA' => 'Media',
716 'SWFOBJECT' => 'ShockwaveFlashObject',
717 'FLOWPLAYER' => 'FlowPlayer',
718 'QTOBJECT' => 'QuicktimeObject',
719 'SVG' => 'ScalableVectorGraphics',
720 'EDITPANEL' => 'EditPanel',
721 );
722 $name = $classMapping[$name];
723
724 if (!array_key_exists($name, $this->contentObjects)) {
725 try {
726 $this->contentObjects[$name] = t3lib_div::makeInstance('tslib_content_' . $name, $this);
727 } catch (ReflectionException $e) {
728 $this->contentObjects[$name] = NULL;
729 }
730 }
731 return $this->contentObjects[$name];
732 }
733
734 /********************************************
735 *
736 * Functions rendering content objects (cObjects)
737 *
738 ********************************************/
739
740 /**
741 * Rendering the cObject, HTML
742 *
743 * @param array $conf Array of TypoScript properties
744 * @return string Output
745 * @deprecated since 6.0, will be removed in two versions
746 */
747 function HTML($conf) {
748 t3lib_div::logDeprecatedFunction();
749 return '';
750 }
751
752 /**
753 * Rendering the cObject, FLOWPLAYER
754 *
755 * @param array $conf Array of TypoScript properties
756 * @return string Output
757 */
758 function FLOWPLAYER($conf) {
759 return $this->getContentObject('FLOWPLAYER')->render($conf);
760 }
761
762 /**
763 * Rendering the cObject, TEXT
764 *
765 * @param array $conf Array of TypoScript properties
766 * @return string Output
767 */
768 function TEXT($conf) {
769 return $this->getContentObject('TEXT')->render($conf);
770 }
771
772 /**
773 * Rendering the cObject, CLEARGIF
774 *
775 * @param array $conf Array of TypoScript properties
776 * @return string Output
777 */
778 function CLEARGIF($conf) {
779 return $this->getContentObject('CLEARGIF')->render($conf);
780 }
781
782 /**
783 * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT
784 *
785 * @param array $conf Array of TypoScript properties
786 * @param string $ext If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached)
787 * @return string Output
788 */
789 function COBJ_ARRAY($conf, $ext = '') {
790 if ($ext === 'INT') {
791 return $this->getContentObject('COA_INT')->render($conf);
792 } else {
793 return $this->getContentObject('COA')->render($conf);
794 }
795 }
796
797 /**
798 * Rendering the cObject, USER and USER_INT
799 *
800 * @param array $conf Array of TypoScript properties
801 * @param string $ext If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached)
802 * @return string Output
803 */
804 function USER($conf, $ext = '') {
805 if ($ext === 'INT') {
806 return $this->getContentObject('USER_INT')->render($conf);
807 } else {
808 return $this->getContentObject('USER')->render($conf);
809 }
810 }
811
812 /**
813 * Retrieves a type of object called as USER or USER_INT. Object can detect their
814 * type by using this call. It returns OBJECTTYPE_USER_INT or OBJECTTYPE_USER depending on the
815 * current object execution. In all other cases it will return FALSE to indicate
816 * a call out of context.
817 *
818 * @return mixed One of OBJECTTYPE_ class constants or FALSE
819 */
820 public function getUserObjectType() {
821 return $this->userObjectType;
822 }
823
824 /**
825 * Sets the user object type
826 *
827 * @param mixed $userObjectType
828 * @return void
829 */
830 public function setUserObjectType($userObjectType) {
831 $this->userObjectType = $userObjectType;
832 }
833
834 /**
835 * Requests the current USER object to be converted to USER_INT.
836 *
837 * @return void
838 */
839 public function convertToUserIntObject() {
840 if ($this->userObjectType !== self::OBJECTTYPE_USER) {
841 $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' . 'is called in the wrong context or for the wrong object type', 2);
842 } else {
843 $this->doConvertToUserIntObject = TRUE;
844 }
845 }
846
847 /**
848 * Rendering the cObject, FILE
849 *
850 * @param array $conf Array of TypoScript properties
851 * @return string Output
852 */
853 function FILE($conf) {
854 return $this->getContentObject('FILE')->render($conf);
855 }
856
857 /**
858 * Rendering the cObject, FILES
859 *
860 * @param array $conf Array of TypoScript properties
861 * @return string Output
862 */
863 function FILES($conf) {
864 return $this->getContentObject('FILES')->render($conf);
865 }
866
867 /**
868 * Rendering the cObject, IMAGE
869 *
870 * @param array $conf Array of TypoScript properties
871 * @return string Output
872 * @see cImage()
873 */
874 function IMAGE($conf) {
875 return $this->getContentObject('IMAGE')->render($conf);
876 }
877
878 /**
879 * Rendering the cObject, IMG_RESOURCE
880 *
881 * @param array $conf Array of TypoScript properties
882 * @return string Output
883 * @see getImgResource()
884 */
885 function IMG_RESOURCE($conf) {
886 return $this->getContentObject('IMG_RESOURCE')->render($conf);
887 }
888
889 /**
890 * Rendering the cObject, IMGTEXT
891 *
892 * @param array $conf Array of TypoScript properties
893 * @return string Output
894 */
895 function IMGTEXT($conf) {
896 return $this->getContentObject('IMGTEXT')->render($conf);
897 }
898
899 /**
900 * Rendering the cObject, CONTENT
901 *
902 * @param array $conf Array of TypoScript properties
903 * @return string Output
904 */
905 function CONTENT($conf) {
906 return $this->getContentObject('CONTENT')->render($conf);
907 }
908
909 /**
910 * Rendering the cObject, RECORDS
911 *
912 * @param array $conf Array of TypoScript properties
913 * @return string Output
914 */
915 function RECORDS($conf) {
916 return $this->getContentObject('RECORDS')->render($conf);
917 }
918
919 /**
920 * Rendering the cObject, HMENU
921 *
922 * @param array $conf Array of TypoScript properties
923 * @return string Output
924 */
925 function HMENU($conf) {
926 return $this->getContentObject('HMENU')->render($conf);
927 }
928
929 /**
930 * Rendering the cObject, CTABLE
931 *
932 * @param array $conf Array of TypoScript properties
933 * @return string Output
934 */
935 function CTABLE($conf) {
936 return $this->getContentObject('CTABLE')->render($conf);
937 }
938
939 /**
940 * Rendering the cObject, OTABLE
941 *
942 * @param array $conf Array of TypoScript properties
943 * @return string Output
944 */
945 function OTABLE($conf) {
946 return $this->getContentObject('OTABLE')->render($conf);
947 }
948
949 /**
950 * Rendering the cObject, COLUMNS
951 *
952 * @param array $conf Array of TypoScript properties
953 * @return string Output
954 */
955 function COLUMNS($conf) {
956 return $this->getContentObject('COLUMNS')->render($conf);
957 }
958
959 /**
960 * Rendering the cObject, HRULER
961 *
962 * @param array $conf Array of TypoScript properties
963 * @return string Output
964 */
965 function HRULER($conf) {
966 return $this->getContentObject('HRULER')->render($conf);
967 }
968
969 /**
970 * Rendering the cObject, CASE
971 *
972 * @param array $conf Array of TypoScript properties
973 * @return string Output
974 */
975 function CASEFUNC($conf) {
976 return $this->getContentObject('CASE')->render($conf);
977 }
978
979 /**
980 * Rendering the cObject, LOAD_REGISTER and RESTORE_REGISTER
981 * NOTICE: This cObject does NOT return any content since it just sets internal data based on the TypoScript properties.
982 *
983 * @param array $conf Array of TypoScript properties
984 * @param string $name If "RESTORE_REGISTER" then the cObject rendered is "RESTORE_REGISTER", otherwise "LOAD_REGISTER"
985 * @return string Empty string (the cObject only sets internal data!)
986 */
987 function LOAD_REGISTER($conf, $name) {
988 if ($name === 'RESTORE_REGISTER') {
989 return $this->getContentObject('RESTORE_REGISTER')->render($conf);
990 } else {
991 return $this->getContentObject('LOAD_REGISTER')->render($conf);
992 }
993 }
994
995 /**
996 * Rendering the cObject, FORM
997 *
998 * @param array $conf Array of TypoScript properties
999 * @param array $formData Alternative formdata overriding whatever comes from TypoScript
1000 * @return string Output
1001 */
1002 function FORM($conf, $formData = '') {
1003 return $this->getContentObject('FORM')->render($conf, $formData);
1004 }
1005
1006 /**
1007 * Rendering the cObject, SEARCHRESULT
1008 *
1009 * @param array $conf Array of TypoScript properties
1010 * @return string Output
1011 */
1012 function SEARCHRESULT($conf) {
1013 return $this->getContentObject('SEARCHRESULT')->render($conf);
1014 }
1015
1016 /**
1017 * Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT
1018 *
1019 * @param array $conf Array of TypoScript properties
1020 * @param string $ext If "INT", then rendering "PHP_SCRIPT_INT"; If "EXT", then rendering "PHP_SCRIPT_EXT"; Default is rendering "PHP_SCRIPT" (cached)
1021 * @return string Output
1022 * @deprecated and unused since 6.0, will be removed two versions later
1023 */
1024 function PHP_SCRIPT($conf, $ext = '') {
1025 t3lib_div::logDeprecatedFunction();
1026 return '';
1027 }
1028
1029 /**
1030 * Rendering the cObject, TEMPLATE
1031 *
1032 * @param array $conf Array of TypoScript properties
1033 * @return string Output
1034 * @see substituteMarkerArrayCached()
1035 */
1036 function TEMPLATE($conf) {
1037 return $this->getContentObject('TEMPLATE')->render($conf);
1038 }
1039
1040 /**
1041 * Rendering the cObject, FLUIDTEMPLATE
1042 *
1043 * @param array $conf Array of TypoScript properties
1044 * @return string the HTML output
1045 * @author Steffen Ritter <info@steffen-ritter.net>
1046 * @author Benjamin Mack <benni@typo3.org>
1047 */
1048 protected function FLUIDTEMPLATE(array $conf) {
1049 return $this->getContentObject('FLUIDTEMPLATE')->render($conf);
1050 }
1051
1052 /**
1053 * Rendering the cObject, MULTIMEDIA
1054 *
1055 * @param array $conf Array of TypoScript properties
1056 * @return string Output
1057 */
1058 function MULTIMEDIA($conf) {
1059 return $this->getContentObject('MULTIMEDIA')->render($conf);
1060 }
1061
1062 /**
1063 * Rendering the cObject, MEDIA
1064 *
1065 * @param array $conf Array of TypoScript properties
1066 * @return string Output
1067 */
1068 public function MEDIA($conf) {
1069 return $this->getContentObject('MEDIA')->render($conf);
1070 }
1071
1072 /**
1073 * Rendering the cObject, SWFOBJECT
1074 *
1075 * @param array $conf Array of TypoScript properties
1076 * @return string Output
1077 */
1078 public function SWFOBJECT($conf) {
1079 return $this->getContentObject('SWFOBJECT')->render($conf);
1080 }
1081
1082 /**
1083 * Rendering the cObject, QTOBJECT
1084 *
1085 * @param array $conf Array of TypoScript properties
1086 * @return string Output
1087 */
1088 public function QTOBJECT($conf) {
1089 return $this->getContentObject('QTOBJECT')->render($conf);
1090 }
1091
1092 /**
1093 * Rendering the cObject, SVG
1094 *
1095 * @param array $conf Array of TypoScript properties
1096 * @return string Output
1097 */
1098 public function SVG($conf) {
1099 return $this->getContentObject('SVG')->render($conf);
1100 }
1101
1102 /************************************
1103 *
1104 * Various helper functions for content objects:
1105 *
1106 ************************************/
1107
1108 /**
1109 * Converts a given config in Flexform to a conf-array
1110 * @param string $flexData Flexform data
1111 * @param array $conf Array to write the data into, by reference
1112 * @param boolean $recursive Is set if called recursive. Don't call function with this parameter, it's used inside the function only
1113 * @return void
1114 * @access public
1115 *
1116 */
1117 public function readFlexformIntoConf($flexData, &$conf, $recursive = FALSE) {
1118 if ($recursive === FALSE) {
1119 $flexData = t3lib_div::xml2array($flexData, 'T3');
1120 }
1121
1122 if (is_array($flexData)) {
1123 if (isset($flexData['data']['sDEF']['lDEF'])) {
1124 $flexData = $flexData['data']['sDEF']['lDEF'];
1125 }
1126
1127 foreach ($flexData as $key => $value) {
1128 if (is_array($value['el']) && count($value['el']) > 0) {
1129 foreach ($value['el'] as $ekey => $element) {
1130 if (isset($element['vDEF'])) {
1131 $conf[$ekey] = $element['vDEF'];
1132 } else {
1133 if (is_array($element)) {
1134 $this->readFlexformIntoConf($element, $conf[$key][key($element)][$ekey], TRUE);
1135 } else {
1136 $this->readFlexformIntoConf($element, $conf[$key][$ekey], TRUE);
1137 }
1138 }
1139 }
1140 } else {
1141 $this->readFlexformIntoConf($value['el'], $conf[$key], TRUE);
1142 }
1143 if ($value['vDEF']) {
1144 $conf[$key] = $value['vDEF'];
1145 }
1146 }
1147 }
1148 }
1149
1150 /**
1151 * Returns all parents of the given PID (Page UID) list
1152 *
1153 * @param string $pidList A list of page Content-Element PIDs (Page UIDs) / stdWrap
1154 * @param array $pidConf stdWrap array for the list
1155 * @return string A list of PIDs
1156 * @access private
1157 */
1158 function getSlidePids($pidList, $pidConf) {
1159 $pidList = isset($pidConf)
1160 ? trim($this->stdWrap($pidList, $pidConf))
1161 : trim($pidList);
1162 if (!strcmp($pidList, '')) {
1163 $pidList = 'this';
1164 }
1165 if (trim($pidList)) {
1166 $listArr = t3lib_div::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $pidList));
1167 $listArr = $this->checkPidArray($listArr);
1168 }
1169 $pidList = array();
1170 if (is_array($listArr) && count($listArr)) {
1171 foreach ($listArr as $uid) {
1172 $page = $GLOBALS['TSFE']->sys_page->getPage($uid);
1173 if (!$page['is_siteroot']) {
1174 $pidList[] = $page['pid'];
1175 }
1176 }
1177 }
1178 return implode(',', $pidList);
1179 }
1180
1181 /**
1182 * Returns a default value for a form field in the FORM cObject.
1183 * Page CANNOT be cached because that would include the inserted value for the current user.
1184 *
1185 * @param boolean $noValueInsert If noValueInsert OR if the no_cache flag for this page is NOT set, the original default value is returned.
1186 * @param string $fieldName The POST var name to get default value for
1187 * @param string $defaultVal The current default value
1188 * @return string The default value, either from INPUT var or the current default, based on whether caching is enabled or not.
1189 * @access private
1190 */
1191 function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) {
1192 if (!$GLOBALS['TSFE']->no_cache || (!isset($_POST[$fieldName]) && !isset($_GET[$fieldName])) || $noValueInsert) {
1193 return $defaultVal;
1194 } else {
1195 return t3lib_div::_GP($fieldName);
1196 }
1197 }
1198
1199 /**
1200 * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
1201 * Mostly this function is a sub-function to the IMAGE function which renders the IMAGE cObject in TypoScript.
1202 * This function is called by "$this->cImage($conf['file'], $conf);" from IMAGE().
1203 *
1204 * @param string $file File TypoScript resource
1205 * @param array $conf TypoScript configuration properties
1206 * @return string <img> tag, (possibly wrapped in links and other HTML) if any image found.
1207 * @access private
1208 * @see IMAGE()
1209 */
1210 function cImage($file, $conf) {
1211 $info = $this->getImgResource($file, $conf['file.']);
1212 $GLOBALS['TSFE']->lastImageInfo = $info;
1213 if (is_array($info)) {
1214 $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
1215 // This array is used to collect the image-refs on the page...
1216 $GLOBALS['TSFE']->imagesOnPage[] = $info[3];
1217
1218 $altParam = $this->getAltParam($conf);
1219 if ($conf['params'] && !isset($conf['params.'])) {
1220 $params = ' ' . $conf['params'];
1221 } else {
1222 $params = isset($conf['params.'])
1223 ? ' ' . $this->stdWrap($conf['params'], $conf['params.'])
1224 : '';
1225 }
1226 $theValue = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix .
1227 t3lib_div::rawUrlEncodeFP($info[3])) . '" width="' . $info[0] . '" height="' . $info[1] . '"' .
1228 $this->getBorderAttr(' border="' . intval($conf['border']) . '"') .
1229 $params .
1230 ($altParam) .
1231 (!empty($GLOBALS['TSFE']->xhtmlDoctype) ? ' /' : '') .
1232 '>';
1233 $linkWrap = isset($conf['linkWrap.'])
1234 ? $this->stdWrap($conf['linkWrap'], $conf['linkWrap.'])
1235 : $conf['linkWrap'];
1236 if ($linkWrap) {
1237 $theValue = $this->linkWrap($theValue, $linkWrap);
1238 } elseif ($conf['imageLinkWrap']) {
1239 $theValue = $this->imageLinkWrap($theValue, $info['origFile'], $conf['imageLinkWrap.']);
1240 }
1241 $wrap = isset($conf['wrap.'])
1242 ? $this->stdWrap($conf['wrap'], $conf['wrap.'])
1243 : $conf['wrap'];
1244 if ($wrap) {
1245 $theValue = $this->wrap($theValue, $conf['wrap']);
1246 }
1247 return $theValue;
1248 }
1249 }
1250
1251 /**
1252 * Returns the 'border' attribute for an <img> tag only if the doctype is not xhtml_strict, xhtml_11, xhtml_2 or html5
1253 * or if the config parameter 'disableImgBorderAttr' is not set.
1254 *
1255 * @param string $borderAttr The border attribute
1256 * @return string The border attribute
1257 */
1258 function getBorderAttr($borderAttr) {
1259 if (! t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype) &&
1260 $GLOBALS['TSFE']->config['config']['doctype'] != 'html5' &&
1261 ! $GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
1262 return $borderAttr;
1263 }
1264 }
1265
1266 /**
1267 * Wraps the input string in link-tags that opens the image in a new window.
1268 *
1269 * @param string $string String to wrap, probably an <img> tag
1270 * @param string $imageFile The original image file
1271 * @param array $conf TypoScript properties for the "imageLinkWrap" function
1272 * @return string The input string, $string, wrapped as configured.
1273 * @see cImage()
1274 */
1275 function imageLinkWrap($string, $imageFile, $conf) {
1276 $a1 = '';
1277 $a2 = '';
1278 $content = $string;
1279 $enable = isset($conf['enable.'])
1280 ? $this->stdWrap($conf['enable'], $conf['enable.'])
1281 : $conf['enable'];
1282 if ($enable) {
1283 $content = $this->typolink($string, $conf['typolink.']);
1284 if (isset($conf['file.'])) {
1285 $imageFile = $this->stdWrap($imageFile, $conf['file.']);
1286 }
1287
1288 // imageFileLink:
1289 if ($content == $string && @is_file($imageFile)) {
1290 $parameterNames = array('width', 'height', 'effects', 'alternativeTempPath', 'bodyTag', 'title', 'wrap');
1291 $parameters = array();
1292
1293 $sample = isset($conf['sample.'])
1294 ? $this->stdWrap($conf['sample'], $conf['sample.'])
1295 : $conf['sample'];
1296 if ($sample) {
1297 $parameters['sample'] = 1;
1298 }
1299
1300 foreach ($parameterNames as $parameterName) {
1301 if (isset($conf[$parameterName.'.'])) {
1302 $conf[$parameterName] = $this->stdWrap($conf[$parameterName], $conf[$parameterName.'.']);
1303 }
1304 if (isset($conf[$parameterName]) && $conf[$parameterName]) {
1305 $parameters[$parameterName] = $conf[$parameterName];
1306 }
1307 }
1308
1309 $parametersEncoded = base64_encode(serialize($parameters));
1310
1311 $md5_value = t3lib_div::hmac(
1312 implode(
1313 '|',
1314 array($imageFile, $parametersEncoded)
1315 )
1316 );
1317
1318 $params = '&md5=' . $md5_value;
1319 foreach (str_split($parametersEncoded, 64) as $index => $chunk) {
1320 $params .= '&parameters' . rawurlencode('[') . $index . rawurlencode(']') . '=' . rawurlencode($chunk);
1321 }
1322
1323 $url = $GLOBALS['TSFE']->absRefPrefix . 'index.php?eID=tx_cms_showpic&file=' . rawurlencode($imageFile) . $params;
1324
1325 $directImageLink = isset($conf['directImageLink.'])
1326 ? $this->stdWrap($conf['directImageLink'], $conf['directImageLink.'])
1327 : $conf['directImageLink'];
1328 if ($directImageLink) {
1329 $imgResourceConf = array(
1330 'file' => $imageFile,
1331 'file.' => $conf
1332 );
1333 $url = $this->IMG_RESOURCE($imgResourceConf);
1334 if (!$url) {
1335 // If no imagemagick / gm is available
1336 $url = $imageFile;
1337 }
1338 }
1339
1340 // Create TARGET-attribute only if the right doctype is used
1341 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
1342 $target = isset($conf['target.'])
1343 ? $this->stdWrap($conf['target'], $conf['target.'])
1344 : $conf['target'];
1345 if ($target) {
1346 $target = sprintf(' target="%s"', $target);
1347 } else {
1348 $target = ' target="thePicture"';
1349 }
1350 } else {
1351 $target = '';
1352 }
1353 $conf['JSwindow'] = isset($conf['JSwindow.'])
1354 ? $this->stdWrap($conf['JSwindow'], $conf['JSwindow.'])
1355 : $conf['JSwindow'];
1356 if ($conf['JSwindow']) {
1357 if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.']) {
1358 $altUrl = isset($conf['JSwindow.']['altUrl.'])
1359 ? $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.'])
1360 : $conf['JSwindow.']['altUrl'];
1361 if ($altUrl) {
1362 $url = $altUrl .
1363 ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file=' .
1364 rawurlencode($imageFile) . $params);
1365 }
1366 }
1367 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
1368 $gifCreator->init();
1369 $gifCreator->mayScaleUp = 0;
1370
1371 $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile), $conf['width'], $conf['height'], '');
1372 $JSwindowExpand = isset($conf['JSwindow.']['expand.'])
1373 ? $this->stdWrap($conf['JSwindow.']['expand'], $conf['JSwindow.']['expand.'])
1374 : $conf['JSwindow.']['expand'];
1375 $offset = t3lib_div::intExplode(',', $JSwindowExpand . ',');
1376
1377 $newWindow = isset($conf['JSwindow.']['newWindow.'])
1378 ? $this->stdWrap($conf['JSwindow.']['newWindow'], $conf['JSwindow.']['newWindow.'])
1379 : $conf['JSwindow.']['newWindow'];
1380 $a1 = '<a href="' . htmlspecialchars($url) . '" onclick="' .
1381 htmlspecialchars('openPic(\'' . $GLOBALS['TSFE']->baseUrlWrap($url) . '\',\'' .
1382 ($newWindow ? md5($url) : 'thePicture') . '\',\'width=' .
1383 ($dims[0] + $offset[0]) . ',height=' . ($dims[1] + $offset[1]) .
1384 ',status=0,menubar=0\'); return false;') . '"' .
1385 $target . $GLOBALS['TSFE']->ATagParams . '>';
1386 $a2 = '</a>';
1387 $GLOBALS['TSFE']->setJS('openPic');
1388 } else {
1389 $conf['linkParams.']['parameter'] = $url;
1390 $string = $this->typoLink($string, $conf['linkParams.']);
1391 }
1392
1393 if (isset($conf['stdWrap.'])) {
1394 $string = $this->stdWrap($string, $conf['stdWrap.']);
1395 }
1396
1397 $content = $a1 . $string . $a2;
1398 }
1399 }
1400
1401 return $content;
1402 }
1403
1404 /**
1405 * Returns content of a file. If it's an image the content of the file is not returned but rather an image tag is.
1406 *
1407 * @param string $fName The filename, being a TypoScript resource data type
1408 * @param string $addParams Additional parameters (attributes). Default is empty alt and title tags.
1409 * @return string If jpg,gif,jpeg,png: returns image_tag with picture in. If html,txt: returns content string
1410 * @see FILE()
1411 */
1412 function fileResource($fName, $addParams = 'alt="" title=""') {
1413 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
1414 if ($incFile) {
1415 $fileinfo = t3lib_div::split_fileref($incFile);
1416 if (t3lib_div::inList('jpg,gif,jpeg,png', $fileinfo['fileext'])) {
1417 $imgFile = $incFile;
1418 $imgInfo = @getImageSize($imgFile);
1419 return '<img src="' . $GLOBALS['TSFE']->absRefPrefix . $imgFile .
1420 '" width="' . $imgInfo[0] . '" height="' . $imgInfo[1] . '"' .
1421 $this->getBorderAttr(' border="0"') . ' ' . $addParams . ' />';
1422 } elseif (filesize($incFile) < 1024 * 1024) {
1423 return $GLOBALS['TSFE']->tmpl->fileContent($incFile);
1424 }
1425 }
1426 }
1427
1428 /**
1429 * Sets the SYS_LASTCHANGED timestamp if input timestamp is larger than current value.
1430 * The SYS_LASTCHANGED timestamp can be used by various caching/indexing applications to determine if the page has new content.
1431 * Therefore you should call this function with the last-changed timestamp of any element you display.
1432 *
1433 * @param integer $tstamp Unix timestamp (number of seconds since 1970)
1434 * @return void
1435 * @see tslib_fe::setSysLastChanged()
1436 */
1437 function lastChanged($tstamp) {
1438 $tstamp = intval($tstamp);
1439 if ($tstamp > intval($GLOBALS['TSFE']->register['SYS_LASTCHANGED'])) {
1440 $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] = $tstamp;
1441 }
1442 }
1443
1444 /**
1445 * Wraps the input string by the $wrap value and implements the "linkWrap" data type as well.
1446 * The "linkWrap" data type means that this function will find any integer encapsulated in {} (curly braces) in the first wrap part and substitute it with the corresponding page uid from the rootline where the found integer is pointing to the key in the rootline. See link below.
1447 *
1448 * @param string $content Input string
1449 * @param string $wrap A string where the first two parts separated by "|" (vertical line) will be wrapped around the input string
1450 * @return string Wrapped output string
1451 * @see wrap(), cImage(), FILE()
1452 */
1453 function linkWrap($content, $wrap) {
1454 $wrapArr = explode('|', $wrap);
1455 if (preg_match('/\{([0-9]*)\}/', $wrapArr[0], $reg)) {
1456 if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid']) {
1457 $wrapArr[0] = str_replace($reg[0], $uid, $wrapArr[0]);
1458 }
1459 }
1460 return trim($wrapArr[0]) . $content . trim($wrapArr[1]);
1461 }
1462
1463 /**
1464 * An abstraction method which creates an alt or title parameter for an HTML img, applet, area or input element and the FILE content element.
1465 * From the $conf array it implements the properties "altText", "titleText" and "longdescURL"
1466 *
1467 * @param array $conf TypoScript configuration properties
1468 * @param boolean $longDesc If set, the longdesc attribute will be generated - must only be used for img elements!
1469 * @return string Parameter string containing alt and title parameters (if any)
1470 * @see IMGTEXT(), FILE(), FORM(), cImage(), filelink()
1471 */
1472 function getAltParam($conf, $longDesc = TRUE) {
1473 $altText = isset($conf['altText.'])
1474 ? trim($this->stdWrap($conf['altText'], $conf['altText.']))
1475 : trim($conf['altText']);
1476 $titleText = isset($conf['titleText.'])
1477 ? trim($this->stdWrap($conf['titleText'], $conf['titleText.']))
1478 : trim($conf['titleText']);
1479 if (isset($conf['longdescURL.']) && $GLOBALS['TSFE']->config['config']['doctype'] != 'html5') {
1480 $longDesc = $this->typoLink_URL($conf['longdescURL.']);
1481 } else {
1482 $longDesc = trim($conf['longdescURL']);
1483 }
1484
1485 // "alt":
1486 $altParam = ' alt="' . htmlspecialchars($altText) . '"';
1487
1488 // "title":
1489 $emptyTitleHandling = 'useAlt';
1490 $emptyTitleHandling = isset($conf['emptyTitleHandling.'])
1491 ? $this->stdWrap($conf['emptyTitleHandling'], $conf['emptyTitleHandling.'])
1492 : $conf['emptyTitleHandling'];
1493 // Choices: 'keepEmpty' | 'useAlt' | 'removeAttr'
1494 if ($titleText || $emptyTitleHandling == 'keepEmpty') {
1495 $altParam .= ' title="' . htmlspecialchars($titleText) . '"';
1496 } elseif (!$titleText && $emptyTitleHandling == 'useAlt') {
1497 $altParam .= ' title="' . htmlspecialchars($altText) . '"';
1498 }
1499
1500 // "longDesc" URL
1501 if ($longDesc) {
1502 $altParam .= ' longdesc="' . htmlspecialchars(strip_tags($longDesc)) . '"';
1503 }
1504
1505 return $altParam;
1506 }
1507
1508 /**
1509 * Removes forbidden characters and spaces from name/id attributes in the form tag and formfields
1510 *
1511 * @param string $name Input string
1512 * @return string the cleaned string
1513 * @see FORM()
1514 */
1515 function cleanFormName($name) {
1516 // Turn data[x][y] into data:x:y:
1517 $name = preg_replace('/\[|\]\[?/', ':', trim($name));
1518 // Remove illegal chars like _
1519 return preg_replace('#[^:a-zA-Z0-9]#', '', $name);
1520 }
1521
1522 /**
1523 * An abstraction method to add parameters to an A tag.
1524 * Uses the ATagParams property.
1525 *
1526 * @param array $conf TypoScript configuration properties
1527 * @param boolean $addGlobal If set, will add the global config.ATagParams to the link
1528 * @return string String containing the parameters to the A tag (if non empty, with a leading space)
1529 * @see IMGTEXT(), filelink(), makelinks(), typolink()
1530 */
1531 function getATagParams($conf, $addGlobal = 1) {
1532 $aTagParams = '';
1533 if ($conf['ATagParams.']) {
1534 $aTagParams = ' ' . $this->stdWrap($conf['ATagParams'], $conf['ATagParams.']);
1535 } elseif ($conf['ATagParams']) {
1536 $aTagParams = ' ' . $conf['ATagParams'];
1537 }
1538 if ($addGlobal) {
1539 $aTagParams = ' ' . trim($GLOBALS['TSFE']->ATagParams . $aTagParams);
1540 }
1541
1542 // Extend params
1543 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParamsPostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParamsPostProc'])) {
1544 $_params = array(
1545 'conf' => &$conf,
1546 'aTagParams' => &$aTagParams
1547 );
1548 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getATagParamsPostProc'] as $objRef) {
1549 $processor = &t3lib_div::getUserObj($objRef);
1550 $aTagParams = $processor->process( $_params, $this);
1551 }
1552 }
1553
1554 return $aTagParams;
1555 }
1556
1557 /**
1558 * All extension links should ask this function for additional properties to their tags.
1559 * Designed to add for instance an "onclick" property for site tracking systems.
1560 *
1561 * @param string $URL URL of the website
1562 * @param string $TYPE
1563 * @return string The additional tag properties
1564 */
1565 function extLinkATagParams($URL, $TYPE) {
1566 $out = '';
1567
1568 if ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler']) {
1569 $extLinkATagParamsHandler = t3lib_div::getUserObj(
1570 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler']
1571 );
1572
1573 if (method_exists($extLinkATagParamsHandler, 'main')) {
1574 $out .= trim($extLinkATagParamsHandler->main($URL, $TYPE, $this));
1575 }
1576 }
1577
1578 return trim($out) ? ' ' . trim($out) : '';
1579 }
1580
1581 /***********************************************
1582 *
1583 * HTML template processing functions
1584 *
1585 ***********************************************/
1586
1587 /**
1588 * Returns a subpart from the input content stream.
1589 * A subpart is a part of the input stream which is encapsulated in a
1590 * string matching the input string, $marker. If this string is found
1591 * inside of HTML comment tags the start/end points of the content block
1592 * returned will be that right outside that comment block.
1593 * Example: The contennt string is
1594 * "Hello <!--###sub1### begin--> World. How are <!--###sub1### end--> you?"
1595 * If $marker is "###sub1###" then the content returned is
1596 * " World. How are ". The input content string could just as well have
1597 * been "Hello ###sub1### World. How are ###sub1### you?" and the result
1598 * would be the same
1599 * Wrapper for t3lib_parsehtml::getSubpart which behaves identical
1600 *
1601 * @param string $content The content stream, typically HTML template content.
1602 * @param string $marker The marker string, typically on the form "###[the marker string]###"
1603 * @return string The subpart found, if found.
1604 * @see substituteSubpart(), t3lib_parsehtml::getSubpart()
1605 */
1606 public function getSubpart($content, $marker) {
1607 return t3lib_parsehtml::getSubpart($content, $marker);
1608 }
1609
1610 /**
1611 * Substitute subpart in input template stream.
1612 * This function substitutes a subpart in $content with the content of
1613 * $subpartContent.
1614 * Wrapper for t3lib_parsehtml::substituteSubpart which behaves identical
1615 *
1616 * @param string $content The content stream, typically HTML template content.
1617 * @param string $marker The marker string, typically on the form "###[the marker string]###"
1618 * @param mixed $subpartContent The content to insert instead of the subpart found. If a string, then just plain substitution happens (includes removing the HTML comments of the subpart if found). If $subpartContent happens to be an array, it's [0] and [1] elements are wrapped around the EXISTING content of the subpart (fetched by getSubpart()) thereby not removing the original content.
1619 * @param boolean $recursive If $recursive is set, the function calls itself with the content set to the remaining part of the content after the second marker. This means that proceding subparts are ALSO substituted!
1620 * @return string The processed HTML content string.
1621 * @see getSubpart(), t3lib_parsehtml::substituteSubpart()
1622 */
1623 public function substituteSubpart($content, $marker, $subpartContent, $recursive = 1) {
1624 return t3lib_parsehtml::substituteSubpart($content, $marker, $subpartContent, $recursive);
1625 }
1626
1627 /**
1628 * Substitues multiple subparts at once
1629 *
1630 * @param string $content The content stream, typically HTML template content.
1631 * @param array $subpartsContent The array of key/value pairs being subpart/content values used in the substitution. For each element in this array the function will substitute a subpart in the content stream with the content.
1632 * @return string The processed HTML content string.
1633 */
1634 public function substituteSubpartArray($content, array $subpartsContent) {
1635 return t3lib_parsehtml::substituteSubpartArray($content, $subpartsContent);
1636 }
1637
1638 /**
1639 * Substitutes a marker string in the input content
1640 * (by a simple str_replace())
1641 *
1642 * @param string $content The content stream, typically HTML template content.
1643 * @param string $marker The marker string, typically on the form "###[the marker string]###"
1644 * @param mixed $markContent The content to insert instead of the marker string found.
1645 * @return string The processed HTML content string.
1646 * @see substituteSubpart()
1647 */
1648 public function substituteMarker($content, $marker, $markContent) {
1649 return t3lib_parsehtml::substituteMarker($content, $marker, $markContent);
1650 }
1651
1652 /**
1653 * Multi substitution function with caching.
1654 *
1655 * This function should be a one-stop substitution function for working
1656 * with HTML-template. It does not substitute by str_replace but by
1657 * splitting. This secures that the value inserted does not themselves
1658 * contain markers or subparts.
1659 *
1660 * Note that the "caching" won't cache the content of the substition,
1661 * but only the splitting of the template in various parts. So if you
1662 * want only one cache-entry per template, make sure you always pass the
1663 * exact same set of marker/subpart keys. Else you will be flooding the
1664 * users cache table.
1665 *
1666 * This function takes three kinds of substitutions in one:
1667 * $markContentArray is a regular marker-array where the 'keys' are
1668 * substituted in $content with their values
1669 *
1670 * $subpartContentArray works exactly like markContentArray only is whole
1671 * subparts substituted and not only a single marker.
1672 *
1673 * $wrappedSubpartContentArray is an array of arrays with 0/1 keys where
1674 * the subparts pointed to by the main key is wrapped with the 0/1 value
1675 * alternating.
1676 *
1677 * @param string $content The content stream, typically HTML template content.
1678 * @param array $markContentArray Regular marker-array where the 'keys' are substituted in $content with their values
1679 * @param array $subpartContentArray Exactly like markContentArray only is whole subparts substituted and not only a single marker.
1680 * @param array $wrappedSubpartContentArray An array of arrays with 0/1 keys where the subparts pointed to by the main key is wrapped with the 0/1 value alternating.
1681 * @return string The output content stream
1682 * @see substituteSubpart(), substituteMarker(), substituteMarkerInObject(), TEMPLATE()
1683 */
1684 public function substituteMarkerArrayCached($content, array $markContentArray = NULL, array $subpartContentArray = NULL, array $wrappedSubpartContentArray = NULL) {
1685 $GLOBALS['TT']->push('substituteMarkerArrayCached');
1686
1687 // If not arrays then set them
1688 if (is_null($markContentArray)) {
1689 // Plain markers
1690 $markContentArray = array();
1691 }
1692
1693 if (is_null($subpartContentArray)) {
1694 // Subparts being directly substituted
1695 $subpartContentArray = array();
1696 }
1697
1698 if (is_null($wrappedSubpartContentArray)) {
1699 // Subparts being wrapped
1700 $wrappedSubpartContentArray = array();
1701 }
1702
1703 // Finding keys and check hash:
1704 $sPkeys = array_keys($subpartContentArray);
1705 $wPkeys = array_keys($wrappedSubpartContentArray);
1706 $aKeys = array_merge(array_keys($markContentArray), $sPkeys, $wPkeys);
1707 if (!count($aKeys)) {
1708 $GLOBALS['TT']->pull();
1709 return $content;
1710 }
1711 asort($aKeys);
1712 $storeKey = md5('substituteMarkerArrayCached_storeKey:' . serialize(array(
1713 $content, $aKeys
1714 )));
1715 if ($this->substMarkerCache[$storeKey]) {
1716 $storeArr = $this->substMarkerCache[$storeKey];
1717 $GLOBALS['TT']->setTSlogMessage('Cached', 0);
1718 } else {
1719 $storeArrDat = $GLOBALS['TSFE']->sys_page->getHash($storeKey);
1720 if (!isset($storeArrDat)) {
1721 // Initialize storeArr
1722 $storeArr = array();
1723
1724 // Finding subparts and substituting them with the subpart as a marker
1725 foreach ($sPkeys as $sPK) {
1726 $content = $this->substituteSubpart($content, $sPK, $sPK);
1727 }
1728
1729 // Finding subparts and wrapping them with markers
1730 foreach ($wPkeys as $wPK) {
1731 $content = $this->substituteSubpart($content, $wPK, array(
1732 $wPK, $wPK
1733 ));
1734 }
1735
1736 // Traverse keys and quote them for reg ex.
1737 foreach ($aKeys as $tK => $tV) {
1738 $aKeys[$tK] = preg_quote($tV, '/');
1739 }
1740 $regex = '/' . implode('|', $aKeys) . '/';
1741 // Doing regex's
1742 $storeArr['c'] = preg_split($regex, $content);
1743 preg_match_all($regex, $content, $keyList);
1744 $storeArr['k'] = $keyList[0];
1745 // Setting cache:
1746 $this->substMarkerCache[$storeKey] = $storeArr;
1747
1748 // Storing the cached data:
1749 $GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
1750
1751 $GLOBALS['TT']->setTSlogMessage('Parsing', 0);
1752 } else {
1753 // Unserializing
1754 $storeArr = unserialize($storeArrDat);
1755 // Setting cache:
1756 $this->substMarkerCache[$storeKey] = $storeArr;
1757 $GLOBALS['TT']->setTSlogMessage('Cached from DB', 0);
1758 }
1759 }
1760
1761 // Substitution/Merging:
1762 // Merging content types together, resetting
1763 $valueArr = array_merge($markContentArray, $subpartContentArray, $wrappedSubpartContentArray);
1764
1765 $wSCA_reg = array();
1766 $content = '';
1767 // Traversing the keyList array and merging the static and dynamic content
1768 foreach ($storeArr['k'] as $n => $keyN) {
1769 $content .= $storeArr['c'][$n];
1770 if (!is_array($valueArr[$keyN])) {
1771 $content .= $valueArr[$keyN];
1772 } else {
1773 $content .= $valueArr[$keyN][(intval($wSCA_reg[$keyN]) % 2)];
1774 $wSCA_reg[$keyN]++;
1775 }
1776 }
1777 $content .= $storeArr['c'][count($storeArr['k'])];
1778
1779 $GLOBALS['TT']->pull();
1780 return $content;
1781 }
1782
1783 /**
1784 * Traverses the input $markContentArray array and for each key the marker
1785 * by the same name (possibly wrapped and in upper case) will be
1786 * substituted with the keys value in the array.
1787 *
1788 * This is very useful if you have a data-record to substitute in some
1789 * content. In particular when you use the $wrap and $uppercase values to
1790 * pre-process the markers. Eg. a key name like "myfield" could effectively
1791 * be represented by the marker "###MYFIELD###" if the wrap value
1792 * was "###|###" and the $uppercase boolean TRUE.
1793 *
1794 * @param string $content The content stream, typically HTML template content.
1795 * @param array $markContentArray 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.
1796 * @param string $wrap A wrap value - [part 1] | [part 2] - for the markers before substitution
1797 * @param boolean $uppercase If set, all marker string substitution is done with upper-case markers.
1798 * @param boolean $deleteUnused If set, all unused marker are deleted.
1799 * @return string The processed output stream
1800 * @see substituteMarker(), substituteMarkerInObject(), TEMPLATE()
1801 */
1802 public function substituteMarkerArray($content, array $markContentArray, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE) {
1803 return t3lib_parsehtml::substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
1804 }
1805
1806 /**
1807 * Substitute marker array in an array of values
1808 *
1809 * @param mixed $tree 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)
1810 * @param array $markContentArray 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.
1811 * @return mixed The processed input variable.
1812 * @see substituteMarker()
1813 */
1814 public function substituteMarkerInObject(&$tree, array $markContentArray) {
1815 if (is_array($tree)) {
1816 foreach ($tree as $key => $value) {
1817 $this->substituteMarkerInObject($tree[$key], $markContentArray);
1818 }
1819 } else {
1820 $tree = $this->substituteMarkerArray($tree, $markContentArray);
1821 }
1822
1823 return $tree;
1824 }
1825
1826 /**
1827 * Replaces all markers and subparts in a template with the content provided in the structured array.
1828 *
1829 * @param string $content
1830 * @param array $markersAndSubparts
1831 * @param string $wrap
1832 * @param boolean $uppercase
1833 * @param boolean $deleteUnused
1834 * @return string
1835 * @see t3lib_parsehtml::substituteMarkerAndSubpartArrayRecursive()
1836 */
1837 public function substituteMarkerAndSubpartArrayRecursive($content, array $markersAndSubparts, $wrap = '', $uppercase = FALSE,
1838 $deleteUnused = FALSE) {
1839 return t3lib_parsehtml::substituteMarkerAndSubpartArrayRecursive(
1840 $content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused
1841 );
1842 }
1843
1844 /**
1845 * Adds elements to the input $markContentArray based on the values from
1846 * the fields from $fieldList found in $row
1847 *
1848 * @param array $markContentArray Array with key/values being marker-strings/substitution values.
1849 * @param array $row An array with keys found in the $fieldList (typically a record) which values should be moved to the $markContentArray
1850 * @param string $fieldList 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)
1851 * @param boolean $nl2br If set, all values added to $markContentArray will be nl2br()'ed
1852 * @param string $prefix 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 "###"
1853 * @param boolean $HSC If set, all values are passed through htmlspecialchars() - RECOMMENDED to avoid most obvious XSS and maintain XHTML compliance.
1854 * @return array The modified $markContentArray
1855 */
1856 public function fillInMarkerArray(array $markContentArray, array $row, $fieldList = '', $nl2br = TRUE, $prefix = 'FIELD_', $HSC = FALSE) {
1857 if ($fieldList) {
1858 $fArr = t3lib_div::trimExplode(',', $fieldList, 1);
1859 foreach ($fArr as $field) {
1860 $markContentArray['###' . $prefix . $field . '###'] =
1861 $nl2br ? nl2br($row[$field], !empty($GLOBALS['TSFE']->xhtmlDoctype)) : $row[$field];
1862 }
1863 } else {
1864 if (is_array($row)) {
1865 foreach ($row as $field => $value) {
1866 if (!t3lib_utility_Math::canBeInterpretedAsInteger($field)) {
1867 if ($HSC) {
1868 $value = htmlspecialchars($value);
1869 }
1870
1871 $markContentArray['###' . $prefix . $field . '###'] =
1872 $nl2br ? nl2br($value, !empty($GLOBALS['TSFE']->xhtmlDoctype)) : $value;
1873 }
1874 }
1875 }
1876 }
1877
1878 return $markContentArray;
1879 }
1880
1881 /**
1882 * Sets the current file object during iterations over files.
1883 *
1884 * @param t3lib_file_File $fileObject The file object.
1885 */
1886 public function setCurrentFile($fileObject) {
1887 $this->currentFile = $fileObject;
1888 }
1889
1890 /**
1891 * Gets the current file object during iterations over files.
1892 *
1893 * @return t3lib_file_File The current file object.
1894 */
1895 public function getCurrentFile() {
1896 return $this->currentFile;
1897 }
1898
1899 /***********************************************
1900 *
1901 * "stdWrap" + sub functions
1902 *
1903 ***********************************************/
1904
1905 /**
1906 * The "stdWrap" function. This is the implementation of what is known as "stdWrap properties" in TypoScript.
1907 * Basically "stdWrap" performs some processing of a value based on properties in the input $conf array(holding the TypoScript "stdWrap properties")
1908 * 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.
1909 *
1910 * If $this->alternativeData is an array it's used instead of the $this->data array in ->getData
1911 *
1912 * @param string $content Input value undergoing processing in this function. Possibly substituted by other values fetched from another source.
1913 * @param array $conf TypoScript "stdWrap properties".
1914 * @return string The processed input value
1915 */
1916 public function stdWrap($content = '', $conf = array()) {
1917 if (count($this->stdWrapHookObjects)) {
1918 foreach ($this->stdWrapHookObjects as $hookObject) {
1919 if (is_callable(array($hookObject, 'stdWrapPreProcess'))) {
1920 $conf['stdWrapPreProcess'] = 1;
1921 }
1922 if (is_callable(array($hookObject, 'stdWrapOverride'))) {
1923 $conf['stdWrapOverride'] = 1;
1924 }
1925 if (is_callable(array($hookObject, 'stdWrapProcess'))) {
1926 $conf['stdWrapProcess'] = 1;
1927 }
1928 if (is_callable(array($hookObject, 'stdWrapPostProcess'))) {
1929 $conf['stdWrapPostProcess'] = 1;
1930 }
1931 }
1932 }
1933
1934 if (is_array($conf) && count($conf)) {
1935
1936 // Cache handling
1937 if (is_array($conf['cache.'])) {
1938 $conf['cache.']['key'] = $this->stdWrap($conf['cache.']['key'], $conf['cache.']['key.']);
1939 $conf['cache.']['tags'] = $this->stdWrap($conf['cache.']['tags'], $conf['cache.']['tags.']);
1940 $conf['cache.']['lifetime'] = $this->stdWrap($conf['cache.']['lifetime'], $conf['cache.']['lifetime.']);
1941
1942 $conf['cacheRead'] = 1;
1943 $conf['cacheStore'] = 1;
1944 }
1945
1946 // Check, which of the available stdWrap functions is needed for the current conf Array
1947 // and keep only those but still in the same order
1948 $sortedConf = array_intersect_key($this->stdWrapOrder, $conf);
1949 // Functions types that should not make use of nested stdWrap function calls to avoid conflicts with internal TypoScript used by these functions
1950 $stdWrapDisabledFunctionTypes = 'cObject,functionName,stdWrap';
1951 // Additional Array to check whether a function has already been executed
1952 $isExecuted = array();
1953 // Additional switch to make sure 'required', 'if' and 'fieldRequired'
1954 // will still stop rendering immediately in case they return FALSE
1955 $this->stdWrapRecursionLevel++;
1956 $this->stopRendering[$this->stdWrapRecursionLevel] = FALSE;
1957
1958 // execute each function in the predefined order
1959 foreach ($sortedConf as $stdWrapName => $functionType) {
1960 // eliminate the second key of a pair 'key'|'key.' to make sure functions get called only once and check if rendering has been stopped
1961 if (!$isExecuted[$stdWrapName] &&
1962 !$this->stopRendering[$this->stdWrapRecursionLevel]) {
1963 $functionName = rtrim($stdWrapName, '.');
1964 $functionProperties = $functionName . '.';
1965 // If there is any code one the next level, check if it contains "official" stdWrap functions
1966 // if yes, execute them first - will make each function stdWrap aware
1967 // so additional stdWrap calls within the functions can be removed, since the result will be the same
1968 // exception: the recursive stdWrap function and cObject will still be using their own stdWrap call, since it modifies the content and not a property
1969 if (count($conf[$functionProperties]) &&
1970 !t3lib_div::inList($stdWrapDisabledFunctionTypes, $functionType)) {
1971 if (array_intersect_key($this->stdWrapOrder, $conf[$functionProperties])) {
1972 $conf[$functionName] = $this->stdWrap($conf[$functionName], $conf[$functionProperties]);
1973 }
1974 }
1975 // Get just that part of $conf that is needed for the particular function
1976 $singleConf = array(
1977 $functionName => $conf[$functionName],
1978 $functionProperties => $conf[$functionProperties]
1979 );
1980
1981 // In this special case 'spaceBefore' and 'spaceAfter' need additional stuff from 'space.''
1982 if ($functionName == 'spaceBefore' || $functionName == 'spaceAfter') {
1983 $singleConf['space.'] = $conf['space.'];
1984 }
1985
1986 // Hand over the whole $conf array to the stdWrapHookObjects
1987 if ($functionType === 'hook') {
1988 $singleConf = $conf;
1989 }
1990 // Check if key is still containing something, since it might have been changed by next level stdWrap before
1991 if ((isset($conf[$functionName]) || $conf[$functionProperties]) &&
1992 !($functionType == 'boolean' && !$conf[$functionName])) {
1993 // Add both keys - with and without the dot - to the set of executed functions
1994 $isExecuted[$functionName] = TRUE;
1995 $isExecuted[$functionProperties] = TRUE;
1996 // Call the function with the prefix stdWrap_ to make sure nobody can execute functions just by adding their name to the TS Array
1997 $functionName = 'stdWrap_' . $functionName;
1998 $content = $this->$functionName(
1999 $content,
2000 $singleConf
2001 );
2002 // For booleans we have to mark the function as executed in any case, even if it has been 0, '' or false to avoid a second call based on the functionProperties, which would always be true
2003 } elseif ($functionType == 'boolean' && !$conf[$functionName]) {
2004 $isExecuted[$functionName] = TRUE;
2005 $isExecuted[$functionProperties] = TRUE;
2006 }
2007 }
2008 }
2009
2010 unset($this->stopRendering[$this->stdWrapRecursionLevel]);
2011 $this->stdWrapRecursionLevel--;
2012
2013 }
2014 return $content;
2015 }
2016
2017 /**
2018 * stdWrap pre process hook
2019 * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
2020 * this hook will execute functions before any other stdWrap function can modify anything
2021 *
2022 * @param string $content Input value undergoing processing in these functions.
2023 * @param array $conf All stdWrap properties, not just the ones for a particular function.
2024 * @return string The processed input value
2025 */
2026 public function stdWrap_stdWrapPreProcess($content = '', $conf = array()) {
2027 foreach ($this->stdWrapHookObjects as $hookObject) {
2028 $content = $hookObject->stdWrapPreProcess($content, $conf, $this);
2029 }
2030 return $content;
2031 }
2032
2033 /**
2034 * Check if content was cached before (depending on the given cache key)
2035 *
2036 * @param string $content Input value undergoing processing in these functions.
2037 * @param array $conf All stdWrap properties, not just the ones for a particular function.
2038 * @return string The processed input value
2039 */
2040 public function stdWrap_cacheRead($content = '', $conf = array()) {
2041 if (!empty($conf['cache.']['key'])) {
2042 /** @var $cacheFrontend t3lib_cache_frontend_VariableFrontend */
2043 $cacheFrontend = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
2044 if ($cacheFrontend && $cacheFrontend->has($conf['cache.']['key'])) {
2045 $content = $cacheFrontend->get($conf['cache.']['key']);
2046 $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
2047 }
2048 }
2049 return $content;
2050 }
2051
2052 /**
2053 * setContentToCurrent
2054 * actually it just does the contrary: Sets the value of 'current' based on current content
2055 *
2056 * @param string $content Input value undergoing processing in this function.
2057 * @param array $conf stdWrap properties for setContentToCurrent.
2058 * @return string The processed input value
2059 */
2060 public function stdWrap_setContentToCurrent($content = '', $conf = array()) {
2061 $this->data[$this->currentValKey] = $content;
2062 return $content;
2063 }
2064
2065 /**
2066 * setCurrent
2067 * Sets the value of 'current' based on the outcome of stdWrap operations
2068 *
2069 * @param string $content Input value undergoing processing in this function.
2070 * @param array $conf stdWrap properties for setCurrent.
2071 * @return string The processed input value
2072 */
2073 public function stdWrap_setCurrent($content = '', $conf = array()) {
2074 $this->data[$this->currentValKey] = $conf['setCurrent'];
2075 return $content;
2076 }
2077
2078 /**
2079 * lang
2080 * Translates content based on the language currently used by the FE
2081 *
2082 * @param string $content Input value undergoing processing in this function.
2083 * @param array $conf stdWrap properties for lang.
2084 * @return string The processed input value
2085 */
2086 public function stdWrap_lang($content = '', $conf = array()) {
2087 if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
2088 $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
2089 }
2090 return $content;
2091 }
2092
2093 /**
2094 * data
2095 * Gets content from different sources based on getText functions, makes use of alternativeData, when set
2096 *
2097 * @param string $content Input value undergoing processing in this function.
2098 * @param array $conf stdWrap properties for data.
2099 * @return string The processed input value
2100 */
2101 public function stdWrap_data($content = '', $conf = array()) {
2102 $content = $this->getData($conf['data'], is_array($this->alternativeData) ? $this->alternativeData : $this->data);
2103 // This must be unset directly after
2104 $this->alternativeData = '';
2105 return $content;
2106 }
2107
2108 /**
2109 * field
2110 * Gets content from a DB field
2111 *
2112 * @param string $content Input value undergoing processing in this function.
2113 * @param array $conf stdWrap properties for field.
2114 * @return string The processed input value
2115 */
2116 public function stdWrap_field($content = '', $conf = array()) {
2117 $content = $this->getFieldVal($conf['field']);
2118 return $content;
2119 }
2120
2121 /**
2122 * current
2123 * Gets content that has been perviously set as 'current'
2124 * Can be set via setContentToCurrent or setCurrent or will be set automatically i.e. inside the split function
2125 *
2126 * @param string $content Input value undergoing processing in this function.
2127 * @param array $conf stdWrap properties for current.
2128 * @return string The processed input value
2129 */
2130 public function stdWrap_current($content = '', $conf = array()) {
2131 $content = $this->data[$this->currentValKey];
2132 return $content;
2133 }
2134
2135 /**
2136 * cObject
2137 * Will replace the content with the value of a any official TypoScript cObject
2138 * like TEXT, COA, HMENU
2139 *
2140 * @param string $content Input value undergoing processing in this function.
2141 * @param array $conf stdWrap properties for cObject.
2142 * @return string The processed input value
2143 */
2144 public function stdWrap_cObject($content = '', $conf = array()) {
2145 $content = $this->cObjGetSingle($conf['cObject'], $conf['cObject.'], '/stdWrap/.cObject');
2146 return $content;
2147 }
2148
2149 /**
2150 * numRows
2151 * Counts the number of returned records of a DB operation
2152 * makes use of select internally
2153 *
2154 * @param string $content Input value undergoing processing in this function.
2155 * @param array $conf stdWrap properties for numRows.
2156 * @return string The processed input value
2157 */
2158 public function stdWrap_numRows($content = '', $conf = array()) {
2159 $content = $this->numRows($conf['numRows.']);
2160 return $content;
2161 }
2162
2163 /**
2164 * filelist
2165 * Will create a list of files based on some additional parameters
2166 *
2167 * @param string $content Input value undergoing processing in this function.
2168 * @param array $conf stdWrap properties for filelist.
2169 * @return string The processed input value
2170 */
2171 public function stdWrap_filelist($content = '', $conf = array()) {
2172 $content = $this->filelist($conf['filelist']);
2173 return $content;
2174 }
2175
2176 /**
2177 * preUserFunc
2178 * Will execute a user public function before the content will be modified by any other stdWrap function
2179 *
2180 * @param string $content Input value undergoing processing in this function.
2181 * @param array $conf stdWrap properties for preUserFunc.
2182 * @return string The processed input value
2183 */
2184 public function stdWrap_preUserFunc($content = '', $conf = array()) {
2185 $content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);
2186 return $content;
2187 }
2188
2189 /**
2190 * stdWrap override hook
2191 * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
2192 * this hook will execute functions on existing content but still before the content gets modified or replaced
2193 *
2194 * @param string $content Input value undergoing processing in these functions.
2195 * @param array $conf All stdWrap properties, not just the ones for a particular function.
2196 * @return string The processed input value
2197 */
2198 public function stdWrap_stdWrapOverride($content = '', $conf = array()) {
2199 foreach ($this->stdWrapHookObjects as $hookObject) {
2200 $content = $hookObject->stdWrapOverride($content, $conf, $this);
2201 }
2202 return $content;
2203 }
2204
2205 /**
2206 * override
2207 * Will override the current value of content with its own value'
2208 *
2209 * @param string $content Input value undergoing processing in this function.
2210 * @param array $conf stdWrap properties for override.
2211 * @return string The processed input value
2212 */
2213 public function stdWrap_override($content = '', $conf = array()) {
2214 if (trim($conf['override'])) {
2215 $content = $conf['override'];
2216 }
2217 return $content;
2218 }
2219
2220 /**
2221 * preIfEmptyListNum
2222 * Gets a value off a CSV list before the following ifEmpty check
2223 * 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
2224 *
2225 * @param string $content Input value undergoing processing in this function.
2226 * @param array $conf stdWrap properties for preIfEmptyListNum.
2227 * @return string The processed input value
2228 */
2229 public function stdWrap_preIfEmptyListNum($content = '', $conf = array()) {
2230 $content = $this->listNum($content, $conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['splitChar']);
2231 return $content;
2232 }
2233
2234 /**
2235 * ifEmpty
2236 * Will set content to a replacement value in case the trimmed value of content returns FALSE
2237 * 0 (zero) will be replaced as well
2238 *
2239 * @param string $content Input value undergoing processing in this function.
2240 * @param array $conf stdWrap properties for ifEmpty.
2241 * @return string The processed input value
2242 */
2243 public function stdWrap_ifEmpty($content = '', $conf = array()) {
2244 if (!trim($content)) {
2245 $content = $conf['ifEmpty'];
2246 }
2247 return $content;
2248 }
2249
2250 /**
2251 * ifBlank
2252 * Will set content to a replacement value in case the trimmed value of content has no length
2253 * 0 (zero) will not be replaced
2254 *
2255 * @param string $content Input value undergoing processing in this function.
2256 * @param array $conf stdWrap properties for ifBlank.
2257 * @return string The processed input value
2258 */
2259 public function stdWrap_ifBlank($content = '', $conf = array()) {
2260 if (!strlen(trim($content))) {
2261 $content = $conf['ifBlank'];
2262 }
2263 return $content;
2264 }
2265
2266 /**
2267 * listNum
2268 * Gets a value off a CSV list after ifEmpty check
2269 * Might return an empty value in case the CSV does not contain a value at the position given by listNum
2270 * Use preIfEmptyListNum to avoid that behaviour
2271 *
2272 * @param string $content Input value undergoing processing in this function.
2273 * @param array $conf stdWrap properties for listNum.
2274 * @return string The processed input value
2275 */
2276 public function stdWrap_listNum($content = '', $conf = array()) {
2277 $content = $this->listNum($content, $conf['listNum'], $conf['listNum.']['splitChar']);
2278 return $content;
2279 }
2280
2281 /**
2282 * trim
2283 * Cuts off any whitespace at the beginning and the end of the content
2284 *
2285 * @param string $content Input value undergoing processing in this function.
2286 * @param array $conf stdWrap properties for trim.
2287 * @return string The processed input value
2288 */
2289 public function stdWrap_trim($content = '', $conf = array()) {
2290 $content = trim($content);
2291 return $content;
2292 }
2293
2294 /**
2295 * stdWrap
2296 * A recursive call of the stdWrap function set
2297 * This enables the user to execute stdWrap functions in another than the predefined order
2298 * It modifies the content, not the property
2299 * while the new feature of chained stdWrap functions modifies the property and not the content
2300 *
2301 * @param string $content Input value undergoing processing in this function.
2302 * @param array $conf stdWrap properties for stdWrap.
2303 * @return string The processed input value
2304 */
2305 public function stdWrap_stdWrap($content = '', $conf = array()) {
2306 $content = $this->stdWrap($content, $conf['stdWrap.']);
2307 return $content;
2308 }
2309
2310 /**
2311 * stdWrap process hook
2312 * can be used by extensions authors to modify the behaviour of stdWrap functions to their needs
2313 * this hook executes functions directly after the recursive stdWrap function call but still before the content gets modified
2314 *
2315 * @param string $content Input value undergoing processing in these functions.
2316 * @param array $conf All stdWrap properties, not just the ones for a particular function.
2317 * @return string The processed input value
2318 */
2319 public function stdWrap_stdWrapProcess($content = '', $conf = array()) {
2320 foreach ($this->stdWrapHookObjects as $hookObject) {
2321 $content = $hookObject->stdWrapProcess($content, $conf, $this);
2322 }
2323 return $content;
2324 }
2325
2326 /**
2327 * required
2328 * Will immediately stop rendering and return an empty value
2329 * when there is no content at this point
2330 *
2331 * @param string $content Input value undergoing processing in this function.
2332 * @param array $conf stdWrap properties for required.
2333 * @return string The processed input value
2334 */
2335 public function stdWrap_required($content = '', $conf = array()) {
2336 if ((string) $content == '') {
2337 $content = '';
2338 $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
2339 }
2340 return $content;
2341 }
2342
2343 /**
2344 * if
2345 * Will immediately stop rendering and return an empty value
2346 * when the result of the checks returns FALSE
2347 *
2348 * @param string $content Input value undergoing processing in this function.
2349 * @param array $conf stdWrap properties for if.
2350 * @return string The processed input value
2351 */
2352 public function stdWrap_if($content = '', $conf = array()) {
2353 if (!$this->checkIf($conf['if.'])) {
2354 $content = '';
2355 $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
2356 }
2357 return $content;
2358 }
2359
2360 /**
2361 * fieldRequired
2362 * Will immediately stop rendering and return an empty value
2363 * when there is no content in the field given by fieldRequired
2364 *
2365 * @param string $content Input value undergoing processing in this function.
2366 * @param array $conf stdWrap properties for fieldRequired.
2367 * @return string The processed input value
2368 */
2369 public function stdWrap_fieldRequired($content = '', $conf = array()) {
2370 if (!trim($this->data[$conf['fieldRequired']])) {
2371 $content = '';
2372 $this->stopRendering[$this->stdWrapRecursionLevel] = TRUE;
2373 }
2374 return $content;
2375 }
2376
2377 /**
2378 * csConv
2379 * Will convert the current chracter set of the content to the one given in csConv
2380 *
2381 * @param string $content Input value undergoing processing in this function.
2382 * @param array $conf stdWrap properties for csConv.
2383 * @return string The processed input value
2384 */
2385 public function stdWrap_csConv($content = '', $conf = array()) {
2386 $content = $GLOBALS['TSFE']->csConv($content, $conf['csConv']);
2387 return $content;
2388 }
2389
2390 /**
2391 * parseFunc
2392 * Will parse the content based on functions given as stdWrap properties
2393 * Heavily used together with RTE based content
2394 *
2395 * @param string $content Input value undergoing processing in this function.
2396 * @param array $conf stdWrap properties for parseFunc.
2397 * @return string The processed input value
2398 */
2399 public function stdWrap_parseFunc($content = '', $conf = array()) {
2400 $content = $this->parseFunc($content, $conf['parseFunc.'], $conf['parseFunc']);
2401 return $content;
2402 }
2403
2404 /**
2405 * HTMLparser
2406 * Will parse HTML content based on functions given as stdWrap properties
2407 * Heavily used together with RTE based content
2408 *
2409 * @param string $content Input value undergoing processing in this function.
2410 * @param array $conf stdWrap properties for HTMLparser.
2411 * @return string The processed input value
2412 */
2413 public function stdWrap_HTMLparser($content = '', $conf = array()) {
2414 if (is_array($conf['HTMLparser.'])) {
2415 $content = $this->HTMLparser_TSbridge($content, $conf['HTMLparser.']);
2416 }
2417 return $content;
2418 }
2419
2420 /**
2421 * split
2422 * Will split the content by a given token and treat the results separately
2423 * Automatically fills 'current' with a single result
2424 *
2425 * @param string $content Input value undergoing processing in this function.
2426 * @param array $conf stdWrap properties for split.
2427 * @return string The processed input value
2428 */
2429 public function stdWrap_split($content = '', $conf = array()) {
2430 $content = $this->splitObj($content, $conf['split.']);
2431 return $content;
2432 }
2433
2434 /**
2435 * replacement
2436 * Will execute replacements on the content (optionally with preg-regex)
2437 *
2438 * @param string $content Input value undergoing processing in this function.
2439 * @param array $conf stdWrap properties for replacement.
2440 * @return string The processed input value
2441 */
2442 public function stdWrap_replacement($content = '', $conf = array()) {
2443 $content = $this->replacement($content, $conf['replacement.']);
2444 return $content;
2445 }
2446
2447 /**
2448 * prioriCalc
2449 * Will use the content as a mathematical term and calculate the result
2450 * Can be set to 1 to just get a calculated value or 'intval' to get the integer of the result
2451 *
2452 * @param string $content Input value undergoing processing in this function.
2453 * @param array $conf stdWrap properties for prioriCalc.
2454 * @return string The processed input value
2455 */
2456 public function stdWrap_prioriCalc($content = '', $conf = array()) {
2457 $content = t3lib_utility_Math::calculateWithParentheses($content);
2458 if ($conf['prioriCalc'] == 'intval')
2459 $content = intval($content);
2460 return $content;
2461 }
2462
2463 /**
2464 * char
2465 * Will return a character based on its position within the current character set
2466 *
2467 * @param string $content Input value undergoing processing in this function.
2468 * @param array $conf stdWrap properties for char.
2469 * @return string The processed input value
2470 */
2471 public function stdWrap_char($content = '', $conf = array()) {
2472 $content = chr(intval($conf['char']));
2473 return $content;
2474 }
2475
2476 /**
2477 * intval
2478 * Will return an integer value of the current content
2479 *
2480 * @param string $content Input value undergoing processing in this function.
2481 * @param array $conf stdWrap properties for intval.
2482 * @return string The processed input value
2483 */
2484 public function stdWrap_intval($content = '', $conf = array()) {
2485 $content = intval($content);
2486 return $content;
2487 }
2488
2489 /**
2490 * Will return a hashed value of the current content
2491 *
2492 * @param string $content Input value undergoing processing in this function.
2493 * @param array $conf stdWrap properties for hash.
2494 * @return string The processed input value
2495 * @link http://php.net/manual/de/function.hash-algos.php for a list of supported hash algorithms
2496 */
2497 public function stdWrap_hash($content = '', array $conf = array()) {
2498 $algorithm = isset($conf['hash.'])
2499 ? $this->stdWrap($conf['hash'], $conf['hash.'])
2500 : $conf['hash'];
2501 if (function_exists('hash') && in_array($algorithm, hash_algos())) {
2502 $content = hash($algorithm, $content);
2503 } else {
2504 // Non-existing hashing algorithm
2505 $content = '';
2506 }
2507 return $content;
2508 }
2509
2510 /**
2511 * stdWrap_round will return a rounded number with ceil(), floor() or round(), defaults to round()
2512 * Only the english number format is supported . (dot) as decimal point
2513 *
2514 * @param string $content Input value undergoing processing in this function.
2515 * @param array $conf stdWrap properties for round.
2516 * @return string The processed input value
2517 */
2518 public function stdWrap_round($content = '', $conf = array()) {
2519 $content = $this->round($content, $conf['round.']);
2520 return $content;
2521 }
2522
2523 /**
2524 * numberFormat
2525 * Will return a formatted number based on configuration given as stdWrap properties
2526 *
2527 * @param string $content Input value undergoing processing in this function.
2528 * @param array $conf stdWrap properties for numberFormat.
2529 * @return string The processed input value
2530 */
2531 public function stdWrap_numberFormat($content = '', $conf = array()) {
2532 $content = $this->numberFormat($content, $conf['numberFormat.']);
2533 return $content;
2534 }
2535
2536 /**
2537 * expandList
2538 * Will return a formatted number based on configuration given as stdWrap properties
2539 *
2540 * @param string $content Input value undergoing processing in this function.
2541 * @param array $conf stdWrap properties for expandList.
2542 * @return string The processed input value
2543 */
2544 public function stdWrap_expandList($content = '', $conf = array()) {
2545 $content = t3lib_div::expandList($content);
2546 return $content;
2547 }
2548
2549 /**
2550 * date
2551 * Will return a formatted date based on configuration given according to PHP date/gmdate properties
2552 * Will return gmdate when the property GMT returns TRUE
2553 *
2554 * @param string $content Input value undergoing processing in this function.
2555 * @param array $conf stdWrap properties for date.
2556 * @return string The processed input value
2557 */
2558 public function stdWrap_date($content = '', $conf = array()) {
2559 // Check for zero length string to mimic default case of date/gmdate.
2560 $content = $content == '' ? $GLOBALS['EXEC_TIME'] : intval($content);
2561 $content = ($conf['date.']['GMT'] ? gmdate($conf['date'], $content) : date($conf['date'], $content));
2562 return $content;
2563 }
2564
2565 /**
2566 * strftime
2567 * Will return a formatted date based on configuration given according to PHP strftime/gmstrftime properties
2568 * Will return gmstrftime when the property GMT returns TRUE
2569 *
2570 * @param string $content Input value undergoing processing in this function.
2571 * @param array $conf stdWrap properties for strftime.
2572 * @return string The processed input value
2573 */
2574 public function stdWrap_strftime($content = '', $conf = array()) {
2575 $content = ($conf['strftime.']['GMT'] ? gmstrftime($conf['strftime'], $content) : strftime($conf['strftime'], $content));
2576 $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
2577 if ($tmp_charset) {
2578 $content = $GLOBALS['TSFE']->csConv($content, $tmp_charset);
2579 }
2580 return $content;
2581 }
2582
2583 /**
2584 * age
2585 * Will return the age of a given timestamp based on configuration given by stdWrap properties
2586 *
2587 * @param string $content Input value undergoing processing in this function.
2588 * @param array $conf stdWrap properties for age.
2589 * @return string The processed input value
2590 */
2591 public function stdWrap_age($content = '', $conf = array()) {
2592 $content = $this->calcAge($GLOBALS['EXEC_TIME'] - $content, $conf['age']);
2593 return $content;
2594 }
2595
2596 /**
2597 * case
2598 * Will transform the content to be upper or lower case only
2599 * Leaves HTML tags untouched
2600 *
2601 * @param string $content Input value undergoing processing in this function.
2602 * @param array $conf stdWrap properties for case.
2603 * @return string The processed input value
2604 */
2605 public function stdWrap_case($content = '', $conf = array()) {
2606 $content = $this->HTMLcaseshift($content, $conf['case']);
2607 return $content;
2608 }
2609
2610 /**
2611 * bytes
2612 * Will return the size of a given number in Bytes *
2613 *
2614 * @param string $content Input value undergoing processing in this function.
2615 * @param array $conf stdWrap properties for bytes.
2616 * @return string The processed input value
2617 */
2618 public function stdWrap_bytes($content = '', $conf = array()) {
2619 $content = t3lib_div::formatSize($content, $conf['bytes.']['labels']);
2620 return $content;
2621 }
2622
2623 /**
2624 * substring
2625 * Will return a substring based on position information given by stdWrap properties
2626 *
2627 * @param string $content Input value undergoing processing in this function.
2628 * @param array $conf stdWrap properties for substring.
2629 * @return string The processed input value
2630 */
2631 public function stdWrap_substring($content = '', $conf = array()) {
2632 $content = $this->substring($content, $conf['substring']);
2633 return $content;
2634 }
2635
2636 /**
2637 * removeBadHTML
2638 * Removes HTML tags based on stdWrap properties
2639 *
2640 * @param string $content Input value undergoing processing in this function.
2641 * @param array $conf stdWrap properties for removeBadHTML.
2642 * @return string The processed input value
2643 */
2644 public function stdWrap_removeBadHTML($content = '', $conf = array()) {
2645 $content = $this->removeBadHTML($content, $conf['removeBadHTML.']);
2646 return $content;
2647 }
2648
2649 /**
2650 * cropHTML
2651 * Crops content to a given size while leaving HTML tags untouched
2652 *
2653 * @param string $content Input value undergoing processing in this function.
2654 * @param array $conf stdWrap properties for cropHTML.
2655 * @return string The processed input value
2656 */
2657 public function stdWrap_cropHTML($content = '', $conf = array()) {
2658 $content = $this->cropHTML($content, $conf['cropHTML']);
2659 return $content;
2660 }
2661
2662 /**
2663 * stripHtml
2664 * Copmletely removes HTML tags from content
2665 *
2666 * @param string $content Input value undergoing processing in this function.
2667 * @param array $conf stdWrap properties for stripHtml.
2668 * @return string The processed input value
2669 */
2670 public function stdWrap_stripHtml($content = '', $conf = array()) {
2671 $content = strip_tags($content);
2672 return $content;
2673 }
2674
2675 /**
2676 * cropHTML
2677 * Crops content to a given size without caring abhout HTML tags
2678 *
2679 * @param string $content Input value undergoing processing in this function.
2680 * @param array $conf stdWrap properties for crop.
2681 * @return string The processed input value
2682 */
2683 public function stdWrap_crop($content = '', $conf = array()) {
2684 $content = $this->crop($content, $conf['crop']);
2685 return $content;
2686 }
2687
2688 /**
2689 * rawUrlEncode
2690 * Encodes content to be used within URLs
2691 *
2692 * @param string $content Input value undergoing processing in this function.
2693 * @param array $conf stdWrap properties for rawUrlEncode.
2694 * @return string The processed input value
2695 */
2696 public function stdWrap_rawUrlEncode($content = '', $conf = array()) {
2697 $content = rawurlencode($content);
2698 return $content;
2699 }
2700
2701 /**
2702 * htmlSpecialChars
2703 * Transforms HTML tags to readable text by replacing special characters with their HTML entity
2704 * When preserveEntities returns TRUE, existing entities will be left untouched
2705 *
2706 * @param string $content Input value undergoing processing in this function.
2707 * @param array $conf stdWrap properties for htmlSpecalChars.
2708 * @return string The processed input value
2709 */
2710 public function stdWrap_htmlSpecialChars($content = '', $conf = array()) {
2711 $content = htmlSpecialChars($content);
2712 if ($conf['htmlSpecialChars.']['preserveEntities'])
2713 $content = t3lib_div::deHSCentities($content);
2714 return $content;
2715 }
2716
2717 /**
2718 * doubleBrTag
2719 * Searches for double line breaks and replaces them with the given value
2720 *
2721 * @param string $content Input value undergoing processing in this function.
2722 * @param array $conf stdWrap properties for doubleBrTag.
2723 * @return string The processed input value
2724 */
2725 public function stdWrap_doubleBrTag($content = '', $conf = array()) {
2726 $content = preg_replace("/\r?\n[\t ]*\r?\n/", $conf['doubleBrTag'], $content);
2727 return $content;
2728 }
2729
2730 /**
2731 * br
2732 * Searches for single line breaks and replaces them with a <br />/<br> tag
2733 * according to the doctype
2734 *
2735 * @param string $content Input value undergoing processing in this function.
2736 * @param array $conf stdWrap properties for br.
2737 * @return string The processed input value
2738 */
2739 public function stdWrap_br($content = '', $conf = array()) {
2740 $content = nl2br($content, !empty($GLOBALS['TSFE']->xhtmlDoctype));
2741 return $content;
2742 }
2743
2744 /**
2745 * brTag
2746 * Searches for single line feeds and replaces them with the given value
2747 *
2748 * @param string $content Input value undergoing processing in this function.
2749 * @param array $conf stdWrap properties for brTag.
2750 * @return string The processed input value
2751 */
2752 public function stdWrap_brTag($content = '', $conf = array()) {
2753 $content = str_replace(LF, $conf['brTag'], $content);
2754 return $content;
2755 }
2756
2757 /**
2758 * encapsLines
2759 * Modifies text blocks by searching for lines which are not surrounded by HTML tags yet
2760 * and wrapping them with values given by stdWrap properties
2761 *
2762 * @param string $content Input value undergoing processing in this function.
2763 * @param array $conf stdWrap properties for erncapsLines.
2764 * @return string The processed input value
2765 */
2766 public function stdWrap_encapsLines($content = '', $conf = array()) {
2767 $content = $this->encaps_lineSplit($content, $conf['encapsLines.']);
2768 return $content;
2769 }
2770
2771 /**
2772 * keywords
2773 * Transforms content into a CSV list to be used i.e. as keywords within a meta tag
2774 *
2775 * @param string $content Input value undergoing processing in this function.
2776 * @param array $conf stdWrap properties for keywords.
2777 * @return string The processed input value
2778 */
2779 public function stdWrap_keywords($content = '', $conf = array()) {
2780 $content = $this->keywords($content);
2781 return $content;
2782 }
2783
2784 /**
2785 * innerWrap
2786 * First of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
2787 * See wrap
2788 *
2789 * @param string $content Input value undergoing processing in this function.
2790 * @param array $conf stdWrap properties for innerWrap.
2791 * @return string The processed input value
2792 */
2793 public function stdWrap_innerWrap($content = '', $conf = array()) {
2794 $content = $this->wrap($content, $conf['innerWrap']);
2795 return $content;
2796 }
2797
2798 /**
2799 * innerWrap2
2800 * Second of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
2801 * See wrap
2802 *
2803 * @param string $content Input value undergoing processing in this function.
2804 * @param array $conf stdWrap properties for innerWrap2.
2805 * @return string The processed input value
2806 */
2807 public function stdWrap_innerWrap2($content = '', $conf = array()) {
2808 $content = $this->wrap($content, $conf['innerWrap2']);
2809 return $content;
2810 }
2811
2812 /**
2813 * fontTag
2814 * A wrap formerly used to apply font tags to format the content
2815 * Still used by lib.stdheader although real font tags are not state of the art anymore
2816 * See wrap
2817 *
2818 * @param string $content Input value undergoing processing in this function.
2819 * @param array $conf stdWrap properties for fontTag.
2820 * @return string The processed input value
2821 */
2822 public function stdWrap_fontTag($content = '', $conf = array()) {
2823 $content = $this->wrap($content, $conf['fontTag']);
2824 return $content;
2825 }
2826
2827 /**
2828 * addParams
2829 * Adds tag attributes to any content that is a tag
2830 *
2831 * @param string $content Input value undergoing processing in this function.
2832 * @param array $conf stdWrap properties for addParams.
2833 * @return string The processed input value
2834 */
2835 public function stdWrap_addParams($content = '', $conf = array()) {
2836 $content = $this->addParams($content, $conf['addParams.']);
2837 return $content;
2838 }
2839
2840 /**
2841 * textStyle
2842 * Wraps content in font tags
2843 * See wrap
2844 *
2845 * @param string $content Input value undergoing processing in this function.
2846 * @param array $conf stdWrap properties for textStyle.
2847 * @return string The processed input value
2848 */
2849 public function stdWrap_textStyle($content = '', $conf = array()) {
2850 $content = $this->textStyle($content, $conf['textStyle.']);
2851 return $content;
2852 }
2853
2854 /**
2855 * tableStyle
2856 * Wraps content with table tags
2857 * See wrap
2858 *
2859 * @param string $content Input value undergoing processing in this function.
2860 * @param array $conf stdWrap properties for tableStyle.
2861 * @return string The processed input value
2862 */
2863 public function stdWrap_tableStyle($content = '', $conf = array()) {
2864 $content = $this->tableStyle($content, $conf['tableStyle.']);
2865 return $content;
2866 }
2867
2868 /**
2869 * filelink
2870 * Used to make lists of links to files
2871 * See wrap
2872 *
2873 * @param string $content Input value undergoing processing in this function.
2874 * @param array $conf stdWrap properties for filelink.
2875 * @return string The processed input value
2876 */
2877 public function stdWrap_filelink($content = '', $conf = array()) {
2878 $content = $this->filelink($content, $conf['filelink.']);
2879 return $content;
2880 }
2881
2882 /**
2883 * preCObject
2884 * A content object that is prepended to the current content but between the innerWraps and the rest of the wraps
2885 *
2886 * @param string $content Input value undergoing processing in this function.
2887 * @param array $conf stdWrap properties for preCObject.
2888 * @return string The processed input value
2889 */
2890 public function stdWrap_preCObject($content = '', $conf = array()) {
2891 $content = $this->cObjGetSingle($conf['preCObject'], $conf['preCObject.'], '/stdWrap/.preCObject') . $content;
2892 return $content;
2893 }
2894
2895 /**
2896 * postCObject
2897 * A content object that is appended to the current content but between the innerWraps and the rest of the wraps
2898 *
2899 * @param string $content Input value undergoing processing in this function.
2900 * @param array $conf stdWrap properties for postCObject.
2901 * @return string The processed input value
2902 */
2903 public function stdWrap_postCObject($content = '', $conf = array()) {
2904 $content .= $this->cObjGetSingle($conf['postCObject'], $conf['postCObject.'], '/stdWrap/.postCObject');
2905 return $content;
2906 }
2907
2908 /**
2909 * wrapAlign
2910 * Wraps content with a div container having the style attribute text-align set to the given value
2911 * See wrap
2912 *
2913 * @param string $content Input value undergoing processing in this function.
2914 * @param array $conf stdWrap properties for wrapAlign.
2915 * @return string The processed input value
2916 */
2917 public function stdWrap_wrapAlign($content = '', $conf = array()) {
2918 $wrapAlign = trim($conf['wrapAlign']);
2919 if ($wrapAlign) {
2920 $content = $this->wrap($content, '<div style="text-align:' . $wrapAlign . ';">|</div>');
2921 }
2922 return $content;
2923 }
2924
2925 /**
2926 * typolink
2927 * Wraps the content with a link tag
2928 * URLs and other attributes are created automatically by the values given in the stdWrap properties
2929 * See wrap
2930 *
2931 * @param string $content Input value undergoing processing in this function.
2932 * @param array $conf stdWrap properties for typolink.
2933 * @return string The processed input value
2934 */
2935 public function stdWrap_typolink($content = '', $conf = array()) {
2936 $content = $this->typolink($content, $conf['typolink.']);
2937 return $content;
2938 }
2939
2940 /**
2941 * TCAselectItem
2942 * Returns a list of options available for a given field in the DB which has to be of the type select
2943 *
2944 * @param string $content Input value undergoing processing in this function.
2945 * @param array $conf stdWrap properties for TCAselectItem.
2946 * @return string The processed input value
2947 */
2948 public function stdWrap_TCAselectItem($content = '', $conf = array()) {
2949 if (is_array($conf['TCAselectItem.'])) {
2950 $content = $this->TCAlookup($content, $conf['TCAselectItem.']);
2951 }
2952 return $content;
2953 }
2954
2955 /**
2956 * spaceBefore
2957 * Will add space before the current content
2958 * By default this is done with a clear.gif but it can be done with CSS margins by setting the property space.useDiv to TRUE
2959 *
2960 * @param string $content Input value undergoing processing in this function.
2961 * @param array $conf stdWrap properties for spaceBefore and space.
2962 * @return string The processed input value
2963 */
2964 public function stdWrap_spaceBefore($content = '', $conf = array()) {
2965 $content = $this->wrapSpace($content, trim($conf['spaceBefore']) . '|', $conf['space.']);
2966 return $content;
2967 }
2968
2969 /**
2970 * spaceAfter
2971 * Will add space after the current content
2972 * By default this is done with a clear.gif but it can be done with CSS margins by setting the property space.useDiv to TRUE
2973 *
2974 * @param string $content Input value undergoing processing in this function.
2975 * @param array $conf stdWrap properties for spaceAfter and space.
2976 * @return string The processed input value
2977 */
2978 public function stdWrap_spaceAfter($content = '', $conf = array()) {
2979 $content = $this->wrapSpace($content, '|' . trim($conf['spaceAfter']), $conf['space.']);
2980 return $content;
2981 }
2982
2983 /**
2984 * space
2985 * Will add space before or after the current content
2986 * By default this is done with a clear.gif but it can be done with CSS margins by setting the property space.useDiv to TRUE
2987 * See wrap
2988 *
2989 * @param string $content Input value undergoing processing in this function.
2990 * @param array $conf stdWrap properties for space.
2991 * @return string The processed input value
2992 */
2993 public function stdWrap_space($content = '', $conf = array()) {
2994 $content = $this->wrapSpace($content, trim($conf['space']), $conf['space.']);
2995 return $content;
2996 }
2997
2998 /**
2999 * wrap
3000 * This is the "mother" of all wraps
3001 * Third of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3002 * Basically it will put additional content before and after the current content using a split character as a placeholder for the current content
3003 * The default split character is | but it can be replaced with other characters by the property splitChar
3004 * Any other wrap that does not have own splitChar settings will be using the default split char though
3005 *
3006 * @param string $content Input value undergoing processing in this function.
3007 * @param array $conf stdWrap properties for wrap.
3008 * @return string The processed input value
3009 */
3010 public function stdWrap_wrap($content = '', $conf = array()) {
3011 $content = $this->wrap($content, $conf['wrap'], ($conf['wrap.']['splitChar'] ? $conf['wrap.']['splitChar'] : '|'));
3012 return $content;
3013 }
3014
3015 /**
3016 * noTrimWrap
3017 * Fourth of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3018 * The major difference to any other wrap is, that this one can make use of whitespace without trimming *
3019 *
3020 * @param string $content Input value undergoing processing in this function.
3021 * @param array $conf stdWrap properties for noTrimWrap.
3022 * @return string The processed input value
3023 */
3024 public function stdWrap_noTrimWrap($content = '', $conf = array()) {
3025 $content = $this->noTrimWrap($content, $conf['noTrimWrap']);
3026 return $content;
3027 }
3028
3029 /**
3030 * wrap2
3031 * Fifth of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3032 * The default split character is | but it can be replaced with other characters by the property splitChar
3033 *
3034 * @param string $content Input value undergoing processing in this function.
3035 * @param array $conf stdWrap properties for wrap2.
3036 * @return string The processed input value
3037 */
3038 public function stdWrap_wrap2($content = '', $conf = array()) {
3039 $content = $this->wrap($content, $conf['wrap2'], ($conf['wrap2.']['splitChar'] ? $conf['wrap2.']['splitChar'] : '|'));
3040 return $content;
3041 }
3042
3043 /**
3044 * dataWrap
3045 * Sixth of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3046 * Can fetch additional content the same way data does (i.e. {field:whatever}) and apply it to the wrap before that is applied to the content
3047 *
3048 * @param string $content Input value undergoing processing in this function.
3049 * @param array $conf stdWrap properties for dataWrap.
3050 * @return string The processed input value
3051 */
3052 public function stdWrap_dataWrap($content = '', $conf = array()) {
3053 $content = $this->dataWrap($content, $conf['dataWrap']);
3054 return $content;
3055 }
3056
3057 /**
3058 * prepend
3059 * A content object that will be prepended to the current content after most of the wraps have already been applied
3060 *
3061 * @param string $content Input value undergoing processing in this function.
3062 * @param array $conf stdWrap properties for prepend.
3063 * @return string The processed input value
3064 */
3065 public function stdWrap_prepend($content = '', $conf = array()) {
3066 $content = $this->cObjGetSingle($conf['prepend'], $conf['prepend.'], '/stdWrap/.prepend') . $content;
3067 return $content;
3068 }
3069
3070 /**
3071 * append
3072 * A content object that will be appended to the current content after most of the wraps have already been applied
3073 *
3074 * @param string $content Input value undergoing processing in this function.
3075 * @param array $conf stdWrap properties for append.
3076 * @return string The processed input value
3077 */
3078 public function stdWrap_append($content = '', $conf = array()) {
3079 $content .= $this->cObjGetSingle($conf['append'], $conf['append.'], '/stdWrap/.append');
3080 return $content;
3081 }
3082
3083 /**
3084 * wrap3
3085 * Seventh of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3086 * The default split character is | but it can be replaced with other characters by the property splitChar
3087 *
3088 * @param string $content Input value undergoing processing in this function.
3089 * @param array $conf stdWrap properties for wrap3.
3090 * @return string The processed input value
3091 */
3092 public function stdWrap_wrap3($content = '', $conf = array()) {
3093 $content = $this->wrap($content, $conf['wrap3'], ($conf['wrap3.']['splitChar'] ? $conf['wrap3.']['splitChar'] : '|'));
3094 return $content;
3095 }
3096
3097 /**
3098 * orderedStdWrap
3099 * Calls stdWrap for each entry in the provided array
3100 *
3101 * @param string $content Input value undergoing processing in this function.
3102 * @param array $conf stdWrap properties for orderedStdWrap.
3103 * @return string The processed input value
3104 */
3105 public function stdWrap_orderedStdWrap($content = '', $conf = array()) {
3106 $sortedKeysArray = t3lib_TStemplate::sortedKeyList($conf['orderedStdWrap.'], TRUE);
3107 foreach ($sortedKeysArray as $key) {
3108 $content = $this->stdWrap($content, $conf['orderedStdWrap.'][$key . '.']);
3109 }
3110 return $content;
3111 }
3112 /**
3113 * outerWrap
3114 * Eighth of a set of different wraps which will be applied in a certain order before or after other functions that modify the content
3115 *
3116 * @param string $content Input value undergoing processing in this function.
3117 * @param array $conf stdWrap properties for outerWrap.
3118 * @return string The processed input value
3119 */
3120 public function stdWrap_outerWrap($content = '', $conf = array()) {
3121 $content = $this->wrap($content, $conf['outerWrap']);
3122 return $content;
3123 }
3124
3125 /**
3126 * insertData
3127 * Can fetch additional content the same way data does and replaces any occurence of {field:whatever} with this content
3128 *
3129 * @param string $content Input value undergoing processing in this function.
3130 * @param array $conf stdWrap properties for insertData.
3131 * @return string The processed input value
3132 */
3133 public function stdWrap_insertData($content = '', $conf = array()) {
3134 $content = $this->insertData($content);
3135 return $content;
3136 }
3137
3138 /**
3139 * offsetWrap
3140 * Creates a so called offset table around the content
3141 * Still here for historical reasons even not used too much nowadays
3142 *
3143 * @param string $content Input value undergoing processing in this function.
3144 * @param array $conf stdWrap properties for offsetWrap.
3145 * @return string The processed input value
3146 */
3147 public function stdWrap_offsetWrap($content = '', $conf = array()) {
3148 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
3149 if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {
3150 $controlTable->tableParams = isset($conf['offsetWrap.']['tableParams.'])
3151 ? $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.'])
3152 : $conf['offsetWrap.']