cvs: pear /HTML_Template_Flexy/Flexy/Compiler Standard.php /HTML_Template_Flexy/Flexy/Compiler/Standard Functions.php

From: Date: Thu, 16 Oct 2003 01:28:48 +0000
Subject: cvs: pear /HTML_Template_Flexy/Flexy/Compiler Standard.php /HTML_Template_Flexy/Flexy/Compiler/Standard Functions.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13646@lists.php.net to get a copy of this message
alan_k Wed Oct 15 21:28:48 2003 EDT Removed files: /pear/HTML_Template_Flexy/Flexy/Compiler/Standard Functions.php Modified files: /pear/HTML_Template_Flexy/Flexy/Compiler Standard.php Log: revert {include(#xxx.html#)} code - use <flexy:include src="xxxx.html"> instead Index: pear/HTML_Template_Flexy/Flexy/Compiler/Standard.php diff -u pear/HTML_Template_Flexy/Flexy/Compiler/Standard.php:1.6 pear/HTML_Template_Flexy/Flexy/Compiler/Standard.php:1.7 --- pear/HTML_Template_Flexy/Flexy/Compiler/Standard.php:1.6 Wed Oct 8 21:26:02 2003 +++ pear/HTML_Template_Flexy/Flexy/Compiler/Standard.php Wed Oct 15 21:28:46 2003 @@ -16,7 +16,7 @@ // | Authors: Alan Knowles <alan@akbkhome.com> | // +----------------------------------------------------------------------+ // -// $Id: Standard.php,v 1.6 2003/10/09 01:26:02 alan_k Exp $ +// $Id: Standard.php,v 1.7 2003/10/16 01:28:46 alan_k Exp $ // // Base Compiler Class // Standard 'Original Flavour' Flexy compiler @@ -379,10 +379,61 @@ function toStringMethod($element) { + + // set up the modifier at present!! + list($prefix,$suffix) = $this->getModifierWrapper($element); + + // add the '!' to if + + if ($element->isConditional) { + $prefix = 'if ('.$element->isNegative; + $element->pushState(); + $suffix = ')'; + } + + + // check that method exists.. + // if (method_exists($object,'method'); + $bits = explode('.',$element->method); + $method = array_pop($bits); + + $object = implode('.',$bits); + $prefix = 'if (isset('.$element->toVar($object). + ') && method_exists('.$element->toVar($object) .",'{$method}')) " . $prefix; - require_once 'HTML/Template/Flexy/Compiler/Standard/Functions.php'; - return HTML_Template_Flexy_Compiler_Standard_Functions::handle($this,$element); + + + $ret = $prefix; + $ret .= $element->toVar($element->method) . "("; + $s =0; + + foreach($element->args as $a) { + + if ($s) { + $ret .= ","; + } + $s =1; + if ($a{0} == '#') { + $ret .= '"'. addslashes(substr($a,1,-1)) . '"'; + continue; + } + $ret .= $element->toVar($a); + + } + $ret .= ")" . $suffix; + + if ($element->isConditional) { + $ret .= ' { '; + } else { + $ret .= ";"; + } + + + + return $this->appendPhp($ret); + + } /**

« previous php.pear.cvs (#13646) next »