1: <?php
2:
3: 4: 5:
6: class Quform_Filter_Static
7: {
8: 9: 10: 11: 12: 13: 14: 15:
16: public static function filter($filter, $value, array $options = array())
17: {
18: $instance = null;
19:
20: if ( ! empty($filter)) {
21: $className = 'Quform_Filter_' . ucfirst($filter);
22: if (class_exists($className)) {
23: $instance = new $className($options);
24: }
25: }
26:
27: if ( ! $instance instanceof Quform_Filter_Abstract) {
28: throw new InvalidArgumentException("Filter '$filter' does not exist");
29: }
30:
31: return $instance->filter($value);
32: }
33: }
34: