-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInitialize.php
More file actions
45 lines (33 loc) · 1.2 KB
/
Initialize.php
File metadata and controls
45 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Integry framework bootstrap
*
* @package framework
* @author Integry Systems
*
*/
require_once(dirname(__file__) . DIRECTORY_SEPARATOR . 'ClassLoader.php');
// we're assuming that application root is one level above the framework directory
// if it's not the case, call ClassLoader::mountPath('.', '/path/to/the/root/directory');
ClassLoader::mountPath('.', dirname(dirname(__file__)) . DIRECTORY_SEPARATOR);
ClassLoader::mountPath('framework', dirname(__file__) . DIRECTORY_SEPARATOR);
ClassLoader::import('framework.request.*');
ClassLoader::import('framework.renderer.*');
ClassLoader::import('framework.response.*');
ClassLoader::import('framework.controller.*');
ClassLoader::import('framework.Application');
$app = new Application();
// initialize default routing rules
$router = $app->getRouter();
$rules = array(
array(":controller", array("action" => "index"), array()),
array(":controller/:id", array("action" => "index"), array("id" => "-?[0-9]+")),
array(":controller/:action", array(), array()),
array(":controller/:action/:id", array(), array("id" => "-?[0-9]+")),
);
foreach ($rules as $route)
{
$router->connect($route[0], $route[1], $route[2]);
}
return $app;
?>