16 private $handlers = array();
25 $this->hooks = $hooks;
41 $identifier = array_shift($segments);
51 elgg_deprecated_notice(
"The 'index', 'system' plugin has been deprecated. See elgg_front_page_handler()", 1.9);
59 'identifier' => $identifier,
60 'handler' => $identifier,
61 'segments' => $segments,
63 $result = $this->hooks->trigger(
'route', $identifier, null,
$result);
68 if ($identifier !=
$result[
'identifier']) {
69 $identifier =
$result[
'identifier'];
70 }
else if ($identifier !=
$result[
'handler']) {
71 $identifier =
$result[
'handler'];
74 $segments =
$result[
'segments'];
77 if (isset($this->handlers[$identifier]) && is_callable($this->handlers[$identifier])) {
78 $function = $this->handlers[$identifier];
79 $handled = call_user_func($function, $segments, $identifier);
82 return $handled || headers_sent();
95 if (is_callable($function,
true)) {
96 $this->handlers[$identifier] = $function;
111 unset($this->handlers[$identifier]);
120 return $this->handlers;
getPageHandlers()
Get page handlers as array of identifier => callback.
__construct(Elgg_PluginHooksService $hooks)
Constructor.
getUrlSegments()
Get URL segments from the path info.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
unregisterPageHandler($identifier)
Unregister a page handler for an identifier.
route(Elgg_Http_Request $request)
Routes the request to a registered page handler.
registerPageHandler($identifier, $function)
Register a function that gets called when the first part of a URL is equal to the identifier...