HTML_Template_Flexy
[ class tree: HTML_Template_Flexy ] [ index: HTML_Template_Flexy ] [ all elements ]

Source for file Token.php

Documentation is available at Token.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors:  Alan Knowles <alan@akbkhome>                               |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Token.php 334846 2014-09-12 04:50:56Z alan_k $
  20. //
  21. //  This is the master Token file for The New Token driver Engine.
  22. //  All the Token output, and building routines are in here.
  23. //
  24. //  Note overriden methods are not documented unless they differ majorly from
  25. //  The parent.
  26. //
  27. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['base'= 0; 
  28. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['state'= 0;
  29. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['statevars'= array();
  30. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['activeForm''';
  31. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['tokens'= array();
  32. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['gettextStrings'= array();
  33. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['activeFormId'= 0;
  34. $GLOBALS['_HTML_TEMPLATE_FLEXY_TOKEN']['flexyIgnore'= false;
  35. /**
  36. * Base Class for all Tokens.
  37. *
  38. @abstract Provides the static Create Method, and default toString() methods
  39. *
  40. */
  41.  
  42. class HTML_Template_Flexy_Token {
  43.     
  44.     /**
  45.     * the token type (Depreciated when we have classes for all tokens
  46.     *
  47.     * @var string 
  48.     * @access public
  49.     */
  50.     var $token;
  51.     /**
  52.     * the default value (normally a string)
  53.     *
  54.     * @var string 
  55.     * @access public
  56.     */
  57.     var $value;
  58.     /**
  59.     * the line the token is from
  60.     *
  61.     * @var int 
  62.     * @access public
  63.     */
  64.     var $line;
  65.     /**
  66.     * the character Position
  67.     *
  68.     * @var int 
  69.     * @access public
  70.     */
  71.     var $charPos;
  72.     
  73.  
  74.     /**
  75.     * factory a Token
  76.     *
  77.     * Standard factory method.. - with object vars.
  78.     * ?? rename me to factory?
  79.     * @param   string      Token type
  80.     * @param   mixed       Initialization settings for token
  81.     * @param   int   line that the token is defined.
  82.     * 
  83.     *
  84.     * @return   object    Created Object
  85.     * @access   public
  86.     */
  87.   
  88.     function factory($token,$value,$line,$charPos=0{
  89.         // try not to reload the same class to often
  90.         static $loaded = array();
  91.         
  92.         
  93.         $c 'HTML_Template_Flexy_Token_'.$token;
  94.         
  95.         if (!class_exists($c&& !isset($loaded[$token])) {
  96.             // make sure parse errors are picked up - no  @ here..
  97.             if (file_exists(dirname(__FILE__)."/Token/{$token}.php")) {
  98.                 require_once 'HTML/Template/Flexy/Token/'.$token.'.php';
  99.             }
  100.             $loaded[$token= true;
  101.         
  102.             
  103.         $t = new HTML_Template_Flexy_Token;
  104.         
  105.         if (class_exists($c)) {
  106.             $t = new $c;
  107.         }
  108.         $t->token = $token;
  109.         $t->charPos = $charPos;
  110.         
  111.         if ($t->setValue($value=== false{
  112.             // kick back error conditions..
  113.             return false;
  114.         }
  115.         $t->line = $line;
  116.         
  117.         return $t;
  118.     }
  119.     
  120.     /**
  121.     * Standard Value iterpretor
  122.     *
  123.     * @param   mixed    value recieved from factory method
  124.  
  125.     * @return   none 
  126.     * @access   public
  127.     */
  128.   
  129.     function setValue($value{
  130.         $this->value = $value;
  131.     }
  132.  
  133.     
  134.     /**
  135.     * compile to String (vistor method) replaces toString
  136.     *
  137.     * @return   string   HTML
  138.     * @access   public
  139.     */
  140.     
  141.     function compile(&$compiler{
  142.         return $compiler->toString($this);
  143.     }
  144.     
  145.      
  146.     /**
  147.     * compile children (visitor approach).
  148.     *
  149.     * @return   string   HTML
  150.     * @access   public
  151.     */
  152.     function compileChildren&$compiler{
  153.          
  154.         if (!$this->children{
  155.             return '';
  156.         }
  157.         if ($this->ignoreChildren{
  158.             return;
  159.         }
  160.         $ret '';
  161.         //echo "output $this->id";
  162.         //new Gtk_VarDump($this);
  163.         foreach ($this->children as $child{
  164.             if (!$child{
  165.                 continue;
  166.             }
  167.             $add $child->compile($compiler);
  168.             if (is_object($add&& is_a($add,'PEAR_Error')) {
  169.                 return $add;
  170.             }
  171.             $ret .= $add;
  172.         }
  173.         return $ret;
  174.     }
  175.     
  176.     
  177.  
  178.     
  179.     /* ======================================================= */
  180.     /* Token Managmenet = parse and store all the tokens in 
  181.      * an associative array and tree.
  182.      */
  183.    
  184.     /**
  185.     * Run a Tokenizer and Store its results
  186.     * It should build a DOM Tree of the HTML
  187.     * 
  188.     * @param   object    Tokenizer to run.. - Theoretically other Tokenizers could be done for email,rtf etc.
  189.     *
  190.     * @access   public
  191.     * @return   base token (really a dummy token, which contains the tree)
  192.     * @static
  193.     */
  194.   
  195.     static function buildTokens($tokenizer
  196.     {
  197.     
  198.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  199.         
  200.         // first record is a filler - to stick all the children on !
  201.         // reset my globals..
  202.         $_HTML_TEMPLATE_FLEXY_TOKEN['base'= 0;
  203.         
  204.         $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'= array();
  205.         $_HTML_TEMPLATE_FLEXY_TOKEN['state'= 0;
  206.         
  207.         $_HTML_TEMPLATE_FLEXY_TOKEN['flexyIgnore'= false;
  208.         if (@$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['flexyIgnore']{
  209.             $_HTML_TEMPLATE_FLEXY_TOKEN['flexyIgnore'= true;
  210.         }
  211.         $_HTML_TEMPLATE_FLEXY_TOKEN['activeFormId'= 0;
  212.         $_HTML_TEMPLATE_FLEXY_TOKEN['activeForm''';
  213.         
  214.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'= array(new HTML_Template_Flexy_Token);
  215.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][0]->id =0;
  216.         $_HTML_TEMPLATE_FLEXY_TOKEN['gettextStrings'= array();
  217.         $i=1;
  218.         
  219.         
  220.         // initialize state - this trys to make sure that
  221.         // you dont do to many elses etc.
  222.        
  223.         //echo "RUNNING TOKENIZER";
  224.         // step one just tokenize it.
  225.         while ($t $tokenizer->yylex()) {  
  226.             
  227.             if ($t == HTML_TEMPLATE_FLEXY_TOKEN_ERROR{
  228.                 //echo "ERROR";
  229.                 
  230.                 //print_r($tokenizer);
  231.                 $err "<PRE>" $tokenizer->error . "\n" .
  232.                     htmlspecialchars(substr($tokenizer->yy_buffer,0,$tokenizer->yy_buffer_end)) 
  233.                     "<font color='red'>"htmlspecialchars(substr($tokenizer->yy_buffer,$tokenizer->yy_buffer_end,100)) 
  234.                     ".......</font></PRE>";
  235.                     
  236.                 return HTML_Template_Flexy::staticRaiseError('HTML_Template_Flexy::Syntax error in ".
  237.                     "Template line:'$tokenizer->yyline .
  238.                     $err
  239.                    HTML_TEMPLATE_FLEXY_ERROR_SYNTAX ,HTML_TEMPLATE_FLEXY_ERROR_RETURN);
  240.             }
  241.             if ($t == HTML_TEMPLATE_FLEXY_TOKEN_NONE{
  242.                 continue;
  243.             }
  244.             if $tokenizer->value->token == 'Php' {
  245.                 if (!$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['allowPHP']{
  246.                     return HTML_Template_Flexy::staticRaiseError('PHP code found in script (Token)',
  247.                         HTML_TEMPLATE_FLEXY_ERROR_SYNTAX,HTML_TEMPLATE_FLEXY_ERROR_RETURN
  248.                     );
  249.                 }
  250.                 
  251.                 if ($GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['allowPHP'=== 'delete'{
  252.                     continue;
  253.                 }
  254.             
  255.             }
  256.             $i++;
  257.             $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i$tokenizer->value;
  258.             $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->id = $i;
  259.             
  260.             // this whole children thing needs rethinking 
  261.             // - I think the body of the page should be wrapped: ..
  262.             //  ?php if (!$this->bodyOnly) { .. <HTML> .... <BODY....>  ?php } ?
  263.             // 
  264.             // old values alias to new ones..
  265.             if (isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXYSTART'])) {
  266.                 unset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXYSTART']);
  267.                 $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXY:START'= true;
  268.             }
  269.             
  270.             if (isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXYSTARTCHILDREN'])) {
  271.                 unset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXYSTARTCHILDREN']);
  272.                 $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXY:STARTCHILDREN'= true;
  273.             }
  274.             
  275.             if (isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXY:START'])) {
  276.                 $_HTML_TEMPLATE_FLEXY_TOKEN['base'$i;
  277.                 unset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXY:START']);
  278.             }
  279.             
  280.             if (isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->ucAttributes['FLEXY:STARTCHILDREN'])) {
  281.                 $_HTML_TEMPLATE_FLEXY_TOKEN['base'$i;
  282.             }
  283.             
  284.             
  285.             //print_r($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]);
  286.              
  287.         }
  288.         //echo "BUILT TOKENS";
  289.         
  290.         $res &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'];
  291.        
  292.         // DEBUG DUMPTING : foreach($res as $k) {  $k->dump(); }
  293.         
  294.         
  295.         $stack = array();
  296.         $total $i +1;
  297.         
  298.         // merge strings and entities - blanking out empty text.
  299.         
  300.   
  301.         for($i=1;$i<$total;$i++{
  302.             if (!isset($res[$i]|| !is_object($res[$i]|| !is_a($res[$i],'HTML_Template_Flexy_Token_Text')) {
  303.                 continue;
  304.             }
  305.             $first $i;
  306.             $i++;
  307.             while ($i<$total && is_object($res[$i])  && is_a($res[$i],'HTML_Template_Flexy_Token_Text')) {
  308.                 if (isset($res[$i])) {
  309.                     $res[$first]->value .= $res[$i]->value;
  310.                     $res[$i]->value = '';
  311.                 }
  312.                 $i++;
  313.             }
  314.         }  
  315.         // connect open  and close tags.
  316.         
  317.         // this is done by having a stack for each of the tag types..
  318.         // then removing it when it finds the closing one
  319.         // eg.
  320.         //  <a href=""><img src=""></a>
  321.         //  ends up with a stack for <a>'s and a stack for <img>'s
  322.         //
  323.         //
  324.         //
  325.         //echo '<PRE>' . htmlspecialchars(print_R($res,true));//exit;
  326.         //echo '<PRE>';
  327.         for($i=1;$i<$total;$i++{
  328.             
  329.             if (empty($res[$i]->tag)) {
  330.                 continue;
  331.             }
  332.             //echo "Checking TAG $i {$res[$i]->tag}\n";
  333.             if ($res[$i]->tag{0== '/'// it's a close tag..
  334.                 //echo "GOT END TAG: {$res[$i]->tag}\n";
  335.                 $tag strtoupper(substr($res[$i]->tag,1));
  336.                 if (!count($stack)) {
  337.                     continue;
  338.                 }
  339.                 $ssc count($stack- 1;
  340.                 /* go up the stack trying to find a match */
  341.                 for($s $ssc$s > -1; $s--{
  342.                     if (!isset($stack[$s])) {
  343.                         echo "MISSED STACK? $s<BR><PRE>";print_r($stack);exit;
  344.                     }
  345.                     if (!isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$stack[$s]])) {
  346.                         echo "STACKED BAD OFFSET : {$stack[$s]}<BR><PRE>";print_r($stack);exit;
  347.                     }
  348.                     $tok =  &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$stack[$s]];
  349.                     if (strtoupper($tok->tag== $tag{
  350.                         // got the matching closer..
  351.                         // echo "MATCH: {$i}:{$tok->tag}({$tok->line}) to  {$stack[$s]}:$tag<BR>";
  352.                         $tok->close = &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i];
  353.                         
  354.                         array_splice($stack,$s);
  355.                         //print_R($stack);
  356.                          
  357.                         break;
  358.                     }
  359.                 }
  360.                 continue;
  361.             }
  362.             $stack[$i;
  363.             // tag with no closer (or unmatched in stack..)
  364.         
  365.       
  366.                 
  367.         // create a dummy close for the end
  368.         $i $total;
  369.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i= new HTML_Template_Flexy_Token;
  370.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->id = $total;
  371.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][0]->close = &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$total];
  372.         
  373.         // now is it possible to connect children...
  374.         // now we need to GLOBALIZE!! - 
  375.         
  376.         
  377.         $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'$res;
  378.         
  379.         HTML_Template_Flexy_Token::buildChildren(0);
  380.         //new Gtk_VarDump($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][0]);
  381.         //echo '<PRE>';print_R($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$_HTML_TEMPLATE_FLEXY_TOKEN['base']]  ); 
  382.         return $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$_HTML_TEMPLATE_FLEXY_TOKEN['base']];
  383.     }
  384.     /**
  385.     * Matching closing tag for a Token
  386.     *
  387.     * @var object|none optional closing tag
  388.     * @access public
  389.     */
  390.     
  391.   
  392.     var $close;
  393.            
  394.     /**
  395.     * array of children to each object.
  396.     *
  397.     * @var array 
  398.     * @access public|private
  399.     */
  400.     
  401.   
  402.     var $children = array();
  403.     
  404.     /**
  405.     * Build the child array for each element.
  406.     * RECURSIVE FUNCTION!!!!
  407.     * @param   int  id of node to add children to.
  408.     *
  409.     * @access   public
  410.     * @static
  411.     */
  412.     static function buildChildren($id
  413.     {
  414.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  415.         
  416.         $base &$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$id];
  417.         $base->children = array();
  418.         $start $base->id +1;
  419.         $end $base->close->id;
  420.         
  421.         for ($i=$start$i<$end$i++{
  422.             //echo "{$base->id}:{$base->tag} ADDING {$i}{$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->tag}<BR>";
  423.             //if ($base->id == 1176) {
  424.             //    echo "<PRE>";print_r($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]);
  425.             // }
  426.          
  427.             $base->children[&$_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i];
  428.             
  429.             if (isset($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]&& 
  430.                 is_object($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->close)) {
  431.             
  432.                 // if the close id is greater than my id - ignore it! - 
  433.                 if ($_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->close->id > $end{
  434.                     continue;
  435.                 }
  436.                 HTML_Template_Flexy_Token::buildChildren($i);
  437.                 $i $_HTML_TEMPLATE_FLEXY_TOKEN['tokens'][$i]->close->id;
  438.             }
  439.         }
  440.     }
  441.             
  442.             
  443.             
  444.     /**
  445.     * Flag to ignore children - Used to block output for select/text area etc.
  446.     * may not be required as I moved the Tag parsing into the toString ph
  447.     *
  448.     * @var boolean ingore children
  449.     * @access public
  450.     */
  451.     
  452.   
  453.     var $ignoreChildren = false;
  454.     
  455.     
  456.     
  457.      
  458.     /* ======================================================== */
  459.     /* variable STATE management 
  460.     *
  461.     * raw variables are assumed to be $this->, unless defined by foreach..
  462.     * it also monitors syntax - eg. end without an if/foreach etc.
  463.     */
  464.  
  465.     
  466.     /**
  467.     * tell the generator you are entering a block
  468.     *
  469.     * @access   public
  470.     */
  471.     function pushState(
  472.     {
  473.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  474.         
  475.         $_HTML_TEMPLATE_FLEXY_TOKEN['state']++;
  476.         $s $_HTML_TEMPLATE_FLEXY_TOKEN['state'];
  477.         
  478.         $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s= array()// initialize statevars
  479.     }
  480.     /**
  481.     * tell the generator you are entering a block
  482.     *
  483.     * @return  boolean  parse error - out of bounds
  484.     * @access   public
  485.     */
  486.     function pullState(
  487.     {
  488.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  489.         
  490.         $s $_HTML_TEMPLATE_FLEXY_TOKEN['state'];
  491.         $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s= array()// initialize statevars
  492.         $_HTML_TEMPLATE_FLEXY_TOKEN['state']--;
  493.         if ($s<0{
  494.             return false;
  495.         }
  496.         return true;
  497.     }
  498.      /**
  499.     * get the real variable name formated x.y.z => $this->x->y->z
  500.     * if  a variable is in the stack it return $x->y->z
  501.     *
  502.     * @return  string PHP variable
  503.     * @access   public
  504.     */
  505.     
  506.     function toVar($s{
  507.         // wrap [] with quotes.
  508.         $s str_replace('[',"['",$s);
  509.         $s str_replace('%5b',"['",$s);
  510.         $s str_replace('%5B',"['",$s);
  511.         $s str_replace(']',"']",$s);
  512.         $s str_replace('%5d',"']",$s);
  513.         $s str_replace('%5D',"']",$s);
  514.         // strip the quotes if it's only numbers..
  515.         $s preg_replace("/'([-]?[0-9]+)'/""\\1",$s);
  516.         
  517.         $parts explode(".",$s);
  518.         
  519.         
  520.         $ret =  $this->findVar($parts[0]);
  521.         if (is_object($ret&& is_a($ret,'PEAR_Error')) {
  522.             return $ret;
  523.         }
  524.         
  525.         array_shift($parts);
  526.         
  527.         if (!count($parts)) {
  528.             return $ret;
  529.         }
  530.         foreach($parts as $p{
  531.             $ret .= "->{$p}";
  532.         }
  533.         return $ret;
  534.     }
  535.     /**
  536.     * do the stack lookup on the variable
  537.     * this relates to flexy
  538.     * t relates to the object being parsed.
  539.     *
  540.     * @return  string PHP variable
  541.     * @access   public
  542.     */
  543.     
  544.     function findVar($string
  545.     {
  546.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  547.     
  548.         if (!$string || $string == 't'{
  549.             return '$t';
  550.         }
  551.         if ($string == 'this'{
  552.             return '$this';
  553.         }
  554.         // accept global access on some string
  555.         if (@$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['globals'&&
  556.             preg_match('/^(_POST|_GET|_REQUEST|_SESSION|_COOKIE|GLOBALS)\[/',$string)) {
  557.             return '$'.$string;
  558.         
  559.         if (!@$GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['privates'&&
  560.                 ($string{0== '_')) {
  561.                 return HTML_Template_Flexy::staticRaiseError('HTML_Template_Flexy::Attempt to access private variable:'.
  562.                     " on line {$this->line} of {$GLOBALS['_HTML_TEMPLATE_FLEXY']['filename']}".
  563.                     ", Use options[privates] to allow this."
  564.                    HTML_TEMPLATE_FLEXY_ERROR_SYNTAX ,HTML_TEMPLATE_FLEXY_ERROR_RETURN);
  565.         }
  566.         
  567.         $lookup $string;
  568.         if ($p strpos($string,'[')) {
  569.             $lookup substr($string,0,$p);
  570.         }
  571.         
  572.         
  573.         for ($s $_HTML_TEMPLATE_FLEXY_TOKEN['state']$s > 0; $s--{
  574.             if (in_array($lookup $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s])) {
  575.                 return '$'.$string;
  576.             }
  577.         }
  578.         return '$t->'.$string;
  579.     }
  580.     /**
  581.     * add a variable to the stack.
  582.     *
  583.     * @param  string PHP variable
  584.     * @access   public
  585.     */
  586.     
  587.     function pushVar($string
  588.     {
  589.         if (empty($string)) {
  590.             return;
  591.         }
  592.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  593.         $s $_HTML_TEMPLATE_FLEXY_TOKEN['state'];
  594.         $_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s][$string;
  595.     }
  596.     
  597.      /**
  598.     * get the scoped variables as an array of strings so that it can
  599.     * be passed to child templates...
  600.     *
  601.     * 
  602.     * @access   public
  603.     */
  604.     
  605.     function scopeVarsToArrayString()
  606.     {
  607.         global $_HTML_TEMPLATE_FLEXY_TOKEN;
  608.         $ar = array();
  609.         for ($s $_HTML_TEMPLATE_FLEXY_TOKEN['state']$s > 0; $s--{
  610.             $ar array_merge($ar$_HTML_TEMPLATE_FLEXY_TOKEN['statevars'][$s]);
  611.         }
  612.         if (empty($ar)) {
  613.             return 'array()';
  614.         }
  615.         return "array('"implode("','"$ar)"')";
  616.         
  617.     }
  618.     
  619.        /**
  620.     * dump to text ATM
  621.     *
  622.     * 
  623.     * @access   public
  624.     */
  625.     
  626.     function dump({
  627.         echo "{$this->token}/" . (isset($this->tag? "<{$this->tag}>" : ''. ": {$this->value}\n";
  628.     }
  629.     
  630.     
  631.     
  632.     
  633. }

Documentation generated on Mon, 11 Mar 2019 16:00:00 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.