Branch 'ticket/4569' - lib/kolab_hooks.php

Daniel Hoffend hoffend at kolabsys.com
Wed Feb 18 12:26:13 CET 2015


 lib/kolab_hooks.php |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 6282750bcc12760293514de517723e515df6dc59
Author: Daniel Hoffend <dh at dotlan.net>
Date:   Wed Feb 18 12:26:08 2015 +0100

    add method to check if a hook has been defined

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




More information about the commits mailing list