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