MDL-20638 importing latest smarty 2.6.26

This commit is contained in:
Petr Skoda
2009-11-17 08:45:54 +00:00
parent 8bcf4b5749
commit 5953ae1d30
69 changed files with 929 additions and 517 deletions
+4 -2
View File
@@ -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);
}
}