From 3468b554c90457e0033564ccd209359a4a37abd3 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 18 May 2011 01:35:52 +0000 Subject: Fixes #3132 added 'route', $handler plugin hook git-svn-id: http://code.elgg.org/elgg/trunk@9098 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/pagehandler.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'engine/lib/pagehandler.php') diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index e598d6821..31d73b18c 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -27,6 +27,20 @@ function page_handler($handler, $page) { array_pop($page); } + // return false to stop processing the request (because you handled it) + // return a new $params array if you want to route the request differently + $params = array( + 'handler' => $handler, + 'segments' => $page, + ); + $params = elgg_trigger_plugin_hook('route', $handler, NULL, $params); + if ($params === false) { + return true; + } + + $handler = $params['handler']; + $page = $params['segments']; + if (!isset($CONFIG->pagehandler) || empty($handler)) { $result = false; } else if (isset($CONFIG->pagehandler[$handler]) && is_callable($CONFIG->pagehandler[$handler])) { -- cgit v1.2.3