a60736c9 by Chris Boden

Added add_shortcodes function

1 parent 6705e48f
......@@ -45,4 +45,16 @@ function add_actions($class) {
add_action($action->name, Array($class, $action->name));
}
}
function add_shortcodes($class) {
if (!class_exists($class)) {
throw new Exception("$class does not exist");
}
$ref = new ReflectionClass($class);
$methods = $ref->getMethods(ReflectionMethod::IS_STATIC);
foreach ($methods as $method) {
add_shortcode($method->name, Array($class, $method->name));
}
}
?>
......