-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
36 lines (26 loc) · 961 Bytes
/
bootstrap.php
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
<?php
$abspath = __DIR__ . DIRECTORY_SEPARATOR;
set_include_path($abspath . PATH_SEPARATOR . $abspath . 'app' . DIRECTORY_SEPARATOR);
require_once 'vendor/pecee/framework/boot.php';
$app = array();
require_once 'config/app.php';
if(isset($app['db'])) {
new \Pixie\Connection($app['db']['driver'], $app['db'], 'QB');
}
$modules = \Pecee\Module::getInstance();
function modules_autoloader($class) {
global $modules;
$file = explode('\\', $class);
$app = array_shift($file);
$file = join(DIRECTORY_SEPARATOR, $file) . '.php';
$module = $modules->get($app);
if($module !== null) {
require_once $module . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . $file;
}
}
if(count($modules->getList())) {
foreach($modules->getList() as $module) {
set_include_path(get_include_path() . PATH_SEPARATOR . $module . '/app/' . PATH_SEPARATOR . $module . '/');
}
}
spl_autoload_register('modules_autoloader');