aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-08-18 23:28:06 +0200
committerKevin Chabowski <kevin@kch42.de>2011-08-18 23:28:06 +0200
commit95d1c61c6352d126ff77222eb88fc576b210621f (patch)
treed50b180bda229aa52c25a3f02c02961ed4730f62 /ratatoeskr/sys
parentf7192d05ab4afafdd91c517b4c3fd6329a3c3a24 (diff)
downloadratatoeskr-cms-95d1c61c6352d126ff77222eb88fc576b210621f.tar.gz
ratatoeskr-cms-95d1c61c6352d126ff77222eb88fc576b210621f.tar.bz2
ratatoeskr-cms-95d1c61c6352d126ff77222eb88fc576b210621f.zip
added url_action_alias
Diffstat (limited to 'ratatoeskr/sys')
-rw-r--r--ratatoeskr/sys/urlprocess.php20
1 files changed, 19 insertions, 1 deletions
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)
@@ -57,6 +57,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.
*