aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys
diff options
context:
space:
mode:
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.
*