71 'enable' => [
'Enable features',
'a'],
72 'dims' => [
'Dimensions, widths, heights, pixels',
'b'],
73 'file' => [
'Files',
'c'],
74 'typo' => [
'Typography',
'd'],
75 'color' => [
'Colors',
'e'],
76 'links' => [
'Links and targets',
'f'],
77 'language' => [
'Language specific constants',
'g'],
79 'cheader' => [
'Content: \'Header\'',
'ma'],
80 'cheader_g' => [
'Content: \'Header\', Graphical',
'ma'],
81 'ctext' => [
'Content: \'Text\'',
'mb'],
82 'cimage' => [
'Content: \'Image\'',
'md'],
83 'ctextmedia' => [
'Content: \'Textmedia\'',
'ml'],
84 'cbullets' => [
'Content: \'Bullet list\'',
'me'],
85 'ctable' => [
'Content: \'Table\'',
'mf'],
86 'cuploads' => [
'Content: \'Filelinks\'',
'mg'],
87 'cmultimedia' => [
'Content: \'Multimedia\'',
'mh'],
88 'cmedia' => [
'Content: \'Media\'',
'mr'],
89 'cmailform' => [
'Content: \'Form\'',
'mi'],
90 'csearch' => [
'Content: \'Search\'',
'mj'],
91 'clogin' => [
'Content: \'Login\'',
'mk'],
92 'cmenu' => [
'Content: \'Menu/Sitemap\'',
'mm'],
93 'cshortcut' => [
'Content: \'Insert records\'',
'mn'],
94 'clist' => [
'Content: \'List of records\'',
'mo'],
95 'chtml' => [
'Content: \'HTML\'',
'mq']
248 $this->tt_track =
false;
249 $this->verbose =
false;
270 return preg_replace_callback(
'/\\{\\$(.[^}]+)\\}/', [$this,
'substituteConstantsCallBack'], $all);
282 $marker = substr(md5($matches[0]), 0, 6);
283 switch ($this->constantMode) {
285 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
'##' . $marker .
'_B##' . $this->flatSetup[$matches[1]] .
'##' . $marker .
'_M##' . $matches[0] .
'##' . $marker .
'_E##' : $matches[0];
288 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ?
'##' . $marker .
'_B##' . $matches[0] .
'##' . $marker .
'_M##' . $this->flatSetup[$matches[1]] .
'##' . $marker .
'_E##' : $matches[0];
291 $ret_val = $matches[0];
294 $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ? $this->flatSetup[$matches[1]] : $matches[0];
308 switch ($this->constantMode) {
312 '/##[a-z0-9]{6}_B##(.*?)##[a-z0-9]{6}_M##(.*?)##[a-z0-9]{6}_E##/',
313 '<strong class="text-success" data-toggle="tooltip" data-placement="top" data-title="$1" title="$1">$2</strong>',
333 $constants = GeneralUtility::makeInstance(Parser\TypoScriptParser::class);
338 $matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
340 $matchObj->setSimulateMatchResult(
true);
342 $cc = count($this->constants);
343 $defaultConstants = [];
344 foreach ($this->constants as $str) {
347 $this->flatSetup = [];
353 $this->flatSetup = [];
366 $parts = explode(
'.', $theKey, 2);
367 if ((
string)$parts[0] !==
'' && is_array($theSetup[$parts[0] .
'.'])) {
368 if (trim($parts[1]) !==
'') {
369 return $this->
ext_getSetup($theSetup[$parts[0] .
'.'], trim($parts[1]));
371 return [$theSetup[$parts[0] .
'.'], $theSetup[$parts[0]]];
373 if (trim($theKey) !==
'') {
374 return [[], $theSetup[$theKey]];
376 return [$theSetup,
''];
390 public function ext_getObjTree($arr, $depth_in, $depthData, $parentType =
'', $parentValue =
'', $alphaSort =
'0')
393 if ($alphaSort ==
'1') {
399 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
400 foreach ($arr as $key => $value) {
402 if (substr($key, -2) !==
'..') {
403 $key = preg_replace(
'/\\.$/',
'', $key);
404 if (substr($key, -1) !==
'.') {
406 $keyArr_num[$key] = $arr[$key];
408 $keyArr_alpha[$key] = $arr[$key];
414 $keyArr = $keyArr_num + $keyArr_alpha;
416 $depth_in = $depth_in .
'.';
418 foreach ($keyArr as $key => $value) {
419 $depth = $depth_in . $key;
421 if ($this->bType !==
'const' || $depth[0] !==
'_') {
422 $goto = substr(md5($depth), 0, 6);
424 $PM = is_array($arr[$key .
'.']) && !$this->ext_noPMicons ? ($deeper ?
'minus' :
'plus') :
'join';
425 $HTML .= $depthData .
'<li><span class="list-tree-group">';
426 if ($PM !==
'join') {
428 'id' => (int)GeneralUtility::_GP(
'id'),
429 'tsbr[' . $depth .
']' => $deeper ? 0 : 1
431 if (GeneralUtility::_GP(
'breakPointLN')) {
432 $urlParameters[
'breakPointLN'] = GeneralUtility::_GP(
'breakPointLN');
434 $aHref = (string)$uriBuilder->buildUriFromRoute(
'web_ts', $urlParameters) .
'#' . $goto;
435 $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>';
439 if (($depth ===
'types' || $depth ===
'resources' || $depth ===
'sitetitle') && $this->bType ===
'setup') {
440 $label =
'<span style="color: #666666;">' . $label .
'</span>';
442 if ($this->linkObjects) {
444 'id' => (int)GeneralUtility::_GP(
'id'),
447 if (GeneralUtility::_GP(
'breakPointLN')) {
448 $urlParameters[
'breakPointLN'] = GeneralUtility::_GP(
'breakPointLN');
450 $aHref = (string)$uriBuilder->buildUriFromRoute(
'web_ts', $urlParameters);
451 if ($this->bType !==
'const') {
452 $ln = is_array($arr[$key .
'.ln..']) ?
'Defined in: ' . $this->
lineNumberToScript($arr[$key .
'.ln..']) :
'N/A';
456 if ($this->tsbrowser_searchKeys[$depth] & 4) {
458 $label =
'<strong class="text-danger">' . $label .
'</strong>';
460 $label =
'<a href="' . htmlspecialchars($aHref) .
'" title="' . htmlspecialchars($depth_in . $key .
' ' . $ln) .
'">' . $label .
'</a>';
463 $HTML .=
'<span class="list-tree-label" title="' . htmlspecialchars($depth_in . $key) .
'">[' . $label .
']</span>';
464 if (isset($arr[$key])) {
465 $theValue = $arr[$key];
466 if ($this->fixedLgd) {
467 $imgBlocks = ceil(1 + strlen($depthData) / 77);
468 $lgdChars = 68 - ceil(strlen(
'[' . $key .
']') * 0.8) - $imgBlocks * 3;
472 if ($this->tsbrowser_searchKeys[$depth] & 2) {
473 $HTML .=
' = <span class="list-tree-value text-danger">' . htmlspecialchars($theValue) .
'</span>';
475 $HTML .=
' = <span class="list-tree-value">' . htmlspecialchars($theValue) .
'</span>';
477 if ($this->ext_regComments && isset($arr[$key .
'..'])) {
478 $comment = $arr[$key .
'..'];
480 if (!preg_match(
'/### <INCLUDE_TYPOSCRIPT:.*/', $comment)) {
482 $comment = preg_replace(
'/[\\r\\n]/',
' ', $comment);
484 $comment = preg_replace(
'/[#\\*]{2,}/',
'', $comment);
486 $comment = preg_replace(
'/^[#\\*\\s]+/',
'# ', $comment);
488 $comment = htmlspecialchars($comment);
489 $HTML .=
' <i class="text-muted">' . trim($comment) .
'</i>';
495 $HTML .= $this->
ext_getObjTree($arr[$key .
'.'], $depth, $depthData,
'', $arr[$key], $alphaSort);
500 $HTML =
'<ul class="list-tree text-monospace">' . $HTML .
'</ul>';
519 if (!is_array($this->lnToScript)) {
520 $this->lnToScript = [];
524 foreach ($this->hierarchyInfo as $templateNumber => $info) {
528 $linecountAfterIncludeProcessing = substr_count($this->config[$templateNumber], LF) + 2;
529 $c += $linecountAfterIncludeProcessing;
530 $this->lnToScript[$c] = $info[
'title'];
534 foreach ($lnArr as $k => $ln) {
535 foreach ($this->lnToScript as $endLn => $title) {
536 if ($endLn >= (
int)$ln) {
537 $lnArr[$k] =
'"' . $title .
'", ' . $ln;
543 return implode(
'; ', $lnArr);
557 foreach ($arr as $key => $value) {
558 $key = preg_replace(
'/\\.$/',
'', $key);
559 if (substr($key, -1) !==
'.') {
564 $depth_in = $depth_in .
'.';
567 if ($this->regexMode) {
568 $searchPattern =
'/' . addcslashes($searchString,
'/') .
'/';
569 $matchResult = @preg_match($searchPattern,
'');
570 if ($matchResult ===
false) {
571 throw new Exception(sprintf(
'Error evaluating regular expression "%s".', $searchPattern), 1446559458);
574 foreach ($keyArr as $key => $value) {
575 $depth = $depth_in . $key;
576 $deeper = is_array($arr[$key .
'.']);
577 if ($this->regexMode) {
579 if (preg_match($searchPattern, $arr[$key])) {
580 $this->tsbrowser_searchKeys[$depth] += 2;
583 if (preg_match($searchPattern, $key)) {
584 $this->tsbrowser_searchKeys[$depth] += 4;
587 if (preg_match($searchPattern, $depth_in)) {
588 $this->tsbrowser_searchKeys[$depth] = 1;
592 if (stristr($arr[$key], $searchString)) {
593 $this->tsbrowser_searchKeys[$depth] += 2;
596 if (stristr($key, $searchString)) {
597 $this->tsbrowser_searchKeys[$depth] += 4;
600 if (stristr($depth_in, $searchString)) {
601 $this->tsbrowser_searchKeys[$depth] = 1;
605 $cS = count($this->tsbrowser_searchKeys);
606 $keyArray = $this->
ext_getSearchKeys($arr[$key .
'.'], $depth, $searchString, $keyArray);
607 if ($cS != count($this->tsbrowser_searchKeys)) {
608 $keyArray[$depth] = 1;
623 if ((
int)$val[
'uid'] === (
int)$pid) {
641 foreach ($arr as $key => $value) {
642 $key = preg_replace(
'/\\.$/',
'', $key);
643 if (substr($key, -1) !==
'.') {
650 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
652 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
653 foreach ($keyArr as $key => $value) {
656 $deeper = is_array($arr[$key .
'.']);
658 $LN = $a == $c ?
'blank' :
'line';
659 $BTM = $a == $c ?
'top' :
'';
661 $alttext =
'[' . $row[
'templateID'] .
']';
663 $icon = strpos($row[
'templateID'],
'sys') === 0
664 ?
'<span title="' . htmlspecialchars($alttext) .
'">' . $iconFactory->getIconForRecord(
'sys_template', $row,
Icon::SIZE_SMALL)->render() .
'</span>'
665 :
'<span title="' . htmlspecialchars($alttext) .
'">' . $iconFactory->getIcon(
'mimetypes-x-content-template-static',
Icon::SIZE_SMALL)->render() .
'</span>';
666 if (in_array($row[
'templateID'], $this->clearList_const) || in_array($row[
'templateID'], $this->clearList_setup)) {
668 'id' => (int)GeneralUtility::_GP(
'id'),
669 'template' => $row[
'templateID']
671 $aHref = (string)$uriBuilder->buildUriFromRoute(
'web_ts', $urlParameters);
672 $A_B =
'<a href="' . htmlspecialchars($aHref) .
'">';
674 if (GeneralUtility::_GP(
'template') == $row[
'templateID']) {
675 $A_B =
'<strong>' . $A_B;
682 $HTML .= ($first ?
'' :
'<span class="treeline-icon treeline-icon-join' . $BTM .
'"></span>') . $icon .
' ' . $A_B
683 . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row[
'title'],
$GLOBALS[
'BE_USER']->uc[
'titleLen']))
684 . $A_E .
' ';
686 $statusCheckedIcon = $iconFactory->getIcon(
'status-status-checked',
Icon::SIZE_SMALL)->render();
688 <td class="nowrap">' . $HTML .
'</td>
689 <td align="center">' . ($row[
'root'] ? $statusCheckedIcon :
'') .
'</td>
690 <td align="center">' . ($row[
'clConf'] ? $statusCheckedIcon :
'') .
'</td>
691 <td align="center">' . ($row[
'clConst'] ? $statusCheckedIcon :
'') .
'</td>
692 <td align="center">' . ($row[
'pid'] ?:
'') .
'</td>
693 <td align="center">' . ($RL >= 0 ? $RL :
'') .
'</td>
694 <td>' . ($row[
'next'] ? $row[
'next'] :
'') .
'</td>
697 $keyArray = $this->
ext_getTemplateHierarchyArr($arr[$key .
'.'], $depthData . ($first ?
'' :
'<span class="treeline-icon treeline-icon-' . $LN .
'"></span>'), $keyArray);
713 $parent = $this->hierarchyInfo[$pointer - 1][
'templateParent'];
714 while ($pointer > 0 && $this->hierarchyInfo[$pointer - 1][
'templateParent'] == $parent) {
716 $row = $this->hierarchyInfo[$pointer];
717 $depthDataArr[$row[
'templateID']] = $row;
718 unset($this->clearList_setup_temp[$row[
'templateID']]);
719 unset($this->clearList_const_temp[$row[
'templateID']]);
720 $this->templateTitles[$row[
'templateID']] = $row[
'title'];
721 if ($row[
'templateID'] == $this->hierarchyInfo[$pointer - 1][
'templateParent']) {
725 return $depthDataArr;
741 $lineNumbers =
false,
745 $syntaxHLBlockmode = 0
749 $all .=
'[GLOBAL]' . LF . $str;
752 $tsparser = GeneralUtility::makeInstance(Parser\TypoScriptParser::class);
753 $tsparser->lineNumberOffset = $this->ext_lineNumberOffset + 1;
754 $tsparser->parentObject = $this;
755 return $tsparser->doSyntaxHighlight($all, $lineNumbers ? [$this->ext_lineNumberOffset + 1] :
'', $syntaxHLBlockmode);
757 return $this->
ext_formatTS($all, $lineNumbers, $comments, $crop);
772 if (strlen($string) > $chars) {
773 if (strlen($string) > 24 && preg_match(
'/^##[a-z0-9]{6}_B##$/', substr($string, 0, 12))) {
774 $string = GeneralUtility::fixed_lgd_cs(substr($string, 12, -12), $chars - 3);
775 $marker = substr(md5($string), 0, 6);
776 return '##' . $marker .
'_B##' . $string .
'##' . $marker .
'_E##';
778 return GeneralUtility::fixed_lgd_cs($string, $chars - 3);
791 return '<a href="#" id="line-' . $lineNumber .
'" onClick="return brPoint(' . $lineNumber .
','
792 . ($this->ext_lineNumberOffset_mode ===
'setup' ? 1 : 0) .
');">' . $str .
'</a>';
802 public function ext_formatTS($input, $ln, $comments =
true, $crop =
false)
804 $cArr = explode(LF, $input);
805 $n = ceil(log10(count($cArr) + $this->ext_lineNumberOffset));
807 foreach ($cArr as $k => $v) {
808 $lln = $k + $this->ext_lineNumberOffset + 1;
810 $lineNum = $this->
ext_lnBreakPointWrap($lln, str_replace(
' ',
' ', sprintf(
'% ' . $n .
'd', $lln))) .
': ';
812 $v = htmlspecialchars($v);
816 $cArr[$k] = $lineNum . str_replace(
' ',
' ', $v);
817 $firstChar = substr(trim($v), 0, 1);
818 if ($firstChar ===
'[') {
819 $cArr[$k] =
'<strong class="text-success">' . $cArr[$k] .
'</strong>';
820 } elseif ($firstChar ===
'/' || $firstChar ===
'#') {
822 $cArr[$k] =
'<span class="text-muted">' . $cArr[$k] .
'</span>';
828 $output = implode(
'<br />', $cArr) .
'<br />';
852 $queryBuilder->expr()->eq(
'uid', $queryBuilder->createNamedParameter($templateUid, \PDO::PARAM_INT))
855 $row = $queryBuilder->
execute()->fetch();
874 while ($row = $result->fetch()) {
876 if (is_array($row)) {
892 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
893 ->getQueryBuilderForTable(
'sys_template');
896 ->
add(GeneralUtility::makeInstance(DeletedRestriction::class))
897 ->
add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
899 $queryBuilder->select(
'*')
900 ->from(
'sys_template')
902 $queryBuilder->expr()->eq(
'pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT))
904 if (!empty(
$GLOBALS[
'TCA'][
'sys_template'][
'ctrl'][
'sortby'])) {
905 $queryBuilder->orderBy(
$GLOBALS[
'TCA'][
'sys_template'][
'ctrl'][
'sortby']);
908 return $queryBuilder;
920 $editableComments = [];
922 foreach ($this->flatSetup as $const => $value) {
923 if (substr($const, -2) ===
'..' || !isset($this->flatSetup[$const .
'..'])) {
927 $comment = trim($this->flatSetup[$const .
'..']);
928 $c_arr = explode(LF, $comment);
929 foreach ($c_arr as $k => $v) {
930 $line = trim(preg_replace(
'/^[#\\/]*/',
'', $v));
934 $parts = explode(
';', $line);
935 foreach ($parts as $par) {
936 if (strstr($par,
'=')) {
937 $keyValPair = explode(
'=', $par, 2);
938 switch (trim(strtolower($keyValPair[0]))) {
941 $editableComments[$const][
'type'] = trim($keyValPair[1]);
945 $catSplit = explode(
'/', strtolower($keyValPair[1]));
946 $catSplit[0] = trim($catSplit[0]);
947 if (isset($this->categoryLabels[$catSplit[0]])) {
948 $catSplit[0] = $this->categoryLabels[$catSplit[0]];
950 $editableComments[$const][
'cat'] = $catSplit[0];
953 $catSplit[1] = trim($catSplit[1]);
954 if ($catSplit[1] && isset($this->subCategories[$catSplit[1]])) {
955 $editableComments[$const][
'subcat_name'] = $catSplit[1];
956 $orderIdentifier = isset($catSplit[2]) ? trim($catSplit[2]) : $counter;
957 $editableComments[$const][
'subcat'] = $this->subCategories[$catSplit[1]][1]
958 .
'/' . $catSplit[1] .
'/' . $orderIdentifier .
'z';
959 } elseif (isset($catSplit[2])) {
960 $editableComments[$const][
'subcat'] =
'x' .
'/' . trim($catSplit[2]) .
'z';
962 $editableComments[$const][
'subcat'] =
'x' .
'/' . $counter .
'z';
967 $editableComments[$const][
'label'] = trim($keyValPair[1]);
969 case 'customcategory':
971 $customCategory = explode(
'=', $keyValPair[1], 2);
972 if (trim($customCategory[0])) {
973 $categoryKey = strtolower($customCategory[0]);
977 case 'customsubcategory':
979 $customSubcategory = explode(
'=', $keyValPair[1], 2);
980 if (trim($customSubcategory[0])) {
981 $subCategoryKey = strtolower($customSubcategory[0]);
989 if (isset($editableComments[$const])) {
990 $editableComments[$const][
'name'] = $const;
991 $editableComments[$const][
'value'] = trim($value);
992 if (isset($default[$const])) {
993 $editableComments[$const][
'default_value'] = trim($default[$const]);
997 return $editableComments;
1006 foreach ($editConstArray as $constName => $constData) {
1007 if (!$constData[
'type']) {
1008 $constData[
'type'] =
'string';
1010 $cats = explode(
',', $constData[
'cat']);
1012 foreach ($cats as $theCat) {
1013 $theCat = trim($theCat);
1015 $this->categories[$theCat][$constName] = $constData[
'subcat'];
1028 foreach ($this->categories as $k => $v) {
1030 $retArr[$k] = strtoupper($k) .
' (' . count($v) .
')';
1043 $type = trim($type);
1045 $retArr[
'type'] =
'string';
1047 $m = strcspn($type,
' [');
1048 $retArr[
'type'] = strtolower(substr($type, 0, $m));
1049 $types = [
'int' => 1,
'options' => 1,
'file' => 1,
'boolean' => 1,
'offset' => 1,
'user' => 1];
1050 if (isset($types[$retArr[
'type']])) {
1051 $p = trim(substr($type, $m));
1053 preg_match(
'/\\[(.*)\\]/', $p, $reg);
1056 $retArr[
'paramstr'] = $p;
1057 switch ($retArr[
'type']) {
1059 if ($retArr[
'paramstr'][0] ===
'-') {
1060 $retArr[
'params'] = GeneralUtility::intExplode(
'-', substr($retArr[
'paramstr'], 1));
1061 $retArr[
'params'][0] = (int)(
'-' . $retArr[
'params'][0]);
1063 $retArr[
'params'] = GeneralUtility::intExplode(
'-', $retArr[
'paramstr']);
1065 $retArr[
'min'] = $retArr[
'params'][0];
1066 $retArr[
'max'] = $retArr[
'params'][1];
1067 $retArr[
'paramstr'] = $retArr[
'params'][0] .
' - ' . $retArr[
'params'][1];
1070 $retArr[
'params'] = explode(
',', $retArr[
'paramstr']);
1085 $fN =
'data[' . $params[
'name'] .
']';
1086 $idName = str_replace(
'.',
'-', $params[
'name']);
1087 $fV = $params[
'value'];
1089 if (preg_match(
'/^{[\\$][a-zA-Z0-9\\.]*}$/', trim($fV), $reg)) {
1092 $fV = htmlspecialchars($fV);
1093 return [$fN, $fV, $params, $idName];
1105 reset($theConstants);
1108 if (is_array($this->categories[$category])) {
1109 if (!$this->doNotSortCategoriesBeforeMakingForm) {
1110 asort($this->categories[$category]);
1113 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
1114 foreach ($this->categories[$category] as $name => $type) {
1115 $params = $theConstants[$name];
1116 if (is_array($params)) {
1117 if ($subcat != $params[
'subcat_name']) {
1118 $subcat = $params[
'subcat_name'];
1119 $subcat_name = $params[
'subcat_name'] ? $this->subCategories[$params[
'subcat_name']][0] :
'Others';
1120 $output .=
'<h3>' . $subcat_name .
'</h3>';
1123 $label_parts = explode(
':', $label, 2);
1124 if (count($label_parts) === 2) {
1125 $head = trim($label_parts[0]);
1126 $body = trim($label_parts[1]);
1128 $head = trim($label_parts[0]);
1133 $raname = substr(md5($params[
'name']), 0, 10);
1134 $aname =
'\'' . $raname .
'\'';
1135 list($fN, $fV, $params, $idName) = $this->
ext_fNandV($params);
1136 $idName = htmlspecialchars($idName);
1138 switch ($typeDat[
'type']) {
1141 $additionalAttributes =
'';
1142 if ($typeDat[
'paramstr']) {
1143 $hint =
' Range: ' . $typeDat[
'paramstr'];
1144 } elseif ($typeDat[
'type'] ===
'int+') {
1145 $hint =
' Range: 0 - ';
1146 $typeDat[
'min'] = 0;
1148 $hint =
' (Integer)';
1151 if (isset($typeDat[
'min'])) {
1152 $additionalAttributes .=
' min="' . (int)$typeDat[
'min'] .
'" ';
1154 if (isset($typeDat[
'max'])) {
1155 $additionalAttributes .=
' max="' . (int)$typeDat[
'max'] .
'" ';
1159 '<input class="form-control" id="' . $idName .
'" type="number"'
1160 .
' name="' . $fN .
'" value="' . $fV .
'"' .
' onChange="uFormUrl(' . $aname .
')"' . $additionalAttributes .
' />';
1164 <input class="form-control formengine-colorpickerelement t3js-color-picker" type="text" id="input-' . $idName .
'" rel="' . $idName .
1165 '" name="' . $fN .
'" value="' . $fV .
'" onChange="uFormUrl(' . $aname .
')" />';
1167 if (empty($this->inlineJavaScript[$typeDat[
'type']])) {
1168 $this->inlineJavaScript[$typeDat[
'type']] =
'require([\'TYPO3/CMS/Backend/ColorPicker\'], function(ColorPicker){ColorPicker.initialize()});';
1172 $wArr = explode(
'|', $fV);
1173 $p_field =
'<div class="input-group">
1174 <input class="form-control form-control-adapt" type="text" id="' . $idName .
'" name="' . $fN .
'" value="' . $wArr[0] .
'" onChange="uFormUrl(' . $aname .
')" />
1175 <span class="input-group-addon input-group-icon">|</span>
1176 <input class="form-control form-control-adapt" type="text" name="W' . $fN .
'" value="' . $wArr[1] .
'" onChange="uFormUrl(' . $aname .
')" />
1180 $wArr = explode(
',', $fV);
1181 $labels = GeneralUtility::trimExplode(
',', $typeDat[
'paramstr']);
1182 $p_field =
'<span class="input-group-addon input-group-icon">' . ($labels[0] ?:
'x') .
'</span><input type="text" class="form-control form-control-adapt" name="' . $fN .
'" value="' . $wArr[0] .
'" onChange="uFormUrl(' . $aname .
')" />';
1183 $p_field .=
'<span class="input-group-addon input-group-icon">' . ($labels[1] ?:
'y') .
'</span><input type="text" name="W' . $fN .
'" value="' . $wArr[1] .
'" class="form-control form-control-adapt" onChange="uFormUrl(' . $aname .
')" />';
1184 $labelsCount = count($labels);
1185 for ($aa = 2; $aa < $labelsCount; $aa++) {
1187 $p_field .=
'<span class="input-group-addon input-group-icon">' . $labels[$aa] .
'</span><input type="text" name="W' . $aa . $fN .
'" value="' . $wArr[$aa] .
'" class="form-control form-control-adapt" onChange="uFormUrl(' . $aname .
')" />';
1189 $p_field .=
'<input type="hidden" name="W' . $aa . $fN .
'" value="' . $wArr[$aa] .
'" />';
1192 $p_field =
'<div class="input-group">' . $p_field .
'</div>';
1195 if (is_array($typeDat[
'params'])) {
1197 foreach ($typeDat[
'params'] as $val) {
1198 $vParts = explode(
'=', $val, 2);
1199 $label = $vParts[0];
1200 $val = $vParts[1] ?? $vParts[0];
1203 if ($val === $params[
'value']) {
1206 $p_field .=
'<option value="' . htmlspecialchars($val) .
'"' . $sel .
'>' . $this->
getLanguageService()->
sL($label) .
'</option>';
1208 $p_field =
'<select class="form-control" id="' . $idName .
'" name="' . $fN .
'" onChange="uFormUrl(' . $aname .
')">' . $p_field .
'</select>';
1212 $sel = $fV ?
'checked' :
'';
1214 '<input type="hidden" name="' . $fN .
'" value="0" />'
1215 .
'<label class="btn btn-default btn-checkbox">'
1216 .
'<input id="' . $idName .
'" type="checkbox" name="' . $fN .
'" value="' . ($typeDat[
'paramstr'] ? $typeDat[
'paramstr'] : 1) .
'" ' . $sel .
' onClick="uFormUrl(' . $aname .
')" />'
1217 .
'<span class="t3-icon fa"></span>'
1221 $sel = $fV ?
'' :
'checked';
1223 '<input type="hidden" name="' . $fN .
'" value="" />'
1224 .
'<label class="btn btn-default btn-checkbox">'
1225 .
'<input id="' . $idName .
'" type="checkbox" name="' . $fN .
'" value="1" ' . $sel .
' onClick="uFormUrl(' . $aname .
')" />'
1226 .
'<span class="t3-icon fa"></span>'
1231 $extList = $typeDat[
'paramstr'];
1232 if ($extList ===
'IMAGE_EXT') {
1233 $extList =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'];
1235 $p_field =
'<option value="">(' . $extList .
')</option>';
1236 if (trim($params[
'value'])) {
1237 $val = $params[
'value'];
1238 $p_field .=
'<option value=""></option>';
1239 $p_field .=
'<option value="' . htmlspecialchars($val) .
'" selected>' . $val .
'</option>';
1241 $p_field =
'<select class="form-select" id="' . $idName .
'" name="' . $fN .
'" onChange="uFormUrl(' . $aname .
')">' . $p_field .
'</select>';
1244 $userFunction = $typeDat[
'paramstr'];
1245 $userFunctionParams = [
'fieldName' => $fN,
'fieldValue' => $fV];
1246 $p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
1249 $p_field =
'<input class="form-control" id="' . $idName .
'" type="text" name="' . $fN .
'" value="' . $fV .
'"'
1250 .
' onChange="uFormUrl(' . $aname .
')" />';
1253 $userTyposcriptID =
'userTS-' . $idName;
1254 $defaultTyposcriptID =
'defaultTS-' . $idName;
1255 $checkboxName =
'check[' . $params[
'name'] .
']';
1256 $checkboxID =
'check-' . $idName;
1257 $userTyposcriptStyle =
'';
1258 $deleteIconHTML =
'';
1259 $constantCheckbox =
'';
1260 $constantDefaultRow =
'';
1261 if (!$this->ext_dontCheckIssetValues) {
1263 if (isset($this->objReg[$params[
'name']])) {
1264 $checkboxValue =
'checked';
1265 $defaultTyposcriptStyle =
'style="display:none;"';
1267 $checkboxValue =
'';
1268 $userTyposcriptStyle =
'style="display:none;"';
1269 $defaultTyposcriptStyle =
'';
1271 $deleteTitle = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.deleteTitle'));
1272 $deleteIcon = $iconFactory->getIcon(
'actions-edit-undo',
Icon::SIZE_SMALL)->render();
1274 '<button type="button" class="btn btn-default t3js-toggle" data-toggle="undo" rel="' . $idName .
'">'
1275 .
'<span title="' . $deleteTitle .
'" alt="' . $deleteTitle .
'">'
1279 $editTitle = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.editTitle'));
1282 '<button type="button" class="btn btn-default t3js-toggle" data-toggle="edit" rel="' . $idName .
'">'
1283 .
'<span title="' . $editTitle .
'" alt="' . $editTitle .
'">'
1287 $constantCheckbox =
'<input type="hidden" name="' . $checkboxName .
'" id="' . $checkboxID .
'" value="' . $checkboxValue .
'"/>';
1289 if (!$params[
'default_value']) {
1290 $params[
'default_value'] =
'[Empty]';
1292 $constantDefaultRow =
1293 '<div class="input-group defaultTS" id="' . $defaultTyposcriptID .
'" ' . $defaultTyposcriptStyle .
'>'
1294 .
'<span class="input-group-btn">' . $editIconHTML .
'</span>'
1295 .
'<input class="form-control" type="text" placeholder="' . htmlspecialchars($params[
'default_value']) .
'" readonly>'
1299 '<div class="input-group userTS" id="' . $userTyposcriptID .
'" ' . $userTyposcriptStyle .
'>'
1300 .
'<span class="input-group-btn">' . $deleteIconHTML .
'</span>'
1303 $constantLabel =
'<label class="t3js-formengine-label"><span>' . htmlspecialchars($head) .
'</span></label>';
1304 $constantName =
'<span class="help-block">[' . $params[
'name'] .
']</span>';
1305 $constantDescription = $body ?
'<p class="help-block">' . htmlspecialchars($body) .
'</p>' :
'';
1308 $constantData .=
'<span class="help-block">' . $hint .
'</span>';
1313 . $constantDefaultRow;
1316 '<fieldset class="form-section">'
1317 .
'<a name="' . $raname .
'"></a>'
1318 .
'<div class="form-group">'
1319 . $constantLabel . $constantName . $constantDescription . $constantData
1323 debug(
'Error. Constant did not exist. Should not happen.');
1327 return '<div class="tstemplate-constanteditor">' .
$output .
'</div>';
1355 while (isset($this->raw[$this->rawP])) {
1356 $line = ltrim($this->raw[$this->rawP]);
1359 if ($line[0] ===
'[') {
1360 } elseif (strcspn($line,
'}#/') != 0) {
1361 $varL = strcspn($line,
' {=<');
1362 $var = substr($line, 0, $varL);
1363 $line = ltrim(substr($line, $varL));
1366 $this->objReg[$pre . $var] = $this->rawP - 1;
1369 $this->ext_inBrace++;
1373 $this->lastComment =
'';
1374 } elseif ($line[0] ===
'}') {
1375 $this->lastComment =
'';
1376 $this->ext_inBrace--;
1377 if ($this->ext_inBrace < 0) {
1378 $this->ext_inBrace = 0;
1395 $theValue =
' ' . trim($var);
1396 if (isset($this->objReg[$key])) {
1397 $lineNum = $this->objReg[$key];
1398 $parts = explode(
'=', $this->raw[$lineNum], 2);
1399 if (count($parts) === 2) {
1400 $parts[1] = $theValue;
1402 $this->raw[$lineNum] = implode(
'=', $parts);
1404 $this->raw[] = $key .
' =' . $theValue;
1406 $this->changed =
true;
1415 if (isset($this->objReg[$key])) {
1416 $lineNum = $this->objReg[$key];
1417 unset($this->raw[$lineNum]);
1419 $this->changed =
true;
1430 foreach ($arr as $theK => $theV) {
1431 $theKeyParts = explode(
'.', $theK);
1433 $c = count($theKeyParts);
1435 foreach ($theKeyParts as $p) {
1437 $depth .= ($depth ?
'.' :
'') . $p;
1438 $tsbrArray[$depth] = $c == $a ? $theV : 1;
1442 foreach ($tsbrArray as $theK => $theV) {
1444 $settings[$theK] = 1;
1446 unset($settings[$theK]);
1460 public function ext_procesInput($http_post_vars, $http_post_files, $theConstants, $tplRow)
1462 $data = $http_post_vars[
'data'];
1463 $check = $http_post_vars[
'check'];
1464 $Wdata = $http_post_vars[
'Wdata'];
1465 $W2data = $http_post_vars[
'W2data'];
1466 $W3data = $http_post_vars[
'W3data'];
1467 $W4data = $http_post_vars[
'W4data'];
1468 $W5data = $http_post_vars[
'W5data'];
1469 if (is_array($data)) {
1470 foreach ($data as $key => $var) {
1471 if (isset($theConstants[$key])) {
1473 if ($this->ext_dontCheckIssetValues || isset($check[$key])) {
1475 list($var) = explode(LF, $var);
1477 switch ($typeDat[
'type']) {
1479 if ($typeDat[
'paramstr']) {
1486 $var = max(0, (
int)$var);
1491 $var = preg_replace(
'/[^A-Fa-f0-9]*/',
'', $var);
1492 $useFulHex = strlen($var) > 3;
1493 $col[] = hexdec($var[0]);
1494 $col[] = hexdec($var[1]);
1495 $col[] = hexdec($var[2]);
1497 $col[] = hexdec($var[3]);
1498 $col[] = hexdec($var[4]);
1499 $col[] = hexdec($var[5]);
1501 $var = substr(
'0' . dechex($col[0]), -1) . substr(
'0' . dechex($col[1]), -1) . substr(
'0' . dechex($col[2]), -1);
1503 $var .= substr(
'0' . dechex($col[3]), -1) . substr(
'0' . dechex($col[4]), -1) . substr(
'0' . dechex($col[5]), -1);
1505 $var =
'#' . strtoupper($var);
1516 if (isset($Wdata[$key])) {
1517 $var .=
'|' . $Wdata[$key];
1521 if (isset($Wdata[$key])) {
1522 $var = (int)$var .
',' . (
int)$Wdata[$key];
1523 if (isset($W2data[$key])) {
1524 $var .=
',' . (int)$W2data[$key];
1525 if (isset($W3data[$key])) {
1526 $var .=
',' . (int)$W3data[$key];
1527 if (isset($W4data[$key])) {
1528 $var .=
',' . (int)$W4data[$key];
1529 if (isset($W5data[$key])) {
1530 $var .=
',' . (int)$W5data[$key];
1539 $var = $typeDat[
'paramstr'] ? $typeDat[
'paramstr'] : 1;
1543 if ($this->ext_printAll || (
string)$theConstants[$key][
'value'] !== (string)$var) {
1548 unset($check[$key]);
1557 if (!$this->ext_dontCheckIssetValues && is_array($check)) {
1558 foreach ($check as $key => $var) {
1559 if (isset($theConstants[$key])) {
1560 $dValue = $theConstants[$key][
'default_value'];
1590 return is_array($this->absoluteRootLine) ? $this->absoluteRootLine : [];