diff --git a/filters.inc.php b/filters.inc.php index b83739c..6e03e0e 100644 --- a/filters.inc.php +++ b/filters.inc.php @@ -86,18 +86,14 @@ function flt_class($val, $name, $struct, $args) $conf_path = \taskman\config_real_path($conf_path); - $lines = file($conf_path); - foreach($lines as $line) - { - if(preg_match('~"?class"?\s*:\s*"([^"]+)"~', $line, $matches)) - { - $conf_class = $matches[1]; - if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0])) - throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child"); - else - return $val; - } - } + $cce = \taskman\config_fetch_by_path($conf_path); + + $conf_class = $cce->class; + + if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0])) + throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child"); + else + return $val; throw new Exception($val.". Config class is not found in '$conf_path'"); }