Refactor PHP init code.
This commit is contained in:
parent
f78e6dfc64
commit
b94530b93d
2 changed files with 23 additions and 12 deletions
|
@ -1,8 +1,28 @@
|
|||
<?php
|
||||
|
||||
class Setup {
|
||||
class Bootstrap {
|
||||
|
||||
public static function run() {
|
||||
|
||||
Bootstrap::setup();
|
||||
|
||||
$app = new App();
|
||||
if (Util::has_request_param("action")) {
|
||||
$api = new Api($app);
|
||||
$api->apply();
|
||||
} else {
|
||||
define("FALLBACK", $app->get_fallback());
|
||||
normalized_require_once("page");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function setup() {
|
||||
|
||||
if (defined("NAME")) {
|
||||
return;
|
||||
}
|
||||
|
||||
public static function init() {
|
||||
|
||||
// MISC
|
||||
putenv("LANG=en_US.UTF-8");
|
|
@ -21,13 +21,4 @@ function __autoload($class_name) {
|
|||
normalized_require_once("class-" . strtolower($class_name));
|
||||
}
|
||||
|
||||
Setup::init();
|
||||
$app = new App();
|
||||
|
||||
if (Util::has_request_param("action")) {
|
||||
$api = new Api($app);
|
||||
$api->apply();
|
||||
} else {
|
||||
define("FALLBACK", $app->get_fallback());
|
||||
normalized_require_once("page");
|
||||
}
|
||||
Bootstrap::run();
|
||||
|
|
Loading…
Add table
Reference in a new issue