blob: 181fda74957ed0f4b697a55cd3f9ec9e915181f7 (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
/**
* Bootstraps the system
* @package Core
*/
class Bootstrap{
/**
* Autload function. Searches for the class file and includes it.
*
* @param unknown $class Class name
* @return void
* @access public
* @throws Exception If the class is not found
* @static
*/
public static function autoload($class) {
$path = array_reverse(explode('_', strtolower($class)));
$file = array_pop($path);
$path = 'classes/'.implode('/',$path);
$file = Misc::find_file($path, $file);
if($file)
include($file);
}
/**
* Runs the application
*
* @return void
* @access public
* @static
*/
public static function run() {
/**
* Application folder
*/
define('APPDIR', ROOTDIR.'/application/');
/**
* Modules folder
*/
define('MODDIR', ROOTDIR.'/modules/');
/**
* System folder
*/
define('SYSDIR', ROOTDIR.'/system/');
/**
* Web folder
*/
define('WEBDIR', ROOTDIR.'/web/');
/**
* Helper functions
*/
include('classes/misc.php');
/**
* Configuration handler
*/
include('classes/config.php');
Config::load_group('core', 'application/config/core.php');
spl_autoload_register('Bootstrap::autoload');
Debug::init();
foreach(Config::get('core.routes') as $route)
Route::add($route[0],$route[1],$route[2]);
}
}
|