public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Well, if you want, you can use it as a singleton.... * @return Autoloader $singleton instance */ public static function getInstance() { if (self::$instance == null) { self::$instance = new Autoloader(); } return self::$instance; }
public function run() { $loader = Autoloader::instance(); pc($loader, 'loader'); $ViewClass = $loader->view(); $view = new $ViewClass(); $view->render(); }
<?php /* * Lantern-CMS */ session_start(); define('LCMS_V', '0.0.1'); define('ABSPATH', __DIR__); define('PATH_VIEWS', ABSPATH . '/lantern/views'); define('PATH_PLUGINS', ABSPATH . '/lantern/plugins'); define('PATH_CACHE', ABSPATH . '/cache'); // Autoloaders include 'core/autoloader.php'; include 'vendor/autoload.php'; Autoloader::instance('Core', __DIR__)->register(); // register the core autoloader with spl Autoloader::instance('Lantern', __DIR__)->register(); // register the plugin autoloader with spl //include 'services.php'; $url = isset($_GET['url']) ? $_GET['url'] : '/'; $app = new Core\App(); $app->configure(parse_ini_file('config.ini')); $app->run($url);