MDL-20638 importing latest smarty 2.6.26
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* Purpose: handle math computations in template<br>
|
||||
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
|
||||
* (Smarty online manual)
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @param array
|
||||
* @param Smarty
|
||||
* @return string
|
||||
@@ -26,7 +27,8 @@ function smarty_function_math($params, &$smarty)
|
||||
return;
|
||||
}
|
||||
|
||||
$equation = $params['equation'];
|
||||
// strip out backticks, not necessary for math
|
||||
$equation = str_replace('`','',$params['equation']);
|
||||
|
||||
// make sure parenthesis are balanced
|
||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
||||
@@ -57,7 +59,7 @@ function smarty_function_math($params, &$smarty)
|
||||
$smarty->trigger_error("math: parameter $key: is not numeric");
|
||||
return;
|
||||
}
|
||||
$equation = preg_replace("/\b$key\b/",$val, $equation);
|
||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user