[TASK] Remove explicit tt_track in ExtendedTemplateService 02/48902/3
authorBenni Mack <benni@typo3.org>
Mon, 11 Jul 2016 14:36:06 +0000 (16:36 +0200)
committerJan Helke <typo3@helke.de>
Mon, 11 Jul 2016 14:55:21 +0000 (16:55 +0200)
ExtendedTemplateService for the backend always disables the
timetracker information from the actual funcmodule but could
easily be turned off by default from the actual class itself.

This makes the code easier to read and also removes some
syntax errors from previous cleanups where values and variables
are empty.

Resolves: #77033
Releases: master
Change-Id: I9963f863fc74b7fae95c81b5a6418b026c40a268
Reviewed-on: https://review.typo3.org/48902
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/indexed_search/Classes/Hook/CrawlerHook.php
typo3/sysext/info_pagetsconfig/Classes/Controller/InfoPageTyposcriptConfigController.php
typo3/sysext/t3editor/Classes/CodeCompletion.php
typo3/sysext/t3editor/Classes/Hook/TypoScriptTemplateInfoHook.php
typo3/sysext/tstemplate/Classes/Controller/TemplateAnalyzerModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateObjectBrowserModuleFunctionController.php

index 3931f44..6b43eb6 100644 (file)
@@ -43,6 +43,13 @@ class ExtendedTemplateService extends TemplateService
     public $edit_divider = '###MOD_TS:EDITABLE_CONSTANTS###';
 
     /**
+     * Disabled in backend context
+     *
+     * @var bool
+     */
+    public $tt_track = false;
+
+    /**
      * @var array
      */
     public $categories = array(
@@ -368,13 +375,13 @@ class ExtendedTemplateService extends TemplateService
                     $constants->parse($parts[0], $matchObj);
                 }
                 $this->flatSetup = array();
-                $this->flattenSetup($constants->setup, '', '');
+                $this->flattenSetup($constants->setup, '');
                 $defaultConstants = $this->flatSetup;
             }
             $constants->parse($str, $matchObj);
         }
         $this->flatSetup = array();
-        $this->flattenSetup($constants->setup, '', '');
+        $this->flattenSetup($constants->setup, '');
         $this->setup['constants'] = $constants->setup;
         return $this->ext_compareFlatSetups($defaultConstants);
     }
@@ -1368,14 +1375,12 @@ class ExtendedTemplateService extends TemplateService
                             '<div class="input-group defaultTS" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>'
                                 . '<span class="input-group-btn">' . $editIconHTML . '</span>'
                                 . '<input class="form-control" type="text" placeholder="' . htmlspecialchars($params['default_value']) . '" readonly>'
-                                . $appendedGroupAddon
                             . '</div>';
                     }
                     $constantEditRow =
                         '<div class="input-group userTS" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>'
                             . '<span class="input-group-btn">' . $deleteIconHTML . '</span>'
                             . $p_field
-                            . $appendedGroupAddon
                         . '</div>';
                     $constantLabel = '<label class="t3js-formengine-label"><span>' . htmlspecialchars($head) . '</span></label>';
                     $constantName = '<span class="help-block">[' . $params['name'] . ']</span>';
@@ -1573,7 +1578,7 @@ class ExtendedTemplateService extends TemplateService
                                 break;
                             case 'color':
                                 $col = array();
-                                if ($var && !GeneralUtility::inList($this->HTMLcolorList, strtolower($var))) {
+                                if ($var) {
                                     $var = preg_replace('/[^A-Fa-f0-9]*/', '', $var);
                                     $useFulHex = strlen($var) > 3;
                                     $col[] = hexdec($var[0]);
index 64c13d8..8602b63 100644 (file)
@@ -569,8 +569,6 @@ class CrawlerHook
     public function getUidRootLineForClosestTemplate($id)
     {
         $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
-        $tmpl->tt_track = 0;
-        // Do not log time-performance information
         $tmpl->init();
         // Gets the rootLine
         $sys_page = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
index c425145..afcd50e 100644 (file)
@@ -161,12 +161,6 @@ class InfoPageTyposcriptConfigController extends \TYPO3\CMS\Backend\Module\Abstr
                 $this->view->assign('tsconfParts99', 0);
                 // Defined global here!
                 $tmpl = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
-
-                // Do not log time-performance information
-                $tmpl->tt_track = 0;
-                $tmpl->fixedLgd = 0;
-                $tmpl->linkObjects = 0;
-                $tmpl->bType = '';
                 $tmpl->ext_expandAllNotes = 1;
                 $tmpl->ext_noPMicons = 1;
 
index 136881e..32e6718 100644 (file)
@@ -87,10 +87,8 @@ class CodeCompletion
      */
     protected function getMergedTemplates($pageId, $templateId = 0)
     {
-        $result = array();
         /** @var $tsParser \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService */
         $tsParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
-        $tsParser->tt_track = 0;
         $tsParser->init();
         // Gets the rootLine
         $page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class);
@@ -103,7 +101,6 @@ class CodeCompletion
         array_pop($tsParser->constants);
         $tsParser->linkObjects = true;
         $tsParser->ext_regLinenumbers = false;
-        $tsParser->bType = $bType;
         $tsParser->generateConfig();
         $result = $this->treeWalkCleanup($tsParser->setup);
         return $result;
index ba400a6..cf69fce 100644 (file)
@@ -100,8 +100,6 @@ class TypoScriptTemplateInfoHook
             $template_uid = $set['templatesOnPage'] ?: 0;
             // Defined global here!
             $tmpl = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\ExtendedTemplateService::class);
-            // Do not log time-performance information
-            $tmpl->tt_track = 0;
             $tmpl->init();
             // Get the first template record on the page, which might be hidden as well
             // (for instance the TypoScript constant editor is persisting to the first template)
index 9622ab2..dc20169 100644 (file)
@@ -79,9 +79,6 @@ class TemplateAnalyzerModuleFunctionController extends AbstractFunctionModule
         // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
         $templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $templateService;
-
-        // Do not log time-performance information
-        $templateService->tt_track = false;
         $templateService->init();
 
         // Gets the rootLine
index 679f6f2..92ae023 100644 (file)
@@ -48,10 +48,6 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
     {
         $templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $templateService;
-
-        // Do not log time-performance information
-        $templateService->tt_track = false;
-
         $templateService->init();
         $templateService->ext_localGfxPrefix = ExtensionManagementUtility::extPath('tstemplate');
         $templateService->ext_localWebGfxPrefix = ExtensionManagementUtility::extRelPath('tstemplate') . 'Resources/Public/';
index 05a16d6..c9428ac 100644 (file)
@@ -113,9 +113,6 @@ class TypoScriptTemplateInformationModuleFunctionController extends AbstractFunc
         /** @var ExtendedTemplateService $tmpl */
         $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $tmpl;
-
-        // Do not log time-performance information
-        $tmpl->tt_track = false;
         $tmpl->init();
 
         // Get the row of the first VISIBLE template of the page. where clause like the frontend.
index 1d99851..40e47f0 100755 (executable)
@@ -441,9 +441,6 @@ class TypoScriptTemplateModuleController extends BaseScriptClass
         /** @var ExtendedTemplateService $tmpl */
         $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $tmpl;
-
-        // Do not log time-performance information
-        $tmpl->tt_track = false;
         $tmpl->init();
 
         $lang = $this->getLanguageService();
@@ -516,9 +513,6 @@ class TypoScriptTemplateModuleController extends BaseScriptClass
         /** @var ExtendedTemplateService $tmpl */
         $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $tmpl;
-
-        // Do not log time-performance information
-        $tmpl->tt_track = false;
         $tmpl->init();
 
         $all = $tmpl->ext_getAllTemplates($this->id, $this->perms_clause);
index 433ccb0..841aaae 100644 (file)
@@ -119,9 +119,6 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends AbstractFu
         // Defined global here!
         $templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
         $GLOBALS['tmpl'] = $templateService;
-
-        // Do not log time-performance information
-        $templateService->tt_track = false;
         $templateService->init();
 
         // Gets the rootLine