mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-09 15:26:46 +02:00
Refactor PHP init code.
This commit is contained in:
@@ -1,8 +1,28 @@
|
|||||||
<?php
|
<?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
|
// MISC
|
||||||
putenv("LANG=en_US.UTF-8");
|
putenv("LANG=en_US.UTF-8");
|
@@ -21,13 +21,4 @@ function __autoload($class_name) {
|
|||||||
normalized_require_once("class-" . strtolower($class_name));
|
normalized_require_once("class-" . strtolower($class_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
Setup::init();
|
Bootstrap::run();
|
||||||
$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");
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user