diff -ru typo3_src-4.0beta3.orig/t3lib/class.t3lib_tsparser.php typo3_src-4.0beta3/t3lib/class.t3lib_tsparser.php --- typo3_src-4.0beta3.orig/t3lib/class.t3lib_tsparser.php 2006-01-31 12:19:50.000000000 +0100 +++ typo3_src-4.0beta3/t3lib/class.t3lib_tsparser.php 2006-02-03 12:32:58.000000000 +0100 @@ -216,7 +216,7 @@ $setup[$this->multiLineObject.'.ln..'][]=($this->lineNumberOffset+$this->rawP-1); } } - } else{ + } else { if ($this->syntaxHighLight) $this->regHighLight("value",$lineP); $this->multiLineValue[]=$this->raw[($this->rawP-1)]; } @@ -246,9 +246,44 @@ $this->regHighLight("operator_postspace", $lineP, strlen(ltrim(substr($line,1)))); } } + switch(substr($line,0,1)) { case '=': - if ($this->syntaxHighLight) $this->regHighLight("value", $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1)))); + if ($this->syntaxHighLight) $this->regHighLight('value', $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1)))); + + // Checking for TS-modify properties + if (preg_match('/.*\._[^\.]+/', $objStrName)) { + $operator = preg_replace('/.*\.(_[^\.]+)/', '$1', $objStrName); // Examples: _addString, _removeFromList, etc. + $propertyName = str_replace('.'.$operator, '', $objStrName); // Name of the parent property (which will be changed) + list ($currentValue) = $this->getVal($propertyName,$setup); + $operationValue = substr($line,1); // Value to be added/removed from $currentValue + + switch ($operator) { + case '_addString': + $newValue = $currentValue . trim($operationValue); + break; + case '_removeString': + $newValue = str_replace(trim($operationValue), '', $currentValue); + break; + case '_addToList': + $newValue = (strcmp('',$currentValue) ? $currentValue.',' : '') . trim($operationValue); + break; + case '_removeFromList': + $existingElements = t3lib_div::trimExplode(',',$currentValue); + $removeElements = t3lib_div::trimExplode(',',$operationValue); + if (count($removeElements)) { + $newValue = implode(',', array_diff($existingElements, $removeElements)); + } + break; + } + + if (isset($newValue)) { + $this->setVal($propertyName,$setup,array($newValue)); + unset($newValue); + continue; + } + } + if (strstr($objStrName,'.')) { $value = Array(); $value[0] = trim(substr($line,1)); @@ -523,7 +558,7 @@ /** * Syntax highlight a TypoScript text - * Will parse the content. Remember, the internal setup array may contain INvalid parsed content since conditions are ignored! + * Will parse the content. Remember, the internal setup array may contain invalid parsed content since conditions are ignored! * * @param string The TypoScript text * @param mixed If blank, linenumbers are NOT printed. If array then the first key is the linenumber offset to add to the internal counter.