2 namespace TYPO3\CMS\Core\TypoScript;
46 public $HTMLcolorList =
'aqua,beige,black,blue,brown,fuchsia,gold,gray,green,lime,maroon,navy,olive,orange,purple,red,silver,tan,teal,turquoise,yellow,white';
60 'advanced' => array(),
79 'enable' => array(
'Enable features',
'a'),
80 'dims' => array(
'Dimensions, widths, heights, pixels',
'b'),
81 'file' => array(
'Files',
'c'),
82 'typo' => array(
'Typography',
'd'),
83 'color' => array(
'Colors',
'e'),
84 'links' => array(
'Links and targets',
'f'),
85 'language' => array(
'Language specific constants',
'g'),
87 'cheader' => array(
'Content: \'Header\'',
'ma'),
88 'cheader_g' => array(
'Content: \'Header\', Graphical',
'ma'),
89 'ctext' => array(
'Content: \'Text\'',
'mb'),
90 'cimage' => array(
'Content: \'Image\'',
'md'),
91 'ctextmedia' => array(
'Content: \'Textmedia\'',
'ml'),
92 'cbullets' => array(
'Content: \'Bullet list\'',
'me'),
93 'ctable' => array(
'Content: \'Table\'',
'mf'),
94 'cuploads' => array(
'Content: \'Filelinks\'',
'mg'),
95 'cmultimedia' => array(
'Content: \'Multimedia\'',
'mh'),
96 'cmedia' => array(
'Content: \'Media\'',
'mr'),
97 'cmailform' => array(
'Content: \'Form\'',
'mi'),
98 'csearch' => array(
'Content: \'Search\'',
'mj'),
99 'clogin' => array(
'Content: \'Login\'',
'mk'),
100 'cmenu' => array(
'Content: \'Menu/Sitemap\'',
'mm'),
101 'cshortcut' => array(
'Content: \'Insert records\'',
'mn'),
102 'clist' => array(
'Content: \'List of records\'',
'mo'),
103 'chtml' => array(
'Content: \'HTML\'',
'mq')
284 $this->Cmarker = substr(md5(uniqid(
'',
true)), 0, 6);
285 return preg_replace_callback(
'/\\{\\$(.[^}]+)\\}/', array($this,
'substituteConstantsCallBack'), $all);
297 switch ($this->constantMode) {
299 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
'##' . $this->Cmarker .
'_B##' . $matches[0] .
'##' . $this->Cmarker .
'_E##' : $matches[0];
302 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
'##' . $this->Cmarker .
'_B##' . $this->flatSetup[$matches[1]] .
'##' . $this->Cmarker .
'_E##' : $matches[0];
305 $ret_val = $matches[0];
308 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ? $this->flatSetup[$matches[1]] : $matches[0];
321 switch ($this->constantMode) {
325 array(
'##' . $this->Cmarker .
'_B##',
'##' . $this->Cmarker .
'_E##'),
326 array(
'<strong style="color: green;">',
'</strong>'),
341 public function generateConfig_constants()
349 $constants->setup = $this->mergeConstantsFromPageTSconfig(array());
353 $matchObj->setSimulateMatchResult(
true);
355 $cc = count($this->constants);
356 $defaultConstants = array();
357 foreach ($this->constants as $str) {
360 if (strstr($str, $this->edit_divider)) {
361 $parts = explode($this->edit_divider, $str, 2);
365 $this->flatSetup = array();
371 $this->flatSetup = array();
373 $this->setup[
'constants'] =
$constants->setup;
384 $parts = explode(
'.', $theKey, 2);
385 if ((
string)$parts[0] !==
'' && is_array($theSetup[$parts[0] .
'.'])) {
386 if (trim($parts[1]) !==
'') {
387 return $this->
ext_getSetup($theSetup[$parts[0] .
'.'], trim($parts[1]));
389 return array($theSetup[$parts[0] .
'.'], $theSetup[$parts[0]]);
392 if (trim($theKey) !==
'') {
393 return array(array(), $theSetup[$theKey]);
395 return array($theSetup,
'');
411 public function ext_getObjTree($arr, $depth_in, $depthData, $parentType =
'', $parentValue =
'', $alphaSort =
'0')
415 if ($alphaSort ==
'1') {
418 $keyArr_num = array();
419 $keyArr_alpha = array();
420 foreach ($arr as $key => $value) {
422 if (substr($key, -2) !=
'..') {
423 $key = preg_replace(
'/\\.$/',
'', $key);
424 if (substr($key, -1) !=
'.') {
426 $keyArr_num[$key] = $arr[$key];
428 $keyArr_alpha[$key] = $arr[$key];
434 $keyArr = $keyArr_num + $keyArr_alpha;
437 $depth_in = $depth_in .
'.';
439 foreach ($keyArr as $key => $value) {
441 $depth = $depth_in . $key;
443 if ($this->bType !==
'const' || $depth[0] !==
'_') {
444 $goto = substr(md5($depth), 0, 6);
446 $LN = $a == $c ?
'blank' :
'line';
447 $BTM = $a == $c ?
'bottom' :
'';
448 $PM = is_array($arr[$key .
'.']) && !$this->ext_noPMicons ? ($deeper ?
'minus' :
'plus') :
'join';
449 $HTML .= $depthData .
'<li>';
450 if ($PM !==
'join') {
451 $urlParameters = array(
453 'tsbr[' . $depth .
']' => $deeper ? 0 : 1
458 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters) .
'#' . $goto;
459 $HTML .=
'<a class="list-tree-control' . ($PM ===
'minus' ?
' list-tree-control-open' :
' list-tree-control-closed') .
'" name="' . $goto .
'" href="' . htmlspecialchars($aHref) .
'"><i class="fa"></i></a>';
464 $label =
'<span style="color: #666666;">' . $label .
'</span>';
466 if ($this->linkObjects) {
467 $urlParameters = array(
474 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
475 if ($this->bType !=
'const') {
476 $ln = is_array($arr[$key .
'.ln..']) ?
'Defined in: ' . $this->
lineNumberToScript($arr[($key .
'.ln..')]) :
'N/A';
480 if ($this->tsbrowser_searchKeys[$depth] & 4) {
481 $label =
'<strong class="text-danger">' . $label .
'</strong>';
484 $label =
'<a href="' . htmlspecialchars($aHref) .
'" title="' . htmlspecialchars($ln) .
'">' . $label .
'</a>';
488 <span class="list-tree-group">
489 <span class="list-tree-label">[' . $label .
']</span>';
490 if (isset($arr[$key])) {
491 $theValue = $arr[$key];
492 if ($this->fixedLgd) {
493 $imgBlocks = ceil(1 + strlen($depthData) / 77);
494 $lgdChars = 68 - ceil(strlen((
'[' . $key .
']')) * 0.8) - $imgBlocks * 3;
498 if ($this->tsbrowser_searchKeys[$depth] & 2) {
499 $HTML .=
' = <span class="list-tree-value text-danger">' . htmlspecialchars($theValue) .
'</span>';
501 $HTML .=
' = <span class="list-tree-value">' . htmlspecialchars($theValue) .
'</span>';
503 if ($this->ext_regComments && isset($arr[$key .
'..'])) {
504 $comment = $arr[$key .
'..'];
506 if (!preg_match(
'/### <INCLUDE_TYPOSCRIPT:.*/', $comment)) {
508 $comment = preg_replace(
'/[\\r\\n]/',
' ', $comment);
510 $comment = preg_replace(
'/[#\\*]{2,}/',
'', $comment);
512 $comment = preg_replace(
'/^[#\\*\\s]+/',
'# ', $comment);
514 $comment = htmlspecialchars($comment);
515 $HTML .=
' <i class="text-muted">' . trim($comment) .
'</i>';
521 $HTML .= $this->
ext_getObjTree($arr[$key .
'.'], $depth, $depthData,
'', $arr[$key], $alphaSort);
526 $HTML =
'<ul class="list-tree text-monospace">' . $HTML .
'</ul>';
545 if (!is_array($this->lnToScript)) {
546 $this->lnToScript = array();
550 foreach ($this->hierarchyInfo as $templateNumber => $info) {
554 $linecountAfterIncludeProcessing = substr_count($this->config[$templateNumber], LF) + 2;
555 $c += $linecountAfterIncludeProcessing;
556 $this->lnToScript[$c] = $info[
'title'];
560 foreach ($lnArr as $k => $ln) {
561 foreach ($this->lnToScript as $endLn => $title) {
562 if ($endLn >= (
int)$ln) {
563 $lnArr[$k] =
'"' . $title .
'", ' . $ln;
569 return implode(
'; ', $lnArr);
580 return $this->ext_noSpecialCharsOnLabels ? $theValue : htmlspecialchars($theValue);
594 foreach ($arr as $key => $value) {
595 $key = preg_replace(
'/\\.$/',
'', $key);
596 if (substr($key, -1) !=
'.') {
601 $depth_in = $depth_in .
'.';
604 if ($this->regexMode) {
605 $searchPattern =
'/' . addcslashes($searchString,
'/') .
'/';
606 $matchResult = @preg_match($searchPattern,
'');
607 if ($matchResult ===
false) {
608 throw new Exception(sprintf(
'Error evaluating regular expression "%s".', $searchPattern), 1446559458);
611 foreach ($keyArr as $key => $value) {
612 $depth = $depth_in . $key;
613 $deeper = is_array($arr[$key .
'.']);
614 if ($this->regexMode) {
616 if (preg_match($searchPattern, $arr[$key])) {
617 $this->tsbrowser_searchKeys[$depth] += 2;
620 if (preg_match($searchPattern, $key)) {
621 $this->tsbrowser_searchKeys[$depth] += 4;
624 if (preg_match($searchPattern, $depth_in)) {
625 $this->tsbrowser_searchKeys[$depth] = 1;
629 if (stristr($arr[$key], $searchString)) {
630 $this->tsbrowser_searchKeys[$depth] += 2;
633 if (stristr($key, $searchString)) {
634 $this->tsbrowser_searchKeys[$depth] += 4;
637 if (stristr($depth_in, $searchString)) {
638 $this->tsbrowser_searchKeys[$depth] = 1;
642 $cS = count($this->tsbrowser_searchKeys);
643 $keyArray = $this->
ext_getSearchKeys($arr[$key .
'.'], $depth, $searchString, $keyArray);
644 if ($cS != count($this->tsbrowser_searchKeys)) {
645 $keyArray[$depth] = 1;
660 if ((
int)$val[
'uid'] === (
int)$pid) {
675 public function ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first = 0)
678 foreach ($arr as $key => $value) {
679 $key = preg_replace(
'/\\.$/',
'', $key);
680 if (substr($key, -1) !=
'.') {
689 foreach ($keyArr as $key => $value) {
692 $deeper = is_array($arr[$key .
'.']);
694 $LN = $a == $c ?
'blank' :
'line';
695 $BTM = $a == $c ?
'top' :
'';
697 $alttext =
'[' . $row[
'templateID'] .
']';
699 $icon = substr($row[
'templateID'], 0, 3) ===
'sys'
700 ?
'<span title="' . htmlspecialchars($alttext) .
'">' . $iconFactory->getIconForRecord(
'sys_template', $row,
Icon::SIZE_SMALL)->render() .
'</span>'
701 :
'<span title="' . htmlspecialchars($alttext) .
'">' . $iconFactory->getIcon(
'mimetypes-x-content-template-static',
Icon::SIZE_SMALL)->render() .
'</span>';
702 if (in_array($row[
'templateID'], $this->clearList_const) || in_array($row[
'templateID'], $this->clearList_setup)) {
703 $urlParameters = array(
705 'template' => $row[
'templateID']
707 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
708 $A_B =
'<a href="' . htmlspecialchars($aHref) .
'">';
711 $A_B =
'<strong>' . $A_B;
718 $HTML .= ($first ?
'' :
'<span class="treeline-icon treeline-icon-join' . $BTM .
'"></span>') . $icon . $A_B
720 . $A_E .
' ';
722 $statusCheckedIcon = $iconFactory->getIcon(
'status-status-checked',
Icon::SIZE_SMALL)->render();
723 $keyArray[] =
'<tr class="' . ($i++ % 2 == 0 ?
'bgColor4' :
'bgColor6') .
'">
724 <td nowrap="nowrap">' . $HTML .
'</td>
725 <td align="center">' . ($row[
'root'] ? $statusCheckedIcon :
'') .
' </td>
726 <td align="center">' . ($row[
'clConf'] ? $statusCheckedIcon :
'') .
' ' .
'</td>
727 <td align="center">' . ($row[
'clConst'] ? $statusCheckedIcon :
'') .
' ' .
'</td>
728 <td align="center">' . ($row[
'pid'] ?:
'') .
'</td>
729 <td align="center">' . ($RL >= 0 ? $RL :
'') .
'</td>
730 <td>' . ($row[
'next'] ?
' ' . $row[
'next'] .
' ' :
'') .
'</td>
733 $keyArray = $this->ext_getTemplateHierarchyArr($arr[$key .
'.'], $depthData . ($first ?
'' :
'<span class="treeline-icon treeline-icon-' . $LN .
'"></span>'), $keyArray);
749 $parent = $this->hierarchyInfo[$pointer - 1][
'templateParent'];
750 while ($pointer > 0 && $this->hierarchyInfo[$pointer - 1][
'templateParent'] == $parent) {
752 $row = $this->hierarchyInfo[$pointer];
753 $depthDataArr[$row[
'templateID']] = $row;
754 $depthDataArr[$row[
'templateID']][
'bgcolor_setup'] = isset($this->clearList_setup_temp[$row[
'templateID']]) ?
' class="bgColor5"' :
'';
755 $depthDataArr[$row[
'templateID']][
'bgcolor_const'] = isset($this->clearList_const_temp[$row[
'templateID']]) ?
' class="bgColor5"' :
'';
756 unset($this->clearList_setup_temp[$row[
'templateID']]);
757 unset($this->clearList_const_temp[$row[
'templateID']]);
758 $this->templateTitles[$row[
'templateID']] = $row[
'title'];
759 if ($row[
'templateID'] == $this->hierarchyInfo[$pointer - 1][
'templateParent']) {
763 return $depthDataArr;
778 array
$config, $lineNumbers =
false, $comments =
false, $crop =
false, $syntaxHL =
false, $syntaxHLBlockmode = 0
781 foreach ($config as $str) {
782 $all .=
'[GLOBAL]' . LF . $str;
786 $tsparser->lineNumberOffset = $this->ext_lineNumberOffset + 1;
787 $tsparser->parentObject = $this;
788 return $tsparser->doSyntaxHighlight($all, $lineNumbers ? array($this->ext_lineNumberOffset + 1) :
'', $syntaxHLBlockmode);
790 return $this->
ext_formatTS($all, $lineNumbers, $comments, $crop);
806 if (strlen($string) > $chars) {
807 if (strlen($string) > 24 && substr($string, 0, 12) ==
'##' . $this->Cmarker .
'_B##') {
809 .
'##' . $this->Cmarker .
'_E##';
825 return '<a href="#" id="line-' . $lineNumber .
'" onClick="return brPoint(' . $lineNumber .
','
826 . ($this->ext_lineNumberOffset_mode ==
'setup' ? 1 : 0) .
');">' . $str .
'</a>';
836 public function ext_formatTS($input, $ln, $comments =
true, $crop =
false)
838 $cArr = explode(LF, $input);
839 $n = ceil(log10(count($cArr) + $this->ext_lineNumberOffset));
841 foreach ($cArr as $k => $v) {
842 $lln = $k + $this->ext_lineNumberOffset + 1;
844 $lineNum = $this->
ext_lnBreakPointWrap($lln, str_replace(
' ',
' ', sprintf((
'% ' . $n .
'd'), $lln))) .
': ';
846 $v = htmlspecialchars($v);
850 $cArr[$k] = $lineNum . str_replace(
' ',
' ', $v);
851 $firstChar = substr(trim($v), 0, 1);
852 if ($firstChar ==
'[') {
853 $cArr[$k] =
'<strong class="text-success">' . $cArr[$k] .
'</strong>';
854 }
elseif ($firstChar ==
'/' || $firstChar ==
'#') {
856 $cArr[$k] =
'<span class="text-muted">' . $cArr[$k] .
'</span>';
862 $output = implode($cArr,
'<br />') .
'<br />';
875 $addC = $template_uid ?
' AND uid=' . (int)$template_uid :
'';
876 $where =
'pid=' . (int)$id . $addC .
' ' . $this->whereClause;
877 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*',
'sys_template', $where,
'',
'sorting',
'1');
898 $res = $this->
getDatabaseConnection()->exec_SELECTquery(
'*',
'sys_template',
'pid=' . (
int)$id .
' ' . $this->whereClause,
'',
'sorting');
903 if (is_array($row)) {
921 $editableComments = array();
922 foreach ($this->flatSetup as $const => $value) {
923 if (substr($const, -2) ===
'..' || !isset($this->flatSetup[$const .
'..'])) {
926 $comment = trim($this->flatSetup[$const .
'..']);
927 $c_arr = explode(LF, $comment);
928 foreach ($c_arr as $k => $v) {
929 $line = trim(preg_replace(
'/^[#\\/]*/',
'', $v));
933 $parts = explode(
';', $line);
934 foreach ($parts as $par) {
935 if (strstr($par,
'=')) {
936 $keyValPair = explode(
'=', $par, 2);
937 switch (trim(strtolower($keyValPair[0]))) {
940 $editableComments[$const][
'type'] = trim($keyValPair[1]);
944 $catSplit = explode(
'/', strtolower($keyValPair[1]));
945 $catSplit[0] = trim($catSplit[0]);
946 if (isset($this->categoryLabels[$catSplit[0]])) {
947 $catSplit[0] = $this->categoryLabels[$catSplit[0]];
949 $editableComments[$const][
'cat'] = $catSplit[0];
952 $catSplit[1] = trim($catSplit[1]);
953 if ($catSplit[1] && isset($this->subCategories[$catSplit[1]])) {
954 $editableComments[$const][
'subcat_name'] = $catSplit[1];
955 $editableComments[$const][
'subcat'] = $this->subCategories[$catSplit[1]][1]
956 .
'/' . $catSplit[1] .
'/' . trim($catSplit[2]) .
'z';
958 $editableComments[$const][
'subcat'] =
'x' .
'/' . trim($catSplit[2]) .
'z';
963 $editableComments[$const][
'label'] = trim($keyValPair[1]);
965 case 'customcategory':
967 $customCategory = explode(
'=', $keyValPair[1], 2);
968 if (trim($customCategory[0])) {
969 $categoryKey = strtolower($customCategory[0]);
970 $this->categoryLabels[$categoryKey] = $this->
getLanguageService()->sL($customCategory[1]);
973 case 'customsubcategory':
975 $customSubcategory = explode(
'=', $keyValPair[1], 2);
976 if (trim($customSubcategory[0])) {
977 $subCategoryKey = strtolower($customSubcategory[0]);
978 $this->subCategories[$subCategoryKey][0] = $this->
getLanguageService()->sL($customSubcategory[1]);
985 if (isset($editableComments[$const])) {
986 $editableComments[$const][
'name'] = $const;
987 $editableComments[$const][
'value'] = trim($value);
988 if (isset($default[$const])) {
989 $editableComments[$const][
'default_value'] = trim($default[$const]);
993 return $editableComments;
1003 foreach ($editConstArray as $constName => $constData) {
1004 if (!$constData[
'type']) {
1005 $constData[
'type'] =
'string';
1007 $cats = explode(
',', $constData[
'cat']);
1009 foreach ($cats as $theCat) {
1010 $theCat = trim($theCat);
1012 $this->categories[$theCat][$constName] = $constData[
'subcat'];
1025 foreach ($this->categories as $k => $v) {
1027 $retArr[$k] = strtoupper($k) .
' (' . count($v) .
')';
1040 $type = trim($type);
1042 $retArr[
'type'] =
'string';
1044 $m = strcspn($type,
' [');
1045 $retArr[
'type'] = strtolower(substr($type, 0, $m));
1047 $p = trim(substr($type, $m));
1049 preg_match(
'/\\[(.*)\\]/', $p, $reg);
1052 $retArr[
'paramstr'] = $p;
1053 switch ($retArr[
'type']) {
1055 if ($retArr[
'paramstr'][0] ===
'-') {
1057 $retArr[
'params'][0] = (int)(
'-' . $retArr[
'params'][0]);
1061 $retArr[
'paramstr'] = $retArr[
'params'][0] .
' - ' . $retArr[
'params'][1];
1064 $retArr[
'params'] = explode(
',', $retArr[
'paramstr']);
1079 $catConf = $this->setup[
'constants'][
'TSConstantEditor.'][$category .
'.'];
1081 if (is_array($catConf)) {
1082 foreach ($catConf as $key => $val) {
1094 $constRefs = explode(
',', $val);
1095 foreach ($constRefs as $const) {
1096 $const = trim($const);
1098 $out[
'constants'][$const] .=
'<span class="label label-danger">' . $key .
'</span>';
1105 $this->helpConfig = $out;
1116 return '<span class="label label-danger">' . $key .
'</span>';
1127 if (substr($imgConf, 0, 4) ==
'gfx/') {
1128 $iFile = $this->ext_localGfxPrefix . $imgConf;
1129 $tFile = $this->ext_localWebGfxPrefix . $imgConf;
1130 }
elseif (substr($imgConf, 0, 4) ==
'EXT:') {
1134 $tFile =
$GLOBALS[
'BACK_PATH'] .
'../' . $f;
1137 if ($iFile !== null) {
1138 $imageInfo = @getImagesize($iFile);
1139 return '<img src="' . $tFile .
'" ' . $imageInfo[3] .
'>';
1150 $fN =
'data[' . $params[
'name'] .
']';
1151 $idName = str_replace(
'.',
'-', $params[
'name']);
1152 $fV = $params[
'value'];
1154 if (preg_match(
'/^{[\\$][a-zA-Z0-9\\.]*}$/', trim($fV), $reg)) {
1157 $fV = htmlspecialchars($fV);
1158 return array($fN, $fV, $params, $idName);
1168 public function ext_printFields($theConstants, $category)
1170 reset($theConstants);
1173 if (is_array($this->categories[$category])) {
1175 if (!$this->doNotSortCategoriesBeforeMakingForm) {
1176 asort($this->categories[$category]);
1180 foreach ($this->categories[$category] as $name => $type) {
1181 $params = $theConstants[$name];
1182 if (is_array($params)) {
1183 if ($subcat != $params[
'subcat_name']) {
1184 $subcat = $params[
'subcat_name'];
1185 $subcat_name = $params[
'subcat_name'] ? $this->subCategories[$params[
'subcat_name']][0] :
'Others';
1186 $output .=
'<h3 class="typo3-tstemplate-ceditor-subcat">' . $subcat_name .
'</h3>';
1189 $label_parts = explode(
':', $label, 2);
1190 if (count($label_parts) === 2) {
1191 $head = trim($label_parts[0]);
1192 $body = trim($label_parts[1]);
1194 $head = trim($label_parts[0]);
1197 if (strlen($head) > 35) {
1205 $raname = substr(md5($params[
'name']), 0, 10);
1206 $aname =
'\'' . $raname .
'\'';
1207 list($fN, $fV, $params, $idName) = $this->
ext_fNandV($params);
1208 $idName = htmlspecialchars($idName);
1210 switch ($typeDat[
'type']) {
1213 if ($typeDat[
'paramstr']) {
1214 $hint =
' Range: ' . $typeDat[
'paramstr'];
1215 }
elseif ($typeDat[
'type'] ===
'int+') {
1216 $hint =
' Range: 0 - ';
1218 $hint =
' (Integer)';
1222 '<input class="form-control" id="' . $idName .
'" type="text"'
1223 .
' name="' . $fN .
'" value="' . $fV .
'"' .
' onChange="uFormUrl(' . $aname .
')" />';
1226 $colorNames = explode(
',',
',' . $this->HTMLcolorList);
1228 foreach ($colorNames as $val) {
1230 if ($val == strtolower($params[
'value'])) {
1233 $p_field .=
'<option value="' . htmlspecialchars($val) .
'"' . $sel .
'>' . $val .
'</option>';
1235 $p_field =
'<select class="form-control t3js-color-select" id="select-' . $idName .
'" rel="' . $idName .
'" name="C' . $fN .
'" onChange="uFormUrl(' . $aname .
');"' . $this->
getDocumentTemplate()->formWidth(7) .
'>' . $p_field .
'</select>';
1236 $p_field .=
'<input class="form-control t3js-color-input" type="text" id="input-' . $idName .
'" rel="' . $idName .
'" name="' . $fN .
'" value="' . $fV .
'"' . $this->
getDocumentTemplate()->formWidth(7) .
' onChange="uFormUrl(' . $aname .
')" />';
1239 $wArr = explode(
'|', $fV);
1240 $p_field =
'<input class="form-control" type="text" id="' . $idName .
'" name="' . $fN .
'" value="' . $wArr[0] .
'"' . $this->
getDocumentTemplate()->formWidth(29) .
' onChange="uFormUrl(' . $aname .
')" />';
1242 $p_field .=
'<input class="form-control" type="text" name="W' . $fN .
'" value="' . $wArr[1] .
'"' . $this->
getDocumentTemplate()->formWidth(15) .
' onChange="uFormUrl(' . $aname .
')" />';
1245 $wArr = explode(
',', $fV);
1247 $p_field = ($labels[0] ? $labels[0] :
'x') .
':<input type="text" name="' . $fN .
'" value="' . $wArr[0] .
'"' . $this->
getDocumentTemplate()->formWidth(4) .
' onChange="uFormUrl(' . $aname .
')" />';
1249 $p_field .= ($labels[1] ? $labels[1] :
'y') .
':<input type="text" name="W' . $fN .
'" value="' . $wArr[1] .
'"' . $this->
getDocumentTemplate()->formWidth(4) .
' onChange="uFormUrl(' . $aname .
')" />';
1250 $labelsCount = count($labels);
1251 for ($aa = 2; $aa < $labelsCount; $aa++) {
1253 $p_field .=
' , ' . $labels[$aa] .
':<input type="text" name="W' . $aa . $fN .
'" value="' . $wArr[$aa] .
'"' . $this->
getDocumentTemplate()->formWidth(4) .
' onChange="uFormUrl(' . $aname .
')" />';
1255 $p_field .=
'<input type="hidden" name="W' . $aa . $fN .
'" value="' . $wArr[$aa] .
'" />';
1260 if (is_array($typeDat[
'params'])) {
1262 foreach ($typeDat[
'params'] as $val) {
1263 $vParts = explode(
'=', $val, 2);
1264 $label = $vParts[0];
1265 $val = isset($vParts[1]) ? $vParts[1] : $vParts[0];
1268 if ($val === $params[
'value']) {
1271 $p_field .=
'<option value="' . htmlspecialchars($val) .
'"' . $sel .
'>' . $this->
getLanguageService()->sL($label) .
'</option>';
1273 $p_field =
'<select class="form-control" id="' . $idName .
'" name="' . $fN .
'" onChange="uFormUrl(' . $aname .
')">' . $p_field .
'</select>';
1277 $sel = $fV ?
'checked' :
'';
1279 '<label class="btn btn-default btn-checkbox">'
1280 .
'<input type="hidden" name="' . $fN .
'" value="0" />'
1281 .
'<input id="' . $idName .
'" type="checkbox" name="' . $fN .
'" value="' . ($typeDat[
'paramstr'] ? $typeDat[
'paramstr'] : 1) .
'" ' . $sel .
' onClick="uFormUrl(' . $aname .
')" />'
1282 .
'<span class="t3-icon fa"></span>'
1286 $sel = $fV ?
'checked' :
'';
1288 '<label class="btn btn-default btn-checkbox">'
1289 .
'<input type="hidden" name="' . $fN .
'" value="#" />'
1290 .
'<input id="' . $idName .
'" type="checkbox" name="' . $fN .
'" value="" ' . $sel .
' onClick="uFormUrl(' . $aname .
')" />'
1291 .
'<span class="t3-icon fa"></span>'
1296 $extList = $typeDat[
'paramstr'];
1297 if ($extList ===
'IMAGE_EXT') {
1298 $extList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'];
1300 $p_field =
'<option value="">(' . $extList .
')</option>';
1301 if (trim($params[
'value'])) {
1302 $val = $params[
'value'];
1303 $p_field .=
'<option value=""></option>';
1304 $p_field .=
'<option value="' . htmlspecialchars($val) .
'" selected>' . $val .
'</option>';
1306 $p_field =
'<select class="form-select" id="' . $idName .
'" name="' . $fN .
'" onChange="uFormUrl(' . $aname .
')">' . $p_field .
'</select>';
1309 $userFunction = $typeDat[
'paramstr'];
1310 $userFunctionParams = array(
'fieldName' => $fN,
'fieldValue' => $fV);
1316 $p_field =
'<input class="form-control" id="' . $idName .
'" type="text" name="' . $fN .
'" value="' . $fV .
'"'
1317 .
' onChange="uFormUrl(' . $aname .
')" />';
1320 $userTyposcriptID =
'userTS-' . $idName;
1321 $defaultTyposcriptID =
'defaultTS-' . $idName;
1322 $checkboxName =
'check[' . $params[
'name'] .
']';
1323 $checkboxID =
'check-' . $idName;
1325 if ($typeDat[
'type'] ===
'color' && substr($params[
'value'], 0, 2) !=
'{$') {
1326 $appendedGroupAddon =
'<span class="input-group-addon colorbox" id="colorbox-' . $idName .
'" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' . $params[
'value'] .
';"></span>';
1328 $appendedGroupAddon =
'';
1330 $userTyposcriptStyle =
'';
1331 $deleteIconHTML =
'';
1332 $constantCheckbox =
'';
1333 $constantDefaultRow =
'';
1334 if (!$this->ext_dontCheckIssetValues) {
1336 if (isset($this->objReg[$params[
'name']])) {
1337 $checkboxValue =
'checked';
1338 $defaultTyposcriptStyle =
'style="display:none;"';
1340 $checkboxValue =
'';
1341 $userTyposcriptStyle =
'style="display:none;"';
1342 $defaultTyposcriptStyle =
'';
1344 $deleteTitle = $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.deleteTitle',
true);
1345 $deleteIcon = $iconFactory->getIcon(
'actions-edit-undo',
Icon::SIZE_SMALL)->render();
1347 '<button type="button" class="btn btn-default t3js-toggle" data-toggle="undo" rel="' . $idName .
'">'
1348 .
'<span title="' . $deleteTitle .
'" alt="' . $deleteTitle .
'">'
1352 $editTitle = $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.editTitle',
true);
1353 $editIcon = $iconFactory->getIcon(
'actions-open',
Icon::SIZE_SMALL)->render();
1355 '<button type="button" class="btn btn-default t3js-toggle" data-toggle="edit" rel="' . $idName .
'">'
1356 .
'<span title="' . $editTitle .
'" alt="' . $editTitle .
'">'
1360 $constantCheckbox =
'<input type="hidden" name="' . $checkboxName .
'" id="' . $checkboxID .
'" value="' . $checkboxValue .
'"/>';
1362 if (!$params[
'default_value']) {
1363 $params[
'default_value'] =
'[Empty]';
1365 $constantDefaultRow =
1366 '<div class="input-group defaultTS" id="' . $defaultTyposcriptID .
'" ' . $defaultTyposcriptStyle .
'>'
1367 .
'<span class="input-group-btn">' . $editIconHTML .
'</span>'
1368 .
'<input class="form-control" type="text" placeholder="' . htmlspecialchars($params[
'default_value']) .
'" readonly>'
1369 . $appendedGroupAddon
1373 '<div class="input-group userTS" id="' . $userTyposcriptID .
'" ' . $userTyposcriptStyle .
'>'
1374 .
'<span class="input-group-btn">' . $deleteIconHTML .
'</span>'
1376 . $appendedGroupAddon
1378 $constantLabel =
'<label class="t3js-formengine-label"><span>' . htmlspecialchars($head) .
'</span></label>';
1379 $constantName =
'<span class="help-block">[' . $params[
'name'] .
']</span>';
1380 $constantDescription = $body ?
'<p class="help-block">' . htmlspecialchars($body) .
'</p>' :
'';
1383 $constantData .=
'<span class="help-block">' . $hint .
'</span>';
1388 . $constantDefaultRow;
1391 '<fieldset class="form-section">'
1392 .
'<a name="' . $raname .
'"></a>' . $help[
'constants'][$params[
'name']]
1393 .
'<div class="form-group">'
1394 . $constantLabel . $constantName . $constantDescription . $constantData
1398 debug(
'Error. Constant did not exist. Should not happen.');
1402 return '<div class="tstemplate-constanteditor">' . $output .
'</div>';
1421 $this->objReg = array();
1432 while (isset($this->raw[$this->rawP])) {
1433 $line = ltrim($this->raw[$this->rawP]);
1434 if (strstr($line, $this->edit_divider)) {
1436 $this->objReg = array();
1440 if ($line[0] ===
'[') {
1441 }
elseif (strcspn($line,
'}#/') != 0) {
1442 $varL = strcspn($line,
' {=<');
1443 $var = substr($line, 0, $varL);
1444 $line = ltrim(substr($line, $varL));
1447 $this->objReg[$pre . $var] = $this->rawP - 1;
1450 $this->ext_inBrace++;
1454 $this->lastComment =
'';
1455 }
elseif ($line[0] ===
'}') {
1456 $this->lastComment =
'';
1457 $this->ext_inBrace--;
1458 if ($this->ext_inBrace < 0) {
1459 $this->ext_inBrace = 0;
1477 $theValue =
' ' . trim($var);
1478 if (isset($this->objReg[$key])) {
1479 $lineNum = $this->objReg[$key];
1480 $parts = explode(
'=', $this->raw[$lineNum], 2);
1481 if (count($parts) === 2) {
1482 $parts[1] = $theValue;
1484 $this->raw[$lineNum] = implode($parts,
'=');
1486 $this->raw[] = $key .
' =' . $theValue;
1488 $this->changed =
true;
1498 if (isset($this->objReg[$key])) {
1499 $lineNum = $this->objReg[$key];
1500 unset($this->raw[$lineNum]);
1502 $this->changed =
true;
1512 $tsbrArray = array();
1513 foreach ($arr as $theK => $theV) {
1514 $theKeyParts = explode(
'.', $theK);
1516 $c = count($theKeyParts);
1518 foreach ($theKeyParts as $p) {
1520 $depth .= ($depth ?
'.' :
'') . $p;
1521 $tsbrArray[$depth] = $c == $a ? $theV : 1;
1525 foreach ($tsbrArray as $theK => $theV) {
1527 $settings[$theK] = 1;
1529 unset($settings[$theK]);
1544 public function ext_procesInput($http_post_vars, $http_post_files, $theConstants, $tplRow)
1546 $data = $http_post_vars[
'data'];
1547 $check = $http_post_vars[
'check'];
1548 $Wdata = $http_post_vars[
'Wdata'];
1549 $W2data = $http_post_vars[
'W2data'];
1550 $W3data = $http_post_vars[
'W3data'];
1551 $W4data = $http_post_vars[
'W4data'];
1552 $W5data = $http_post_vars[
'W5data'];
1553 if (is_array($data)) {
1554 foreach ($data as $key => $var) {
1555 if (isset($theConstants[$key])) {
1557 if ($this->ext_dontCheckIssetValues || isset($check[$key])) {
1559 list($var) = explode(LF, $var);
1561 switch ($typeDat[
'type']) {
1563 if ($typeDat[
'paramstr']) {
1570 $var = max(0, (
int)$var);
1575 $var = preg_replace(
'/[^A-Fa-f0-9]*/',
'', $var);
1576 $useFulHex = strlen($var) > 3;
1577 $col[] = HexDec($var[0]);
1578 $col[] = HexDec($var[1]);
1579 $col[] = HexDec($var[2]);
1581 $col[] = HexDec($var[3]);
1582 $col[] = HexDec($var[4]);
1583 $col[] = HexDec($var[5]);
1585 $var = substr((
'0' . DecHex($col[0])), -1) . substr((
'0' . DecHex($col[1])), -1) . substr((
'0' . DecHex($col[2])), -1);
1587 $var .= substr((
'0' . DecHex($col[3])), -1) . substr((
'0' . DecHex($col[4])), -1) . substr((
'0' . DecHex($col[5])), -1);
1589 $var =
'#' . strtoupper($var);
1600 if (isset($Wdata[$key])) {
1601 $var .=
'|' . $Wdata[$key];
1605 if (isset($Wdata[$key])) {
1606 $var = (int)$var .
',' . (
int)$Wdata[$key];
1607 if (isset($W2data[$key])) {
1608 $var .=
',' . (int)$W2data[$key];
1609 if (isset($W3data[$key])) {
1610 $var .=
',' . (int)$W3data[$key];
1611 if (isset($W4data[$key])) {
1612 $var .=
',' . (int)$W4data[$key];
1613 if (isset($W5data[$key])) {
1614 $var .=
',' . (int)$W5data[$key];
1623 $var = $typeDat[
'paramstr'] ? $typeDat[
'paramstr'] : 1;
1627 if ($this->ext_printAll || (
string)$theConstants[$key][
'value'] !== (string)$var) {
1632 unset($check[$key]);
1641 if (!$this->ext_dontCheckIssetValues && is_array($check)) {
1642 foreach ($check as $key => $var) {
1643 if (isset($theConstants[$key])) {
1644 $dValue = $theConstants[$key][
'default_value'];