[BUGFIX] Autoloader Cache is not updated
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_tsparser_ext.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * TSParser extension class to t3lib_TStemplate
29 *
30 * Contains functions for the TS module in TYPO3 backend
31 *
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 */
34
35
36 /**
37 * TSParser extension class to t3lib_TStemplate
38 *
39 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
40 * @package TYPO3
41 * @subpackage t3lib
42 */
43 class t3lib_tsparser_ext extends t3lib_TStemplate {
44
45 var $edit_divider = '###MOD_TS:EDITABLE_CONSTANTS###'; // This string is used to indicate the point in a template from where the editable constants are listed. Any vars before this point (if it exists though) is regarded as default values.
46 var $HTMLcolorList = 'aqua,beige,black,blue,brown,fuchsia,gold,gray,green,lime,maroon,navy,olive,orange,purple,red,silver,tan,teal,turquoise,yellow,white';
47
48 // internal
49 var $categories = array(
50 'basic' => array(), // Constants of superior importance for the template-layout. This is dimensions, imagefiles and enabling of various features. The most basic constants, which you would almost always want to configure.
51 'menu' => array(), // Menu setup. This includes fontfiles, sizes, background images. Depending on the menutype.
52 'content' => array(), // All constants related to the display of pagecontent elements
53 'page' => array(), // General configuration like metatags, link targets
54 'advanced' => array(), // Advanced functions, which are used very seldomly.
55 'all' => array() // All constants are put here also!
56 ); // This will be filled with the available categories of the current template.
57 var $subCategories = array(
58 // Standard categories:
59 'enable' => Array('Enable features', 'a'),
60 'dims' => Array('Dimensions, widths, heights, pixels', 'b'),
61 'file' => Array('Files', 'c'),
62 'typo' => Array('Typography', 'd'),
63 'color' => Array('Colors', 'e'),
64 'links' => Array('Links and targets', 'f'),
65 'language' => Array('Language specific constants', 'g'),
66
67 // subcategories based on the default content elements
68 'cheader' => Array('Content: \'Header\'', 'ma'),
69 'cheader_g' => Array('Content: \'Header\', Graphical', 'ma'),
70 'ctext' => Array('Content: \'Text\'', 'mb'),
71 'cimage' => Array('Content: \'Image\'', 'md'),
72 'cbullets' => Array('Content: \'Bullet list\'', 'me'),
73 'ctable' => Array('Content: \'Table\'', 'mf'),
74 'cuploads' => Array('Content: \'Filelinks\'', 'mg'),
75 'cmultimedia' => Array('Content: \'Multimedia\'', 'mh'),
76 'cmedia' => Array('Content: \'Media\'', 'mr'),
77 'cmailform' => Array('Content: \'Form\'', 'mi'),
78 'csearch' => Array('Content: \'Search\'', 'mj'),
79 'clogin' => Array('Content: \'Login\'', 'mk'),
80 'csplash' => Array('Content: \'Textbox\'', 'ml'),
81 'cmenu' => Array('Content: \'Menu/Sitemap\'', 'mm'),
82 'cshortcut' => Array('Content: \'Insert records\'', 'mn'),
83 'clist' => Array('Content: \'List of records\'', 'mo'),
84 'cscript' => Array('Content: \'Script\'', 'mp'),
85 'chtml' => Array('Content: \'HTML\'', 'mq')
86 );
87 var $resourceDimensions = array();
88 var $dirResources = array();
89
90 var $backend_info = 1;
91
92 // tsconstanteditor
93 var $ext_inBrace = 0;
94
95 // tsbrowser
96 var $tsbrowser_searchKeys = array();
97 var $tsbrowser_depthKeys = array();
98 var $constantMode = '';
99 var $regexMode = '';
100 var $fixedLgd = '';
101 var $resourceCheck = 0;
102 var $ext_lineNumberOffset = 0;
103 var $ext_localGfxPrefix = '';
104 var $ext_localWebGfxPrefix = '';
105 var $ext_expandAllNotes = 0;
106 var $ext_noPMicons = 0;
107 var $ext_noSpecialCharsOnLabels = 0;
108 var $ext_listOfTemplatesArr = array();
109 var $ext_lineNumberOffset_mode = '';
110 var $ext_dontCheckIssetValues = 0; // Dont change...
111 var $ext_noCEUploadAndCopying = 0;
112 var $ext_printAll = 0;
113 var $ext_CEformName = 'forms[0]';
114 var $ext_defaultOnlineResourceFlag = 0;
115 var $doNotSortCategoriesBeforeMakingForm = FALSE;
116
117 // ts analyzer
118 var $templateTitles = array();
119
120
121 /**
122 * This flattens a hierarchical setuparray to $this->flatSetup
123 * The original function fetched the resource-file if any ('file.'). This functions doesn't.
124 *
125 * @param [type] $setupArray: ...
126 * @param [type] $prefix: ...
127 * @param [type] $resourceFlag: ...
128 * @return [type] ...
129 */
130 function flattenSetup($setupArray, $prefix, $resourceFlag) {
131 if (is_array($setupArray)) {
132 $this->getFileName_backPath = PATH_site; // Setting absolute prefixed path for relative resources.
133 foreach ($setupArray as $key => $val) {
134 if ($prefix || substr($key, 0, 16) != 'TSConstantEditor') { // We don't want 'TSConstantEditor' in the flattend setup.
135 if (is_array($val)) {
136 $this->flattenSetup($val, $prefix . $key, ($key == 'file.'));
137 } elseif ($resourceFlag && $this->resourceCheck) {
138 $this->flatSetup[$prefix . $key] = $this->getFileName($val);
139 if ($this->removeFromGetFilePath &&
140 substr($this->flatSetup[$prefix . $key], 0, strlen($this->removeFromGetFilePath)) == $this->removeFromGetFilePath) {
141 $this->flatSetup[$prefix . $key] = substr($this->flatSetup[$prefix . $key], strlen($this->removeFromGetFilePath));
142 }
143 } else {
144 $this->flatSetup[$prefix . $key] = $val;
145 }
146 }
147 }
148 }
149 }
150
151 /**
152 * [Describe function...]
153 *
154 * @param [type] $all: ...
155 * @return [type] ...
156 */
157 function substituteConstants($all) {
158 $this->Cmarker = substr(md5(uniqid('')), 0, 6);
159
160 return preg_replace_callback('/\{\$(.[^}]+)\}/', array($this, 'substituteConstantsCallBack'), $all);
161 }
162
163 /**
164 * Call back method for preg_replace_callback in substituteConstants
165 *
166 * @param array Regular expression matches
167 * @return string Replacement
168 * @see substituteConstants()
169 */
170 function substituteConstantsCallBack($matches) {
171 switch ($this->constantMode) {
172 case 'const':
173 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
174 '##' . $this->Cmarker . '_B##' . $matches[0] . '##' . $this->Cmarker . '_E##' :
175 $matches[0];
176 break;
177 case 'subst':
178 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
179 '##' . $this->Cmarker . '_B##' . $this->flatSetup[$matches[1]] . '##' . $this->Cmarker . '_E##' :
180 $matches[0];
181 break;
182 case 'untouched':
183 $ret_val = $matches[0];
184 break;
185 default:
186 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
187 $this->flatSetup[$matches[1]] :
188 $matches[0];
189 }
190
191 return $ret_val;
192 }
193
194 /**
195 * [Describe function...]
196 *
197 * @param [type] $all: ...
198 * @return [type] ...
199 */
200 function substituteCMarkers($all) {
201 switch ($this->constantMode) {
202 case 'const':
203 $all = str_replace('##' . $this->Cmarker . '_B##', '<font color="green"><strong>', $all);
204 $all = str_replace('##' . $this->Cmarker . '_E##', '</strong></font>', $all);
205 break;
206 case 'subst':
207 $all = str_replace('##' . $this->Cmarker . '_B##', '<font color="green"><strong>', $all);
208 $all = str_replace('##' . $this->Cmarker . '_E##', '</strong></font>', $all);
209 break;
210 default:
211 $all = $all;
212 break;
213 }
214 return $all;
215 }
216
217 /**
218 * Parses the constants in $this->const with respect to the constant-editor in this module.
219 * In particular comments in the code are registered and the edit_divider is taken into account.
220 *
221 * @return [type] ...
222 */
223 function generateConfig_constants() {
224 // These vars are also set lateron...
225 $this->setup['resources'] = $this->resources;
226 $this->setup['sitetitle'] = $this->sitetitle;
227
228 // parse constants
229 $constants = t3lib_div::makeInstance('t3lib_TSparser');
230 $constants->regComments = 1; // Register comments!
231 $constants->setup = $this->const;
232 $constants->setup = $this->mergeConstantsFromPageTSconfig($constants->setup);
233
234 /* @var $matchObj t3lib_matchCondition_frontend */
235 $matchObj = t3lib_div::makeInstance('t3lib_matchCondition_frontend');
236 $matchObj->setSimulateMatchResult(TRUE); // Matches ALL conditions in TypoScript
237
238 $c = 0;
239 $cc = count($this->constants);
240 foreach ($this->constants as $str) {
241 $c++;
242 if ($c == $cc) {
243 if (strstr($str, $this->edit_divider)) {
244 $parts = explode($this->edit_divider, $str, 2);
245 $str = $parts[1];
246 $constants->parse($parts[0], $matchObj);
247 }
248 $this->flatSetup = Array();
249 $this->flattenSetup($constants->setup, '', '');
250 $defaultConstants = $this->flatSetup;
251 }
252 $constants->parse($str, $matchObj);
253 }
254
255 $this->flatSetup = Array();
256 $this->flattenSetup($constants->setup, '', '');
257 $this->setup['constants'] = $constants->setup;
258
259 return $this->ext_compareFlatSetups($defaultConstants);
260 }
261
262 /**
263 * [Describe function...]
264 *
265 * @param [type] $theSetup: ...
266 * @param [type] $theKey: ...
267 * @return [type] ...
268 */
269 function ext_getSetup($theSetup, $theKey) {
270 $parts = explode('.', $theKey, 2);
271 if (strcmp($parts[0], '') && is_array($theSetup[$parts[0] . '.'])) {
272 if (strcmp(trim($parts[1]), '')) {
273 return $this->ext_getSetup($theSetup[$parts[0] . '.'], trim($parts[1]));
274 } else {
275 return array($theSetup[$parts[0] . '.'], $theSetup[$parts[0]]);
276 }
277 } else {
278 if (strcmp(trim($theKey), '')) {
279 return array(array(), $theSetup[$theKey]);
280 } else {
281 return array($theSetup, '');
282 }
283 }
284 }
285
286 /**
287 * [Describe function...]
288 *
289 * @param [type] $arr: ...
290 * @param [type] $depth_in: ...
291 * @param [type] $depthData: ...
292 * @param [type] $parentType: ...
293 * @param [type] $parentValue: ...
294 * @param boolean $alphaSort sorts the array keys / tree by alphabet when set to 1
295 * @return [type] ...
296 */
297 function ext_getObjTree($arr, $depth_in, $depthData, $parentType = '', $parentValue = '', $alphaSort = '0') {
298 $HTML = '';
299 $a = 0;
300
301 if ($alphaSort == '1') {
302 ksort($arr);
303 }
304 $keyArr_num = array();
305 $keyArr_alpha = array();
306 foreach ($arr as $key => $value) {
307 if (substr($key, -2) != '..') { // Don't do anything with comments / linenumber registrations...
308 $key = preg_replace('/\.$/', '', $key);
309 if (substr($key, -1) != '.') {
310 if (t3lib_utility_Math::canBeInterpretedAsInteger($key)) {
311 $keyArr_num[$key] = $arr[$key];
312 } else {
313 $keyArr_alpha[$key] = $arr[$key];
314 }
315 }
316 }
317 }
318 ksort($keyArr_num);
319 $keyArr = $keyArr_num + $keyArr_alpha;
320 $c = count($keyArr);
321 if ($depth_in) {
322 $depth_in = $depth_in . '.';
323 }
324
325 foreach ($keyArr as $key => $value) {
326 $a++;
327 $depth = $depth_in . $key;
328 if ($this->bType != 'const' || substr($depth, 0, 1) != '_') { // this excludes all constants starting with '_' from being shown.
329 $goto = substr(md5($depth), 0, 6);
330 $deeper = (is_array($arr[$key . '.']) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes)) ? 1 : 0;
331 $PM = 'join';
332 $LN = ($a == $c) ? 'blank' : 'line';
333 $BTM = ($a == $c) ? 'bottom' : '';
334 $PM = is_array($arr[$key . '.']) && !$this->ext_noPMicons ? ($deeper ? 'minus' : 'plus') : 'join';
335
336 $HTML .= $depthData;
337 $theIcon = '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" alt="" />';
338 if ($PM == 'join') {
339 $HTML .= $theIcon;
340 } else {
341 $aHref = 'index.php?id=' . $GLOBALS['SOBE']->id .
342 '&tsbr[' . $depth . ']=' . ($deeper ? 0 : 1) .
343 (t3lib_div::_GP("breakPointLN") ? '&breakPointLN=' . t3lib_div::_GP("breakPointLN") : '') .
344 '#' . $goto;
345 $HTML .= '<a name="' . $goto . '" href="' . htmlspecialchars($aHref) . '">' . $theIcon . '</a>';
346 }
347
348 $label = $key;
349 if (t3lib_div::inList('types,resources,sitetitle', $depth) && $this->bType == 'setup') { // Read only...
350 $label = '<font color="#666666">' . $label . '</font>';
351 } else {
352 if ($this->linkObjects) {
353 $aHref = 'index.php?id=' . $GLOBALS['SOBE']->id .
354 '&sObj=' . $depth .
355 (t3lib_div::_GP("breakPointLN") ? '&breakPointLN=' . t3lib_div::_GP("breakPointLN") : '');
356 if ($this->bType != 'const') {
357 $ln = is_array($arr[$key . '.ln..']) ? 'Defined in: ' . $this->lineNumberToScript($arr[$key . '.ln..']) : 'N/A';
358 } else {
359 $ln = '';
360 }
361
362 if ($this->tsbrowser_searchKeys[$depth] & 4) {
363 $label = '<strong><font color="red">' . $label . '</font></strong>';
364 } // The key has matched the search string
365 $label = '<a href="' . htmlspecialchars($aHref) . '" title="' . htmlspecialchars($ln) . '">' . $label . '</a>';
366 }
367 }
368
369 $HTML .= '[' . $label . ']';
370
371 if (isset($arr[$key])) {
372 $theValue = $arr[$key];
373 if ($this->fixedLgd) {
374 $imgBlocks = ceil(1 + strlen($depthData) / 77);
375 $lgdChars = 68 - ceil(strlen('[' . $key . ']') * 0.8) - $imgBlocks * 3;
376 $theValue = $this->ext_fixed_lgd($theValue, $lgdChars);
377 }
378 if ($this->tsbrowser_searchKeys[$depth] & 2) { // The value has matched the search string
379 $HTML .= '&nbsp;=&nbsp;<strong><font color="red">' . $this->makeHtmlspecialchars($theValue) . '</font></strong>';
380 } else {
381 $HTML .= '&nbsp;=&nbsp;<strong>' . $this->makeHtmlspecialchars($theValue) . '</strong>';
382 }
383 if ($this->ext_regComments && isset($arr[$key . '..'])) {
384 $comment = $arr[$key . '..'];
385 if (!preg_match('/### <INCLUDE_TYPOSCRIPT:.*/', $comment)) { // Skip INCLUDE_TYPOSCRIPT comments, they are almost useless
386 $comment = preg_replace('/[\r\n]/', ' ', $comment); // Remove linebreaks, replace with ' '
387 $comment = preg_replace('/[#\*]{2,}/', '', $comment); // Remove # and * if more than twice in a row
388 $comment = preg_replace('/^[#\*\s]+/', '# ', $comment); // Replace leading # (just if it exists) and add it again. Result: Every comment should be prefixed by a '#'.
389 $comment = $this->makeHtmlspecialchars($comment); // Masking HTML Tags: Replace < with &lt; and > with &gt;
390 $HTML .= ' <span class="comment">' . trim($comment) . '</span>';
391 }
392 }
393 }
394 $HTML .= '<br />';
395
396 if ($deeper) {
397 $HTML .= $this->ext_getObjTree(
398 $arr[$key . '.'],
399 $depth,
400 $depthData . '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $LN . '.gif" width="18" height="16" align="top" alt="" />',
401 '' /* not used: $validate_info[$key] */,
402 $arr[$key],
403 $alphaSort
404 );
405 }
406 }
407 }
408 return $HTML;
409 }
410
411 /**
412 * [Describe function...]
413 *
414 * @param [type] $lnArr: ...
415 * @return [type] ...
416 */
417 function lineNumberToScript($lnArr) {
418 if (!is_array($this->lnToScript)) {
419 $this->lnToScript = array();
420 $c = 1;
421 $c += substr_count($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup'], LF) + 2;
422 $this->lnToScript[$c] = '[Default]';
423
424 foreach ($this->hierarchyInfoToRoot as $info) {
425 $c += $info['configLines'] + 1;
426 $this->lnToScript[$c] = $info['title'];
427 }
428 }
429
430 foreach ($lnArr as $k => $ln) {
431 foreach ($this->lnToScript as $endLn => $title) {
432 if ($endLn >= intval($ln)) {
433 $lnArr[$k] = '"' . $title . '", ' . $ln;
434 break;
435 }
436 }
437 }
438
439 return implode('; ', $lnArr);
440 }
441
442 /**
443 * [Describe function...]
444 *
445 * @param [type] $theValue: ...
446 * @return [type] ...
447 */
448 function makeHtmlspecialchars($theValue) {
449 return $this->ext_noSpecialCharsOnLabels ? $theValue : htmlspecialchars($theValue);
450 }
451
452 /**
453 * [Describe function...]
454 *
455 * @param [type] $arr: ...
456 * @param [type] $depth_in: ...
457 * @param [type] $searchString: ...
458 * @param [type] $keyArray: ...
459 * @return [type] ...
460 */
461 function ext_getSearchKeys($arr, $depth_in, $searchString, $keyArray) {
462 $keyArr = array();
463 foreach ($arr as $key => $value) {
464 $key = preg_replace('/\.$/', '', $key);
465 if (substr($key, -1) != '.') {
466 $keyArr[$key] = 1;
467 }
468 }
469 $c = count($keyArr);
470 if ($depth_in) {
471 $depth_in = $depth_in . '.';
472 }
473 foreach ($keyArr as $key => $value) {
474 $depth = $depth_in . $key;
475 $deeper = is_array($arr[$key . '.']);
476
477 if ($this->regexMode) {
478 if (preg_match('/' . $searchString . '/', $arr[$key])) { // The value has matched
479 $this->tsbrowser_searchKeys[$depth] += 2;
480 }
481 if (preg_match('/' . $searchString . '/', $key)) { // The key has matched
482 $this->tsbrowser_searchKeys[$depth] += 4;
483 }
484 if (preg_match('/' . $searchString . '/', $depth_in)) { // Just open this subtree if the parent key has matched the search
485 $this->tsbrowser_searchKeys[$depth] = 1;
486 }
487 } else {
488 if (stristr($arr[$key], $searchString)) { // The value has matched
489 $this->tsbrowser_searchKeys[$depth] += 2;
490 }
491 if (stristr($key, $searchString)) { // The key has matches
492 $this->tsbrowser_searchKeys[$depth] += 4;
493 }
494 if (stristr($depth_in, $searchString)) { // Just open this subtree if the parent key has matched the search
495 $this->tsbrowser_searchKeys[$depth] = 1;
496 }
497 }
498
499 if ($deeper) {
500 $cS = count($this->tsbrowser_searchKeys);
501 $keyArray = $this->ext_getSearchKeys($arr[$key . '.'], $depth, $searchString, $keyArray);
502 if ($cS != count($this->tsbrowser_searchKeys)) {
503 $keyArray[$depth] = 1;
504 }
505 }
506 }
507 return $keyArray;
508 }
509
510 /**
511 * [Describe function...]
512 *
513 * @param [type] $pid: ...
514 * @return [type] ...
515 */
516 function ext_getRootlineNumber($pid) {
517 if ($pid && is_array($GLOBALS['rootLine'])) {
518 foreach ($GLOBALS['rootLine'] as $key => $val) {
519 if ($val['uid'] == $pid) {
520 return $key;
521 }
522 }
523 }
524 }
525
526 /**
527 * [Describe function...]
528 *
529 * @param [type] $arr: ...
530 * @param [type] $depthData: ...
531 * @param [type] $keyArray: ...
532 * @param [type] $first: ...
533 * @return [type] ...
534 */
535 function ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first = 0) {
536 $keyArr = array();
537 foreach ($arr as $key => $value) {
538 $key = preg_replace('/\.$/', '', $key);
539 if (substr($key, -1) != '.') {
540 $keyArr[$key] = 1;
541 }
542 }
543 $a = 0;
544 $c = count($keyArr);
545 static $i = 0;
546 foreach ($keyArr as $key => $value) {
547 $HTML = '';
548 $a++;
549 $deeper = is_array($arr[$key . '.']);
550 $row = $arr[$key];
551
552 $PM = 'join';
553 $LN = ($a == $c) ? 'blank' : 'line';
554 $BTM = ($a == $c) ? 'top' : '';
555 $PM = 'join';
556
557 $HTML .= $depthData;
558
559 $alttext = '[' . $row['templateID'] . ']';
560 $alttext .= $row['pid'] ? ' - ' . t3lib_BEfunc::getRecordPath($row['pid'], $GLOBALS['SOBE']->perms_clause, 20) : '';
561
562 $icon = (substr($row['templateID'], 0, 3) == 'sys' ?
563 t3lib_iconWorks::getSpriteIconForRecord('sys_template', $row, array('title' => $alttext))
564 : t3lib_iconWorks::getSpriteIcon('mimetypes-x-content-template-static', array('title' => $alttext))
565 );
566 if (in_array($row['templateID'], $this->clearList_const) || in_array($row['templateID'], $this->clearList_setup)) {
567 $A_B = '<a href="index.php?id=' . htmlspecialchars($GLOBALS['SOBE']->id . '&template=' . $row['templateID']) . '">';
568 $A_E = '</a>';
569 if (t3lib_div::_GP('template') == $row['templateID']) {
570 $A_B = '<strong>' . $A_B;
571 $A_E .= '</strong>';
572 }
573 } else {
574 $A_B = '';
575 $A_E = '';
576 }
577 $HTML .= ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" alt="" />') .
578 $icon .
579 $A_B . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . $A_E . '&nbsp;&nbsp;';
580 $RL = $this->ext_getRootlineNumber($row['pid']);
581 $keyArray[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
582 <td nowrap="nowrap">' . $HTML . '</td>
583 <td align="center">' . ($row['root'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;</td>
584 <td align="center">' . ($row['clConf'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
585 <td align="center">' . ($row['clConst'] ? t3lib_iconWorks::getSpriteIcon('status-status-checked') : '') . '&nbsp;&nbsp;' . '</td>
586 <td align="center">' . ($row['pid'] ? $row['pid'] : '') . '</td>
587 <td align="center">' . (strcmp($RL, '') ? $RL : '') . '</td>
588 <td>' . ($row['next'] ? '&nbsp;' . $row['next'] . '&nbsp;&nbsp;' : '') . '</td>
589 </tr>';
590 if ($deeper) {
591 $keyArray = $this->ext_getTemplateHierarchyArr(
592 $arr[$key . '.'],
593 $depthData . ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $LN . '.gif" width="18" height="16" align="top" />'),
594 $keyArray
595 );
596 }
597 }
598 return $keyArray;
599 }
600
601 /**
602 * [Describe function...]
603 *
604 * @param [type] $depthDataArr: ...
605 * @param [type] $pointer: ...
606 * @return [type] ...
607 */
608 function ext_process_hierarchyInfo($depthDataArr, &$pointer) {
609 $parent = $this->hierarchyInfo[$pointer - 1]['templateParent'];
610 while ($pointer > 0 && $this->hierarchyInfo[$pointer - 1]['templateParent'] == $parent) {
611 $pointer--;
612 $row = $this->hierarchyInfo[$pointer];
613
614 $depthDataArr[$row['templateID']] = $row;
615 $depthDataArr[$row['templateID']]['bgcolor_setup'] = isset($this->clearList_setup_temp[$row['templateID']]) ? ' class="bgColor5"' : '';
616 $depthDataArr[$row['templateID']]['bgcolor_const'] = isset($this->clearList_const_temp[$row['templateID']]) ? ' class="bgColor5"' : '';
617 unset($this->clearList_setup_temp[$row['templateID']]);
618 unset($this->clearList_const_temp[$row['templateID']]);
619 $this->templateTitles[$row['templateID']] = $row['title'];
620
621 if ($row['templateID'] == $this->hierarchyInfo[$pointer - 1]['templateParent']) {
622 $depthDataArr[$row['templateID'] . '.'] = $this->ext_process_hierarchyInfo(array(), $pointer);
623 }
624 }
625 return $depthDataArr;
626 }
627
628 /**
629 * [Describe function...]
630 *
631 * @param [type] $config: ...
632 * @param [type] $lineNumbers: ...
633 * @param [type] $comments: ...
634 * @param [type] $crop: ...
635 * @param [type] $syntaxHL: ...
636 * @param [type] $syntaxHLBlockmode: ...
637 * @return [type] ...
638 */
639 function ext_outputTS($config, $lineNumbers = 0, $comments = 0, $crop = 0, $syntaxHL = 0, $syntaxHLBlockmode = 0) {
640 $all = '';
641 foreach ($config as $str) {
642 $all .= LF . '[GLOBAL]' . LF . $str;
643 }
644
645 if ($syntaxHL) {
646 $all = preg_replace('/^[^' . LF . ']*./', '', $all);
647 $all = chop($all);
648 $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
649 $tsparser->lineNumberOffset = $this->ext_lineNumberOffset + 1;
650 $tsparser->parentObject = $this;
651 return $tsparser->doSyntaxHighlight($all, $lineNumbers ? array($this->ext_lineNumberOffset + 1) : '', $syntaxHLBlockmode);
652 } else {
653 return $this->ext_formatTS($all, $lineNumbers, $comments, $crop);
654 }
655 }
656
657 /**
658 * Returns a new string of max. $chars lenght
659 * If the string is longer, it will be truncated and prepended with '...'
660 * $chars must be an integer of at least 4
661 *
662 * @param [type] $string: ...
663 * @param [type] $chars: ...
664 * @return [type] ...
665 */
666 function ext_fixed_lgd($string, $chars) {
667 if ($chars >= 4) {
668 if (strlen($string) > $chars) {
669 if (strlen($string) > 24 && substr($string, 0, 12) == '##' . $this->Cmarker . '_B##') {
670 return '##' . $this->Cmarker . '_B##' . t3lib_div::fixed_lgd_cs(substr($string, 12, -12), $chars - 3) . '##' . $this->Cmarker . '_E##';
671 } else {
672 return t3lib_div::fixed_lgd_cs($string, $chars - 3);
673 }
674 }
675 }
676 return $string;
677 }
678
679 /**
680 * [Describe function...]
681 *
682 * @param [type] $ln: ...
683 * @param [type] $str: ...
684 * @return [type] ...
685 */
686 function ext_lnBreakPointWrap($ln, $str) {
687 return '<a href="#" onClick="return brPoint(' . $ln . ',' . ($this->ext_lineNumberOffset_mode == "setup" ? 1 : 0) . ');">' . $str . '</a>';
688 }
689
690 /**
691 * [Describe function...]
692 *
693 * @param [type] $input: ...
694 * @param [type] $ln: ...
695 * @param [type] $comments: ...
696 * @param [type] $crop: ...
697 * @return [type] ...
698 */
699 function ext_formatTS($input, $ln, $comments = 1, $crop = 0) {
700 $input = preg_replace('/^[^' . LF . ']*./', '', $input);
701 $input = chop($input);
702 $cArr = explode(LF, $input);
703
704 $n = ceil(log10(count($cArr) + $this->ext_lineNumberOffset));
705 $lineNum = '';
706 foreach ($cArr as $k => $v) {
707 $lln = $k + $this->ext_lineNumberOffset + 1;
708 if ($ln) {
709 $lineNum = $this->ext_lnBreakPointWrap($lln, str_replace(' ', '&nbsp;', sprintf('% ' . $n . 'd', $lln))) . ': ';
710 }
711 $v = htmlspecialchars($v);
712 if ($crop) {
713 $v = $this->ext_fixed_lgd($v, ($ln ? 71 : 77));
714 }
715 $cArr[$k] = $lineNum . str_replace(' ', '&nbsp;', $v);
716
717 $firstChar = substr(trim($v), 0, 1);
718 if ($firstChar == '[') {
719 $cArr[$k] = '<font color="green"><strong>' . $cArr[$k] . '</strong></font>';
720 } elseif ($firstChar == '/' || $firstChar == '#') {
721 if ($comments) {
722 $cArr[$k] = '<span class="typo3-dimmed">' . $cArr[$k] . '</span>';
723 } else {
724 unset($cArr[$k]);
725 }
726 }
727
728
729 }
730 $output = implode($cArr, '<br />') . '<br />';
731 return $output;
732 }
733
734 /**
735 * [Describe function...]
736 *
737 * @param [type] $id: ...
738 * @param [type] $template_uid: ...
739 * @return [type] ...
740 */
741 function ext_getFirstTemplate($id, $template_uid = 0) {
742 // Query is taken from the runThroughTemplates($theRootLine) function in the parent class.
743 if (intval($id)) {
744 if ($template_uid) {
745 $addC = ' AND uid=' . $template_uid;
746 }
747 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid=' . intval($id) . $addC . ' ' . $this->whereClause, '', 'sorting', '1');
748 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
749 t3lib_BEfunc::workspaceOL('sys_template', $row);
750 $GLOBALS['TYPO3_DB']->sql_free_result($res);
751 return $row; // Returns the template row if found.
752 }
753 }
754
755 /**
756 * [Describe function...]
757 *
758 * @param [type] $id: ...
759 * @return [type] ...
760 */
761 function ext_getAllTemplates($id) {
762 // Query is taken from the runThroughTemplates($theRootLine) function in the parent class.
763 if (intval($id)) {
764 $outRes = array();
765 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid=' . intval($id) . ' ' . $this->whereClause, '', 'sorting');
766 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
767 t3lib_BEfunc::workspaceOL('sys_template', $row);
768 if (is_array($row)) {
769 $outRes[] = $row;
770 }
771 }
772 $GLOBALS['TYPO3_DB']->sql_free_result($res);
773 return $outRes; // Returns the template rows in an array.
774 }
775 }
776
777 /**
778 * This function compares the flattened constants (default and all).
779 * Returns an array with the constants from the whole template which may be edited by the module.
780 *
781 * @param [type] $default: ...
782 * @return [type] ...
783 */
784 function ext_compareFlatSetups($default) {
785 $editableComments = array();
786 foreach ($this->flatSetup as $const => $value) {
787 if (substr($const, -2) != '..' && isset($this->flatSetup[$const . '..'])) {
788 $comment = trim($this->flatSetup[$const . '..']);
789 $c_arr = explode(LF, $comment);
790 foreach ($c_arr as $k => $v) {
791 $line = trim(preg_replace('/^[#\/]*/', '', $v));
792 if ($line) {
793 $parts = explode(';', $line);
794 foreach ($parts as $par) {
795 if (strstr($par, '=')) {
796 $keyValPair = explode('=', $par, 2);
797 switch (trim(strtolower($keyValPair[0]))) {
798 case 'type':
799 // Type:
800 $editableComments[$const]['type'] = trim($keyValPair[1]);
801 break;
802 case 'cat':
803 // list of categories.
804 $catSplit = explode('/', strtolower($keyValPair[1]));
805 $editableComments[$const]['cat'] = trim($catSplit[0]);
806 $catSplit[1] = trim($catSplit[1]); // This is the subcategory. Must be a key in $this->subCategories[]. catSplit[2] represents the search-order within the subcat.
807 if ($catSplit[1] && isset($this->subCategories[$catSplit[1]])) {
808 $editableComments[$const]['subcat_name'] = $catSplit[1];
809 $editableComments[$const]['subcat'] = $this->subCategories[$catSplit[1]][1] . '/' .
810 $catSplit[1] . '/' . trim($catSplit[2]) . 'z';
811 } else {
812 $editableComments[$const]['subcat'] = 'x' . '/' . trim($catSplit[2]) . 'z';
813 }
814 break;
815 case 'label':
816 // label
817 $editableComments[$const]['label'] = trim($keyValPair[1]);
818 break;
819 case 'customsubcategory':
820 // custom subCategory label
821 $customSubcategory = explode('=', $keyValPair[1], 2);
822 if (trim($customSubcategory[0])) {
823 $subCategoryKey = strtolower($customSubcategory[0]);
824 $this->subCategories[$subCategoryKey][0] = $GLOBALS['LANG']->sL($customSubcategory[1]);
825 }
826 break;
827 }
828 }
829 }
830 }
831 }
832 }
833 if (isset($editableComments[$const])) {
834 $editableComments[$const]['name'] = $const;
835 $editableComments[$const]['value'] = trim($value);
836 if (isset($default[$const])) {
837 $editableComments[$const]['default_value'] = trim($default[$const]);
838 }
839 }
840 }
841 return $editableComments;
842 }
843
844 /**
845 * [Describe function...]
846 *
847 * @param [type] $editConstArray: ...
848 * @return [type] ...
849 */
850 function ext_categorizeEditableConstants($editConstArray) {
851 // Runs through the available constants and fills the $this->categories array with pointers and priority-info
852 foreach ($editConstArray as $constName => $constData) {
853 if (!$constData['type']) {
854 $constData['type'] = 'string';
855 }
856 $cats = explode(',', $constData['cat']);
857 foreach ($cats as $theCat) { // if = only one category, while allows for many. We have agreed on only one category is the most basic way...
858 $theCat = trim($theCat);
859 if ($theCat) {
860 $this->categories[$theCat][$constName] = $constData['subcat'];
861 }
862 }
863 }
864 }
865
866 /**
867 * [Describe function...]
868 *
869 * @return [type] ...
870 */
871 function ext_getCategoryLabelArray() {
872 // Returns array used for labels in the menu.
873 $retArr = array();
874 foreach ($this->categories as $k => $v) {
875 if (count($v)) {
876 $retArr[$k] = strtoupper($k) . ' (' . count($v) . ')';
877 }
878 }
879 return $retArr;
880 }
881
882 /**
883 * [Describe function...]
884 *
885 * @param [type] $type: ...
886 * @return [type] ...
887 */
888 function ext_getTypeData($type) {
889 $retArr = array();
890 $type = trim($type);
891 if (!$type) {
892 $retArr['type'] = 'string';
893 } else {
894 $m = strcspn($type, ' [');
895 $retArr['type'] = strtolower(substr($type, 0, $m));
896 if (t3lib_div::inList('int,options,file,boolean,offset,user', $retArr['type'])) {
897 $p = trim(substr($type, $m));
898 $reg = array();
899 preg_match('/\[(.*)\]/', $p, $reg);
900 $p = trim($reg[1]);
901 if ($p) {
902 $retArr['paramstr'] = $p;
903 switch ($retArr['type']) {
904 case 'int':
905 if (substr($retArr['paramstr'], 0, 1) == '-') {
906 $retArr['params'] = t3lib_div::intExplode('-', substr($retArr['paramstr'], 1));
907 $retArr['params'][0] = intval('-' . $retArr['params'][0]);
908 } else {
909 $retArr['params'] = t3lib_div::intExplode('-', $retArr['paramstr']);
910 }
911 $retArr['paramstr'] = $retArr['params'][0] . ' - ' . $retArr['params'][1];
912 break;
913 case 'options':
914 $retArr['params'] = explode(',', $retArr['paramstr']);
915 break;
916 }
917 }
918 }
919 }
920 return $retArr;
921 }
922
923 /**
924 * [Describe function...]
925 *
926 * @param [type] $category: ...
927 * @return [type] ...
928 */
929 function ext_getTSCE_config($category) {
930 $catConf = $this->setup['constants']['TSConstantEditor.'][$category . '.'];
931 $out = array();
932 if (is_array($catConf)) {
933 foreach ($catConf as $key => $val) {
934 switch ($key) {
935 case 'image':
936 $out['imagetag'] = $this->ext_getTSCE_config_image($catConf['image']);
937 break;
938 case 'description':
939 case 'bulletlist':
940 case 'header':
941 $out[$key] = $val;
942 break;
943 default:
944 if (t3lib_utility_Math::canBeInterpretedAsInteger($key)) {
945 $constRefs = explode(',', $val);
946 foreach ($constRefs as $const) {
947 $const = trim($const);
948 if ($const && $const <= 20) {
949 $out['constants'][$const] .= $this->ext_getKeyImage($key);
950 }
951 }
952 }
953 break;
954 }
955 }
956 }
957 $this->helpConfig = $out;
958 }
959
960 /**
961 * [Describe function...]
962 *
963 * @param [type] $key: ...
964 * @return [type] ...
965 */
966 function ext_getKeyImage($key) {
967 return '<img src="' . $this->ext_localWebGfxPrefix . 'gfx/' . $key . '.gif" align="top" hspace=2>';
968 }
969
970 /**
971 * [Describe function...]
972 *
973 * @param [type] $imgConf: ...
974 * @return [type] ...
975 */
976 function ext_getTSCE_config_image($imgConf) {
977 if (substr($imgConf, 0, 4) == 'gfx/') {
978 $iFile = $this->ext_localGfxPrefix . $imgConf;
979 $tFile = $this->ext_localWebGfxPrefix . $imgConf;
980 } elseif (substr($imgConf, 0, 4) == 'EXT:') {
981 $iFile = t3lib_div::getFileAbsFileName($imgConf);
982 if ($iFile) {
983 $f = substr($iFile, strlen(PATH_site));
984 $tFile = $GLOBALS['BACK_PATH'] . '../' . $f;
985 }
986 } else {
987 $f = 'uploads/tf/' . $this->extractFromResources($this->setup['resources'], $imgConf);
988 $iFile = PATH_site . $f;
989 $tFile = $GLOBALS['BACK_PATH'] . '../' . $f;
990 }
991 $imageInfo = @getImagesize($iFile);
992 return '<img src="' . $tFile . '" ' . $imageInfo[3] . '>';
993 }
994
995 /**
996 * [Describe function...]
997 *
998 * @return [type] ...
999 */
1000 function ext_resourceDims() {
1001 if ($this->setup['resources']) {
1002 $rArr = explode(',', $this->setup['resources']);
1003 foreach ($rArr as $c => $val) {
1004 $val = trim($val);
1005 $theFile = PATH_site . 'uploads/tf/' . $val;
1006 if ($val && @is_file($theFile)) {
1007 $imgInfo = @getimagesize($theFile);
1008 }
1009 if (is_array($imgInfo)) {
1010 $this->resourceDimensions[$val] = ' (' . $imgInfo[0] . 'x' . $imgInfo[1] . ')';
1011 }
1012 }
1013 }
1014 foreach ($this->dirResources as $c => $val) {
1015 $val = trim($val);
1016 $imgInfo = @getimagesize(PATH_site . $val);
1017 if (is_array($imgInfo)) {
1018 $this->resourceDimensions[$val] = ' (' . $imgInfo[0] . 'x' . $imgInfo[1] . ')';
1019 }
1020 }
1021 }
1022
1023 /**
1024 * [Describe function...]
1025 *
1026 * @param [type] $path: ...
1027 * @return [type] ...
1028 */
1029 function ext_readDirResources($path) {
1030 $path = trim($path);
1031 if ($path && strstr($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'])) {
1032 $path = rtrim($path, '/');
1033 $this->readDirectory(PATH_site . $path);
1034 }
1035 }
1036
1037 /**
1038 * [Describe function...]
1039 *
1040 * @param [type] $path: ...
1041 * @param [type] $type: ...
1042 * @return [type] ...
1043 */
1044 function readDirectory($path, $type = 'file') {
1045 if (@is_dir($path)) {
1046 $d = @dir($path);
1047 $tempArray = Array();
1048 if (is_object($d)) {
1049 while ($entry = $d->read()) {
1050 if ($entry != '.' && $entry != '..') {
1051 $wholePath = $path . '/' . $entry; // Because of odd PHP-error where <BR>-tag is sometimes placed after a filename!!
1052 if (file_exists($wholePath) && (!$type || filetype($wholePath) == $type)) {
1053 $fI = t3lib_div::split_fileref($wholePath);
1054 $this->dirResources[] = substr($wholePath, strlen(PATH_site));
1055 }
1056 }
1057 }
1058 $d->close();
1059 }
1060 }
1061 }
1062
1063 /**
1064 * [Describe function...]
1065 *
1066 * @param [type] $params: ...
1067 * @return [type] ...
1068 */
1069 function ext_fNandV($params) {
1070 $fN = 'data[' . $params['name'] . ']';
1071 $fV = $params['value'];
1072 if (preg_match('/^{[\$][a-zA-Z0-9\.]*}$/', trim($fV), $reg)) { // Values entered from the constantsedit cannot be constants! 230502; removed \{ and set {
1073 $fV = '';
1074 }
1075 $fV = htmlspecialchars($fV);
1076
1077 return array($fN, $fV, $params);
1078 }
1079
1080 /**
1081 * This functions returns the HTML-code that creates the editor-layout of the module.
1082 *
1083 * @param [type] $theConstants: ...
1084 * @param [type] $category: ...
1085 * @return [type] ...
1086 */
1087 function ext_printFields($theConstants, $category) {
1088 reset($theConstants);
1089 $output = '<script type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/constantEditor.js"></script>
1090 ';
1091 $subcat = '';
1092 if (is_array($this->categories[$category])) {
1093
1094 $help = $this->helpConfig;
1095 $this->rArr = explode(',', $this->setup['resources'] . ',' . implode($this->dirResources, ','));
1096
1097 if (!$this->doNotSortCategoriesBeforeMakingForm) {
1098 asort($this->categories[$category]);
1099 }
1100 foreach ($this->categories[$category] as $name => $type) {
1101 $params = $theConstants[$name];
1102 if (is_array($params)) {
1103 if ($subcat != $params['subcat_name']) {
1104 $subcat = $params['subcat_name'];
1105 $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : 'Others';
1106
1107 $output .= '<h2 class="typo3-tstemplate-ceditor-subcat">' . $subcat_name . '</h2>';
1108 }
1109
1110 $label = $GLOBALS['LANG']->sL($params['label']);
1111 $label_parts = explode(':', $label, 2);
1112 if (count($label_parts) == 2) {
1113 $head = trim($label_parts[0]);
1114 $body = trim($label_parts[1]);
1115 } else {
1116 $head = trim($label_parts[0]);
1117 $body = '';
1118 }
1119 if (strlen($head) > 35) {
1120 if (!$body) {
1121 $body = $head;
1122 }
1123 $head = t3lib_div::fixed_lgd_cs($head, 35);
1124 }
1125 $typeDat = $this->ext_getTypeData($params['type']);
1126 $checked = '';
1127 $p_field = '';
1128 $raname = substr(md5($params['name']), 0, 10);
1129 $aname = '\'' . $raname . '\'';
1130
1131 list($fN, $fV, $params) = $this->ext_fNandV($params);
1132
1133 switch ($typeDat['type']) {
1134 case 'int':
1135 case 'int+':
1136 $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' .
1137 $GLOBALS['TBE_TEMPLATE']->formWidth(5) . ' onChange="uFormUrl(' . $aname . ')" />';
1138 if ($typeDat['paramstr']) {
1139 $p_field .= ' Range: ' . $typeDat['paramstr'];
1140 } elseif ($typeDat['type'] == 'int+') {
1141 $p_field .= ' Range: 0 - ';
1142 } else {
1143 $p_field .= ' (Integer)';
1144 }
1145 break;
1146 case 'color':
1147 $colorNames = explode(',', ',' . $this->HTMLcolorList);
1148 $p_field = '';
1149 foreach ($colorNames as $val) {
1150 $sel = '';
1151 if ($val == strtolower($params['value'])) {
1152 $sel = ' selected';
1153 }
1154 $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . '</option>';
1155 }
1156 $p_field = '<select id="select-' . $fN . '" rel="' . $fN . '" name="C' . $fN .
1157 '" class="typo3-tstemplate-ceditor-color-select" onChange="uFormUrl(' .
1158 $aname . ');">' . $p_field . '</select>';
1159
1160 $p_field .= '<input type="text" id="input-' . $fN . '" rel="' . $fN . '" name="' . $fN .
1161 '" class="typo3-tstemplate-ceditor-color-input" value="' . $fV . '"' .
1162 $GLOBALS['TBE_TEMPLATE']->formWidth(7) . ' onChange="uFormUrl(' . $aname . ')" />';
1163 break;
1164 case 'wrap':
1165 $wArr = explode('|', $fV);
1166 $p_field = '<input type="text" id="' . $fN . '" name="' . $fN . '" value="' . $wArr[0] . '"' .
1167 $GLOBALS['TBE_TEMPLATE']->formWidth(29) . ' onChange="uFormUrl(' . $aname . ')" />';
1168 $p_field .= ' | ';
1169 $p_field .= '<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' .
1170 $GLOBALS['TBE_TEMPLATE']->formWidth(15) . ' onChange="uFormUrl(' . $aname . ')" />';
1171 break;
1172 case 'offset':
1173 $wArr = explode(',', $fV);
1174 $labels = t3lib_div::trimExplode(',', $typeDat['paramstr']);
1175 $p_field = ($labels[0] ? $labels[0] : 'x') . ':<input type="text" name="' . $fN . '" value="' . $wArr[0] . '"' .
1176 $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
1177 $p_field .= ' , ';
1178 $p_field .= ($labels[1] ? $labels[1] : 'y') . ':<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' .
1179 $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
1180 for ($aa = 2; $aa < count($labels); $aa++) {
1181 if ($labels[$aa]) {
1182 $p_field .= ' , ' . $labels[$aa] . ':<input type="text" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '"' .
1183 $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
1184 } else {
1185 $p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />';
1186 }
1187 }
1188 break;
1189 case 'options':
1190 if (is_array($typeDat['params'])) {
1191 $p_field = '';
1192 foreach ($typeDat['params'] as $val) {
1193 $vParts = explode('=', $val, 2);
1194 $label = $vParts[0];
1195 $val = isset($vParts[1]) ? $vParts[1] : $vParts[0];
1196
1197 // option tag:
1198 $sel = '';
1199 if ($val == $params['value']) {
1200 $sel = ' selected';
1201 }
1202 $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $GLOBALS['LANG']->sL($label) . '</option>';
1203 }
1204 $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
1205 }
1206 break;
1207 case 'boolean':
1208 $p_field = '<input type="hidden" name="' . $fN . '" value="0" />';
1209 $sel = '';
1210 if ($fV) {
1211 $sel = ' checked';
1212 }
1213 $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ? $typeDat['paramstr'] : 1) .
1214 '"' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
1215 break;
1216 case 'comment':
1217 $p_field = '<input type="hidden" name="' . $fN . '" value="#" />';
1218 $sel = '';
1219 if (!$fV) {
1220 $sel = ' checked';
1221 }
1222 $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value=""' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
1223 break;
1224 case 'file':
1225 $p_field = '<option value=""></option>';
1226 $theImage = '';
1227 $selectThisFile = $this->extractFromResources($this->setup['resources'], $params['value']);
1228 if ($params['value'] && !$selectThisFile) {
1229 if (in_array($params['value'], $this->dirResources)) {
1230 $selectThisFile = $params['value'];
1231 }
1232 }
1233 // extensionlist
1234 $extList = $typeDat['paramstr'];
1235 $p_field = '<option value="">(' . $extList . ')</option>';
1236 if ($extList == 'IMAGE_EXT') {
1237 $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
1238 }
1239 $onlineResourceFlag = $this->ext_defaultOnlineResourceFlag;
1240
1241 foreach ($this->rArr as $c => $val) {
1242 $val = trim($val);
1243 $fI = t3lib_div::split_fileref($val);
1244 if ($val && (!$extList || t3lib_div::inList($extList, $fI['fileext']))) {
1245 if ($onlineResourceFlag <= 0 && strstr($fI['path'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'])) {
1246 if ($onlineResourceFlag < 0) {
1247 $p_field .= '<option value=""></option>';
1248 }
1249 $p_field .= '<option value="">__' . $fI['path'] . '__:</option>';
1250 $onlineResourceFlag = 1;
1251 }
1252 $dims = $this->resourceDimensions[$val];
1253 $sel = '';
1254
1255 // Check if $params['value'] is in the list of resources.
1256 if ($selectThisFile && $selectThisFile == $val) {
1257 $sel = ' selected';
1258 if ($onlineResourceFlag <= 0) {
1259 $theImage = t3lib_BEfunc::thumbCode(
1260 array(
1261 'resources' => $selectThisFile
1262 ),
1263 'sys_template',
1264 'resources',
1265 $GLOBALS['BACK_PATH'],
1266 ''
1267 );
1268 } else {
1269 $theImage = t3lib_BEfunc::thumbCode(
1270 array(
1271 'resources' => $fI['file']
1272 ),
1273 'sys_template',
1274 'resources',
1275 $GLOBALS['BACK_PATH'],
1276 '',
1277 $fI['path']
1278 );
1279 }
1280 }
1281
1282 if ($onlineResourceFlag <= 0) {
1283 $onlineResourceFlag--;
1284 // Value is set with a *
1285 $val = $this->ext_setStar($val);
1286 $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . $dims . '</option>';
1287 } else {
1288 $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $fI['file'] . $dims . '</option>';
1289 }
1290 }
1291 }
1292
1293 if (trim($params['value']) && !$selectThisFile) {
1294 $val = $params['value'];
1295 $p_field .= '<option value=""></option>';
1296 $p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
1297 }
1298
1299 $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
1300 $p_field .= $theImage;
1301
1302 if (!$this->ext_noCEUploadAndCopying) {
1303 // Copy a resource
1304 $copyFile = $this->extractFromResources($this->setup['resources'], $params['value']);
1305 if (!$copyFile) {
1306 if ($params['value']) {
1307 $copyFile = PATH_site . $this->ext_detectAndFixExtensionPrefix($params['value']);
1308 }
1309 } else {
1310 $copyFile = '';
1311 }
1312
1313 if ($copyFile && @is_file($copyFile)) {
1314 $p_field .= '<img src="clear.gif" width="20" ' . 'height="1" alt="" />' .
1315 t3lib_iconWorks::getSpriteIcon('actions-edit-copy') . '<input type="checkbox" ' .
1316 'name="_copyResource[' . $params['name'] . ']" value="' . htmlspecialchars($copyFile) .
1317 '" onclick="uFormUrl(' . $aname . ');if (this.checked && !confirm(\'' .
1318 t3lib_div::slashJS(htmlspecialchars(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsparser.xml:tsparser_ext.make_copy'), $params['value']))) .
1319 '\')) this.checked=false;" />';
1320 }
1321
1322 // Upload?
1323 $p_field .= '<br />';
1324 $p_field .= '<input id="' . $fN . '" type="file" name="upload_' . $fN . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() .
1325 ' onChange="uFormUrl(' . $aname . ')" size="50" />';
1326 }
1327 break;
1328 case 'user':
1329 $userFunction = $typeDat['paramstr'];
1330 $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV);
1331 $p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, '');
1332 break;
1333 case 'small':
1334 default:
1335 $fwidth = $typeDat['type'] == 'small' ? 10 : 46;
1336 $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' .
1337 $GLOBALS['TBE_TEMPLATE']->formWidth($fwidth) . ' onChange="uFormUrl(' . $aname . ')" />';
1338 break;
1339 }
1340
1341 // Define default names and IDs
1342 $userTyposcriptID = 'userTS-' . $params['name'];
1343 $defaultTyposcriptID = 'defaultTS-' . $params['name'];
1344 $checkboxName = 'check[' . $params['name'] . ']';
1345 $checkboxID = $checkboxName;
1346
1347 // Handle type=color specially
1348 if ($typeDat['type'] == 'color' && substr($params['value'], 0, 2) != '{$') {
1349 $color = '<div id="colorbox-' . $fN . '" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' .
1350 $params['value'] . ';">&nbsp;</div>';
1351 } else {
1352 $color = '';
1353 }
1354
1355 if (!$this->ext_dontCheckIssetValues) {
1356
1357 /* Set the default styling options */
1358 if (isset($this->objReg[$params['name']])) {
1359 $checkboxValue = 'checked';
1360 $userTyposcriptStyle = '';
1361 $defaultTyposcriptStyle = 'style="display:none;"';
1362 } else {
1363 $checkboxValue = '';
1364 $userTyposcriptStyle = 'style="display:none;"';
1365 $defaultTyposcriptStyle = '';
1366 }
1367
1368
1369 $deleteIconHTML = t3lib_iconWorks::getSpriteIcon(
1370 'actions-edit-undo',
1371 array(
1372 'class' => "typo3-tstemplate-ceditor-control undoIcon",
1373 'alt' => "Revert to default Constant",
1374 'title' => "Revert to default Constant",
1375 'rel' => $params['name']
1376 )
1377 );
1378 $editIconHTML = t3lib_iconWorks::getSpriteIcon(
1379 'actions-document-open',
1380 array(
1381 'class' => "typo3-tstemplate-ceditor-control editIcon",
1382 'alt' => "Edit this Constant",
1383 'title' => "Edit this Constant",
1384 'rel' => $params['name']
1385 )
1386 );
1387 $constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>';
1388
1389 // If there's no default value for the field, use a static label.
1390 if (!$params['default_value']) {
1391 $params['default_value'] = '[Empty]';
1392 }
1393
1394 $constantDefaultRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $defaultTyposcriptID . '" ' .
1395 $defaultTyposcriptStyle . '>' . $editIconHTML .
1396 htmlspecialchars($params['default_value']) . $color . '</div>';
1397 }
1398
1399 $constantEditRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $userTyposcriptID . '" ' .
1400 $userTyposcriptStyle . '>' . $deleteIconHTML . $p_field . $color . '</div>';
1401
1402 $constantLabel = '<dt class="typo3-tstemplate-ceditor-label">' . htmlspecialchars($head) . '</dt>';
1403 $constantName = '<dt class="typo3-dimmed">[' . $params['name'] . ']</dt>';
1404 $constantDescription = $body ? '<dd>' . htmlspecialchars($body) . '</dd>' : '';
1405 $constantData = '<dd>' . $constantCheckbox . $constantEditRow . $constantDefaultRow . '</dd>';
1406
1407 $output .= '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']];
1408 $output .= '<dl class="typo3-tstemplate-ceditor-constant">' . $constantLabel . $constantName .
1409 $constantDescription . $constantData . '</dl>';
1410 } else {
1411 debug('Error. Constant did not exist. Should not happen.');
1412 }
1413 }
1414 }
1415 return $output;
1416 }
1417
1418
1419 /***************************
1420 *
1421 * Processing input values
1422 *
1423 ***************************/
1424
1425 /**
1426 * @param [type] $constants: ...
1427 * @return [type] ...
1428 */
1429 function ext_regObjectPositions($constants) {
1430 // This runs through the lines of the constants-field of the active template and registers the constants-names
1431 // and linepositions in an array, $this->objReg
1432 $this->raw = explode(LF, $constants);
1433 $this->rawP = 0;
1434
1435 $this->objReg = array(); // resetting the objReg if the divider is found!!
1436 $this->ext_regObjects('');
1437 }
1438
1439 /**
1440 * [Describe function...]
1441 *
1442 * @param [type] $pre: ...
1443 * @return [type] ...
1444 */
1445 function ext_regObjects($pre) {
1446 // works with regObjectPositions. "expands" the names of the TypoScript objects
1447 while (isset($this->raw[$this->rawP])) {
1448 $line = ltrim($this->raw[$this->rawP]);
1449 if (strstr($line, $this->edit_divider)) {
1450 $this->objReg = array(); // resetting the objReg if the divider is found!!
1451 }
1452 $this->rawP++;
1453 if ($line) {
1454 if (substr($line, 0, 1) == '[') {
1455 // return $line;
1456 } elseif (strcspn($line, '}#/') != 0) {
1457 $varL = strcspn($line, ' {=<');
1458 $var = substr($line, 0, $varL);
1459 $line = ltrim(substr($line, $varL));
1460 switch (substr($line, 0, 1)) {
1461 case '=':
1462 $this->objReg[$pre . $var] = $this->rawP - 1;
1463 break;
1464 case '{':
1465 $this->ext_inBrace++;
1466 $this->ext_regObjects($pre . $var . '.');
1467 break;
1468 }
1469 $this->lastComment = '';
1470 } elseif (substr($line, 0, 1) == '}') {
1471 $this->lastComment = '';
1472 $this->ext_inBrace--;
1473 if ($this->ext_inBrace < 0) {
1474 $this->ext_inBrace = 0;
1475 } else {
1476 break;
1477 }
1478 }
1479 }
1480 }
1481 }
1482
1483 /**
1484 * [Describe function...]
1485 *
1486 * @param [type] $key: ...
1487 * @param [type] $var: ...
1488 * @return [type] ...
1489 */
1490 function ext_putValueInConf($key, $var) {
1491 // Puts the value $var to the TypoScript value $key in the current lines of the templates.
1492 // If the $key is not found in the template constants field, a new line is inserted in the bottom.
1493 $theValue = ' ' . trim($var);
1494 if (isset($this->objReg[$key])) {
1495 $lineNum = $this->objReg[$key];
1496 $parts = explode('=', $this->raw[$lineNum], 2);
1497 if (count($parts) == 2) {
1498 $parts[1] = $theValue;
1499 }
1500 $this->raw[$lineNum] = implode($parts, '=');
1501 } else {
1502 $this->raw[] = $key . ' =' . $theValue;
1503 }
1504 $this->changed = 1;
1505 }
1506
1507 /**
1508 * [Describe function...]
1509 *
1510 * @param [type] $key: ...
1511 * @return [type] ...
1512 */
1513 function ext_removeValueInConf($key) {
1514 // Removes the value in the configuration
1515 if (isset($this->objReg[$key])) {
1516 $lineNum = $this->objReg[$key];
1517 unset($this->raw[$lineNum]);
1518 }
1519 $this->changed = 1;
1520 }
1521
1522 /**
1523 * [Describe function...]
1524 *
1525 * @param [type] $arr: ...
1526 * @param [type] $settings: ...
1527 * @return [type] ...
1528 */
1529 function ext_depthKeys($arr, $settings) {
1530 $tsbrArray = array();
1531 foreach ($arr as $theK => $theV) {
1532 $theKeyParts = explode('.', $theK);
1533 $depth = '';
1534 $c = count($theKeyParts);
1535 $a = 0;
1536 foreach ($theKeyParts as $p) {
1537 $a++;
1538 $depth .= ($depth ? '.' : '') . $p;
1539 $tsbrArray[$depth] = ($c == $a) ? $theV : 1;
1540 }
1541 }
1542 // Modify settings
1543 foreach ($tsbrArray as $theK => $theV) {
1544 if ($theV) {
1545 $settings[$theK] = 1;
1546 } else {
1547 unset($settings[$theK]);
1548 }
1549 }
1550 return $settings;
1551 }
1552
1553 /**
1554 * [Describe function...]
1555 *
1556 * @param [type] $http_post_vars: ...
1557 * @param [type] $http_post_files: ...
1558 * @param [type] $theConstants: ...
1559 * @param [type] $tplRow: ...
1560 * @return [type] ...
1561 */
1562 function ext_procesInput($http_post_vars, $http_post_files, $theConstants, $tplRow) {
1563 $data = $http_post_vars['data'];
1564 $check = $http_post_vars['check'];
1565 $copyResource = $http_post_vars['_copyResource'];
1566 $Wdata = $http_post_vars['Wdata'];
1567 $W2data = $http_post_vars['W2data'];
1568 $W3data = $http_post_vars['W3data'];
1569 $W4data = $http_post_vars['W4data'];
1570 $W5data = $http_post_vars['W5data'];
1571
1572 if (is_array($data)) {
1573 foreach ($data as $key => $var) {
1574 if (isset($theConstants[$key])) {
1575 if ($this->ext_dontCheckIssetValues || isset($check[$key])) { // If checkbox is set, update the value
1576 list($var) = explode(LF, $var); // exploding with linebreak, just to make sure that no multiline input is given!
1577 $typeDat = $this->ext_getTypeData($theConstants[$key]['type']);
1578 switch ($typeDat['type']) {
1579 case 'int':
1580 if ($typeDat['paramstr']) {
1581 $var = t3lib_utility_Math::forceIntegerInRange($var, $typeDat['params'][0], $typeDat['params'][1]);
1582 } else {
1583 $var = intval($var);
1584 }
1585 break;
1586 case 'int+':
1587 $var = max(0, intval($var));
1588 break;
1589 case 'color':
1590 $col = array();
1591 if ($var && !t3lib_div::inList($this->HTMLcolorList, strtolower($var))) {
1592 $var = preg_replace('/[^A-Fa-f0-9]*/', '', $var);
1593 $useFullHex = strlen($var) > 3;
1594
1595 $col[] = HexDec(substr($var, 0, 1));
1596 $col[] = HexDec(substr($var, 1, 1));
1597 $col[] = HexDec(substr($var, 2, 1));
1598
1599 if ($useFullHex) {
1600 $col[] = HexDec(substr($var, 3, 1));
1601 $col[] = HexDec(substr($var, 4, 1));
1602 $col[] = HexDec(substr($var, 5, 1));
1603 }
1604
1605 $var = substr('0' . DecHex($col[0]), -1) . substr('0' . DecHex($col[1]), -1) . substr('0' . DecHex($col[2]), -1);
1606 if ($useFullHex) {
1607 $var .= substr('0' . DecHex($col[3]), -1) . substr('0' . DecHex($col[4]), -1) . substr('0' . DecHex($col[5]), -1);
1608 }
1609
1610 $var = '#' . strtoupper($var);
1611 }
1612 break;
1613 case 'comment':
1614 if ($var) {
1615 $var = '#';
1616 } else {
1617 $var = '';
1618 }
1619 break;
1620 case 'wrap':
1621 if (isset($Wdata[$key])) {
1622 $var .= '|' . $Wdata[$key];
1623 }
1624 break;
1625 case 'offset':
1626 if (isset($Wdata[$key])) {
1627 $var = intval($var) . ',' . intval($Wdata[$key]);
1628 if (isset($W2data[$key])) {
1629 $var .= ',' . intval($W2data[$key]);
1630 if (isset($W3data[$key])) {
1631 $var .= ',' . intval($W3data[$key]);
1632 if (isset($W4data[$key])) {
1633 $var .= ',' . intval($W4data[$key]);
1634 if (isset($W5data[$key])) {
1635 $var .= ',' . intval($W5data[$key]);
1636 }
1637 }
1638 }
1639 }
1640 }
1641 break;
1642 case 'boolean':
1643 if ($var) {
1644 $var = $typeDat['paramstr'] ? $typeDat['paramstr'] : 1;
1645 }
1646 break;
1647 case 'file':
1648 if (!$this->ext_noCEUploadAndCopying) {
1649 if ($http_post_files['upload_data']['name'][$key] && $http_post_files['upload_data']['tmp_name'][$key] != 'none') {
1650 $var = $this->upload_copy_file(
1651 $typeDat,
1652 $tplRow,
1653 trim($http_post_files['upload_data']['name'][$key]),
1654 $http_post_files['upload_data']['tmp_name'][$key]
1655 );
1656 }
1657 if ($copyResource[$key]) {
1658 $var = $this->upload_copy_file(
1659 $typeDat,
1660 $tplRow,
1661 basename($copyResource[$key]),
1662 $copyResource[$key]
1663 );
1664 }
1665 }
1666 break;
1667 }
1668 if ($this->ext_printAll || strcmp($theConstants[$key]['value'], $var)) {
1669 $this->ext_putValueInConf($key, $var); // Put value in, if changed.
1670 }
1671 unset($check[$key]); // Remove the entry because it has been "used"
1672 } else {
1673 $this->ext_removeValueInConf($key);
1674 }
1675 }
1676 }
1677 }
1678 // Remaining keys in $check indicates fields that are just clicked "on" to be edited. Therefore we get the default value and puts that in the template as a start...
1679 if (!$this->ext_dontCheckIssetValues && is_array($check)) {
1680 foreach ($check as $key => $var) {
1681 if (isset($theConstants[$key])) {
1682 $dValue = $theConstants[$key]['default_value'];
1683 $this->ext_putValueInConf($key, $dValue);
1684 }
1685 }
1686 }
1687 }
1688
1689 /**
1690 * [Describe function...]
1691 *
1692 * @param [type] $typeDat: ...
1693 * @param [type] $tplRow: ...
1694 * @param [type] $theRealFileName: ...
1695 * @param [type] $tmp_name: ...
1696 * @return [type] ...
1697 */
1698 function upload_copy_file($typeDat, &$tplRow, $theRealFileName, $tmp_name) {
1699
1700 // extensions
1701 $extList = $typeDat['paramstr'];
1702 if ($extList == 'IMAGE_EXT') {
1703 $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
1704 }
1705 $fI = t3lib_div::split_fileref($theRealFileName);
1706 if ($theRealFileName && (!$extList || t3lib_div::inList($extList, $fI['fileext']))) {
1707 $tmp_upload_name = t3lib_div::upload_to_tempfile($tmp_name); // If there is an uploaded file, move it.
1708
1709 // Saving resource
1710 $alternativeFileName = array();
1711 $alternativeFileName[$tmp_upload_name] = $theRealFileName;
1712 // Making list of resources
1713 $resList = $tplRow['resources'];
1714 $resList = $tmp_upload_name . ',' . $resList;
1715 $resList = implode(t3lib_div::trimExplode(',', $resList, 1), ',');
1716 // Making data-array
1717 $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
1718
1719 $recData = array();
1720 $recData['sys_template'][$saveId]['resources'] = $resList;
1721 // Saving
1722 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
1723 $tce->stripslashes_values = 0;
1724 $tce->alternativeFileName = $alternativeFileName;
1725 $tce->start($recData, Array());
1726 $tce->process_datamap();
1727
1728 t3lib_div::unlink_tempfile($tmp_upload_name);
1729
1730 $tmpRow = t3lib_BEfunc::getRecordWSOL('sys_template', $saveId, 'resources');
1731
1732 $tplRow['resources'] = $tmpRow['resources'];
1733
1734 // Setting the value
1735 $var = $this->ext_setStar($theRealFileName);
1736 }
1737 return $var;
1738 }
1739
1740 /**
1741 * [Describe function...]
1742 *
1743 * @param [type] $id: ...
1744 * @param [type] $perms_clause: ...
1745 * @return [type] ...
1746 */
1747 function ext_prevPageWithTemplate($id, $perms_clause) {
1748 $rootLine = t3lib_BEfunc::BEgetRootLine($id, $perms_clause ? ' AND ' . $perms_clause : '');
1749 foreach ($rootLine as $p) {
1750 if ($this->ext_getFirstTemplate($p['uid'])) {
1751 return $p;
1752 }
1753 }
1754 }
1755
1756 /**
1757 * [Describe function...]
1758 *
1759 * @param [type] $val: ...
1760 * @return [type] ...
1761 */
1762 function ext_setStar($val) {
1763 $fParts = explode('.', strrev($val), 2);
1764 $val = preg_replace('/_[0-9][0-9]$/', '', strrev($fParts[1])) . '*.' . strrev($fParts[0]);
1765 return $val;
1766 }
1767
1768 /**
1769 * [Describe function...]
1770 *
1771 * @param [type] $value: ...
1772 * @return [type] ...
1773 */
1774 function ext_detectAndFixExtensionPrefix($value) {
1775 if (substr($value, 0, 4) == 'EXT:') {
1776 $parts = explode('/', substr($value, 4), 2);
1777
1778 $extPath = t3lib_extMgm::siteRelPath($parts[0]);
1779 $value = $extPath . $parts[1];
1780 return $value;
1781 } else {
1782 return $value;
1783 }
1784 }
1785 }
1786
1787
1788 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsparser_ext.php'])) {
1789 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsparser_ext.php']);
1790 }
1791
1792 ?>