Added add_filters function
Showing
1 changed file
with
12 additions
and
0 deletions
| ... | @@ -57,4 +57,16 @@ function add_shortcodes($class) { | ... | @@ -57,4 +57,16 @@ function add_shortcodes($class) { |
| 57 | add_shortcode($method->name, Array($class, $method->name)); | 57 | add_shortcode($method->name, Array($class, $method->name)); |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | |||
| 61 | function add_filters($class) { | ||
| 62 | if (!class_exists($class)) { | ||
| 63 | throw new Exception("$class does not exist"); | ||
| 64 | } | ||
| 65 | |||
| 66 | $ref = new ReflectionClass($class); | ||
| 67 | $methods = $ref->getMethods(ReflectionMethod::IS_STATIC); | ||
| 68 | foreach ($methods as $method) { | ||
| 69 | add_filter($method->name, Array($class, $method->name)); | ||
| 70 | } | ||
| 71 | } | ||
| 60 | ?> | 72 | ?> | ... | ... |
-
Please register or sign in to post a comment