| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * @filter math 12 * @min_attributes 1 13 * @max_attributes 9999 14 * @package wact 15 * @version $Id: math.filter.php 5945 2007-06-06 08:31:43Z pachanga $ 16 */ 17 18 19 require_once('limb/wact/src/components/data/math_filter.inc.php');class WactMathFilter extends WactCompilerFilter { 20 21 /** 22 * Return this value as a PHP value 23 * @return String 24 */ 25 function getValue() { 26 if ($this->isConstant()) { 27 $value = $this->base->getValue(); 28 $exp = ''; 29 foreach (array_keys($this->parameters) as $i) { 30 $exp .= $this->parameters[$i]->getValue(); 31 } 32 return math_filter($value, 33 $exp, 34 $this->location_in_template->getFile(), 35 $this->location_in_template->getLine()); 36 } else { 37 $this->raiseUnresolvedBindingError(); 38 } 39 } 40 41 /** 42 * Generate the code to read the data value at run time 43 * Must generate only a valid PHP Expression. 44 * @param WactCodeWriter 45 * @return void 46 */ 47 function generateExpression($code_writer) { 48 $code_writer->registerInclude('limb/wact/src/components/data/math_filter.inc.php'); 49 $code_writer->writePHP('math_filter('); 50 $this->base->generateExpression($code_writer); 51 $code_writer->writePHP(','); 52 $first = true; 53 foreach (array_keys($this->parameters) as $i) { 54 if (!$first) { 55 $code_writer->writePHP('.'); 56 } else { 57 $first = false; 58 } 59 $this->parameters[$i]->generateExpression($code_writer); 60 } 61 $code_writer->writePHP(','); 62 $code_writer->writePHPLiteral($this->location_in_template->getFile()); 63 $code_writer->writePHP(','); 64 $code_writer->writePHPLiteral($this->location_in_template->getLine()); 65 $code_writer->writePHP(')'); 66 } 67 } 68 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Sep 6 04:46:52 2008 | Cross-referenced by PHPXref 0.7 |