‪TYPO3CMS  10.4
ExtendedTemplateService.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
35 
43 {
47  protected ‪$categories = [
48  'basic' => [],
49  // 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.
50  'menu' => [],
51  // Menu setup. This includes fontfiles, sizes, background images. Depending on the menutype.
52  'content' => [],
53  // All constants related to the display of pagecontent elements
54  'page' => [],
55  // General configuration like metatags, link targets
56  'advanced' => [],
57  // Advanced functions, which are used very seldom.
58  'all' => []
59  ];
60 
66  public ‪$ext_inBrace = 0;
67 
73  public ‪$tsbrowser_searchKeys = [];
74 
79 
83  public ‪$constantMode = '';
84 
88  public ‪$regexMode = '';
89 
93  public ‪$ext_lineNumberOffset = 0;
94 
99 
103  public ‪$ext_noPMicons = 0;
104 
109 
115  public ‪$ext_dontCheckIssetValues = 0;
116 
120  public ‪$ext_printAll = 0;
121 
126 
132  public ‪$templateTitles = [];
133 
137  protected ‪$lnToScript;
138 
143 
148 
152  public ‪$bType = '';
153 
157  public ‪$linkObjects = false;
158 
162  public ‪$changed = false;
163 
167  protected ‪$objReg = [];
168 
172  public ‪$raw = [];
173 
177  public ‪$rawP = 0;
178 
182  public ‪$lastComment = '';
183 
187  protected ‪$inlineJavaScript = [];
191  private ‪$constantParser;
192 
198  {
199  parent::__construct(‪$context);
200  $this->constantParser = ‪$constantParser ?? GeneralUtility::makeInstance(ConstantConfigurationParser::class);
201  // Disabled in backend context
202  $this->tt_track = false;
203  $this->verbose = false;
204  }
205 
211  public function ‪getInlineJavaScript()
212  {
214  }
215 
222  public function ‪substituteConstants($all)
223  {
224  return preg_replace_callback('/\\{\\$(.[^}]+)\\}/', [$this, 'substituteConstantsCallBack'], $all);
225  }
226 
234  public function ‪substituteConstantsCallBack($matches)
235  {
236  $marker = substr(md5($matches[0]), 0, 6);
237  switch ($this->constantMode) {
238  case 'const':
239  $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];
240  break;
241  case 'subst':
242  $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];
243  break;
244  case 'untouched':
245  $ret_val = $matches[0];
246  break;
247  default:
248  $ret_val = isset($this->flatSetup[$matches[1]]) && !is_array($this->flatSetup[$matches[1]]) ? $this->flatSetup[$matches[1]] : $matches[0];
249  }
250  return $ret_val;
251  }
252 
260  public function ‪substituteCMarkers($all)
261  {
262  switch ($this->constantMode) {
263  case 'const':
264  case 'subst':
265  $all = preg_replace(
266  '/##[a-z0-9]{6}_B##(.*?)##[a-z0-9]{6}_M##(.*?)##[a-z0-9]{6}_E##/',
267  '<strong class="text-success" data-toggle="tooltip" data-placement="top" data-title="$1" title="$1">$2</strong>',
268  $all
269  );
270  break;
271  default:
272  }
273  return $all;
274  }
275 
282  public function ‪generateConfig_constants()
283  {
284  // These vars are also set later on...
285  $this->setup['sitetitle'] = ‪$this->sitetitle;
286  // Parse constants
287  ‪$constants = GeneralUtility::makeInstance(TypoScriptParser::class);
288  // Register comments!
289  ‪$constants->regComments = true;
291  $matchObj = GeneralUtility::makeInstance(ConditionMatcher::class);
292  // Matches ALL conditions in TypoScript
293  $matchObj->setSimulateMatchResult(true);
294  $c = 0;
295  $cc = count($this->constants);
296  $defaultConstants = [];
297  foreach ($this->constants as $str) {
298  $c++;
299  if ($c == $cc) {
300  $defaultConstants = ‪ArrayUtility::flatten(‪$constants->setup, '', true);
301  }
302  ‪$constants->parse($str, $matchObj);
303  }
304  $this->setup['constants'] = ‪$constants->setup;
306  return $this->constantParser->parseComments(
308  $defaultConstants
309  );
310  }
311 
317  public function ‪ext_getSetup($theSetup, $theKey)
318  {
319  $parts = explode('.', $theKey, 2);
320  if ((string)$parts[0] !== '' && is_array($theSetup[$parts[0] . '.'])) {
321  if (trim($parts[1]) !== '') {
322  return $this->‪ext_getSetup($theSetup[$parts[0] . '.'], trim($parts[1]));
323  }
324  return [$theSetup[$parts[0] . '.'], $theSetup[$parts[0]]];
325  }
326  if (trim($theKey) !== '') {
327  return [[], $theSetup[$theKey]];
328  }
329  return [$theSetup, ''];
330  }
331 
343  public function ‪ext_getObjTree($arr, $depth_in, $depthData, $parentType = '', $parentValue = '', $alphaSort = '0')
344  {
345  $HTML = '';
346  if ($alphaSort == '1') {
347  ksort($arr);
348  }
349  $keyArr_num = [];
350  $keyArr_alpha = [];
352  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
353  foreach ($arr as $key => $value) {
354  // Don't do anything with comments / linenumber registrations...
355  if (substr($key, -2) !== '..') {
356  $key = preg_replace('/\\.$/', '', $key) ?? '';
357  if (substr($key, -1) !== '.') {
359  $keyArr_num[$key] = $arr[$key];
360  } else {
361  $keyArr_alpha[$key] = $arr[$key];
362  }
363  }
364  }
365  }
366  ksort($keyArr_num);
367  $keyArr = $keyArr_num + $keyArr_alpha;
368  if ($depth_in) {
369  $depth_in = $depth_in . '.';
370  }
371  foreach ($keyArr as $key => $value) {
372  $depth = $depth_in . $key;
373  // This excludes all constants starting with '_' from being shown.
374  if ($this->bType !== 'const' || $depth[0] !== '_') {
375  $goto = substr(md5($depth), 0, 6);
376  $deeper = is_array($arr[$key . '.']) && ($this->tsbrowser_depthKeys[$depth] || ‪$this->ext_expandAllNotes);
377  $PM = is_array($arr[$key . '.']) && !$this->ext_noPMicons ? ($deeper ? 'minus' : 'plus') : 'join';
378  $HTML .= $depthData . '<li><span class="list-tree-group">';
379  if ($PM !== 'join') {
380  $urlParameters = [
381  'id' => (int)GeneralUtility::_GP('id'),
382  'tsbr[' . $depth . ']' => $deeper ? 0 : 1
383  ];
384  if (GeneralUtility::_GP('breakPointLN')) {
385  $urlParameters['breakPointLN'] = GeneralUtility::_GP('breakPointLN');
386  }
387  $aHref = (string)$uriBuilder->buildUriFromRoute('web_ts', $urlParameters) . '#' . $goto;
388  $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>';
389  }
390  $label = $key;
391  // Read only...
392  if (($depth === 'types' || $depth === 'resources' || $depth === 'sitetitle') && $this->bType === 'setup') {
393  $label = '<span style="color: #666666;">' . $label . '</span>';
394  } else {
395  if ($this->linkObjects) {
396  $urlParameters = [
397  'id' => (int)GeneralUtility::_GP('id'),
398  'sObj' => $depth
399  ];
400  if (GeneralUtility::_GP('breakPointLN')) {
401  $urlParameters['breakPointLN'] = GeneralUtility::_GP('breakPointLN');
402  }
403  $aHref = (string)$uriBuilder->buildUriFromRoute('web_ts', $urlParameters);
404  if ($this->bType !== 'const') {
405  $ln = is_array($arr[$key . '.ln..']) ? 'Defined in: ' . $this->‪lineNumberToScript($arr[$key . '.ln..']) : 'N/A';
406  } else {
407  $ln = '';
408  }
409  if ($this->tsbrowser_searchKeys[$depth] & 4) {
410  // The key has matched the search string
411  $label = '<strong class="text-danger">' . $label . '</strong>';
412  }
413  $label = '<a href="' . htmlspecialchars($aHref) . '" title="' . htmlspecialchars($depth_in . $key . ' ' . $ln) . '">' . $label . '</a>';
414  }
415  }
416  $HTML .= '<span class="list-tree-label" title="' . htmlspecialchars($depth_in . $key) . '">[' . $label . ']</span>';
417  if (isset($arr[$key])) {
418  $theValue = $arr[$key];
419  // The value has matched the search string
420  if ($this->tsbrowser_searchKeys[$depth] & 2) {
421  $HTML .= ' = <span class="list-tree-value text-danger">' . htmlspecialchars($theValue) . '</span>';
422  } else {
423  $HTML .= ' = <span class="list-tree-value">' . htmlspecialchars($theValue) . '</span>';
424  }
425  if ($this->ext_regComments && isset($arr[$key . '..'])) {
426  $comment = (string)$arr[$key . '..'];
427  // Skip INCLUDE_TYPOSCRIPT comments, they are almost useless
428  if (!preg_match('/### <INCLUDE_TYPOSCRIPT:.*/', $comment)) {
429  // Remove linebreaks, replace with ' '
430  $comment = preg_replace('/[\\r\\n]/', ' ', $comment) ?? '';
431  // Remove # and * if more than twice in a row
432  $comment = preg_replace('/[#\\*]{2,}/', '', $comment) ?? '';
433  // Replace leading # (just if it exists) and add it again. Result: Every comment should be prefixed by a '#'.
434  $comment = preg_replace('/^[#\\*\\s]+/', '# ', $comment) ?? '';
435  // Masking HTML Tags: Replace < with &lt; and > with &gt;
436  $comment = htmlspecialchars($comment);
437  $HTML .= ' <i class="text-muted">' . trim($comment) . '</i>';
438  }
439  }
440  }
441  $HTML .= '</span>';
442  if ($deeper) {
443  $HTML .= $this->‪ext_getObjTree($arr[$key . '.'], $depth, $depthData, '', $arr[$key], $alphaSort);
444  }
445  }
446  }
447  if ($HTML !== '') {
448  $HTML = '<ul class="list-tree text-monospace">' . $HTML . '</ul>';
449  }
450 
451  return $HTML;
452  }
453 
464  public function ‪lineNumberToScript(array $lnArr)
465  {
466  // On the first call, construct the lnToScript array.
467  if (!is_array($this->lnToScript)) {
468  $this->lnToScript = [];
469 
470  // aggregatedTotalLineCount
471  $c = 0;
472  foreach ($this->hierarchyInfo as $templateNumber => $info) {
473  // hierarchyInfo has the number of lines in configLines, but unfortunately this value
474  // was calculated *before* processing of any INCLUDE instructions
475  // for some yet unknown reason we have to add an extra +2 offset
476  $linecountAfterIncludeProcessing = substr_count($this->config[$templateNumber], LF) + 2;
477  $c += $linecountAfterIncludeProcessing;
478  $this->lnToScript[$c] = $info['title'];
479  }
480  }
481 
482  foreach ($lnArr as $k => $ln) {
483  foreach ($this->lnToScript as $endLn => $title) {
484  if ($endLn >= (int)$ln) {
485  $lnArr[$k] = '"' . $title . '", ' . $ln;
486  break;
487  }
488  }
489  }
490 
491  return implode('; ', $lnArr);
492  }
493 
502  public function ‪ext_getSearchKeys($arr, $depth_in, $searchString, $keyArray)
503  {
504  $keyArr = [];
505  foreach ($arr as $key => $value) {
506  $key = preg_replace('/\\.$/', '', $key) ?? '';
507  if (substr($key, -1) !== '.') {
508  $keyArr[$key] = 1;
509  }
510  }
511  if ($depth_in) {
512  $depth_in = $depth_in . '.';
513  }
514  $searchPattern = '';
515  if ($this->regexMode) {
516  $searchPattern = '/' . addcslashes($searchString, '/') . '/';
517  $matchResult = @preg_match($searchPattern, '');
518  if ($matchResult === false) {
519  throw new Exception(sprintf('Error evaluating regular expression "%s".', $searchPattern), 1446559458);
520  }
521  }
522  foreach ($keyArr as $key => $value) {
523  $depth = $depth_in . $key;
524  $deeper = is_array($arr[$key . '.']);
525  if ($this->regexMode) {
526  // The value has matched
527  if (preg_match($searchPattern, $arr[$key])) {
528  $this->tsbrowser_searchKeys[$depth] += 2;
529  }
530  // The key has matched
531  if (preg_match($searchPattern, $key)) {
532  $this->tsbrowser_searchKeys[$depth] += 4;
533  }
534  // Just open this subtree if the parent key has matched the search
535  if (preg_match($searchPattern, $depth_in)) {
536  $this->tsbrowser_searchKeys[$depth] = 1;
537  }
538  } else {
539  // The value has matched
540  if (stripos($arr[$key], $searchString) !== false) {
541  $this->tsbrowser_searchKeys[$depth] += 2;
542  }
543  // The key has matches
544  if (stripos($key, $searchString) !== false) {
545  $this->tsbrowser_searchKeys[$depth] += 4;
546  }
547  // Just open this subtree if the parent key has matched the search
548  if (stripos($depth_in, $searchString) !== false) {
549  $this->tsbrowser_searchKeys[$depth] = 1;
550  }
551  }
552  if ($deeper) {
553  $cS = count($this->tsbrowser_searchKeys);
554  $keyArray = $this->‪ext_getSearchKeys($arr[$key . '.'], $depth, $searchString, $keyArray);
555  if ($cS != count($this->tsbrowser_searchKeys)) {
556  $keyArray[$depth] = 1;
557  }
558  }
559  }
560  return $keyArray;
561  }
562 
567  public function ‪ext_getRootlineNumber($pid)
568  {
569  if ($pid) {
570  foreach ($this->‪getRootLine() as $key => $val) {
571  if ((int)$val['uid'] === (int)$pid) {
572  return (int)$key;
573  }
574  }
575  }
576  return -1;
577  }
578 
586  public function ‪ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first = 0)
587  {
588  $keyArr = [];
589  foreach ($arr as $key => $value) {
590  $key = preg_replace('/\\.$/', '', $key) ?? '';
591  if (substr($key, -1) !== '.') {
592  $keyArr[$key] = 1;
593  }
594  }
595  $a = 0;
596  $c = count($keyArr);
598  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
600  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
601  foreach ($keyArr as $key => $value) {
602  $HTML = '';
603  $a++;
604  $deeper = is_array($arr[$key . '.']);
605  $row = $arr[$key];
606  $LN = $a == $c ? 'blank' : 'line';
607  $BTM = $a == $c ? 'top' : '';
608  $HTML .= $depthData;
609  $alttext = '[' . $row['templateID'] . ']';
610  $alttext .= $row['pid'] ? ' - ' . ‪BackendUtility::getRecordPath($row['pid'], '1=1', 20) : '';
611  $icon = strpos($row['templateID'], 'sys') === 0
612  ? '<span title="' . htmlspecialchars($alttext) . '">' . $iconFactory->getIconForRecord('sys_template', $row, ‪Icon::SIZE_SMALL)->render() . '</span>'
613  : '<span title="' . htmlspecialchars($alttext) . '">' . $iconFactory->getIcon('mimetypes-x-content-template-static', ‪Icon::SIZE_SMALL)->render() . '</span>';
614  if (in_array($row['templateID'], $this->clearList_const) || in_array($row['templateID'], $this->clearList_setup)) {
615  $urlParameters = [
616  'id' => (int)GeneralUtility::_GP('id'),
617  'template' => $row['templateID']
618  ];
619  $aHref = (string)$uriBuilder->buildUriFromRoute('web_ts', $urlParameters);
620  $A_B = '<a href="' . htmlspecialchars($aHref) . '">';
621  $A_E = '</a>';
622  if (GeneralUtility::_GP('template') == $row['templateID']) {
623  $A_B = '<strong>' . $A_B;
624  $A_E .= '</strong>';
625  }
626  } else {
627  $A_B = '';
628  $A_E = '';
629  }
630  $HTML .= ($first ? '' : '<span class="treeline-icon treeline-icon-join' . $BTM . '"></span>') . $icon . ' ' . $A_B
631  . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], ‪$GLOBALS['BE_USER']->uc['titleLen']))
632  . $A_E . '&nbsp;&nbsp;';
633  $RL = $this->‪ext_getRootlineNumber($row['pid']);
634  $statusCheckedIcon = $iconFactory->getIcon('status-status-checked', ‪Icon::SIZE_SMALL)->render();
635  $keyArray[] = '<tr>
636  <td class="nowrap">' . $HTML . '</td>
637  <td align="center">' . ($row['root'] ? $statusCheckedIcon : '') . '</td>
638  <td align="center">' . ($row['clConf'] ? $statusCheckedIcon : '') . '</td>
639  <td align="center">' . ($row['clConst'] ? $statusCheckedIcon : '') . '</td>
640  <td align="center">' . ($row['pid'] ?: '') . '</td>
641  <td align="center">' . ($RL >= 0 ? $RL : '') . '</td>
642  </tr>';
643  if ($deeper) {
644  $keyArray = $this->‪ext_getTemplateHierarchyArr($arr[$key . '.'], $depthData . ($first ? '' : '<span class="treeline-icon treeline-icon-' . $LN . '"></span>'), $keyArray);
645  }
646  }
647  return $keyArray;
648  }
649 
658  public function ‪ext_process_hierarchyInfo(array $depthDataArr, &$pointer)
659  {
660  $parent = $this->hierarchyInfo[$pointer - 1]['templateParent'];
661  while ($pointer > 0 && $this->hierarchyInfo[$pointer - 1]['templateParent'] == $parent) {
662  $pointer--;
663  $row = $this->hierarchyInfo[$pointer];
664  $depthDataArr[$row['templateID']] = $row;
665  unset($this->clearList_setup_temp[$row['templateID']]);
666  unset($this->clearList_const_temp[$row['templateID']]);
667  $this->templateTitles[$row['templateID']] = $row['title'];
668  if ($row['templateID'] == $this->hierarchyInfo[$pointer - 1]['templateParent']) {
669  $depthDataArr[$row['templateID'] . '.'] = $this->‪ext_process_hierarchyInfo([], $pointer);
670  }
671  }
672  return $depthDataArr;
673  }
674 
686  public function ‪ext_outputTS(
687  array ‪$config,
688  $lineNumbers = false,
689  $comments = false,
690  $crop = false,
691  $syntaxHL = false,
692  $syntaxHLBlockmode = 0
693  ) {
694  $all = '';
695  foreach (‪$config as $str) {
696  $all .= '[GLOBAL]' . LF . $str;
697  }
698  if ($syntaxHL) {
699  $tsparser = GeneralUtility::makeInstance(TypoScriptParser::class);
700  $tsparser->lineNumberOffset = $this->ext_lineNumberOffset + 1;
701  $tsparser->parentObject = $this;
702  return $tsparser->doSyntaxHighlight($all, $lineNumbers ? [$this->ext_lineNumberOffset + 1] : '', $syntaxHLBlockmode);
703  }
704  return $this->‪ext_formatTS($all, $lineNumbers, $comments, $crop);
705  }
706 
716  public function ‪ext_fixed_lgd($string, $chars)
717  {
718  if ($chars >= 4) {
719  if (strlen($string) > $chars) {
720  if (strlen($string) > 24 && preg_match('/^##[a-z0-9]{6}_B##$/', substr($string, 0, 12))) {
721  $string = GeneralUtility::fixed_lgd_cs(substr($string, 12, -12), $chars - 3);
722  $marker = substr(md5($string), 0, 6);
723  return '##' . $marker . '_B##' . $string . '##' . $marker . '_E##';
724  }
725  return GeneralUtility::fixed_lgd_cs($string, $chars - 3);
726  }
727  }
728  return $string;
729  }
730 
736  public function ‪ext_lnBreakPointWrap($lineNumber, $str)
737  {
738  return '<a href="#" id="line-' . $lineNumber . '" onClick="return brPoint(' . $lineNumber . ','
739  . ($this->ext_lineNumberOffset_mode === 'setup' ? 1 : 0) . ');">' . $str . '</a>';
740  }
741 
749  public function ‪ext_formatTS($input, $ln, $comments = true, $crop = false)
750  {
751  $cArr = explode(LF, $input);
752  $n = ceil(log10(count($cArr) + $this->ext_lineNumberOffset));
753  $lineNum = '';
754  foreach ($cArr as $k => $v) {
755  $lln = $k + $this->ext_lineNumberOffset + 1;
756  if ($ln) {
757  $lineNum = $this->‪ext_lnBreakPointWrap($lln, str_replace(' ', '&nbsp;', sprintf('% ' . $n . 'd', $lln))) . ': ';
758  }
759  $v = htmlspecialchars($v);
760  if ($crop) {
761  $v = $this->‪ext_fixed_lgd($v, $ln ? 71 : 77);
762  }
763  $cArr[$k] = $lineNum . str_replace(' ', '&nbsp;', $v);
764  $firstChar = substr(trim($v), 0, 1);
765  if ($firstChar === '[') {
766  $cArr[$k] = '<strong class="text-success">' . $cArr[$k] . '</strong>';
767  } elseif ($firstChar === '/' || $firstChar === '#') {
768  if ($comments) {
769  $cArr[$k] = '<span class="text-muted">' . $cArr[$k] . '</span>';
770  } else {
771  unset($cArr[$k]);
772  }
773  }
774  }
775  ‪$output = implode('<br />', $cArr) . '<br />';
776  return ‪$output;
777  }
778 
788  public function ‪ext_getFirstTemplate($pid, $templateUid = 0)
789  {
790  if (empty($pid)) {
791  return null;
792  }
793 
794  // Query is taken from the runThroughTemplates($theRootLine) function in the parent class.
795  $queryBuilder = $this->‪getTemplateQueryBuilder($pid)
796  ->‪setMaxResults(1);
797  if ($templateUid) {
798  $queryBuilder->‪andWhere(
799  $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($templateUid, \PDO::PARAM_INT))
800  );
801  }
802  $row = $queryBuilder->‪execute()->fetch();
803  ‪BackendUtility::workspaceOL('sys_template', $row);
804 
805  return $row;
806  }
807 
814  public function ‪ext_getAllTemplates($pid): array
815  {
816  if (empty($pid)) {
817  return [];
818  }
819  $result = $this->‪getTemplateQueryBuilder($pid)->‪execute();
820  $outRes = [];
821  while ($row = $result->fetch()) {
822  ‪BackendUtility::workspaceOL('sys_template', $row);
823  if (is_array($row)) {
824  $outRes[] = $row;
825  }
826  }
827  return $outRes;
828  }
829 
837  protected function ‪getTemplateQueryBuilder(int $pid): QueryBuilder
838  {
839  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
840  ->getQueryBuilderForTable('sys_template');
841  $queryBuilder->getRestrictions()
842  ->removeAll()
843  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
844  ->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, ‪$GLOBALS['BE_USER']->workspace));
845 
846  $queryBuilder->select('*')
847  ->from('sys_template')
848  ->where(
849  $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT))
850  );
851  if (!empty(‪$GLOBALS['TCA']['sys_template']['ctrl']['sortby'])) {
852  $queryBuilder->orderBy(‪$GLOBALS['TCA']['sys_template']['ctrl']['sortby']);
853  }
854 
855  return $queryBuilder;
856  }
857 
861  public function ‪ext_categorizeEditableConstants($editConstArray)
862  {
863  // Runs through the available constants and fills the $this->categories array with pointers and priority-info
864  foreach ($editConstArray as $constName => $constData) {
865  if (!$constData['type']) {
866  $constData['type'] = 'string';
867  }
868  $cats = explode(',', $constData['cat']);
869  // if = only one category, while allows for many. We have agreed on only one category is the most basic way...
870  foreach ($cats as $theCat) {
871  $theCat = trim($theCat);
872  if ($theCat) {
873  $this->categories[$theCat][$constName] = $constData['subcat'];
874  }
875  }
876  }
877  }
878 
882  public function ‪ext_getCategoryLabelArray()
883  {
884  // Returns array used for labels in the menu.
885  $retArr = [];
886  foreach ($this->categories as $k => $v) {
887  if (!empty($v)) {
888  $retArr[$k] = strtoupper($k) . ' (' . count($v) . ')';
889  }
890  }
891  return $retArr;
892  }
893 
898  public function ‪ext_getTypeData($type)
899  {
900  $retArr = [];
901  $type = trim($type);
902  if (!$type) {
903  $retArr['type'] = 'string';
904  } else {
905  $m = strcspn($type, ' [');
906  $retArr['type'] = strtolower(substr($type, 0, $m));
907  $types = ['int' => 1, 'options' => 1, 'file' => 1, 'boolean' => 1, 'offset' => 1, 'user' => 1];
908  if (isset($types[$retArr['type']])) {
909  $p = trim(substr($type, $m));
910  $reg = [];
911  preg_match('/\\[(.*)\\]/', $p, $reg);
912  $p = trim($reg[1]);
913  if ($p) {
914  $retArr['paramstr'] = $p;
915  switch ($retArr['type']) {
916  case 'int':
917  if ($retArr['paramstr'][0] === '-') {
918  $retArr['params'] = ‪GeneralUtility::intExplode('-', substr($retArr['paramstr'], 1));
919  $retArr['params'][0] = (int)('-' . $retArr['params'][0]);
920  } else {
921  $retArr['params'] = ‪GeneralUtility::intExplode('-', $retArr['paramstr']);
922  }
923  $retArr['min'] = $retArr['params'][0];
924  $retArr['max'] = $retArr['params'][1];
925  $retArr['paramstr'] = $retArr['params'][0] . ' - ' . $retArr['params'][1];
926  break;
927  case 'options':
928  $retArr['params'] = explode(',', $retArr['paramstr']);
929  break;
930  }
931  }
932  }
933  }
934  return $retArr;
935  }
936 
941  public function ‪ext_fNandV($params)
942  {
943  $fN = 'data[' . $params['name'] . ']';
944  $idName = str_replace('.', '-', $params['name']);
945  $fV = $params['value'];
946  // Values entered from the constantsedit cannot be constants! 230502; removed \{ and set {
947  if (preg_match('/^{[\\$][a-zA-Z0-9\\.]*}$/', trim($fV), $reg)) {
948  $fV = '';
949  }
950  $fV = htmlspecialchars($fV);
951  return [$fN, $fV, $params, $idName];
952  }
953 
961  public function ‪ext_printFields($theConstants, $category)
962  {
963  reset($theConstants);
964  ‪$output = '';
965  $subcat = '';
966  if (is_array($this->categories[$category])) {
967  if (!$this->doNotSortCategoriesBeforeMakingForm) {
968  asort($this->categories[$category]);
969  }
971  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
972  foreach ($this->categories[$category] as $name => $type) {
973  $params = $theConstants[$name];
974  if (is_array($params)) {
975  if ($subcat != $params['subcat_name']) {
976  $subcat = $params['subcat_name'];
977  $subcat_name = $params['subcat_name'] ? $this->constantParser->getSubCategories()[$params['subcat_name']][0] : 'Others';
978  ‪$output .= '<h3>' . $subcat_name . '</h3>';
979  }
980  $label = $this->‪getLanguageService()->‪sL($params['label']);
981  $label_parts = explode(':', $label, 2);
982  if (count($label_parts) === 2) {
983  $head = trim($label_parts[0]);
984  $body = trim($label_parts[1]);
985  } else {
986  $head = trim($label_parts[0]);
987  $body = '';
988  }
989  $typeDat = $this->‪ext_getTypeData($params['type']);
990  $p_field = '';
991  $raname = substr(md5($params['name']), 0, 10);
992  $aname = '\'' . $raname . '\'';
993  [$fN, $fV, $params, $idName] = $this->‪ext_fNandV($params);
994  $idName = htmlspecialchars($idName);
995  $hint = '';
996  switch ($typeDat['type']) {
997  case 'int':
998  case 'int+':
999  $additionalAttributes = '';
1000  if ($typeDat['paramstr']) {
1001  $hint = ' Range: ' . $typeDat['paramstr'];
1002  } elseif ($typeDat['type'] === 'int+') {
1003  $hint = ' Range: 0 - ';
1004  $typeDat['min'] = 0;
1005  } else {
1006  $hint = ' (Integer)';
1007  }
1008 
1009  if (isset($typeDat['min'])) {
1010  $additionalAttributes .= ' min="' . (int)$typeDat['min'] . '" ';
1011  }
1012  if (isset($typeDat['max'])) {
1013  $additionalAttributes .= ' max="' . (int)$typeDat['max'] . '" ';
1014  }
1015 
1016  $p_field =
1017  '<input class="form-control" id="' . $idName . '" type="number"'
1018  . ' name="' . $fN . '" value="' . $fV . '" onChange="uFormUrl(' . $aname . ')"' . $additionalAttributes . ' />';
1019  break;
1020  case 'color':
1021  $p_field = '
1022  <input class="form-control formengine-colorpickerelement t3js-color-picker" type="text" id="input-' . $idName . '" rel="' . $idName .
1023  '" name="' . $fN . '" value="' . $fV . '" onChange="uFormUrl(' . $aname . ')" />';
1024 
1025  if (empty($this->inlineJavaScript[$typeDat['type']])) {
1026  $this->inlineJavaScript[$typeDat['type']] = 'require([\'TYPO3/CMS/Backend/ColorPicker\'], function(ColorPicker){ColorPicker.initialize()});';
1027  }
1028  break;
1029  case 'wrap':
1030  $wArr = explode('|', $fV);
1031  $p_field = '<div class="input-group">
1032  <input class="form-control form-control-adapt" type="text" id="' . $idName . '" name="' . $fN . '" value="' . $wArr[0] . '" onChange="uFormUrl(' . $aname . ')" />
1033  <span class="input-group-addon input-group-icon">|</span>
1034  <input class="form-control form-control-adapt" type="text" name="W' . $fN . '" value="' . $wArr[1] . '" onChange="uFormUrl(' . $aname . ')" />
1035  </div>';
1036  break;
1037  case 'offset':
1038  $wArr = explode(',', $fV);
1039  $labels = ‪GeneralUtility::trimExplode(',', $typeDat['paramstr']);
1040  $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 . ')" />';
1041  $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 . ')" />';
1042  $labelsCount = count($labels);
1043  for ($aa = 2; $aa < $labelsCount; $aa++) {
1044  if ($labels[$aa]) {
1045  $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 . ')" />';
1046  } else {
1047  $p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />';
1048  }
1049  }
1050  $p_field = '<div class="input-group">' . $p_field . '</div>';
1051  break;
1052  case 'options':
1053  if (is_array($typeDat['params'])) {
1054  $p_field = '';
1055  foreach ($typeDat['params'] as $val) {
1056  $vParts = explode('=', $val, 2);
1057  $label = $vParts[0];
1058  $val = $vParts[1] ?? $vParts[0];
1059  // option tag:
1060  $sel = '';
1061  if ($val === $params['value']) {
1062  $sel = ' selected';
1063  }
1064  $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $this->‪getLanguageService()->‪sL($label) . '</option>';
1065  }
1066  $p_field = '<select class="form-control" id="' . $idName . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
1067  }
1068  break;
1069  case 'boolean':
1070  $sel = $fV ? 'checked' : '';
1071  $p_field =
1072  '<input type="hidden" name="' . $fN . '" value="0" />'
1073  . '<label class="btn btn-default btn-checkbox">'
1074  . '<input id="' . $idName . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ?: 1) . '" ' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'
1075  . '<span class="t3-icon fa"></span>'
1076  . '</label>';
1077  break;
1078  case 'comment':
1079  $sel = $fV ? '' : 'checked';
1080  $p_field =
1081  '<input type="hidden" name="' . $fN . '" value="" />'
1082  . '<label class="btn btn-default btn-checkbox">'
1083  . '<input id="' . $idName . '" type="checkbox" name="' . $fN . '" value="1" ' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'
1084  . '<span class="t3-icon fa"></span>'
1085  . '</label>';
1086  break;
1087  case 'file':
1088  // extensionlist
1089  $extList = $typeDat['paramstr'];
1090  if ($extList === 'IMAGE_EXT') {
1091  $extList = ‪$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
1092  }
1093  $p_field = '<option value="">(' . $extList . ')</option>';
1094  if (trim($params['value'])) {
1095  $val = $params['value'];
1096  $p_field .= '<option value=""></option>';
1097  $p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
1098  }
1099  $p_field = '<select class="form-select" id="' . $idName . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
1100  break;
1101  case 'user':
1102  $userFunction = $typeDat['paramstr'];
1103  $userFunctionParams = ['fieldName' => $fN, 'fieldValue' => $fV];
1104  $p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
1105  break;
1106  default:
1107  $p_field = '<input class="form-control" id="' . $idName . '" type="text" name="' . $fN . '" value="' . $fV . '"'
1108  . ' onChange="uFormUrl(' . $aname . ')" />';
1109  }
1110  // Define default names and IDs
1111  $userTyposcriptID = 'userTS-' . $idName;
1112  $defaultTyposcriptID = 'defaultTS-' . $idName;
1113  $checkboxName = 'check[' . $params['name'] . ']';
1114  $checkboxID = 'check-' . $idName;
1115  $userTyposcriptStyle = '';
1116  $deleteIconHTML = '';
1117  $constantCheckbox = '';
1118  $constantDefaultRow = '';
1119  if (!$this->ext_dontCheckIssetValues) {
1120  // Set the default styling options
1121  if (isset($this->objReg[$params['name']])) {
1122  $checkboxValue = 'checked';
1123  $defaultTyposcriptStyle = 'style="display:none;"';
1124  } else {
1125  $checkboxValue = '';
1126  $userTyposcriptStyle = 'style="display:none;"';
1127  $defaultTyposcriptStyle = '';
1128  }
1129  $deleteTitle = htmlspecialchars($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.deleteTitle'));
1130  $deleteIcon = $iconFactory->getIcon('actions-edit-undo', ‪Icon::SIZE_SMALL)->render();
1131  $deleteIconHTML =
1132  '<button type="button" class="btn btn-default t3js-toggle" data-toggle="undo" rel="' . $idName . '">'
1133  . '<span title="' . $deleteTitle . '">'
1134  . $deleteIcon
1135  . '</span>'
1136  . '</button>';
1137  $editTitle = htmlspecialchars($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.editTitle'));
1138  $editIcon = $iconFactory->getIcon('actions-open', ‪Icon::SIZE_SMALL)->render();
1139  $editIconHTML =
1140  '<button type="button" class="btn btn-default t3js-toggle" data-toggle="edit" rel="' . $idName . '">'
1141  . '<span title="' . $editTitle . '">'
1142  . $editIcon
1143  . '</span>'
1144  . '</button>';
1145  $constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>';
1146  // If there's no default value for the field, use a static label.
1147  if (!$params['default_value']) {
1148  $params['default_value'] = '[Empty]';
1149  }
1150  $constantDefaultRow =
1151  '<div class="input-group defaultTS" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>'
1152  . '<span class="input-group-btn">' . $editIconHTML . '</span>'
1153  . '<input class="form-control" type="text" placeholder="' . htmlspecialchars($params['default_value']) . '" readonly>'
1154  . '</div>';
1155  }
1156  $constantEditRow =
1157  '<div class="input-group userTS" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>'
1158  . '<span class="input-group-btn">' . $deleteIconHTML . '</span>'
1159  . $p_field
1160  . '</div>';
1161  $constantLabel = '<label class="t3js-formengine-label"><span>' . htmlspecialchars($head) . '</span></label>';
1162  $constantName = '<span class="help-block">[' . $params['name'] . ']</span>';
1163  $constantDescription = $body ? '<p class="help-block">' . htmlspecialchars($body) . '</p>' : '';
1164  $constantData = '';
1165  if ($hint !== '') {
1166  $constantData .= '<span class="help-block">' . $hint . '</span>';
1167  }
1168  $constantData .=
1169  $constantCheckbox
1170  . $constantEditRow
1171  . $constantDefaultRow;
1172 
1173  ‪$output .=
1174  '<fieldset class="form-section">'
1175  . '<a name="' . $raname . '"></a>'
1176  . '<div class="form-group">'
1177  . $constantLabel . $constantName . $constantDescription . $constantData
1178  . '</div>'
1179  . '</fieldset>';
1180  } else {
1181  ‪debug('Error. Constant did not exist. Should not happen.');
1182  }
1183  }
1184  }
1185  return '<div class="tstemplate-constanteditor">' . ‪$output . '</div>';
1186  }
1187 
1188  /***************************
1189  *
1190  * Processing input values
1191  *
1192  ***************************/
1196  public function ‪ext_regObjectPositions(‪$constants)
1197  {
1198  // This runs through the lines of the constants-field of the active template and registers the constants-names
1199  // and line positions in an array, $this->objReg
1200  $this->raw = explode(LF, ‪$constants);
1201  $this->rawP = 0;
1202  // Resetting the objReg if the divider is found!!
1203  $this->objReg = [];
1204  $this->‪ext_regObjects('');
1205  }
1206 
1210  public function ‪ext_regObjects($pre)
1211  {
1212  // Works with regObjectPositions. "expands" the names of the TypoScript objects
1213  while (isset($this->raw[$this->rawP])) {
1214  $line = ltrim($this->raw[$this->rawP]);
1215  $this->rawP++;
1216  if ($line) {
1217  if ($line[0] === '[') {
1218  } elseif (strcspn($line, '}#/') != 0) {
1219  $varL = strcspn($line, ' {=<');
1220  $var = substr($line, 0, $varL);
1221  $line = ltrim(substr($line, $varL));
1222  switch ($line[0]) {
1223  case '=':
1224  $this->objReg[$pre . $var] = $this->rawP - 1;
1225  break;
1226  case '{':
1227  $this->ext_inBrace++;
1228  $this->‪ext_regObjects($pre . $var . '.');
1229  break;
1230  }
1231  $this->lastComment = '';
1232  } elseif ($line[0] === '}') {
1233  $this->lastComment = '';
1234  $this->ext_inBrace--;
1235  if ($this->ext_inBrace < 0) {
1236  $this->ext_inBrace = 0;
1237  } else {
1238  break;
1239  }
1240  }
1241  }
1242  }
1243  }
1249  public function ‪ext_putValueInConf($key, $var)
1250  {
1251  // Puts the value $var to the TypoScript value $key in the current lines of the templates.
1252  // If the $key is not found in the template constants field, a new line is inserted in the bottom.
1253  $theValue = ' ' . trim($var);
1254  if (isset($this->objReg[$key])) {
1255  $lineNum = $this->objReg[$key];
1256  $parts = explode('=', $this->raw[$lineNum], 2);
1257  if (count($parts) === 2) {
1258  $parts[1] = $theValue;
1259  }
1260  $this->raw[$lineNum] = implode('=', $parts);
1261  } else {
1262  $this->raw[] = $key . ' =' . $theValue;
1263  }
1264  $this->changed = true;
1265  }
1266 
1270  public function ‪ext_removeValueInConf($key)
1271  {
1272  // Removes the value in the configuration
1273  if (isset($this->objReg[$key])) {
1274  $lineNum = $this->objReg[$key];
1275  unset($this->raw[$lineNum]);
1276  }
1277  $this->changed = true;
1278  }
1279 
1285  public function ‪ext_depthKeys($arr, $settings)
1286  {
1287  $tsbrArray = [];
1288  foreach ($arr as $theK => $theV) {
1289  $theKeyParts = explode('.', $theK);
1290  $depth = '';
1291  $c = count($theKeyParts);
1292  $a = 0;
1293  foreach ($theKeyParts as $p) {
1294  $a++;
1295  $depth .= ($depth ? '.' : '') . $p;
1296  $tsbrArray[$depth] = $c == $a ? $theV : 1;
1297  }
1298  }
1299  // Modify settings
1300  foreach ($tsbrArray as $theK => $theV) {
1301  if ($theV) {
1302  $settings[$theK] = 1;
1303  } else {
1304  unset($settings[$theK]);
1305  }
1306  }
1307  return $settings;
1308  }
1309 
1318  public function ‪ext_procesInput($http_post_vars, $http_post_files, $theConstants, $tplRow)
1319  {
1320  $data = $http_post_vars['data'];
1321  $check = $http_post_vars['check'];
1322  $Wdata = $http_post_vars['Wdata'];
1323  $W2data = $http_post_vars['W2data'];
1324  $W3data = $http_post_vars['W3data'];
1325  $W4data = $http_post_vars['W4data'];
1326  $W5data = $http_post_vars['W5data'];
1327  if (is_array($data)) {
1328  foreach ($data as $key => $var) {
1329  if (isset($theConstants[$key])) {
1330  // If checkbox is set, update the value
1331  if ($this->ext_dontCheckIssetValues || isset($check[$key])) {
1332  // Exploding with linebreak, just to make sure that no multiline input is given!
1333  [$var] = explode(LF, $var);
1334  $typeDat = $this->‪ext_getTypeData($theConstants[$key]['type']);
1335  switch ($typeDat['type']) {
1336  case 'int':
1337  if ($typeDat['paramstr']) {
1338  $var = ‪MathUtility::forceIntegerInRange((int)$var, $typeDat['params'][0], $typeDat['params'][1]);
1339  } else {
1340  $var = (int)$var;
1341  }
1342  break;
1343  case 'int+':
1344  $var = max(0, (int)$var);
1345  break;
1346  case 'color':
1347  $col = [];
1348  if ($var) {
1349  $var = preg_replace('/[^A-Fa-f0-9]*/', '', $var) ?? '';
1350  $useFulHex = strlen($var) > 3;
1351  $col[] = (int)hexdec($var[0]);
1352  $col[] = (int)hexdec($var[1]);
1353  $col[] = (int)hexdec($var[2]);
1354  if ($useFulHex) {
1355  $col[] = (int)hexdec($var[3]);
1356  $col[] = (int)hexdec($var[4]);
1357  $col[] = (int)hexdec($var[5]);
1358  }
1359  $var = substr('0' . dechex($col[0]), -1) . substr('0' . dechex($col[1]), -1) . substr('0' . dechex($col[2]), -1);
1360  if ($useFulHex) {
1361  $var .= substr('0' . dechex($col[3]), -1) . substr('0' . dechex($col[4]), -1) . substr('0' . dechex($col[5]), -1);
1362  }
1363  $var = '#' . strtoupper($var);
1364  }
1365  break;
1366  case 'comment':
1367  if ($var) {
1368  $var = '';
1369  } else {
1370  $var = '#';
1371  }
1372  break;
1373  case 'wrap':
1374  if (isset($Wdata[$key])) {
1375  $var .= '|' . $Wdata[$key];
1376  }
1377  break;
1378  case 'offset':
1379  if (isset($Wdata[$key])) {
1380  $var = (int)$var . ',' . (int)$Wdata[$key];
1381  if (isset($W2data[$key])) {
1382  $var .= ',' . (int)$W2data[$key];
1383  if (isset($W3data[$key])) {
1384  $var .= ',' . (int)$W3data[$key];
1385  if (isset($W4data[$key])) {
1386  $var .= ',' . (int)$W4data[$key];
1387  if (isset($W5data[$key])) {
1388  $var .= ',' . (int)$W5data[$key];
1389  }
1390  }
1391  }
1392  }
1393  }
1394  break;
1395  case 'boolean':
1396  if ($var) {
1397  $var = $typeDat['paramstr'] ?: 1;
1398  }
1399  break;
1400  }
1401  if ($this->ext_printAll || (string)$theConstants[$key]['value'] !== (string)$var) {
1402  // Put value in, if changed.
1403  $this->‪ext_putValueInConf($key, $var);
1404  }
1405  // Remove the entry because it has been "used"
1406  unset($check[$key]);
1407  } else {
1408  $this->‪ext_removeValueInConf($key);
1409  }
1410  }
1411  }
1412  }
1413  // Remaining keys in $check indicates fields that are just clicked "on" to be edited.
1414  // Therefore we get the default value and puts that in the template as a start...
1415  if (!$this->ext_dontCheckIssetValues && is_array($check)) {
1416  foreach ($check as $key => $var) {
1417  if (isset($theConstants[$key])) {
1418  $dValue = $theConstants[$key]['default_value'];
1419  $this->‪ext_putValueInConf($key, $dValue);
1420  }
1421  }
1422  }
1423  }
1424 
1430  public function ‪ext_prevPageWithTemplate($id, $perms_clause)
1431  {
1432  ‪$rootLine = ‪BackendUtility::BEgetRootLine($id, $perms_clause ? ' AND ' . $perms_clause : '');
1433  foreach (‪$rootLine as $p) {
1434  if ($this->‪ext_getFirstTemplate($p['uid'])) {
1435  return $p;
1436  }
1437  }
1438  return [];
1439  }
1440 
1446  protected function ‪getRootLine()
1447  {
1448  return is_array($this->absoluteRootLine) ? $this->absoluteRootLine : [];
1449  }
1450 
1454  protected function ‪getLanguageService()
1455  {
1456  return ‪$GLOBALS['LANG'];
1457  }
1458 }
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_noPMicons
‪int $ext_noPMicons
Definition: ExtendedTemplateService.php:94
‪TYPO3\CMS\Core\Utility\ArrayUtility\flatten
‪static array flatten(array $array, $prefix='', bool $keepDots=false)
Definition: ArrayUtility.php:486
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:30
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_inBrace
‪int $ext_inBrace
Definition: ExtendedTemplateService.php:64
‪TYPO3\CMS\Core\TypoScript\TemplateService\$constants
‪array $constants
Definition: TemplateService.php:140
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_lineNumberOffset
‪int $ext_lineNumberOffset
Definition: ExtendedTemplateService.php:86
‪TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger
‪static bool canBeInterpretedAsInteger($var)
Definition: MathUtility.php:74
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_outputTS
‪string ext_outputTS(array $config, $lineNumbers=false, $comments=false, $crop=false, $syntaxHL=false, $syntaxHLBlockmode=0)
Definition: ExtendedTemplateService.php:660
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getFirstTemplate
‪array null ext_getFirstTemplate($pid, $templateUid=0)
Definition: ExtendedTemplateService.php:762
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_regObjectPositions
‪ext_regObjectPositions($constants)
Definition: ExtendedTemplateService.php:1170
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getSearchKeys
‪array ext_getSearchKeys($arr, $depth_in, $searchString, $keyArray)
Definition: ExtendedTemplateService.php:476
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_prevPageWithTemplate
‪array ext_prevPageWithTemplate($id, $perms_clause)
Definition: ExtendedTemplateService.php:1404
‪TYPO3\CMS\Core\TypoScript\TemplateService\$context
‪Context $context
Definition: TemplateService.php:261
‪TYPO3\CMS\Core\Exception
Definition: Exception.php:22
‪TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
Definition: TypoScriptParser.php:37
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_regObjects
‪ext_regObjects($pre)
Definition: ExtendedTemplateService.php:1184
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_removeValueInConf
‪ext_removeValueInConf($key)
Definition: ExtendedTemplateService.php:1244
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getTemplateHierarchyArr
‪array ext_getTemplateHierarchyArr($arr, $depthData, $keyArray, $first=0)
Definition: ExtendedTemplateService.php:560
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_lnBreakPointWrap
‪string ext_lnBreakPointWrap($lineNumber, $str)
Definition: ExtendedTemplateService.php:710
‪TYPO3\CMS\Core\TypoScript\TemplateService\$flatSetup
‪array $flatSetup
Definition: TemplateService.php:126
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\removeAll
‪QueryRestrictionContainerInterface removeAll()
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\generateConfig_constants
‪array generateConfig_constants()
Definition: ExtendedTemplateService.php:256
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$constantParser
‪TYPO3 CMS Core TypoScript Parser ConstantConfigurationParser $constantParser
Definition: ExtendedTemplateService.php:165
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:32
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\substituteCMarkers
‪string substituteCMarkers($all)
Definition: ExtendedTemplateService.php:234
‪TYPO3\CMS\Core\Exception
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getObjTree
‪string ext_getObjTree($arr, $depth_in, $depthData, $parentType='', $parentValue='', $alphaSort='0')
Definition: ExtendedTemplateService.php:317
‪TYPO3\CMS\Core\TypoScript\TemplateService\$sitetitle
‪string $sitetitle
Definition: TemplateService.php:188
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_formatTS
‪string ext_formatTS($input, $ln, $comments=true, $crop=false)
Definition: ExtendedTemplateService.php:723
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\getRestrictions
‪QueryRestrictionContainerInterface getRestrictions()
Definition: QueryBuilder.php:104
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\getRootLine
‪array getRootLine()
Definition: ExtendedTemplateService.php:1420
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$constantMode
‪string $constantMode
Definition: ExtendedTemplateService.php:78
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService
Definition: ExtendedTemplateService.php:43
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$categories
‪array $categories
Definition: ExtendedTemplateService.php:46
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:194
‪TYPO3\CMS\Backend\Utility\BackendUtility\BEgetRootLine
‪static array BEgetRootLine($uid, $clause='', $workspaceOL=false, array $additionalFields=[])
Definition: BackendUtility.php:343
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\getInlineJavaScript
‪array getInlineJavaScript()
Definition: ExtendedTemplateService.php:185
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:53
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_categorizeEditableConstants
‪ext_categorizeEditableConstants($editConstArray)
Definition: ExtendedTemplateService.php:835
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$bType
‪string $bType
Definition: ExtendedTemplateService.php:134
‪TYPO3\CMS\Core\Database\Query\QueryBuilder
Definition: QueryBuilder.php:52
‪TYPO3\CMS\Core\TypoScript
Definition: ExtendedTemplateService.php:16
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$objReg
‪int[] $objReg
Definition: ExtendedTemplateService.php:146
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$tsbrowser_searchKeys
‪array $tsbrowser_searchKeys
Definition: ExtendedTemplateService.php:70
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\andWhere
‪QueryBuilder andWhere(... $where)
Definition: QueryBuilder.php:694
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\execute
‪Statement Doctrine DBAL ForwardCompatibility Result Doctrine DBAL Driver ResultStatement int execute()
Definition: QueryBuilder.php:204
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_printFields
‪string ext_printFields($theConstants, $category)
Definition: ExtendedTemplateService.php:935
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_dontCheckIssetValues
‪int $ext_dontCheckIssetValues
Definition: ExtendedTemplateService.php:104
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:38
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\__construct
‪__construct(Context $context=null, ConstantConfigurationParser $constantParser=null)
Definition: ExtendedTemplateService.php:171
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_depthKeys
‪array ext_depthKeys($arr, $settings)
Definition: ExtendedTemplateService.php:1259
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\getLanguageService
‪LanguageService getLanguageService()
Definition: ExtendedTemplateService.php:1428
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$lastComment
‪string $lastComment
Definition: ExtendedTemplateService.php:158
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\getTemplateQueryBuilder
‪QueryBuilder getTemplateQueryBuilder(int $pid)
Definition: ExtendedTemplateService.php:811
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$doNotSortCategoriesBeforeMakingForm
‪bool $doNotSortCategoriesBeforeMakingForm
Definition: ExtendedTemplateService.php:112
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_process_hierarchyInfo
‪array ext_process_hierarchyInfo(array $depthDataArr, &$pointer)
Definition: ExtendedTemplateService.php:632
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getTypeData
‪array ext_getTypeData($type)
Definition: ExtendedTemplateService.php:872
‪TYPO3\CMS\Core\TypoScript\TemplateService\$config
‪array $config
Definition: TemplateService.php:134
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getRootlineNumber
‪int ext_getRootlineNumber($pid)
Definition: ExtendedTemplateService.php:541
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$clearList_setup_temp
‪array $clearList_setup_temp
Definition: ExtendedTemplateService.php:130
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$raw
‪array $raw
Definition: ExtendedTemplateService.php:150
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$tsbrowser_depthKeys
‪array $tsbrowser_depthKeys
Definition: ExtendedTemplateService.php:74
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_printAll
‪int $ext_printAll
Definition: ExtendedTemplateService.php:108
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$templateTitles
‪array $templateTitles
Definition: ExtendedTemplateService.php:118
‪TYPO3\CMS\Core\Database\Query\QueryBuilder\setMaxResults
‪QueryBuilder setMaxResults(int $maxResults)
Definition: QueryBuilder.php:355
‪TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher
Definition: ConditionMatcher.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode
‪static string[] trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:1059
‪$output
‪$output
Definition: annotationChecker.php:119
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getCategoryLabelArray
‪array ext_getCategoryLabelArray()
Definition: ExtendedTemplateService.php:856
‪debug
‪debug($variable='', $title=null, $group=null)
Definition: GlobalDebugFunctions.php:19
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getAllTemplates
‪array[] ext_getAllTemplates($pid)
Definition: ExtendedTemplateService.php:788
‪TYPO3\CMS\Core\TypoScript\TemplateService
Definition: TemplateService.php:46
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\substituteConstants
‪string substituteConstants($all)
Definition: ExtendedTemplateService.php:196
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Utility\BackendUtility\workspaceOL
‪static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=false)
Definition: BackendUtility.php:3586
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_expandAllNotes
‪int $ext_expandAllNotes
Definition: ExtendedTemplateService.php:90
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$regexMode
‪string $regexMode
Definition: ExtendedTemplateService.php:82
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:28
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$inlineJavaScript
‪array $inlineJavaScript
Definition: ExtendedTemplateService.php:162
‪TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser
Definition: ConstantConfigurationParser.php:34
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:988
‪TYPO3\CMS\Core\TypoScript\TemplateService\$rootLine
‪array $rootLine
Definition: TemplateService.php:170
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:22
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_procesInput
‪ext_procesInput($http_post_vars, $http_post_files, $theConstants, $tplRow)
Definition: ExtendedTemplateService.php:1292
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$ext_lineNumberOffset_mode
‪string $ext_lineNumberOffset_mode
Definition: ExtendedTemplateService.php:98
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$clearList_const_temp
‪array $clearList_const_temp
Definition: ExtendedTemplateService.php:126
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$changed
‪bool $changed
Definition: ExtendedTemplateService.php:142
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$lnToScript
‪array null $lnToScript
Definition: ExtendedTemplateService.php:122
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\lineNumberToScript
‪string lineNumberToScript(array $lnArr)
Definition: ExtendedTemplateService.php:438
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface\add
‪QueryRestrictionContainerInterface add(QueryRestrictionInterface $restriction)
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordPath
‪static mixed getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0)
Definition: BackendUtility.php:546
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$rawP
‪int $rawP
Definition: ExtendedTemplateService.php:154
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_fNandV
‪array ext_fNandV($params)
Definition: ExtendedTemplateService.php:915
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_fixed_lgd
‪string ext_fixed_lgd($string, $chars)
Definition: ExtendedTemplateService.php:690
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_getSetup
‪array ext_getSetup($theSetup, $theKey)
Definition: ExtendedTemplateService.php:291
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\$linkObjects
‪bool $linkObjects
Definition: ExtendedTemplateService.php:138
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\ext_putValueInConf
‪ext_putValueInConf($key, $var)
Definition: ExtendedTemplateService.php:1223
‪TYPO3\CMS\Core\TypoScript\ExtendedTemplateService\substituteConstantsCallBack
‪string substituteConstantsCallBack($matches)
Definition: ExtendedTemplateService.php:208
‪TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction
Definition: WorkspaceRestriction.php:39