-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.php
23 lines (19 loc) · 864 Bytes
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
// We can't use Kohana::$config because that causes my default config file to be merged
// with the application config file, with my config file taking priority. I'm almost 100%
// sure this is not what the user wants
$files = Kohana::find_file('config', 'routes', NULL);
while (count($files) > 1) {
// remove my copy of the config file from considerations, if its not the only one
if (strstr($files[0], basename(__DIR__)))
array_shift($files);
}
foreach (Kohana::load(array_shift($files)) as $name => $params) {
$r = Route::set($name, $params['uri'], array_key_exists('rules', $params) ? $params['rules'] : null);
if (@$params['defaults'])
$r->defaults($params['defaults']);
}