function Autoload($path) { spl_autoload_register(function ($className) use($path) { $className = str_replace('\\', '/', $className); $filename = $path . '/' . $className . '.php'; File::__include($filename); }); }
public function __construct() { if (count(self::$loadedModules)) { foreach (self::$loadedModules as $module => $option) { if ($option['use'] === true) { /** Loader */ $loaderClass = self::getClass($module, 'Loader'); if (class_exists($loaderClass)) { $this->instance = new $loaderClass(new Component()); $this->event('init'); } /** Bootstrap */ File::__include(self::getFile($module, Router::$interface . '/bootstrap.php')); } } } }
/** * Constructeur * * @return \sJo\Loader\Loader */ public function __construct() { self::$root = realpath(dirname(__DIR__)); /** Load Settings */ Lib\Ini::load()->file(self::$root . '/settings.default.ini')->toDefine(); if (defined('SJO_TIMEZONE')) { date_default_timezone_set(SJO_TIMEZONE); } /** Locale */ $sJo_I18n = new Lib\I18n(); $sJo_I18n->load('default', self::$root . '/Locale'); /** Router */ $this->router = new Router($this); /** Alert */ $this->alert = new Alert(); /** App autoload */ Helpers\Autoload(SJO_ROOT_APP); /** Bootstrap */ File::__include(SJO_ROOT_APP . '/' . Router::$interface . '/bootstrap.php'); /** Load modules */ $this->module = new Module(); }