mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-05 17:24:20 -04:00
Make Bootstrap static again.
This commit is contained in:
parent
ae677a2194
commit
9611aed707
2 changed files with 5 additions and 10 deletions
|
@ -2,16 +2,11 @@
|
||||||
|
|
||||||
class Bootstrap {
|
class Bootstrap {
|
||||||
|
|
||||||
public static function main() {
|
|
||||||
|
|
||||||
(new Bootstrap())->run();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static $autopaths = ['core', 'ext'];
|
private static $autopaths = ['core', 'ext'];
|
||||||
|
|
||||||
public function run() {
|
public static function run() {
|
||||||
|
|
||||||
spl_autoload_register([$this, 'autoload']);
|
spl_autoload_register(['Bootstrap', 'autoload']);
|
||||||
putenv('LANG=en_US.UTF-8');
|
putenv('LANG=en_US.UTF-8');
|
||||||
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
|
@ -34,14 +29,14 @@ class Bootstrap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function autoload($class_name) {
|
public static function autoload($class_name) {
|
||||||
|
|
||||||
$filename = 'class-' . strtolower($class_name) . '.php';
|
$filename = 'class-' . strtolower($class_name) . '.php';
|
||||||
|
|
||||||
foreach (Bootstrap::$autopaths as $path) {
|
foreach (Bootstrap::$autopaths as $path) {
|
||||||
$file = __DIR__ . '/' . $path . '/' . $filename;
|
$file = __DIR__ . '/' . $path . '/' . $filename;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require $file;
|
require_once $file;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/../backend/php/class-bootstrap.php';
|
require_once __DIR__ . '/../backend/php/class-bootstrap.php';
|
||||||
Bootstrap::main();
|
Bootstrap::run();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue