summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_plugin_api.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-03-07 10:07:57 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-03-07 10:07:57 +0000
commit4e2b29065db764df8e9a2cb70d70fea52524b683 (patch)
tree85b0c6fa521d8bd32dd716ee6223a131d2c8c118 /roundcubemail/program/include/rcube_plugin_api.php
parent465ac159bf1827d67227300fd50fc1f9cf85eba1 (diff)
- Hook unregister methods (#1488184)
git-svn-id: https://svn.roundcube.net/trunk@5975 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_plugin_api.php')
-rw-r--r--roundcubemail/program/include/rcube_plugin_api.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/roundcubemail/program/include/rcube_plugin_api.php b/roundcubemail/program/include/rcube_plugin_api.php
index fbf3584e3..be12f11b5 100644
--- a/roundcubemail/program/include/rcube_plugin_api.php
+++ b/roundcubemail/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.