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
|
|
|
}
|
2013-05-15 19:27:13 +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);
|
2014-05-06 17:44:23 +02:00
|
|
|
}
|
|
|
|
|
2016-07-21 17:20:34 +02:00
|
|
|
if (!defined('RUNTIME_DIR')) {
|
|
|
|
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
|
2013-10-15 15:14:52 +02:00
|
|
|
}
|
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
|
|
|
|
2013-05-15 23:29:09 +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';
|
2013-09-20 08:33:46 +02:00
|
|
|
$conf['b8']['app']['default_controller'] = 'Home';
|
2016-07-21 17:20:34 +02:00
|
|
|
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
|
2013-05-23 13:10:01 +02:00
|
|
|
|
2014-05-06 17:44:23 +02:00
|
|
|
$config = new b8\Config($conf);
|
2014-05-08 14:16:09 +02:00
|
|
|
|
2016-07-21 17:20:34 +02:00
|
|
|
$configFile = APP_DIR . 'config.yml';
|
2014-05-08 14:16:09 +02:00
|
|
|
if (file_exists($configFile)) {
|
|
|
|
$config->loadYaml($configFile);
|
|
|
|
}
|
2013-05-22 17:36:55 +02:00
|
|
|
|
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', '') . '/');
|
2015-02-09 10:00:42 +01:00
|
|
|
}
|
|
|
|
|
2017-02-05 09:34:21 +01:00
|
|
|
\PHPCensor\Helper\Lang::init($config);
|