From 95d1c61c6352d126ff77222eb88fc576b210621f Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 18 Aug 2011 23:28:06 +0200 Subject: added url_action_alias --- ratatoeskr/sys/urlprocess.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'ratatoeskr') diff --git a/ratatoeskr/sys/urlprocess.php b/ratatoeskr/sys/urlprocess.php index a05d694..d3a0db1 100644 --- a/ratatoeskr/sys/urlprocess.php +++ b/ratatoeskr/sys/urlprocess.php @@ -48,7 +48,7 @@ function url_action_simple($function) */ function url_action_subactions($actions) { - return function (&$data, $url_now, &$url_next) use ($actions) + return function(&$data, $url_now, &$url_next) use ($actions) { $result = url_process($url_next, $actions, $data); if($result !== NULL) @@ -56,6 +56,24 @@ function url_action_subactions($actions) }; } +/* + * Function: url_action_alias + * Generate an action that is an alias for another one (i.e. redirects). + * + * Parameters: + * $for - Path (array) of the action this one should be an alias of. + * + * Returns: + * A callback that can be used as an url action. + */ +function url_action_alias($for) +{ + return function(&$data, $url_now, &$url_next) use($for) + { + $url_next = array_merge($for, $url_next); + }; +} + /* * Function: url_process * Choose an appropiate action for the given URL. -- cgit v1.2.3-70-g09d2