This repository has been archived by the owner on May 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
executable file
·47 lines (40 loc) · 1.48 KB
/
init.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
47
<?php
use Adianti\Base\App\Lib\Util\ApplicationTranslator;
use Adianti\Base\Lib\Core\AdiantiApplicationConfig;
use Adianti\Base\Lib\Core\AdiantiCoreTranslator;
use Adianti\Base\Lib\Registry\TSession;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
require 'vendor/autoload.php';
new TSession;
// read configurations
$ini = parse_ini_file('app/config/application.ini', true);
date_default_timezone_set($ini['general']['timezone']);
AdiantiCoreTranslator::setLanguage($ini['general']['language']);
ApplicationTranslator::setLanguage($ini['general']['language']);
AdiantiApplicationConfig::load($ini);
// define constants
define('APPLICATION_NAME', $ini['general']['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
define('LANG', $ini['general']['language']);
define('ENVIRONMENT', $ini['general']['environment']);
if (version_compare(PHP_VERSION, '7.0') == -1) {
die(AdiantiCoreTranslator::translate('The minimum version required for PHP is ^1', '7.0'));
}
$ini = AdiantiApplicationConfig::get();
/**@var Run $whoops*/
$whoops = null;
/**@var PrettyPageHandler $handler*/
$handler = null;
if ($ini['general']['environment'] == 'development') {
$whoops = new Run();
$handler = new PrettyPageHandler;
$whoops->pushHandler($handler);
$whoops->register();
$handler->setEditor("sublime");
}
function _t($msg, $param1 = null, $param2 = null, $param3 = null)
{
return ApplicationTranslator::translate($msg, $param1, $param2, $param3);
}