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