Move timetable to a plugin
Plugin repository: https://github.com/kanboard/plugin-timetable
This commit is contained in:
@@ -46,6 +46,18 @@ class Hook
|
||||
return isset($this->hooks[$hook]) ? $this->hooks[$hook] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the hook is used
|
||||
*
|
||||
* @access public
|
||||
* @param string $hook
|
||||
* @return boolean
|
||||
*/
|
||||
public function exists($hook)
|
||||
{
|
||||
return isset($this->hooks[$hook]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge listener results with input array
|
||||
*
|
||||
@@ -67,4 +79,21 @@ class Hook
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute only first listener
|
||||
*
|
||||
* @access public
|
||||
* @param string $hook
|
||||
* @param array $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function first($hook, array $params = array())
|
||||
{
|
||||
foreach ($this->getListeners($hook) as $listener) {
|
||||
return call_user_func_array($listener, $params);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user