Passing filter args as is if they are not starting with [ or {
This commit is contained in:
parent
9963afe0a9
commit
496bf3aabf
|
@ -115,13 +115,16 @@ function apply_value_filters($field_name, array $tokens, $val, $add_assoc_check
|
|||
|
||||
if(function_exists($filter_func))
|
||||
{
|
||||
$args = array();
|
||||
if($args_json)
|
||||
$args = null;
|
||||
if($args_json && (strpos($args_json, '[') === 0 || strpos($args_json, '{') === 0))
|
||||
{
|
||||
$args = json_decode($args_json, true);
|
||||
if(!is_array($args))
|
||||
throw new Exception("Bad filter args: $args_json");
|
||||
throw new Exception("Bad filter '$token' args: '$args_json'");
|
||||
}
|
||||
else
|
||||
$args = $args_json;
|
||||
|
||||
if($add_assoc_check)
|
||||
$str = "(\$assoc ? $filter_func($str, '$field_name', \$this, " . str_replace("\n", "", var_export($args, true)) . ") : $str)";
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue