CMS for the late garbage.fm
1<?php
2/*
3 url-to-controller mapping file. first-matching route wins.
4
5 for empty urls ("/"), only root routes (added with addRootRoute) will be
6 matched against.
7
8 a specific route example to only match ids that are valid numbers:
9
10 HalfMoon\Router::addRoute(array(
11 "url" => "posts/:id",
12 "controller" => "posts",
13 "action" => "show",
14 "conditions" => array("id" => '/^\d+$/'),
15 ));
16
17 a root route to match "/":
18
19 HalfMoon\Router::addRootRoute(array(
20 "controller" => "posts"
21 ));
22
23 another root route on a specific virtual host to map to a different action
24 (this would have to be defined before the previous root route, since the
25 previous one has no conditions and would match all root urls):
26
27 HalfMoon\Router::addRootRoute(array(
28 "controller" => "posts",
29 "action" => "devindex",
30 "conditions" => array("hostname" => "dev"),
31 ));
32*/
33
34/* admin */
35HalfMoon\Router::addRoute(array(
36 "url" => ADMIN_ROOT_PATH . "episodes/:action/:id",
37 "controller" => "admin_episodes",
38 "conditions" => array("hostname" => ADMIN_ROOT_DOMAIN),
39));
40HalfMoon\Router::addRoute(array(
41 "url" => ADMIN_ROOT_PATH . "profile/:action",
42 "controller" => "admin_profile",
43 "conditions" => array("hostname" => ADMIN_ROOT_DOMAIN),
44));
45HalfMoon\Router::addRoute(array(
46 "url" => ADMIN_ROOT_PATH . ":action/:id",
47 "controller" => "admin",
48 "conditions" => array("hostname" => ADMIN_ROOT_DOMAIN),
49));
50HalfMoon\Router::addRoute(array(
51 "url" => ADMIN_ROOT_PATH,
52 "controller" => "admin",
53 "conditions" => array("hostname" => ADMIN_ROOT_DOMAIN),
54));
55
56
57HalfMoon\Router::addRoute(array(
58 "url" => "episodes.rss",
59 "controller" => "episodes",
60 "action" => "rss",
61));
62
63HalfMoon\Router::addRoute(array(
64 "url" => "episodes pending.rss",
65 "controller" => "episodes",
66 "action" => "rss_with_pending",
67));
68
69HalfMoon\Router::addRoute(array(
70 "url" => "episodes/:id",
71 "controller" => "episodes",
72 "action" => "show",
73 "conditions" => array("id" => '/^\d+$/'),
74));
75
76HalfMoon\Router::addRoute(array(
77 "url" => "page/:page",
78 "controller" => "episodes",
79 "action" => "home",
80 "conditions" => array("page" => '/^\d+$/'),
81));
82
83HalfMoon\Router::addRoute(array(
84 "url" => "episodes/:action/:id",
85 "controller" => "episodes",
86));
87
88HalfMoon\Router::addRootRoute(array(
89 "controller" => "episodes",
90 "action" => "home",
91));
92
93?>