summaryrefslogtreecommitdiff
path: root/program/include/rcube_plugin_api.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-03-07 10:07:57 +0000
committeralecpl <alec@alec.pl>2012-03-07 10:07:57 +0000
commit479af90579e7898ded7ed5de966ab03a3be9300a (patch)
tree925806bbcc1e6967952dabe6bb8015604c293ba8 /program/include/rcube_plugin_api.php
parent2f88b17d341980bfb025cdb002f41f12331bfd16 (diff)
- Hook unregister methods (#1488184)
Diffstat (limited to 'program/include/rcube_plugin_api.php')
-rw-r--r--program/include/rcube_plugin_api.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index fbf3584e3..be12f11b5 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -230,6 +230,20 @@ class rcube_plugin_api
'message' => "Invalid callback function for $hook"), true, false);
}
+ /**
+ * Allow a plugin object to unregister a callback.
+ *
+ * @param string $hook Hook name
+ * @param mixed $callback String with global function name or array($obj, 'methodname')
+ */
+ public function unregister_hook($hook, $callback)
+ {
+ $callback_id = array_search($callback, $this->handlers[$hook]);
+ if ($callback_id !== false) {
+ unset($this->handlers[$hook][$callback_id]);
+ }
+ }
+
/**
* Triggers a plugin hook.