<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "TYPO3 4.0.1: typo3_src-4.0.1/t3lib/class.t3lib_tsparser.php Source File",
				"datetime" => "Sat Dec 2 19:22:19 2006",
				"date" => "2 Dec 2006",
				"doxygenversion" => "1.4.6",
				"projectname" => "TYPO3 4.0.1",
				"projectnumber" => "4.0.1"
			);
  get_header($doxygen_vars);
?>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_9d0e5c424a38b69aeeedc616a9634e5f.html">t3lib</a></div>
<h1>class.t3lib_tsparser.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002 <span class="comment">/***************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">*  Copyright notice</span>
<a name="l00004"></a>00004 <span class="comment">*</span>
<a name="l00005"></a>00005 <span class="comment">*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)</span>
<a name="l00006"></a>00006 <span class="comment">*  All rights reserved</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">*  This script is part of the TYPO3 project. The TYPO3 project is</span>
<a name="l00009"></a>00009 <span class="comment">*  free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">*  it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">*  the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment">*  (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">*  The GNU General Public License can be found at</span>
<a name="l00015"></a>00015 <span class="comment">*  http://www.gnu.org/copyleft/gpl.html.</span>
<a name="l00016"></a>00016 <span class="comment">*  A copy is found in the textfile GPL.txt and important notices to the license</span>
<a name="l00017"></a>00017 <span class="comment">*  from the author is found in LICENSE.txt distributed with these scripts.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">*</span>
<a name="l00020"></a>00020 <span class="comment">*  This script is distributed in the hope that it will be useful,</span>
<a name="l00021"></a>00021 <span class="comment">*  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00022"></a>00022 <span class="comment">*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00023"></a>00023 <span class="comment">*  GNU General Public License for more details.</span>
<a name="l00024"></a>00024 <span class="comment">*</span>
<a name="l00025"></a>00025 <span class="comment">*  This copyright notice MUST APPEAR in all copies of the script!</span>
<a name="l00026"></a>00026 <span class="comment">***************************************************************/</span>
<a name="l00080"></a><a class="code" href="classt3lib__TSparser.html">00080</a> <span class="keyword">class </span><a class="code" href="classt3lib__TSparser.html">t3lib_TSparser</a> {
<a name="l00081"></a><a class="code" href="classt3lib__TSparser.html#46632e159380e2db5c6201a33783dffc">00081</a>         var <a class="code" href="classt3lib__TSparser.html#46632e159380e2db5c6201a33783dffc">$strict</a> = 1;                                <span class="comment">// If set, then key names cannot contain characters other than [:alnum:]_\.-</span>
<a name="l00082"></a>00082 
<a name="l00083"></a>00083                 <span class="comment">// Internal</span>
<a name="l00084"></a><a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">00084</a>         var <a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a> = Array();                   <span class="comment">// TypoScript hierarchy being build during parsing.</span>
<a name="l00085"></a><a class="code" href="classt3lib__TSparser.html#18a69f14f9090066ed1f2df50f8f7ddb">00085</a>         var <a class="code" href="classt3lib__TSparser.html#18a69f14f9090066ed1f2df50f8f7ddb">$raw</a>;                                               <span class="comment">// raw data, the input string exploded by chr(10)</span>
<a name="l00086"></a><a class="code" href="classt3lib__TSparser.html#87ae9e234d48258c5031e16ccf3f00aa">00086</a>         var <a class="code" href="classt3lib__TSparser.html#87ae9e234d48258c5031e16ccf3f00aa">$rawP</a>;                                              <span class="comment">// pointer to entry in raw data array</span>
<a name="l00087"></a><a class="code" href="classt3lib__TSparser.html#59183983bc5d809d7863e0799949c00b">00087</a>         var <a class="code" href="classt3lib__TSparser.html#59183983bc5d809d7863e0799949c00b">$lastComment</a>='';                    <span class="comment">// Holding the value of the last comment</span>
<a name="l00088"></a><a class="code" href="classt3lib__TSparser.html#cd13b7b72188e80e2a74750c0b71f4b2">00088</a>         var <a class="code" href="classt3lib__TSparser.html#cd13b7b72188e80e2a74750c0b71f4b2">$commentSet</a>=0;                              <span class="comment">// Internally set, used as internal flag to create a multi-line comment (one of those like /*... */)</span>
<a name="l00089"></a><a class="code" href="classt3lib__TSparser.html#75bbf5ef62b574ab587e289a5abeff4a">00089</a>         var <a class="code" href="classt3lib__TSparser.html#75bbf5ef62b574ab587e289a5abeff4a">$multiLineEnabled</a>=0;                <span class="comment">// Internally set, when multiline value is accumulated</span>
<a name="l00090"></a><a class="code" href="classt3lib__TSparser.html#27e12e25c2c87a959097871fc1a863d8">00090</a>         var <a class="code" href="classt3lib__TSparser.html#27e12e25c2c87a959097871fc1a863d8">$multiLineObject</a>='';                <span class="comment">// Internally set, when multiline value is accumulated</span>
<a name="l00091"></a><a class="code" href="classt3lib__TSparser.html#191cc9aaad9dd60f594b896c1bdf516b">00091</a>         var <a class="code" href="classt3lib__TSparser.html#191cc9aaad9dd60f594b896c1bdf516b">$multiLineValue</a>=array();    <span class="comment">// Internally set, when multiline value is accumulated</span>
<a name="l00092"></a><a class="code" href="classt3lib__TSparser.html#2083ec1b4abc5db89d6e865b6a2d09ac">00092</a>         var <a class="code" href="classt3lib__TSparser.html#2083ec1b4abc5db89d6e865b6a2d09ac">$inBrace</a> = 0;                               <span class="comment">// Internally set, when in brace. Counter.</span>
<a name="l00093"></a><a class="code" href="classt3lib__TSparser.html#2d29442574621571a53b1b1621da598f">00093</a>         var <a class="code" href="classt3lib__TSparser.html#2d29442574621571a53b1b1621da598f">$lastConditionTrue</a> = 1;             <span class="comment">// For each condition this flag is set, if the condition is true, else it's cleared. Then it's used by the [ELSE] condition to determine if the next part should be parsed.</span>
<a name="l00094"></a><a class="code" href="classt3lib__TSparser.html#ef0f1d068e65f7aad1d81106ab19e353">00094</a>         var <a class="code" href="classt3lib__TSparser.html#ef0f1d068e65f7aad1d81106ab19e353">$sections</a>=array();                  <span class="comment">// Tracking all conditions found</span>
<a name="l00095"></a><a class="code" href="classt3lib__TSparser.html#8e57003a26635ca770aaf23f13515102">00095</a>         var <a class="code" href="classt3lib__TSparser.html#8e57003a26635ca770aaf23f13515102">$sectionsMatch</a>=array();             <span class="comment">// Tracking all matching conditions found</span>
<a name="l00096"></a><a class="code" href="classt3lib__TSparser.html#a798564813dcea4097b1a060a7760e99">00096</a>         var <a class="code" href="classt3lib__TSparser.html#a798564813dcea4097b1a060a7760e99">$syntaxHighLight</a> = 0;               <span class="comment">// If set, then syntax highlight mode is on; Call the function syntaxHighlight() to use this function</span>
<a name="l00097"></a><a class="code" href="classt3lib__TSparser.html#af53a4ffb4cbd8beaecbe056a2eb2009">00097</a>         var <a class="code" href="classt3lib__TSparser.html#af53a4ffb4cbd8beaecbe056a2eb2009">$highLightData</a>=array();             <span class="comment">// Syntax highlight data is accumulated in this array. Used by syntaxHighlight_print() to construct the output.</span>
<a name="l00098"></a><a class="code" href="classt3lib__TSparser.html#ffa00d5d88bb3d992f5023c98ab9fbfe">00098</a>         var <a class="code" href="classt3lib__TSparser.html#ffa00d5d88bb3d992f5023c98ab9fbfe">$highLightData_bracelevel</a> = array();        <span class="comment">// Syntax highlight data keeping track of the curly brace level for each line</span>
<a name="l00099"></a>00099 
<a name="l00100"></a>00100                 <span class="comment">// Debugging, analysis:</span>
<a name="l00101"></a><a class="code" href="classt3lib__TSparser.html#7a7db3dcfc5947a3bda50370fa0fac4f">00101</a>         var <a class="code" href="classt3lib__TSparser.html#7a7db3dcfc5947a3bda50370fa0fac4f">$regComments</a> = 0;                   <span class="comment">// DO NOT register the comments. This is default for the ordinary sitetemplate!</span>
<a name="l00102"></a><a class="code" href="classt3lib__TSparser.html#fb2f2ccceb43f55abcea828f39960575">00102</a>         var <a class="code" href="classt3lib__TSparser.html#fb2f2ccceb43f55abcea828f39960575">$regLinenumbers</a> = 0;                <span class="comment">// DO NOT register the linenumbers. This is default for the ordinary sitetemplate!</span>
<a name="l00103"></a><a class="code" href="classt3lib__TSparser.html#c78e72d99b97f4b7ce07e566e45b0aed">00103</a>         var <a class="code" href="classt3lib__TSparser.html#c78e72d99b97f4b7ce07e566e45b0aed">$errors</a>=array();                    <span class="comment">// Error accumulation array.</span>
<a name="l00104"></a><a class="code" href="classt3lib__TSparser.html#cd695602ed1a0d6e88f76e10ab5fd117">00104</a>         var <a class="code" href="classt3lib__TSparser.html#cd695602ed1a0d6e88f76e10ab5fd117">$lineNumberOffset</a>=0;                <span class="comment">// Used for the error messages line number reporting. Set externally.</span>
<a name="l00105"></a><a class="code" href="classt3lib__TSparser.html#7ca5598bb0c4e3b66dd25cd5ed2b7aa7">00105</a>         var <a class="code" href="classt3lib__TSparser.html#7ca5598bb0c4e3b66dd25cd5ed2b7aa7">$breakPointLN</a>=0;                    <span class="comment">// Line for break point.</span>
<a name="l00106"></a><a class="code" href="classt3lib__TSparser.html#fd774b7792e723ea42e099333f523828">00106</a>         var <a class="code" href="classt3lib__TSparser.html#fd774b7792e723ea42e099333f523828">$highLightStyles</a>=array(
<a name="l00107"></a>00107                 'prespace'                      =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-prespace"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),       <span class="comment">// Space before any content on a line</span>
<a name="l00108"></a>00108                 'objstr_postspace'      =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-objstr_postspace"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),       <span class="comment">// Space after the object string on a line</span>
<a name="l00109"></a>00109                 'operator_postspace' =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-operator_postspace"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),        <span class="comment">// Space after the operator on a line</span>
<a name="l00110"></a>00110                 '<span class="keyword">operator</span>'                      =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-operator"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),       <span class="comment">// The operator char</span>
<a name="l00111"></a>00111                 'value'                         =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-value"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),  <span class="comment">// The value of a line</span>
<a name="l00112"></a>00112                 'objstr'                        =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-objstr"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'), <span class="comment">// The object string of a line</span>
<a name="l00113"></a>00113                 'value_copy'            =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-value_copy"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),     <span class="comment">// The value when the copy syntax (&lt;) is used; that means the object reference</span>
<a name="l00114"></a>00114                 'value_unset'           =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-value_unset"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),    <span class="comment">// The value when an object is unset. Should not exist.</span>
<a name="l00115"></a>00115                 'ignored'                       =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-ignored"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),        <span class="comment">// The "rest" of a line which will be ignored.</span>
<a name="l00116"></a>00116                 '<span class="keywordflow">default</span>'                       =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-default"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),        <span class="comment">// The default style if none other is applied.</span>
<a name="l00117"></a>00117                 'comment'                       =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-comment"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),        <span class="comment">// Comment lines</span>
<a name="l00118"></a>00118                 'condition'                     =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-condition"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),      <span class="comment">// Conditions</span>
<a name="l00119"></a>00119                 '<a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">error</a>'                         =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-error"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),  <span class="comment">// Error messages</span>
<a name="l00120"></a>00120                 'linenum'                       =&gt; array('&lt;span <span class="keyword">class</span>=<span class="stringliteral">"ts-linenum"</span>&gt;<span class="charliteral">','</span>&lt;/span&gt;'),        <span class="comment">// Line numbers</span>
<a name="l00121"></a>00121         );
<a name="l00122"></a><a class="code" href="classt3lib__TSparser.html#20f6e72183ff736c923e9e6e907f202c">00122</a>         var <a class="code" href="classt3lib__TSparser.html#20f6e72183ff736c923e9e6e907f202c">$highLightBlockStyles</a> = '';         <span class="comment">// Additional attributes for the &lt;span&gt; tags for a blockmode line</span>
<a name="l00123"></a><a class="code" href="classt3lib__TSparser.html#4c6b613d6473745320f4e288bce98159">00123</a>         var <a class="code" href="classt3lib__TSparser.html#4c6b613d6473745320f4e288bce98159">$highLightBlockStyles_basecolor</a> = '#cccccc';                <span class="comment">// The hex-HTML color for the blockmode</span>
<a name="l00124"></a>00124 
<a name="l00125"></a>00125 
<a name="l00133"></a><a class="code" href="classt3lib__TSparser.html#8fe3894aa91f2ab7032734c9a4e80137">00133</a>         function <a class="code" href="classt3lib__TSparser.html#8fe3894aa91f2ab7032734c9a4e80137">parse</a>($string,$matchObj='')    {
<a name="l00134"></a>00134                 $this-&gt;raw = explode(chr(10),$string);
<a name="l00135"></a>00135                 $this-&gt;rawP = 0;
<a name="l00136"></a>00136                 $pre = '[GLOBAL]';
<a name="l00137"></a>00137                 <span class="keywordflow">while</span>($pre)     {
<a name="l00138"></a>00138                         <span class="keywordflow">if</span> ($this-&gt;breakPointLN &amp;&amp; $pre=='[_BREAK]')    {
<a name="l00139"></a>00139                                 $this-&gt;<a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">error</a>('Breakpoint at '.($this-&gt;lineNumberOffset+$this-&gt;rawP-2).': Line content was <span class="stringliteral">"'.$this-&gt;raw[$this-&gt;rawP-2].'"</span>',1);
<a name="l00140"></a>00140                                 <span class="keywordflow">break</span>;
<a name="l00141"></a>00141                         }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143                         <span class="keywordflow">if</span> (strtoupper($pre)=='[GLOBAL]' || strtoupper($pre)=='[END]' || (!$this-&gt;lastConditionTrue &amp;&amp; strtoupper($pre)=='[ELSE]'))     {
<a name="l00144"></a>00144                                 $pre = trim($this-&gt;<a class="code" href="classt3lib__TSparser.html#15b8951700967252b93b444fd6228cda">parseSub</a>($this-&gt;setup));
<a name="l00145"></a>00145                                 $this-&gt;lastConditionTrue=1;
<a name="l00146"></a>00146                         } <span class="keywordflow">else</span> {
<a name="l00147"></a>00147                                 <span class="keywordflow">if</span> (strtoupper($pre)!='[ELSE]') {$this-&gt;sections[md5($pre)]=$pre;}      <span class="comment">// we're in a specific section. Therefore we log this section</span>
<a name="l00148"></a>00148                                 <span class="keywordflow">if</span> ((is_object($matchObj) &amp;&amp; $matchObj-&gt;match($pre)) || $this-&gt;syntaxHighLight) {
<a name="l00149"></a>00149                                         <span class="keywordflow">if</span> (strtoupper($pre)!='[ELSE]') {$this-&gt;sectionsMatch[md5($pre)]=$pre;}
<a name="l00150"></a>00150                                         $pre = trim($this-&gt;<a class="code" href="classt3lib__TSparser.html#15b8951700967252b93b444fd6228cda">parseSub</a>($this-&gt;setup));
<a name="l00151"></a>00151                                         $this-&gt;lastConditionTrue=1;
<a name="l00152"></a>00152                                 } <span class="keywordflow">else</span> {
<a name="l00153"></a>00153                                         $pre = trim($this-&gt;<a class="code" href="classt3lib__TSparser.html#a5c8ac4053d4a25098f65f578422984e">nextDivider</a>());
<a name="l00154"></a>00154                                         $this-&gt;lastConditionTrue=0;
<a name="l00155"></a>00155                                 }
<a name="l00156"></a>00156                         }
<a name="l00157"></a>00157                 }
<a name="l00158"></a>00158                 <span class="keywordflow">if</span> ($this-&gt;inBrace)     {$this-&gt;<a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">error</a>('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': The script is <span class="keywordtype">short</span> of '.$this-&gt;inBrace.' end brace(s)',1);    }
<a name="l00159"></a>00159                 <span class="keywordflow">if</span> ($this-&gt;multiLineEnabled)    {$this-&gt;<a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">error</a>('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': A multiline value section is not ended with a parenthesis!',1);        }
<a name="l00160"></a>00160                 $this-&gt;lineNumberOffset+=count($this-&gt;raw)+1;
<a name="l00161"></a>00161         }
<a name="l00162"></a>00162 
<a name="l00169"></a><a class="code" href="classt3lib__TSparser.html#a5c8ac4053d4a25098f65f578422984e">00169</a>         function <a class="code" href="classt3lib__TSparser.html#a5c8ac4053d4a25098f65f578422984e">nextDivider</a>()  {
<a name="l00170"></a>00170                 <span class="keywordflow">while</span> (isset($this-&gt;raw[$this-&gt;rawP]))  {
<a name="l00171"></a>00171                         $line = ltrim($this-&gt;raw[$this-&gt;rawP]);
<a name="l00172"></a>00172                         $this-&gt;rawP++;
<a name="l00173"></a>00173                         <span class="keywordflow">if</span> ($line &amp;&amp; substr($line,0,1)==<span class="charliteral">'['</span>)    {
<a name="l00174"></a>00174                                 <span class="keywordflow">return</span> $line;
<a name="l00175"></a>00175                         }
<a name="l00176"></a>00176                 }
<a name="l00177"></a>00177         }
<a name="l00178"></a>00178 
<a name="l00185"></a><a class="code" href="classt3lib__TSparser.html#15b8951700967252b93b444fd6228cda">00185</a>         function <a class="code" href="classt3lib__TSparser.html#15b8951700967252b93b444fd6228cda">parseSub</a>(&amp;<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>)      {
<a name="l00186"></a>00186                 global $TYPO3_CONF_VARS;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188                 <span class="keywordflow">while</span> (isset($this-&gt;raw[$this-&gt;rawP]))  {
<a name="l00189"></a>00189                         $line = ltrim($this-&gt;raw[$this-&gt;rawP]);
<a name="l00190"></a>00190                         $lineP = $this-&gt;rawP;
<a name="l00191"></a>00191                         $this-&gt;rawP++;
<a name="l00192"></a>00192                         <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;<a class="code" href="classt3lib__TSparser.html#ff702c43d91e648af338b35f74e61ecc">regHighLight</a>(<span class="stringliteral">"prespace"</span>,$lineP,strlen($line));
<a name="l00193"></a>00193 
<a name="l00194"></a>00194                                 <span class="comment">// Breakpoint?</span>
<a name="l00195"></a>00195                         <span class="keywordflow">if</span> ($this-&gt;breakPointLN &amp;&amp; ($this-&gt;lineNumberOffset+$this-&gt;rawP-1)==($this-&gt;breakPointLN+1))    {       <span class="comment">// by adding 1 we get that line processed</span>
<a name="l00196"></a>00196                                 <span class="keywordflow">return</span> '[_BREAK]';
<a name="l00197"></a>00197                         }
<a name="l00198"></a>00198 
<a name="l00199"></a>00199                                 <span class="comment">// Set comment flag?</span>
<a name="l00200"></a>00200                         <span class="keywordflow">if</span> (!$this-&gt;multiLineEnabled &amp;&amp; substr($line,0,2)=='<span class="comment">/*')        {</span>
<a name="l00201"></a>00201 <span class="comment">                                $this-&gt;commentSet=1;</span>
<a name="l00202"></a>00202 <span class="comment">                        }</span>
<a name="l00203"></a>00203 <span class="comment"></span>
<a name="l00204"></a>00204 <span class="comment">                        if (!$this-&gt;commentSet &amp;&amp; ($line || $this-&gt;multiLineEnabled))   {       // If $this-&gt;multiLineEnabled we will go and get the line values here because we know, the first if() will be true.</span>
<a name="l00205"></a>00205 <span class="comment">                                if ($this-&gt;multiLineEnabled) {  // If multiline is enabled. Escape by ')'</span>
<a name="l00206"></a>00206 <span class="comment">                                        if (substr($line,0,1)==')')     {       // Multiline ends...</span>
<a name="l00207"></a>00207 <span class="comment">                                                if ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight("operator",$lineP,strlen($line)-1);</span>
<a name="l00208"></a>00208 <span class="comment">                                                $this-&gt;multiLineEnabled=0;      // Disable multiline</span>
<a name="l00209"></a>00209 <span class="comment">                                                $theValue = implode($this-&gt;multiLineValue,chr(10));</span>
<a name="l00210"></a>00210 <span class="comment">                                                if (strstr($this-&gt;multiLineObject,'.')) {</span>
<a name="l00211"></a>00211 <span class="comment">                                                        $this-&gt;setVal($this-&gt;multiLineObject,$setup,array($theValue));  // Set the value deeper.</span>
<a name="l00212"></a>00212 <span class="comment">                                                } else {</span>
<a name="l00213"></a>00213 <span class="comment">                                                        $setup[$this-&gt;multiLineObject] = $theValue;     // Set value regularly</span>
<a name="l00214"></a>00214 <span class="comment">                                                        if ($this-&gt;lastComment &amp;&amp; $this-&gt;regComments)   {</span>
<a name="l00215"></a>00215 <span class="comment">                                                                $setup[$this-&gt;multiLineObject.'..'].=$this-&gt;lastComment;</span>
<a name="l00216"></a>00216 <span class="comment">                                                        }</span>
<a name="l00217"></a>00217 <span class="comment">                                                        if ($this-&gt;regLinenumbers)      {</span>
<a name="l00218"></a>00218 <span class="comment">                                                                $setup[$this-&gt;multiLineObject.'.ln..'][]=($this-&gt;lineNumberOffset+$this-&gt;rawP-1);</span>
<a name="l00219"></a>00219 <span class="comment">                                                        }</span>
<a name="l00220"></a>00220 <span class="comment">                                                }</span>
<a name="l00221"></a>00221 <span class="comment">                                        } else {</span>
<a name="l00222"></a>00222 <span class="comment">                                                if ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight("value",$lineP);</span>
<a name="l00223"></a>00223 <span class="comment">                                                $this-&gt;multiLineValue[]=$this-&gt;raw[($this-&gt;rawP-1)];</span>
<a name="l00224"></a>00224 <span class="comment">                                        }</span>
<a name="l00225"></a>00225 <span class="comment">                                } elseif ($this-&gt;inBrace==0 &amp;&amp; substr($line,0,1)=='[')  {       // Beginning of condition (only on level zero compared to brace-levels</span>
<a name="l00226"></a>00226 <span class="comment">                                        if ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight("condition",$lineP);</span>
<a name="l00227"></a>00227 <span class="comment">                                        return $line;</span>
<a name="l00228"></a>00228 <span class="comment">                                } else {</span>
<a name="l00229"></a>00229 <span class="comment">                                        if (substr($line,0,1)=='[' &amp;&amp; strtoupper(trim($line))=='[GLOBAL]')      {               // Return if GLOBAL condition is set - no matter what.</span>
<a name="l00230"></a>00230 <span class="comment">                                                if ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight("condition",$lineP);</span>
<a name="l00231"></a>00231 <span class="comment">                                                $this-&gt;error('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': On return to [GLOBAL] scope, the script was short of '.$this-&gt;inBrace.' end brace(s)',1);</span>
<a name="l00232"></a>00232 <span class="comment">                                                $this-&gt;inBrace=0;</span>
<a name="l00233"></a>00233 <span class="comment">                                                return $line;</span>
<a name="l00234"></a>00234 <span class="comment">                                        } elseif (strcspn($line,'}#/')!=0)      {       // If not brace-end or comment</span>
<a name="l00235"></a>00235 <span class="comment">                                                $varL = strcspn($line,' {=&lt;&gt;:(');       // Find object name string until we meet an operator</span>
<a name="l00236"></a>00236 <span class="comment">                                                $objStrName=trim(substr($line,0,$varL));</span>
<a name="l00237"></a>00237 <span class="comment">                                                if ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight("objstr",$lineP,strlen(substr($line,$varL)));</span>
<a name="l00238"></a>00238 <span class="comment">                                                if (strlen($objStrName)) {</span>
<a name="l00239"></a>00239 <span class="comment">                                                        $r = array();</span>
<a name="l00240"></a>00240 <span class="comment">                                                        if ($this-&gt;strict &amp;&amp; preg_match('/[^[:alnum:]_\.-]/i',$objStrName,$r))  {</span>
<a name="l00241"></a>00241 <span class="comment">                                                                $this-&gt;error('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': Object Name String, "'.htmlspecialchars($objStrName).'" contains invalid character "'.$r[0].'". Must be alphanumeric or one of: "_-."');</span>
<a name="l00242"></a>00242 <span class="comment">                                                        } else {</span>
<a name="l00243"></a>00243 <span class="comment">                                                                $line = ltrim(substr($line,$varL));</span>
<a name="l00244"></a>00244 <span class="comment">                                                                if ($this-&gt;syntaxHighLight)     {</span>
<a name="l00245"></a>00245 <span class="comment">                                                                        $this-&gt;regHighLight("objstr_postspace", $lineP, strlen($line));</span>
<a name="l00246"></a>00246 <span class="comment">                                                                        if (strlen($line)&gt;0)    {</span>
<a name="l00247"></a>00247 <span class="comment">                                                                                $this-&gt;regHighLight("operator", $lineP, strlen($line)-1);</span>
<a name="l00248"></a>00248 <span class="comment">                                                                                $this-&gt;regHighLight("operator_postspace", $lineP, strlen(ltrim(substr($line,1))));</span>
<a name="l00249"></a>00249 <span class="comment">                                                                        }</span>
<a name="l00250"></a>00250 <span class="comment">                                                                }</span>
<a name="l00251"></a>00251 <span class="comment"></span>
<a name="l00252"></a>00252 <span class="comment">                                                                        // Checking for special TSparser properties (to change TS values at parsetime)</span>
<a name="l00253"></a>00253 <span class="comment">                                                                $match = array();</span>
<a name="l00254"></a>00254 <span class="comment">                                                                if (preg_match('/^:=([^\(]+)\((.+)\).*/</span>', $line, $match))       {
<a name="l00255"></a>00255                                                                         $tsFunc = trim($match[1]);
<a name="l00256"></a>00256                                                                         $tsFuncArg = $match[2];
<a name="l00257"></a>00257                                                                         list ($currentValue) = $this-&gt;<a class="code" href="classt3lib__TSparser.html#ce8363e341c9093289d598b4060e5322">getVal</a>($objStrName,<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>);
<a name="l00258"></a>00258 
<a name="l00259"></a>00259                                                                         <span class="keywordflow">switch</span> ($tsFunc)        {
<a name="l00260"></a>00260                                                                                 <span class="keywordflow">case</span> 'prependString':
<a name="l00261"></a>00261                                                                                         $newValue = $tsFuncArg . $currentValue;
<a name="l00262"></a>00262                                                                                 <span class="keywordflow">break</span>;
<a name="l00263"></a>00263                                                                                 <span class="keywordflow">case</span> 'apppendString':
<a name="l00264"></a>00264                                                                                         $newValue = $currentValue . $tsFuncArg;
<a name="l00265"></a>00265                                                                                 <span class="keywordflow">break</span>;
<a name="l00266"></a>00266                                                                                 <span class="keywordflow">case</span> 'removeString':
<a name="l00267"></a>00267                                                                                         $newValue = str_replace($tsFuncArg, '', $currentValue);
<a name="l00268"></a>00268                                                                                 <span class="keywordflow">break</span>;
<a name="l00269"></a>00269                                                                                 <span class="keywordflow">case</span> 'replaceString':
<a name="l00270"></a>00270                                                                                         list($fromStr,$toStr) = explode(<span class="charliteral">'|'</span>, $tsFuncArg, 2);
<a name="l00271"></a>00271                                                                                         $newValue = str_replace($fromStr, $toStr, $currentValue);
<a name="l00272"></a>00272                                                                                 <span class="keywordflow">break</span>;
<a name="l00273"></a>00273                                                                                 <span class="keywordflow">case</span> 'addToList':
<a name="l00274"></a>00274                                                                                         $newValue = (strcmp('',$currentValue) ? $currentValue.<span class="charliteral">','</span> : '') . trim($tsFuncArg);
<a name="l00275"></a>00275                                                                                 <span class="keywordflow">break</span>;
<a name="l00276"></a>00276                                                                                 <span class="keywordflow">case</span> 'removeFromList':
<a name="l00277"></a>00277                                                                                         $existingElements = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">','</span>,$currentValue);
<a name="l00278"></a>00278                                                                                         $removeElements = <a class="code" href="classt3lib__div.html#cfb87d585b85e9b32841bde40beaa96c">t3lib_div::trimExplode</a>(<span class="charliteral">','</span>,$tsFuncArg);
<a name="l00279"></a>00279                                                                                         <span class="keywordflow">if</span> (count($removeElements))     {
<a name="l00280"></a>00280                                                                                                 $newValue = implode(<span class="charliteral">','</span>, array_diff($existingElements, $removeElements));
<a name="l00281"></a>00281                                                                                         }
<a name="l00282"></a>00282                                                                                 <span class="keywordflow">break</span>;
<a name="l00283"></a>00283                                                                                 <span class="keywordflow">default</span>:
<a name="l00284"></a>00284                                                                                         <span class="keywordflow">if</span> (isset($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/<span class="keyword">class</span>.t3lib_tsparser.php']['preParseFunc'][$tsFunc]))   {
<a name="l00285"></a>00285                                                                                                 $hookMethod = $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/<span class="keyword">class</span>.t3lib_tsparser.php']['preParseFunc'][$tsFunc];
<a name="l00286"></a>00286                                                                                                 $params = array('currentValue'=&gt;$currentValue, 'functionArgument'=&gt;$tsFuncArg);
<a name="l00287"></a>00287                                                                                                 $fakeThis = FALSE;
<a name="l00288"></a>00288                                                                                                 $newValue = <a class="code" href="classt3lib__div.html#1458e987700fb6f722ec5186644f6580">t3lib_div::callUserFunction</a>($hookMethod,$params,$fakeThis);
<a name="l00289"></a>00289                                                                                         } <span class="keywordflow">else</span> {
<a name="l00290"></a>00290                                                                                                 <a class="code" href="classt3lib__div.html#56f257eb9149c7e62b1d3db0caddab64">t3lib_div::sysLog</a>('Missing function definition <span class="keywordflow">for</span> '.$tsFunc.' on TypoScript line '.$lineP,'Core',2);
<a name="l00291"></a>00291                                                                                         }
<a name="l00292"></a>00292                                                                         }
<a name="l00293"></a>00293 
<a name="l00294"></a>00294                                                                         <span class="keywordflow">if</span> (isset($newValue))   {
<a name="l00295"></a>00295                                                                                 $line = '= '.$newValue;
<a name="l00296"></a>00296                                                                         }
<a name="l00297"></a>00297                                                                 }
<a name="l00298"></a>00298 
<a name="l00299"></a>00299                                                                 <span class="keywordflow">switch</span>(substr($line,0,1))       {
<a name="l00300"></a>00300                                                                         <span class="keywordflow">case</span> <span class="charliteral">'='</span>:
<a name="l00301"></a>00301                                                                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;<a class="code" href="classt3lib__TSparser.html#ff702c43d91e648af338b35f74e61ecc">regHighLight</a>('value', $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1))));
<a name="l00302"></a>00302 
<a name="l00303"></a>00303                                                                                 <span class="keywordflow">if</span> (strstr($objStrName,<span class="charliteral">'.'</span>))    {
<a name="l00304"></a>00304                                                                                         $value = Array();
<a name="l00305"></a>00305                                                                                         $value[0] = trim(substr($line,1));
<a name="l00306"></a>00306                                                                                         $this-&gt;<a class="code" href="classt3lib__TSparser.html#c9518bcd70a4c6516acd3166ad3f436b">setVal</a>($objStrName,<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>,$value);
<a name="l00307"></a>00307                                                                                 } <span class="keywordflow">else</span> {
<a name="l00308"></a>00308                                                                                         <a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName] = trim(substr($line,1));
<a name="l00309"></a>00309                                                                                         <span class="keywordflow">if</span> ($this-&gt;lastComment &amp;&amp; $this-&gt;regComments)   {       <span class="comment">// Setting comment..</span>
<a name="l00310"></a>00310                                                                                                 <a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName.'..'].=$this-&gt;lastComment;
<a name="l00311"></a>00311                                                                                         }
<a name="l00312"></a>00312                                                                                         <span class="keywordflow">if</span> ($this-&gt;regLinenumbers)      {
<a name="l00313"></a>00313                                                                                                 <a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName.'.ln..'][]=($this-&gt;lineNumberOffset+$this-&gt;rawP-1);
<a name="l00314"></a>00314                                                                                         }
<a name="l00315"></a>00315                                                                                 }
<a name="l00316"></a>00316                                                                         <span class="keywordflow">break</span>;
<a name="l00317"></a>00317                                                                         <span class="keywordflow">case</span> <span class="charliteral">'{'</span>:
<a name="l00318"></a>00318                                                                                 $this-&gt;inBrace++;
<a name="l00319"></a>00319                                                                                 <span class="keywordflow">if</span> (strstr($objStrName,<span class="charliteral">'.'</span>))    {
<a name="l00320"></a>00320                                                                                         $exitSig=$this-&gt;<a class="code" href="classt3lib__TSparser.html#4c02a401bc413366d1bef8aab3057728">rollParseSub</a>($objStrName,<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>);
<a name="l00321"></a>00321                                                                                         <span class="keywordflow">if</span> ($exitSig)   <span class="keywordflow">return</span> $exitSig;
<a name="l00322"></a>00322                                                                                 } <span class="keywordflow">else</span> {
<a name="l00323"></a>00323                                                                                         <span class="keywordflow">if</span> (!isset(<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName.<span class="charliteral">'.'</span>])) {<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName.<span class="charliteral">'.'</span>] = Array();}
<a name="l00324"></a>00324                                                                                         $exitSig=$this-&gt;<a class="code" href="classt3lib__TSparser.html#15b8951700967252b93b444fd6228cda">parseSub</a>(<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>[$objStrName.<span class="charliteral">'.'</span>]);
<a name="l00325"></a>00325                                                                                         <span class="keywordflow">if</span> ($exitSig)   <span class="keywordflow">return</span> $exitSig;
<a name="l00326"></a>00326                                                                                 }
<a name="l00327"></a>00327                                                                         <span class="keywordflow">break</span>;
<a name="l00328"></a>00328                                                                         <span class="keywordflow">case</span> <span class="charliteral">'('</span>:
<a name="l00329"></a>00329                                                                                 $this-&gt;multiLineObject = $objStrName;
<a name="l00330"></a>00330                                                                                 $this-&gt;multiLineEnabled=1;
<a name="l00331"></a>00331                                                                                 $this-&gt;multiLineValue=array();
<a name="l00332"></a>00332                                                                         <span class="keywordflow">break</span>;
<a name="l00333"></a>00333                                                                         <span class="keywordflow">case</span> <span class="charliteral">'&lt;'</span>:
<a name="l00334"></a>00334                                                                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;<a class="code" href="classt3lib__TSparser.html#ff702c43d91e648af338b35f74e61ecc">regHighLight</a>(<span class="stringliteral">"value_copy"</span>, $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1))));
<a name="l00335"></a>00335                                                                                 $theVal = trim(substr($line,1));
<a name="l00336"></a>00336                                                                                 <span class="keywordflow">if</span> (substr($theVal,0,1)==<span class="charliteral">'.'</span>) {
<a name="l00337"></a>00337                                                                                         $res = $this-&gt;<a class="code" href="classt3lib__TSparser.html#ce8363e341c9093289d598b4060e5322">getVal</a>(substr($theVal,1),<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>);
<a name="l00338"></a>00338                                                                                 } <span class="keywordflow">else</span> {
<a name="l00339"></a>00339                                                                                         $res = $this-&gt;<a class="code" href="classt3lib__TSparser.html#ce8363e341c9093289d598b4060e5322">getVal</a>($theVal,$this-&gt;setup);
<a name="l00340"></a>00340                                                                                 }
<a name="l00341"></a>00341                                                                                 $this-&gt;<a class="code" href="classt3lib__TSparser.html#c9518bcd70a4c6516acd3166ad3f436b">setVal</a>($objStrName,<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>,unserialize(serialize($res)),1);
<a name="l00342"></a>00342                                                                         <span class="keywordflow">break</span>;
<a name="l00343"></a>00343                                                                         <span class="keywordflow">case</span> <span class="charliteral">'&gt;'</span>:
<a name="l00344"></a>00344                                                                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;<a class="code" href="classt3lib__TSparser.html#ff702c43d91e648af338b35f74e61ecc">regHighLight</a>(<span class="stringliteral">"value_unset"</span>, $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1))));
<a name="l00345"></a>00345                                                                                 $this-&gt;<a class="code" href="classt3lib__TSparser.html#c9518bcd70a4c6516acd3166ad3f436b">setVal</a>($objStrName,<a class="code" href="classt3lib__TSparser.html#b364dae7bb6da849b14d3d8efe4c0edc">$setup</a>,'UNSET');
<a name="l00346"></a>00346                                                                         <span class="keywordflow">break</span>;
<a name="l00347"></a>00347                                                                         <span class="keywordflow">default</span>:
<a name="l00348"></a>00348                                                                                 $this-&gt;<a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">error</a>('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': Object Name String, <span class="stringliteral">"'.htmlspecialchars($objStrName).'"</span> was not preceeded by any <span class="keyword">operator</span>, =&lt;&gt;({');
<a name="l00349"></a>00349                                                                         <span class="keywordflow">break</span>;
<a name="l00350"></a>00350                                                                 }
<a name="l00351"></a>00351                                                         }
<a name="l00352"></a>00352                                                         $this-&gt;lastComment='';
<a name="l00353"></a>00353                                                 }
<a name="l00354"></a>00354                                         } elseif (substr($line,0,1)==<span class="charliteral">'}'</span>)       {
<a name="l00355"></a>00355                                                 $this-&gt;inBrace--;
<a name="l00356"></a>00356                                                 $this-&gt;lastComment='';
<a name="l00357"></a>00357                                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight(<span class="stringliteral">"operator"</span>, $lineP, strlen($line)-1);
<a name="l00358"></a>00358                                                 <span class="keywordflow">if</span> ($this-&gt;inBrace&lt;0)   {
<a name="l00359"></a>00359                                                         $this-&gt;error('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': An end brace is in excess.',1);
<a name="l00360"></a>00360                                                         $this-&gt;inBrace=0;
<a name="l00361"></a>00361                                                 } <span class="keywordflow">else</span> {
<a name="l00362"></a>00362                                                         <span class="keywordflow">break</span>;
<a name="l00363"></a>00363                                                 }
<a name="l00364"></a>00364                                         } <span class="keywordflow">else</span> {
<a name="l00365"></a>00365                                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight(<span class="stringliteral">"comment"</span>,  $lineP);
<a name="l00366"></a>00366 
<a name="l00367"></a>00367                                                         <span class="comment">// Comment. The comments are concatenated in this temporary string:</span>
<a name="l00368"></a>00368                                                 <span class="keywordflow">if</span> ($this-&gt;regComments) $this-&gt;lastComment.= trim($line).chr(10);
<a name="l00369"></a>00369                                         }
<a name="l00370"></a>00370                                 }
<a name="l00371"></a>00371                         }
<a name="l00372"></a>00372 
<a name="l00373"></a>00373                                 <span class="comment">// Unset comment</span>
<a name="l00374"></a>00374                         <span class="keywordflow">if</span> ($this-&gt;commentSet)  {
<a name="l00375"></a>00375                                 <span class="keywordflow">if</span> ($this-&gt;syntaxHighLight)     $this-&gt;regHighLight(<span class="stringliteral">"comment"</span>,  $lineP);
<a name="l00376"></a>00376                                 <span class="keywordflow">if</span> (substr($line,0,2)=='*/')    $this-&gt;commentSet=0;
<a name="l00377"></a>00377                         }
<a name="l00378"></a>00378                 }
<a name="l00379"></a>00379         }
<a name="l00380"></a>00380 
<a name="l00389"></a><a class="code" href="classt3lib__TSparser.html#4c02a401bc413366d1bef8aab3057728">00389</a>         function rollParseSub($string,&amp;$setup)  {
<a name="l00390"></a>00390                 <span class="keywordflow">if</span> ((string)$string!='')        {
<a name="l00391"></a>00391                         $keyLen = strcspn($string,<span class="charliteral">'.'</span>);
<a name="l00392"></a>00392                         <span class="keywordflow">if</span> ($keyLen==strlen($string))   {
<a name="l00393"></a>00393                                 $key = $string.<span class="charliteral">'.'</span>;
<a name="l00394"></a>00394                                 <span class="keywordflow">if</span> (!isset($setup[$key])){$setup[$key]=Array();}
<a name="l00395"></a>00395                                 $exitSig=$this-&gt;parseSub($setup[$key]);
<a name="l00396"></a>00396                                 <span class="keywordflow">if</span> ($exitSig)   <span class="keywordflow">return</span> $exitSig;
<a name="l00397"></a>00397                         } <span class="keywordflow">else</span> {
<a name="l00398"></a>00398                                 $key = substr($string,0,$keyLen).<span class="charliteral">'.'</span>;
<a name="l00399"></a>00399                                 <span class="keywordflow">if</span> (!isset($setup[$key])){$setup[$key]=Array();}
<a name="l00400"></a>00400                                 $exitSig=$this-&gt;rollParseSub(substr($string,$keyLen+1),$setup[$key]);
<a name="l00401"></a>00401                                 <span class="keywordflow">if</span> ($exitSig)   <span class="keywordflow">return</span> $exitSig;
<a name="l00402"></a>00402                         }
<a name="l00403"></a>00403                 }
<a name="l00404"></a>00404         }
<a name="l00405"></a>00405 
<a name="l00413"></a><a class="code" href="classt3lib__TSparser.html#ce8363e341c9093289d598b4060e5322">00413</a>         function getVal($string,$setup) {
<a name="l00414"></a>00414                 <span class="keywordflow">if</span> ((string)$string!='')        {
<a name="l00415"></a>00415                         $keyLen = strcspn($string,<span class="charliteral">'.'</span>);
<a name="l00416"></a>00416                         <span class="keywordflow">if</span> ($keyLen==strlen($string))   {
<a name="l00417"></a>00417                                 $retArr=array();        <span class="comment">// Added 6/6/03. Shouldn't hurt</span>
<a name="l00418"></a>00418                                 <span class="keywordflow">if</span> (isset($setup[$string]))     {$retArr[0]=$setup[$string];    }
<a name="l00419"></a>00419                                 <span class="keywordflow">if</span> (isset($setup[$string.<span class="charliteral">'.'</span>])) {$retArr[1]=$setup[$string.<span class="charliteral">'.'</span>];        }
<a name="l00420"></a>00420                                 <span class="keywordflow">return</span> $retArr;
<a name="l00421"></a>00421                         } <span class="keywordflow">else</span> {
<a name="l00422"></a>00422                                 $key = substr($string,0,$keyLen).<span class="charliteral">'.'</span>;
<a name="l00423"></a>00423                                 <span class="keywordflow">if</span> ($setup[$key])       {
<a name="l00424"></a>00424                                         <span class="keywordflow">return</span> $this-&gt;getVal(substr($string,$keyLen+1),$setup[$key]);
<a name="l00425"></a>00425                                 }
<a name="l00426"></a>00426                         }
<a name="l00427"></a>00427                 }
<a name="l00428"></a>00428         }
<a name="l00429"></a>00429 
<a name="l00439"></a><a class="code" href="classt3lib__TSparser.html#c9518bcd70a4c6516acd3166ad3f436b">00439</a>         function setVal($string,&amp;$setup,$value,$wipeOut=0)      {
<a name="l00440"></a>00440                 <span class="keywordflow">if</span> ((string)$string!='')        {
<a name="l00441"></a>00441                         $keyLen = strcspn($string,<span class="charliteral">'.'</span>);
<a name="l00442"></a>00442                         <span class="keywordflow">if</span> ($keyLen==strlen($string))   {
<a name="l00443"></a>00443                                 <span class="keywordflow">if</span> ($value=='UNSET')    {
<a name="l00444"></a>00444                                         unset($setup[$string]);
<a name="l00445"></a>00445                                         unset($setup[$string.<span class="charliteral">'.'</span>]);
<a name="l00446"></a>00446                                         <span class="keywordflow">if</span> ($this-&gt;regLinenumbers)      {
<a name="l00447"></a>00447                                                 $setup[$string.'.ln..'][]=($this-&gt;lineNumberOffset+$this-&gt;rawP-1).<span class="charliteral">'&gt;'</span>;
<a name="l00448"></a>00448                                         }
<a name="l00449"></a>00449                                 } <span class="keywordflow">else</span> {
<a name="l00450"></a>00450                                         $lnRegisDone=0;
<a name="l00451"></a>00451                                         <span class="keywordflow">if</span> ($wipeOut &amp;&amp; $this-&gt;strict)  {
<a name="l00452"></a>00452                                                 <span class="keywordflow">if</span> ((isset($setup[$string]) &amp;&amp; !isset($value[0])) || (isset($setup[$string.<span class="charliteral">'.'</span>]) &amp;&amp; !isset($value[1]))) {$this-&gt;error('Line '.($this-&gt;lineNumberOffset+$this-&gt;rawP-1).': Object copied in <span class="keyword">this</span> line <span class="stringliteral">"'.trim($this-&gt;raw[($this-&gt;rawP-1)]).'"</span> would leave either the value or properties untouched in TypoScript Version 1. Please check that <span class="keyword">this</span> is not a problem <span class="keywordflow">for</span> you.',1);}
<a name="l00453"></a>00453                                                 unset($setup[$string]);
<a name="l00454"></a>00454                                                 unset($setup[$string.<span class="charliteral">'.'</span>]);
<a name="l00455"></a>00455                                                 <span class="keywordflow">if</span> ($this-&gt;regLinenumbers)      {
<a name="l00456"></a>00456                                                         $setup[$string.'.ln..'][]=($this-&gt;lineNumberOffset+$this-&gt;rawP-1).<span class="charliteral">'&lt;'</span>;
<a name="l00457"></a>00457                                                         $lnRegisDone=1;
<a name="l00458"></a>00458                                                 }
<a name="l00459"></a>00459                                         }
<a name="l00460"></a>00460                                         <span class="keywordflow">if</span> (isset($value[0])) {$setup[$string] = $value[0];}
<a name="l00461"></a>00461                                         <span class="keywordflow">if</span> (isset($value[1])) {$setup[$string.<span class="charliteral">'.'</span>] = $value[1];}
<a name="l00462"></a>00462                                         <span class="keywordflow">if</span> ($this-&gt;lastComment &amp;&amp; $this-&gt;regComments)   {
<a name="l00463"></a>00463                                                 $setup[$string.'..'].=$this-&gt;lastComment;
<a name="l00464"></a>00464                                         }
<a name="l00465"></a>00465                                         <span class="keywordflow">if</span> ($this-&gt;regLinenumbers &amp;&amp; !$lnRegisDone)     {
<a name="l00466"></a>00466                                                 $setup[$string.'.ln..'][]=($this-&gt;lineNumberOffset+$this-&gt;rawP-1);
<a name="l00467"></a>00467                                         }
<a name="l00468"></a>00468                                 }
<a name="l00469"></a>00469                         } <span class="keywordflow">else</span> {
<a name="l00470"></a>00470                                 $key = substr($string,0,$keyLen).<span class="charliteral">'.'</span>;
<a name="l00471"></a>00471                                 <span class="keywordflow">if</span> (!isset($setup[$key])){$setup[$key]=Array();}
<a name="l00472"></a>00472                                 $this-&gt;setVal(substr($string,$keyLen+1),$setup[$key],$value);
<a name="l00473"></a>00473                         }
<a name="l00474"></a>00474                 }
<a name="l00475"></a>00475         }
<a name="l00476"></a>00476 
<a name="l00485"></a><a class="code" href="classt3lib__TSparser.html#46a272bb9b426500f4b5f36d01771532">00485</a>         function error($err,$num=2)     {
<a name="l00486"></a>00486                 <span class="keywordflow">if</span> (is_object($GLOBALS['TT']))  $GLOBALS['TT']-&gt;setTSlogMessage($err,$num);
<a name="l00487"></a>00487                 $this-&gt;errors[]=array($err,$num,$this-&gt;rawP-1,$this-&gt;lineNumberOffset);
<a name="l00488"></a>00488         }
<a name="l00489"></a>00489 
<a name="l00497"></a><a class="code" href="classt3lib__TSparser.html#3e2b7b65c9ab164e0e9700b683735fd0">00497</a>         function checkIncludeLines($string)     {
<a name="l00498"></a>00498                 $splitStr='&lt;INCLUDE_TYPOSCRIPT:';
<a name="l00499"></a>00499                 <span class="keywordflow">if</span> (strstr($string,$splitStr))  {
<a name="l00500"></a>00500                         $newString='';
<a name="l00501"></a>00501                         $allParts = explode($splitStr,chr(10).$string.chr(10)); <span class="comment">// adds line break char before/after</span>
<a name="l00502"></a>00502                         reset($allParts);
<a name="l00503"></a>00503                         <span class="keywordflow">while</span>(list($c,$v)=each($allParts))      {
<a name="l00504"></a>00504                                 <span class="keywordflow">if</span> (!$c)        {        <span class="comment">// first goes through</span>
<a name="l00505"></a>00505                                         $newString.=$v;
<a name="l00506"></a>00506                                 } elseif (preg_match('/\r?\n\s*$/',$allParts[$c-1]))    {       <span class="comment">// There must be a line-break char before.</span>
<a name="l00507"></a>00507                                         $subparts=explode(<span class="charliteral">'&gt;'</span>,$v,2);
<a name="l00508"></a>00508                                         <span class="keywordflow">if</span> (preg_match('/^\s*\r?\n/',$subparts[1]))     {       <span class="comment">// There must be a line-break char after</span>
<a name="l00509"></a>00509                                                         <span class="comment">// SO, the include was positively recognized:</span>
<a name="l00510"></a>00510                                                 $newString.='### '.$splitStr.$subparts[0].'&gt; BEGIN:'.chr(10);
<a name="l00511"></a>00511                                                 $params = <a class="code" href="classt3lib__div.html#040fb56ea1d21aa12d1157da4164cdfc">t3lib_div::get_tag_attributes</a>($subparts[0]);
<a name="l00512"></a>00512                                                 <span class="keywordflow">if</span> ($params['source'])  {
<a name="l00513"></a>00513                                                         $sourceParts = explode(<span class="charliteral">':'</span>,$params['source'],2);
<a name="l00514"></a>00514                                                         <span class="keywordflow">switch</span>(strtolower(trim($sourceParts[0])))       {
<a name="l00515"></a>00515                                                                 <span class="keywordflow">case</span> 'file':
<a name="l00516"></a>00516                                                                         $filename = <a class="code" href="classt3lib__div.html#ad5d27aeabb41e7f5ed6ddaf760de42a">t3lib_div::getFileAbsFileName</a>(trim($sourceParts[1]));
<a name="l00517"></a>00517                                                                         <span class="keywordflow">if</span> (strcmp($filename,''))       {       <span class="comment">// Must exist and must not contain '..' and must be relative</span>
<a name="l00518"></a>00518                                                                                 <span class="keywordflow">if</span> (@is_file($filename) &amp;&amp; filesize($filename)&lt;100000)  {       <span class="comment">// Max. 100 KB include files!</span>
<a name="l00519"></a>00519                                                                                         $newString.=t3lib_div::getUrl($filename).chr(10);
<a name="l00520"></a>00520                                                                                 }
<a name="l00521"></a>00521                                                                         }
<a name="l00522"></a>00522                                                                 <span class="keywordflow">break</span>;
<a name="l00523"></a>00523                                                         }
<a name="l00524"></a>00524                                                 }
<a name="l00525"></a>00525                                                 $newString.='### '.$splitStr.$subparts[0].'&gt; END:'.chr(10);
<a name="l00526"></a>00526                                                 $newString.=$subparts[1];
<a name="l00527"></a>00527                                         } <span class="keywordflow">else</span> $newString.=$splitStr.$v;
<a name="l00528"></a>00528                                 } <span class="keywordflow">else</span> $newString.=$splitStr.$v;
<a name="l00529"></a>00529                         }
<a name="l00530"></a>00530                         $string=substr($newString,1,-1);        <span class="comment">// not the first/last linebreak char.</span>
<a name="l00531"></a>00531                 }
<a name="l00532"></a>00532                 <span class="keywordflow">return</span> $string;
<a name="l00533"></a>00533         }
<a name="l00534"></a>00534 
<a name="l00541"></a><a class="code" href="classt3lib__TSparser.html#239b9cf0fda5cdbe2e93b37b30c99a77">00541</a>         function checkIncludeLines_array($array)        {
<a name="l00542"></a>00542                 reset($array);
<a name="l00543"></a>00543                 <span class="keywordflow">while</span>(list($k)=each($array))    {
<a name="l00544"></a>00544                         $array[$k]=<a class="code" href="classt3lib__TSparser.html#3e2b7b65c9ab164e0e9700b683735fd0">t3lib_TSparser::checkIncludeLines</a>($array[$k]);
<a name="l00545"></a>00545                 }
<a name="l00546"></a>00546                 <span class="keywordflow">return</span> $array;
<a name="l00547"></a>00547         }
<a name="l00548"></a>00548 
<a name="l00549"></a>00549 
<a name="l00550"></a>00550 
<a name="l00551"></a>00551 
<a name="l00552"></a>00552 
<a name="l00553"></a>00553 
<a name="l00554"></a>00554 
<a name="l00555"></a>00555 
<a name="l00556"></a>00556 
<a name="l00557"></a>00557 
<a name="l00558"></a>00558 
<a name="l00559"></a>00559 
<a name="l00560"></a>00560 
<a name="l00561"></a>00561 
<a name="l00562"></a>00562 
<a name="l00563"></a>00563 
<a name="l00564"></a>00564 
<a name="l00565"></a>00565 
<a name="l00566"></a>00566 
<a name="l00567"></a>00567 
<a name="l00568"></a>00568 
<a name="l00569"></a>00569         <span class="comment">/**********************************</span>
<a name="l00570"></a>00570 <span class="comment">         *</span>
<a name="l00571"></a>00571 <span class="comment">         * Syntax highlighting</span>
<a name="l00572"></a>00572 <span class="comment">         *</span>
<a name="l00573"></a>00573 <span class="comment">         *********************************/</span>
<a name="l00574"></a>00574 
<a name="l00584"></a><a class="code" href="classt3lib__TSparser.html#328d7b80a146df5018a71faa65b29640">00584</a>         function doSyntaxHighlight($string,$lineNum='',$highlightBlockMode=0)   {
<a name="l00585"></a>00585                 $this-&gt;syntaxHighLight=1;
<a name="l00586"></a>00586                 $this-&gt;highLightData=array();
<a name="l00587"></a>00587                 $this-&gt;error=array();
<a name="l00588"></a>00588                 $string = str_replace(chr(13),'',$string);              <span class="comment">// This is done in order to prevent empty &lt;span&gt;..&lt;/span&gt; sections around chr(13) content. Should not do anything but help lessen the amount of HTML code.</span>
<a name="l00589"></a>00589 
<a name="l00590"></a>00590                 $this-&gt;parse($string);
<a name="l00591"></a>00591 
<a name="l00592"></a>00592                 <span class="keywordflow">return</span> $this-&gt;syntaxHighlight_print($lineNum,$highlightBlockMode);
<a name="l00593"></a>00593         }
<a name="l00594"></a>00594 
<a name="l00605"></a><a class="code" href="classt3lib__TSparser.html#ff702c43d91e648af338b35f74e61ecc">00605</a>         function regHighLight($code,$pointer,$strlen=-1)        {
<a name="l00606"></a>00606                 <span class="keywordflow">if</span> ($strlen==-1)        {
<a name="l00607"></a>00607                         $this-&gt;highLightData[$pointer] = array(array($code,0));
<a name="l00608"></a>00608                 } <span class="keywordflow">else</span> {
<a name="l00609"></a>00609                         $this-&gt;highLightData[$pointer][] = array($code,$strlen);
<a name="l00610"></a>00610                 }
<a name="l00611"></a>00611                 $this-&gt;highLightData_bracelevel[$pointer] = $this-&gt;inBrace;
<a name="l00612"></a>00612         }
<a name="l00613"></a>00613 
<a name="l00623"></a><a class="code" href="classt3lib__TSparser.html#6b2cbc9f21efd496316669a8eb938ba8">00623</a>         function syntaxHighlight_print($lineNumDat,$highlightBlockMode) {
<a name="l00624"></a>00624                         <span class="comment">// Registers all error messages in relation to their linenumber</span>
<a name="l00625"></a>00625                 $errA=array();
<a name="l00626"></a>00626                 foreach($this-&gt;errors as $err)  {
<a name="l00627"></a>00627                         $errA[$err[2]][]=$err[0];
<a name="l00628"></a>00628                 }
<a name="l00629"></a>00629                         <span class="comment">// Generates the syntax highlighted output:</span>
<a name="l00630"></a>00630                 $lines=array();
<a name="l00631"></a>00631                 foreach($this-&gt;raw as $rawP =&gt; $value)  {
<a name="l00632"></a>00632                         $start=0;
<a name="l00633"></a>00633                         $strlen=strlen($value);
<a name="l00634"></a>00634                         $lineC='';
<a name="l00635"></a>00635 
<a name="l00636"></a>00636                         <span class="keywordflow">if</span> (is_array($this-&gt;highLightData[$rawP]))      {
<a name="l00637"></a>00637                                 foreach($this-&gt;highLightData[$rawP] as $set)    {
<a name="l00638"></a>00638                                         $len = $strlen-$start-$set[1];
<a name="l00639"></a>00639                                         <span class="keywordflow">if</span> ($len &gt; 0)   {
<a name="l00640"></a>00640                                                 $part = substr($value,$start,$len);
<a name="l00641"></a>00641                                                 $start+=$len;
<a name="l00642"></a>00642                                                 $st = $this-&gt;highLightStyles[(isset($this-&gt;highLightStyles[$set[0]])?$set[0]:'<span class="keywordflow">default</span>')];
<a name="l00643"></a>00643                                                 <span class="keywordflow">if</span> (!$highlightBlockMode || $set[0]!='prespace')                        $lineC.=$st[0].htmlspecialchars($part).$st[1];
<a name="l00644"></a>00644                                         }elseif ($len &lt; 0) debug(array($len,$value,$rawP));
<a name="l00645"></a>00645                                 }
<a name="l00646"></a>00646                         } <span class="keywordflow">else</span> debug(array($value));
<a name="l00647"></a>00647 
<a name="l00648"></a>00648                         <span class="keywordflow">if</span> (strlen(substr($value,$start)))      $lineC.=$this-&gt;highLightStyles['ignored'][0].htmlspecialchars(substr($value,$start)).$this-&gt;highLightStyles['ignored'][1];
<a name="l00649"></a>00649 
<a name="l00650"></a>00650                         <span class="keywordflow">if</span> ($errA[$rawP])       {
<a name="l00651"></a>00651                                 $lineC.=$this-&gt;highLightStyles['error'][0].'&lt;strong&gt; - ERROR:&lt;/strong&gt; '.htmlspecialchars(implode(<span class="charliteral">';'</span>,$errA[$rawP])).$this-&gt;highLightStyles['error'][1];
<a name="l00652"></a>00652                         }
<a name="l00653"></a>00653 
<a name="l00654"></a>00654                         <span class="keywordflow">if</span> ($highlightBlockMode &amp;&amp; $this-&gt;highLightData_bracelevel[$rawP])      {
<a name="l00655"></a>00655                                 $lineC = str_pad('',$this-&gt;highLightData_bracelevel[$rawP]*2,<span class="charliteral">' '</span>,STR_PAD_LEFT).'&lt;span style=<span class="stringliteral">"'.$this-&gt;highLightBlockStyles.($this-&gt;highLightBlockStyles_basecolor?'background-color: '.t3lib_div::modifyHTMLColorAll($this-&gt;highLightBlockStyles_basecolor,-$this-&gt;highLightData_bracelevel[$rawP]*16):'').'"</span>&gt;'.(strcmp($lineC,'')?$lineC:'&amp;nbsp;').'&lt;/span&gt;';
<a name="l00656"></a>00656                         }
<a name="l00657"></a>00657 
<a name="l00658"></a>00658                         <span class="keywordflow">if</span> (is_array($lineNumDat))      {
<a name="l00659"></a>00659                                 $lineNum = $rawP+$lineNumDat[0];
<a name="l00660"></a>00660                                 $lineC = $this-&gt;highLightStyles['linenum'][0].str_pad($lineNum,4,<span class="charliteral">' '</span>,STR_PAD_LEFT).<span class="charliteral">':'</span>.$this-&gt;highLightStyles['linenum'][1].<span class="charliteral">' '</span>.$lineC;
<a name="l00661"></a>00661                         }
<a name="l00662"></a>00662 
<a name="l00663"></a>00663 
<a name="l00664"></a>00664                         $lines[] = $lineC;
<a name="l00665"></a>00665                 }
<a name="l00666"></a>00666 
<a name="l00667"></a>00667                 <span class="keywordflow">return</span> '&lt;pre <span class="keyword">class</span>=<span class="stringliteral">"ts-hl"</span>&gt;'.implode(chr(10),$lines).'&lt;/pre&gt;';
<a name="l00668"></a>00668         }
<a name="l00669"></a>00669 }
<a name="l00670"></a>00670 
<a name="l00671"></a>00671 
<a name="l00672"></a>00672 <span class="keywordflow">if</span> (defined('TYPO3_MODE') &amp;&amp; $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.t3lib_tsparser.php'])  {
<a name="l00673"></a>00673         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.t3lib_tsparser.php']);
<a name="l00674"></a>00674 }
<a name="l00675"></a>00675 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>