17 private $handlers = array();
31 $this->logger = $logger;
44 if (empty(
$name) || empty(
$type) || !is_callable($callback,
true)) {
48 if (!isset($this->handlers[
$name])) {
49 $this->handlers[
$name] = array();
80 if (isset($this->handlers[
$name]) && isset($this->handlers[
$name][
$type])) {
81 $matcher = $this->getMatcher($callback);
114 return $this->handlers;
143 $handlers = array_merge($handlers, array_values($this->handlers[
$name][
$type]));
146 if (isset($this->handlers[
'all'][
$type])) {
147 if (
$type !=
'all') {
148 $handlers = array_merge($handlers, array_values($this->handlers[
'all'][
$type]));
151 if (isset($this->handlers[
$name][
'all'])) {
152 if (
$name !=
'all') {
153 $handlers = array_merge($handlers, array_values($this->handlers[
$name][
'all']));
156 if (isset($this->handlers[
'all'][
'all'])) {
157 $handlers = array_merge($handlers, array_values($this->handlers[
'all'][
'all']));
171 if (is_string($spec) &&
false !== strpos($spec,
'::')) {
176 if (!is_array($spec) || empty($spec[0]) || empty($spec[1]) || !is_string($spec[1])) {
180 if (is_object($spec[0])) {
181 $spec[0] = get_class($spec[0]);
184 if (!is_string($spec[0])) {
if($guid==elgg_get_logged_in_user_guid()) $name
hasHandler($name, $type)
Does the hook have a handler?
unregisterHandler($name, $type, $callback)
Unregister a handler.
getMatcher($spec)
Create a matcher for the given callable (if it's for a static or dynamic method)
getOrderedHandlers($name, $type)
Returns an ordered array of handlers registered for $name and $type.
getAllHandlers()
Returns all registered handlers as array( $name => array( $type => array( $priority => callback,...
setLogger(\Elgg\Logger $logger=null)
Set a logger instance, e.g.
registerHandler($name, $type, $callback, $priority=500)
Registers a handler.
Identify a static/dynamic method callable, even if contains an object to which you don't have a refer...