2 namespace TYPO3\CMS\Tstemplate\Controller;
44 parent::init(
$pObj, $conf);
45 $this->
getLanguageService()->includeLLFile(
'EXT:tstemplate/Resources/Private/Language/locallang_analyzer.xlf');
46 $this->pObj->modMenu_setDefaultList .=
',ts_analyzer_checkLinenum,ts_analyzer_checkSyntax';
57 'ts_analyzer_checkSetup' =>
'1',
58 'ts_analyzer_checkConst' =>
'1',
59 'ts_analyzer_checkLinenum' =>
'1',
60 'ts_analyzer_checkComments' =>
'1',
61 'ts_analyzer_checkCrop' =>
'1',
62 'ts_analyzer_checkSyntax' =>
'1'
80 $templateService->tt_track =
false;
81 $templateService->init();
85 $GLOBALS[
'rootLine'] = $sys_page->getRootLine($pageId);
88 $templateService->runThroughTemplates(
$GLOBALS[
'rootLine'], $template_uid);
91 $GLOBALS[
'tplRow'] = $templateService->ext_getFirstTemplate($pageId, $template_uid);
106 $manyTemplatesMenu = $this->pObj->templateMenu();
108 if ($manyTemplatesMenu) {
109 $template_uid = $this->pObj->MOD_SETTINGS[
'templatesOnPage'];
116 if ($existTemplate) {
117 $siteTitle = trim(
$GLOBALS[
'tplRow'][
'sitetitle']);
119 $theOutput .=
'<h3>' .
$lang->getLL(
'currentTemplate',
true) .
'</h3>';
121 .
'<strong>' . $this->pObj->linkWrapTemplateTitle(
$GLOBALS[
'tplRow'][
'title']) .
'</strong>'
122 . htmlspecialchars($siteTitle ?
' (' . $siteTitle .
')' :
'');
124 if ($manyTemplatesMenu) {
125 $theOutput .=
'<div>' . $manyTemplatesMenu .
'</div>';
128 $templateService->clearList_const_temp = array_flip($templateService->clearList_const);
129 $templateService->clearList_setup_temp = array_flip($templateService->clearList_setup);
130 $pointer = count($templateService->hierarchyInfo);
131 $hierarchyInfo = $templateService->ext_process_hierarchyInfo(array(), $pointer);
132 $head =
'<thead><tr>';
133 $head .=
'<th>' .
$lang->getLL(
'title',
true) .
'</th>';
134 $head .=
'<th>' .
$lang->getLL(
'rootlevel',
true) .
'</th>';
135 $head .=
'<th>' .
$lang->getLL(
'clearSetup',
true) .
'</th>';
136 $head .=
'<th>' .
$lang->getLL(
'clearConstants',
true) .
'</th>';
137 $head .=
'<th>' .
$lang->getLL(
'pid',
true) .
'</th>';
138 $head .=
'<th>' .
$lang->getLL(
'rootline',
true) .
'</th>';
139 $head .=
'<th>' .
$lang->getLL(
'nextLevel',
true) .
'</th>';
140 $head .=
'</tr></thead>';
141 $hierar = implode(array_reverse($templateService->ext_getTemplateHierarchyArr($hierarchyInfo,
'', array(), 1)),
'');
142 $hierar =
'<div class="table-fit"><table class="table table-striped table-hover" id="ts-analyzer">' . $head . $hierar .
'</table></div>';
143 $theOutput .=
'<div style="padding-top: 5px;"></div>';
144 $theOutput .=
'<h2>' .
$lang->getLL(
'templateHierarchy',
true) .
'</h2>';
145 $theOutput .=
'<div>' . $hierar .
'</div>';
146 $urlParameters = array(
150 $aHref = BackendUtility::getModuleUrl(
'web_ts', $urlParameters);
152 $completeLink =
'<p><a href="' . htmlspecialchars($aHref) .
'" class="btn btn-default">' .
$lang->getLL(
'viewCompleteTS',
true) .
'</a></p>';
153 $theOutput .=
'<div style="padding-top: 5px;"></div>';
154 $theOutput .=
'<h2>' .
$lang->getLL(
'completeTS',
true) .
'</h2>';
155 $theOutput .=
'<div>' . $completeLink .
'</div>';
156 $theOutput .=
'<div style="padding-top: 15px;"></div>';
158 $theOutput .=
'<h2>' .
$lang->getLL(
'displayOptions',
true) .
'</h2>';
161 $addParams = $template ?
'&template=' . $template :
'';
162 $theOutput .=
'<div class="tst-analyzer-options">' .
163 '<div class="checkbox"><label for="checkTs_analyzer_checkLinenum">' .
164 BackendUtility::getFuncCheck($this->pObj->id,
'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkLinenum'],
'', $addParams,
'id="checkTs_analyzer_checkLinenum"') .
165 $lang->getLL(
'lineNumbers',
true) .
167 '<div class="checkbox"><label for="checkTs_analyzer_checkSyntax">' .
168 BackendUtility::getFuncCheck($this->pObj->id,
'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkSyntax'],
'', $addParams,
'id="checkTs_analyzer_checkSyntax"') .
169 $lang->getLL(
'syntaxHighlight',
true) .
'</label> ' .
171 if (!$this->pObj->MOD_SETTINGS[
'ts_analyzer_checkSyntax']) {
173 '<div class="checkbox"><label for="checkTs_analyzer_checkComments">' .
174 BackendUtility::getFuncCheck($this->pObj->id,
'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkComments'],
'', $addParams,
'id="checkTs_analyzer_checkComments"') .
175 $lang->getLL(
'comments',
true) .
177 '<div class="checkbox"><label for="checkTs_analyzer_checkCrop">' .
178 BackendUtility::getFuncCheck($this->pObj->id,
'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkCrop'],
'', $addParams,
'id="checkTs_analyzer_checkCrop"') .
179 $lang->getLL(
'cropLines',
true) .
182 $theOutput .=
'</div>';
183 $theOutput .=
'<div style="padding-top: 25px;"></div>';
187 $theOutput .=
'<h2>' .
$lang->getLL(
'constants',
true) .
'</h2>';
189 $templateService->ext_lineNumberOffset = 0;
190 $templateService->ext_lineNumberOffset_mode =
'const';
191 foreach ($templateService->constants as $key => $val) {
192 $currentTemplateId = $templateService->hierarchyInfo[$key][
'templateID'];
193 if ($currentTemplateId == $template || $template ===
'all') {
195 <h3>' . htmlspecialchars($templateService->hierarchyInfo[$key][
'title']) .
'</h3>
196 <div class="nowrap">' .
197 $templateService->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkSyntax'], 0) .
200 if ($template !==
'all') {
204 $templateService->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
208 $theOutput .=
'<div style="padding-top: 15px;"></div>';
209 $theOutput .=
'<h2>' .
$lang->getLL(
'setup',
true) .
'</h2>';
210 $templateService->ext_lineNumberOffset = 0;
211 $templateService->ext_lineNumberOffset_mode =
'setup';
212 foreach ($templateService->config as $key => $val) {
213 $currentTemplateId = $templateService->hierarchyInfo[$key][
'templateID'];
214 if ($currentTemplateId == $template || $template ==
'all') {
216 <h3>' . htmlspecialchars($templateService->hierarchyInfo[$key][
'title']) .
'</h3>
217 <div class="nowrap">' .
218 $templateService->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS[
'ts_analyzer_checkSyntax'], 0) .
221 if ($template !==
'all') {
225 $templateService->ext_lineNumberOffset += count(explode(LF, $val)) + 1;