mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-09 07:16:40 +02:00
Refactor PHP init code.
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user