From 6282750bcc12760293514de517723e515df6dc59 Mon Sep 17 00:00:00 2001 From: Daniel Hoffend Date: Wed, 18 Feb 2015 12:26:08 +0100 Subject: add method to check if a hook has been defined --- lib/kolab_hooks.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/kolab_hooks.php b/lib/kolab_hooks.php index 1ffff31..9a91188 100644 --- a/lib/kolab_hooks.php +++ b/lib/kolab_hooks.php @@ -58,6 +58,20 @@ class kolab_hooks { } /** + * check if callbacks are registered for a given hook + * + * @static + * @param string $hook Hook name + * @return bool + */ + public static function exists($hook) + { + return isset(self::$handlers[$hook]) + && is_array(self::$handlers[$hook]) + && count(self::$handlers[$hook]); + } + + /** * register a callback function for a certain hook * * @static -- cgit v0.12