method to disable a hook for the current request

This commit is contained in:
Ralf Becker 2017-02-28 13:27:48 +01:00
parent 809e96794e
commit 9b98e07b69

View File

@ -203,6 +203,23 @@ class Hooks
return isset(self::$locations[$location]) ? array_keys(self::$locations[$location]) : array();
}
/**
* Disable a hook for this request
*
* @param string $hook
* @return boolean true if hook existed, false otherwise
*/
static public function disable($hook)
{
if (!isset(self::$locations)) self::read();
$ret = isset(self::$locations[$hook]);
unset(self::$locations[$hook]);
return $ret;
}
/**
* Read all hooks into self::$locations
*