mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Optimize a bit.
This commit is contained in:
@@ -453,12 +453,11 @@ function smarty_func_math($args, $smarty_obj) {
|
||||
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all("![a-zA-Z][a-zA-Z0-9]*!",$equation,$match);
|
||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||
|
||||
foreach($match[0] as $curr_var) {
|
||||
if(!in_array($curr_var,array_keys($args)) &&
|
||||
!in_array($curr_var,
|
||||
array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'))) {
|
||||
if(!in_array($curr_var,array_keys($args)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
$smarty_obj->_trigger_error_msg("math: parameter $curr_var not passed as argument");
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user