00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00031 require_once(PATH_t3lib."class.t3lib_extobjbase.php");
00032
00033 class tx_tstemplateanalyzer extends t3lib_extobjbase {
00034 function modMenu() {
00035 global $LANG;
00036
00037 return Array (
00038 "ts_analyzer_checkSetup" => "",
00039 "ts_analyzer_checkConst" => "",
00040 "ts_analyzer_checkLinenum" => "",
00041 "ts_analyzer_checkComments" => "",
00042 "ts_analyzer_checkCrop" => "",
00043 "ts_analyzer_checkSyntax" => "",
00044 "ts_analyzer_checkSyntaxBlockmode" => "",
00045 );
00046 }
00047
00048 function initialize_editor($pageId,$template_uid=0) {
00049
00050 global $tmpl,$tplRow,$theConstants,$rootLine;
00051
00052 $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext");
00053 $tmpl->tt_track = 0;
00054 $tmpl->init();
00055
00056
00057 $sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
00058 $rootLine = $sys_page->getRootLine($pageId);
00059 $tmpl->runThroughTemplates($rootLine,$template_uid);
00060
00061 $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid);
00062 if (is_array($tplRow)) {
00063 return 1;
00064 }
00065 }
00066 function main() {
00067
00068 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00069 global $tmpl,$tplRow,$theConstants,$rootLine;
00070
00071
00072
00073
00074 $manyTemplatesMenu = $this->pObj->templateMenu();
00075 $template_uid = 0;
00076 if ($manyTemplatesMenu) {
00077 $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"];
00078 }
00079
00080
00081
00082
00083
00084
00085 $existTemplate = $this->initialize_editor($this->pObj->id,$template_uid);
00086 if ($existTemplate) {
00087 $theOutput.=$this->pObj->doc->divider(5);
00088 $theOutput.=$this->pObj->doc->section("Current template:",'<img src="'.$BACK_PATH.t3lib_iconWorks::getIcon("sys_template",$tplRow).'" width=18 height=16 align=top><b>'.$this->pObj->linkWrapTemplateTitle($tplRow["title"]).'</b>'.htmlspecialchars(trim($tplRow["sitetitle"])?' - ('.$tplRow["sitetitle"].')':''));
00089 }
00090 if ($manyTemplatesMenu) {
00091 $theOutput.=$this->pObj->doc->section("",$manyTemplatesMenu);
00092 }
00093
00094
00095
00096 $tmpl->clearList_const_temp = array_flip($tmpl->clearList_const);
00097 $tmpl->clearList_setup_temp = array_flip($tmpl->clearList_setup);
00098
00099 $pointer = count($tmpl->hierarchyInfo);
00100 $tmpl->hierarchyInfoArr = $tmpl->ext_process_hierarchyInfo(array(), $pointer);
00101 $tmpl->procesIncludes();
00102
00103 $hierarArr = array();
00104 $head= '<tr>';
00105 $head.= '<td class="bgColor2"><b>Title </b></td>';
00106 $head.= '<td class="bgColor2"><b>Rootlevel </b></td>';
00107 $head.= '<td class="bgColor2"><b>C. Setup </b></td>';
00108 $head.= '<td class="bgColor2"><b>C. Const </b></td>';
00109 $head.= '<td class="bgColor2"><b>PID/RL </b></td>';
00110 $head.= '<td class="bgColor2"><b>NL </b></td>';
00111 $head.= '</tr>';
00112 $hierar = implode(array_reverse($tmpl->ext_getTemplateHierarchyArr($tmpl->hierarchyInfoArr, "",array(),1)),"");
00113 $hierar= '<table border=0 cellpadding=0 cellspacing=0>'.$head.$hierar.'</table>';
00114
00115 $theOutput.=$this->pObj->doc->spacer(5);
00116 $theOutput.=$this->pObj->doc->section("Template hierarchy:",$hierar,0,1);
00117
00118
00119
00120 $theOutput.=$this->pObj->doc->spacer(25);
00121 $theOutput.=$this->pObj->doc->divider(0);
00122 $theOutput.=$this->pObj->doc->section("",
00123 "Linenumbers".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_analyzer_checkLinenum]",$this->pObj->MOD_SETTINGS["ts_analyzer_checkLinenum"]).
00124 " Syntax HL".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_analyzer_checkSyntax]",$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntax"]).
00125 (!$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntax"] ?
00126 " Comments".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_analyzer_checkComments]",$this->pObj->MOD_SETTINGS["ts_analyzer_checkComments"]).
00127 " Crop lines".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_analyzer_checkCrop]",$this->pObj->MOD_SETTINGS["ts_analyzer_checkCrop"])
00128 :
00129 " Block mode".t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[ts_analyzer_checkSyntaxBlockmode]",$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntaxBlockmode"])
00130 )
00131 );
00132 $theOutput.=$this->pObj->doc->divider(2);
00133
00134 $theOutput.=$this->pObj->doc->section("Constants:","",0,1);
00135 $theOutput.=$this->pObj->doc->sectionEnd();
00136 if (1==1 || $this->pObj->MOD_SETTINGS["ts_analyzer_checkConst"]) {
00137 $theOutput.='
00138 <table border=0 cellpadding=1 cellspacing=0>
00139 ';
00140 $tmpl->ext_lineNumberOffset=-2;
00141 $tmpl->ext_lineNumberOffset_mode="const";
00142 $tmpl->ext_lineNumberOffset+=count(explode(chr(10),t3lib_TSparser::checkIncludeLines("".$GLOBALS["TYPO3_CONF_VARS"]["FE"]["defaultTypoScript_constants"])))+1;
00143
00144 reset($tmpl->constants);
00145 reset($tmpl->clearList_const);
00146 while(list($key,$val)=each($tmpl->constants)) {
00147 $cVal = current($tmpl->clearList_const);
00148 if ($cVal==t3lib_div::_GET('template') || t3lib_div::_GET('template')=="all") {
00149 $theOutput.='
00150 <tr>
00151 <td><img src=clear.gif width=3 height=1></td><td class="bgColor2"><b>'.$tmpl->templateTitles[$cVal].'</b></td></tr>
00152 <tr>
00153 <td><img src=clear.gif width=3 height=1></td>
00154 <td class="bgColor2"><table border=0 cellpadding=0 cellspacing=0 bgcolor="#D9D5C9" width="100%"><tr><td nowrap>'.$tmpl->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"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntaxBlockmode"]).'</td></tr></table>
00155 </td>
00156 </tr>
00157 ';
00158 if (t3lib_div::_GET('template')!="all") break;
00159 }
00160 $tmpl->ext_lineNumberOffset+=count(explode(chr(10),$val))+1;
00161 next($tmpl->clearList_const);
00162 }
00163 $theOutput.='
00164 </table>
00165 ';
00166 }
00167
00168
00169 $theOutput.=$this->pObj->doc->spacer(15);
00170
00171 $theOutput.=$this->pObj->doc->section("SETUP:","",0,1);
00172 $theOutput.=$this->pObj->doc->sectionEnd();
00173 if (1==1 || $this->pObj->MOD_SETTINGS["ts_analyzer_checkSetup"]) {
00174 $theOutput.='
00175 <table border=0 cellpadding=1 cellspacing=0>
00176 ';
00177 $tmpl->ext_lineNumberOffset=0;
00178 $tmpl->ext_lineNumberOffset_mode="setup";
00179 $tmpl->ext_lineNumberOffset+=count(explode(chr(10),t3lib_TSparser::checkIncludeLines("".$GLOBALS["TYPO3_CONF_VARS"]["FE"]["defaultTypoScript_setup"])))+1;
00180
00181 reset($tmpl->config);
00182 reset($tmpl->clearList_setup);
00183 while(list($key,$val)=each($tmpl->config)) {
00184 if (current($tmpl->clearList_setup)==t3lib_div::_GET('template') || t3lib_div::_GET('template')=="all") {
00185 $theOutput.='
00186 <tr>
00187 <td><img src=clear.gif width=3 height=1></td><td class="bgColor2"><b>'.$tmpl->templateTitles[current($tmpl->clearList_setup)].'</b></td></tr>
00188 <tr>
00189 <td><img src=clear.gif width=3 height=1></td>
00190 <td class="bgColor2"><table border=0 cellpadding=0 cellspacing=0 bgcolor="#D9D5C9" width="100%"><tr><td nowrap>'.$tmpl->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"],$this->pObj->MOD_SETTINGS["ts_analyzer_checkSyntaxBlockmode"]).'</td></tr></table>
00191 </td>
00192 </tr>
00193 ';
00194 if (t3lib_div::_GET('template')!="all") break;
00195 }
00196 $tmpl->ext_lineNumberOffset+=count(explode(chr(10),$val))+1;
00197 next($tmpl->clearList_setup);
00198 }
00199 $theOutput.='
00200 </table>
00201 ';
00202 }
00203 return $theOutput;
00204 }
00205 }
00206
00207 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php"]) {
00208 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/tstemplate_analyzer/class.tx_tstemplateanalyzer.php"]);
00209 }
00210 ?>