cvs: smarty /plugins function.math.php

From: Date: Mon, 03 Jun 2002 16:13:37 +0000
Subject: cvs: smarty /plugins function.math.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-120@lists.php.net to get a copy of this message
mohrt Mon Jun 3 12:13:37 2002 EDT Modified files: /smarty/plugins function.math.php Log: fixed bug with call $assign Index: smarty/plugins/function.math.php diff -u smarty/plugins/function.math.php:1.2 smarty/plugins/function.math.php:1.3 --- smarty/plugins/function.math.php:1.2 Wed Feb 20 17:24:32 2002 +++ smarty/plugins/function.math.php Mon Jun 3 12:13:37 2002 @@ -11,12 +11,12 @@ function smarty_function_math($params, &$smarty) { // be sure equation parameter is present - if (empty($params["equation"])) { + if (empty($params['equation'])) { $smarty->trigger_error("math: missing equation parameter"); return; } - $equation = $params["equation"]; + $equation = $params['equation']; // make sure parenthesis are balanced if (substr_count($equation,"(") != substr_count($equation,")")) { @@ -53,17 +53,17 @@ eval("\$smarty_math_result = ".$equation.";"); - if (empty($params["format"])) { - if (empty($params["assign"])) { + if (empty($params['format'])) { + if (empty($params['assign'])) { echo $smarty_math_result; } else { - $smarty->assign($params["assign"],$smarty_math_result); + $smarty->assign($params['assign'],$smarty_math_result); } } else { - if (empty($params["assign"])){ - printf($params["format"],$smarty_math_result); + if (empty($params['assign'])){ + printf($params['format'],$smarty_math_result); } else { - $smarty->assign($assign,sprintf($params["format"],$smarty_math_result)); + $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); } } }

« previous php.smarty.cvs (#120) next »