17 private $handlers = array();
26 $this->hooks = $hooks;
40 $segments = $request->getUrlSegments();
42 $identifier = array_shift($segments);
52 elgg_deprecated_notice(
"The 'index', 'system' plugin has been deprecated. See elgg_front_page_handler()", 1.9);
60 'identifier' => $identifier,
61 'handler' => $identifier,
62 'segments' => $segments,
69 if ($identifier !=
$result[
'identifier']) {
70 $identifier =
$result[
'identifier'];
71 }
else if ($identifier !=
$result[
'handler']) {
72 $identifier =
$result[
'handler'];
75 $segments =
$result[
'segments'];
78 if (isset($this->handlers[$identifier]) && is_callable($this->handlers[$identifier])) {
79 $function = $this->handlers[$identifier];
80 $handled = call_user_func($function, $segments, $identifier);
83 return $handled || headers_sent();
96 if (is_callable($function,
true)) {
97 $this->handlers[$identifier] = $function;
112 unset($this->handlers[$identifier]);
121 return $this->handlers;
unregisterPageHandler($identifier)
Unregister a page handler for an identifier.
__construct(\Elgg\PluginHooksService $hooks)
Constructor.
registerPageHandler($identifier, $function)
Register a function that gets called when the first part of a URL is equal to the identifier...
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
route(\Elgg\Http\Request $request)
Routes the request to a registered page handler.
getPageHandlers()
Get page handlers as array of identifier => callback.