php-censor/bootstrap.php

47 lines
1.2 KiB
PHP
Raw Normal View History

2013-05-03 17:02:53 +02:00
<?php
2016-04-21 19:05:32 +02:00
if (!defined('ROOT_DIR')) {
define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
2014-04-10 16:59:24 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('SRC_DIR')) {
define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
2016-04-21 19:05:32 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
2016-04-21 19:05:32 +02:00
}
2016-07-21 17:20:34 +02:00
if (!defined('APP_DIR')) {
define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
2016-04-21 19:05:32 +02:00
}
2015-02-26 09:45:42 +01:00
2016-07-21 17:20:34 +02:00
if (!defined('BIN_DIR')) {
define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}
2016-07-21 17:20:34 +02:00
if (!defined('RUNTIME_DIR')) {
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
2013-05-03 17:02:53 +02:00
2016-04-21 19:05:32 +02:00
require_once(ROOT_DIR . 'vendor/autoload.php');
2013-05-15 20:37:56 +02:00
// Load configuration if present:
2016-04-20 12:30:26 +02:00
$conf = [];
2016-07-19 20:28:11 +02:00
$conf['b8']['app']['namespace'] = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
2016-07-21 17:20:34 +02:00
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
$config = new b8\Config($conf);
2016-07-21 17:20:34 +02:00
$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
$config->loadYaml($configFile);
}
2016-07-21 17:20:34 +02:00
if (!defined('APP_URL') && !empty($config)) {
2016-07-21 19:02:11 +02:00
define('APP_URL', $config->get('php-censor.url', '') . '/');
}
2017-02-05 09:34:21 +01:00
\PHPCensor\Helper\Lang::init($config);