forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
46 lines (34 loc) · 1.17 KB
/
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
37
38
39
40
41
42
43
44
45
46
<?php
if (!defined('ROOT_DIR')) {
define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
}
if (!defined('SRC_DIR')) {
define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
}
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
}
if (!defined('APP_DIR')) {
define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
}
if (!defined('BIN_DIR')) {
define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}
if (!defined('RUNTIME_DIR')) {
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
require_once(ROOT_DIR . 'vendor/autoload.php');
// Load configuration if present:
$conf = [];
$conf['b8']['app']['namespace'] = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
$config = new b8\Config($conf);
$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
$config->loadYaml($configFile);
}
if (!defined('APP_URL') && !empty($config)) {
define('APP_URL', $config->get('php-censor.url', '') . '/');
}
\PHPCensor\Helper\Lang::init($config);