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