public static function getInstance() { if (is_null(self::$instance)) { self::$instance = new ClassLoader(); } return self::$instance; }
/** * 获取类的单一实例 * * @return static */ public static function getInstance() { if (!is_object(self::$instance)) { self::$instance = new static(); } return self::$instance; }
public static function instance() { if (!self::$instance) { self::$instance = new ClassLoader(); } return self::$instance; }
/** * * @return ClassLoader */ public static function getInstance() { if (self::$instance == null) { self::$instance = new self(); } return self::$instance; }
public static function startup(){ self::$instance = new ClassLoader(); // --- Contrib Namespaced Classes/Libs /*self::$instance->registerNamespaces(array( 'Symfony' => LIB_ROOT . '/vendor', 'Dreamblaze' => LIB_ROOT . '/vendor', 'RisingGods' => LIB_ROOT . '/vendor' ));*/ // --- Contrib Prefixed Classes/Libs self::$instance->registerPrefixes(array( 'Twig_' => LIB_ROOT . '/vendor', 'FB' => LIB_ROOT . '/FirePHPCore', )); self::$instance->registerNamespaceFallbacks(array( LIB_ROOT . '/vendor' )); self::$instance->registerPrefixFallbacks(array( APP_ROOT . '/controllers', APP_ROOT . '/models', APP_ROOT . '/viewextentions', )); self::$instance->register(); }
private function get_layout_cache_key() { if ($this->layout_cache_key != null) { return $this->layout_cache_key; } $layout_class_source = ClassLoader::instance()->get_element_content_by_name(get_class($this)); $f = new File("/" . $this->layout_path); $layout_file_path = $f->getPath(); $layout_file_size = $f->getSize(); $layout_modification_time = $f->getModificationTime(); $this->layout_cache_key = md5($layout_class_source . $layout_file_path . $layout_file_size . $layout_modification_time); return $this->layout_cache_key; }
private function __construct() { $this->controllers = array(); $class_keys = ClassLoader::instance()->get_element_keys(); foreach ($class_keys as $key) { if (self::is_controller_class($key)) { $controller_name = self::get_controller_name_from_class($key); if ($controller_name == "abstract" || $controller_name == "i") { continue; } $this->controllers[$controller_name] = $key; } } }
private static function init() { self::$instance = new ClassLoader(self::CLASS_FILENAME_SUFFIX, true, false); self::$instance->autoconfigure(); }
case E_USER_WARNING: echo "<b>My WARNING</b> [{$errNo}] {$errStr}<br />\n"; break; case E_USER_NOTICE: echo "<b>My NOTICE</b> [{$errNo}] {$errStr}<br />\n"; break; default: echo "Unknown error type: [{$errNo}] {$errStr}<br>{$errFile} Line {$errLine}<br />\n"; break; } /* Don't execute PHP internal error handler */ return true; }); if (file_exists(BASE_PATH . '/vendor/autoload.php')) { require_once BASE_PATH . '/vendor/autoload.php'; } else { user_error('It doesnt look like you\'ve done a composer update.', E_USER_WARNING); } require_once 'utils/ClassLoader.php'; require_once 'utils/Object.php'; require_once 'utils/TokenisedRegularExpression.php'; require_once 'utils/Manifest.php'; require_once 'utils/ClassManifest.php'; require_once 'utils/ConfigManifest.php'; if (Manifest::make_manifest()) { Manifest::reload_manifest(); } $loader = ClassLoader::instance(); $loader->registerAutoLoader(); DB::init(); Router::route();