Commit 0955418b authored by Kasper Skårhøj's avatar Kasper Skårhøj
Browse files

* Added to TypoScript object browser that the title text of the object links contains information about in which lines in the TypoScript body code that a certain object path is set, cleared, copied.


git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@229 709f56b5-9817-0410-a4d7-c38de5d9e867
parent 7f042cf9
2004-04-24 Kasper Skårhøj,,, <kasper@typo3.com>
* Added to TypoScript object browser that the title text of the object links contains information about in which lines in the TypoScript body code that a certain object path is set, cleared, copied.
2004-04-23 Kasper Skårhøj,,, <kasper@typo3.com>
* Added "removeBadHTML" option to stdWrap - this can help to avoid XSS dangerous HTML.
......
......@@ -99,6 +99,7 @@ class t3lib_TSparser {
// Debugging, analysis:
var $regComments = 0; // DO NOT register the comments. This is default for the ordinary sitetemplate!
var $regLinenumbers = 0; // DO NOT register the linenumbers. This is default for the ordinary sitetemplate!
var $errors=array(); // Error accumulation array.
var $lineNumberOffset=0; // Used for the error messages line number reporting. Set externally.
var $breakPointLN=0; // Line for break point.
......@@ -132,7 +133,6 @@ class t3lib_TSparser {
function parse($string,$matchObj='') {
$this->raw = explode(chr(10),$string);
$this->rawP = 0;
$pre = '[GLOBAL]';
while($pre) {
if ($this->breakPointLN && $pre=='[_BREAK]') {
......@@ -212,6 +212,9 @@ class t3lib_TSparser {
if ($this->lastComment && $this->regComments) {
$setup[$this->multiLineObject.'..'].=$this->lastComment;
}
if ($this->regLinenumbers) {
$setup[$this->multiLineObject.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1);
}
}
} else{
if ($this->syntaxHighLight) $this->regHighLight("value",$lineP);
......@@ -254,6 +257,9 @@ class t3lib_TSparser {
if ($this->lastComment && $this->regComments) { // Setting comment..
$setup[$objStrName.'..'].=$this->lastComment;
}
if ($this->regLinenumbers) {
$setup[$objStrName.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1);
}
}
break;
case '{':
......@@ -385,17 +391,28 @@ class t3lib_TSparser {
if ($value=='UNSET') {
unset($setup[$string]);
unset($setup[$string.'.']);
if ($this->regLinenumbers) {
$setup[$string.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1).'>';
}
} else {
$lnRegisDone=0;
if ($wipeOut && $this->strict) {
if ((isset($setup[$string]) && !isset($value[0])) || (isset($setup[$string.'.']) && !isset($value[1]))) {$this->error('Line '.($this->lineNumberOffset+$this->rawP-1).': Object copied in this line "'.trim($this->raw[($this->rawP-1)]).'" would leave either the value or properties untouched in TypoScript Version 1. Please check that this is not a problem for you.',1);}
unset($setup[$string]);
unset($setup[$string.'.']);
if ($this->regLinenumbers) {
$setup[$string.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1).'<';
$lnRegisDone=1;
}
}
if (isset($value[0])) {$setup[$string] = $value[0];}
if (isset($value[1])) {$setup[$string.'.'] = $value[1];}
if ($this->lastComment && $this->regComments) {
$setup[$string.'..'].=$this->lastComment;
}
if ($this->regLinenumbers && !$lnRegisDone) {
$setup[$string.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1);
}
}
} else {
$key = substr($string,0,$keyLen).'.';
......
......@@ -354,12 +354,14 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
$keyArr_num=array();
$keyArr_alpha=array();
while (list($key,)=each($arr)) {
$key=ereg_replace("\.$","",$key);
if (substr($key,-1)!=".") {
if (t3lib_div::testInt($key)) {
$keyArr_num[$key]=$arr[$key];
} else {
$keyArr_alpha[$key]=$arr[$key];
if (substr($key,-2)!="..") { // Don't do anything with comments / linenumber registrations...
$key=ereg_replace("\.$","",$key);
if (substr($key,-1)!=".") {
if (t3lib_div::testInt($key)) {
$keyArr_num[$key]=$arr[$key];
} else {
$keyArr_alpha[$key]=$arr[$key];
}
}
}
}
......@@ -399,7 +401,12 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
} else {
if ($this->linkObjects) {
$aHref = 'index.php?id='.$GLOBALS["SOBE"]->id.'&sObj='.$depth;
$label = '<a href="'.htmlspecialchars($aHref).'">'.$label.'</a>';
if ($this->bType!="const") {
$ln = is_array($arr[$key.'.ln..']) ? 'Defined in: '.$this->lineNumberToScript($arr[$key.'.ln..']) : 'N/A';
} else {
$ln = '';
}
$label = '<a href="'.htmlspecialchars($aHref).'" title="'.htmlspecialchars($ln).'">'.$label.'</a>';
}
}
......@@ -428,6 +435,32 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
return $HTML;
}
function lineNumberToScript($lnArr) {
if (!is_array($this->lnToScript)) {
$this->lnToScript = array();
$c=1;
$c+=substr_count($GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup'],chr(10))+2;
$this->lnToScript[$c] = '[Default]';
foreach($this->hierarchyInfoToRoot as $info) {
$c+=$info['configLines']+1;
$this->lnToScript[$c] = $info['title'];
}
}
foreach($lnArr as $k => $ln) {
foreach($this->lnToScript as $endLn => $title) {
if ($endLn >= intval($ln)) {
$lnArr[$k] = '"'.$title.'", '.$ln;
break;
}
}
}
return implode('; ',$lnArr);
}
/**
* [Describe function...]
*
......
......@@ -121,6 +121,7 @@ class t3lib_TStemplate {
var $ext_constants_BRP=0;
var $ext_config_BRP=0;
var $ext_editorcfg_BRP=0;
var $ext_regLinenumbers=FALSE;
// Constants:
var $uplPath = 'uploads/tf/';
......@@ -171,6 +172,7 @@ class t3lib_TStemplate {
var $editorcfg = array(); // Backend Editor Configuration field
var $hierarchyInfo = array(); // For Template Analyser in backend
var $hierarchyInfoToRoot = array(); // For Template Analyser in backend (setup content only)
var $nextLevel=0; // Next-level flag (see runThroughTemplates())
var $rootId; // The Page UID of the root page
var $rootLine; // The rootline from current page to the root page
......@@ -403,6 +405,7 @@ class t3lib_TStemplate {
$this->config = Array();
$this->editorcfg = Array();
$this->rowSum = Array();
$this->hierarchyInfoToRoot = Array();
$this->absoluteRootLine=$theRootLine; // Is the TOTAL rootline
reset ($this->absoluteRootLine);
......@@ -458,6 +461,7 @@ class t3lib_TStemplate {
}
if ($clConf) {
$this->config = Array();
$this->hierarchyInfoToRoot = Array();
$this->clearList_setup=array();
$this->editorcfg = Array();
......@@ -505,7 +509,7 @@ class t3lib_TStemplate {
}
// Creating hierarchy information; Used by backend analysis tools
$this->hierarchyInfo[] = array(
$this->hierarchyInfo[] = $this->hierarchyInfoToRoot[] = array(
'root'=>trim($row['root']),
'next'=>$row['nextLevel'],
'clConst'=>$clConst,
......@@ -514,7 +518,8 @@ class t3lib_TStemplate {
'templateParent'=>$templateParent,
'title'=>$row['title'],
'uid'=>$row['uid'],
'pid'=>$row['pid']
'pid'=>$row['pid'],
'configLines' => substr_count($row['config'], chr(10))+1
);
// Adding the content of the fields constants (Constants), config (Setup) and editorcfg (Backend Editor Configuration) to the internal arrays.
......@@ -734,7 +739,8 @@ class t3lib_TStemplate {
// ***********************************************
// Initialize parser and match-condition classes:
$config = t3lib_div::makeInstance('t3lib_TSparser');
$config->breakPointLN=intval($this->ext_config_BRP);
$config->breakPointLN = intval($this->ext_config_BRP);
$config->regLinenumbers = $this->ext_regLinenumbers;
$config->setup = $this->setup;
// Transfer information about conditions found in "Constants" and which of them returned true.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment