- Hook unregister methods (#1488184)
| | |
| | | } |
| | | |
| | | /** |
| | | * Unregister a callback function for a specific (server-side) hook. |
| | | * |
| | | * @param string $hook Hook name |
| | | * @param mixed $callback Callback function as string or array with object reference and method name |
| | | */ |
| | | public function remove_hook($hook, $callback) |
| | | { |
| | | $this->api->unregister_hook($hook, $callback); |
| | | } |
| | | |
| | | /** |
| | | * Load localized texts from the plugins dir |
| | | * |
| | | * @param string $dir Directory to search in |
| | |
| | | return $this->ID.'.'.$key; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | '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. |