From 9611aed7077b1d05b376c913959940df1ae02192 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Wed, 13 May 2015 17:33:43 +0200 Subject: [PATCH] Make Bootstrap static again. --- src/_h5ai/backend/php/class-bootstrap.php | 13 ++++--------- src/_h5ai/public/index.php | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/_h5ai/backend/php/class-bootstrap.php b/src/_h5ai/backend/php/class-bootstrap.php index b0404766..d534d22b 100644 --- a/src/_h5ai/backend/php/class-bootstrap.php +++ b/src/_h5ai/backend/php/class-bootstrap.php @@ -2,16 +2,11 @@ class Bootstrap { - public static function main() { - - (new Bootstrap())->run(); - } - 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'); setlocale(LC_CTYPE, 'en_US.UTF-8'); 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'; foreach (Bootstrap::$autopaths as $path) { $file = __DIR__ . '/' . $path . '/' . $filename; if (file_exists($file)) { - require $file; + require_once $file; return true; } } diff --git a/src/_h5ai/public/index.php b/src/_h5ai/public/index.php index 41e568ce..7f095d66 100644 --- a/src/_h5ai/public/index.php +++ b/src/_h5ai/public/index.php @@ -9,4 +9,4 @@ if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) { } require_once __DIR__ . '/../backend/php/class-bootstrap.php'; -Bootstrap::main(); +Bootstrap::run();