public function registerClassLoader() { if (!interface_exists("ClassLoader", false)) { require \pocketmine\PATH . "src/spl/ClassLoader.php"; require \pocketmine\PATH . "src/spl/BaseClassLoader.php"; require \pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php"; } if ($this->classLoader !== null) { $this->classLoader->register(true); } }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('AutoloaderInit', 'loadClassLoader'), true, true); self::$loader = $loader = new ClassLoader(); spl_autoload_unregister(array('AutoloaderInit', 'loadClassLoader')); /* $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { $loader->set($namespace, $path); }*/ /* $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); }*/ $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { composerRequire($file); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('\\Composer\\Autoload\\Initializer', 'loadClassLoader'), true, true); self::$loader = $loader = new ClassLoader(); spl_autoload_unregister(array('\\Composer\\Autoload\\Initializer', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); $includeFiles = (require __DIR__ . '/autoload_files.php'); foreach ($includeFiles as $file) { require $file; } return $loader; }
public function testLoadClass() { $loader = new ClassLoader(); $loader->register(); $this->assertEquals(true, class_exists("Controller")); $this->assertEquals(false, class_exists("MyController")); }
/** * Makes autoloader. * * @return ClassLoader The class loader */ public static function make() { if (!static::$loader) { $loader = new ClassLoader(); $loader->register(); static::$loader = $loader; } return static::$loader; }
function init() { $loader = new ClassLoader(); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->add($namespace, $path); } $loader->register(); return $loader; }
public function __construct() { parent::__construct(); $this->import('Config'); // Load required translation-fields classes \ClassLoader::addNamespace('TranslationFields'); \ClassLoader::addClass('TranslationFields\\TranslationFieldsWidgetHelper', 'system/modules/translation-fields/classes/TranslationFieldsWidgetHelper.php'); \ClassLoader::addClass('TranslationFields\\TranslationFieldsModel', 'system/modules/translation-fields/models/TranslationFieldsModel.php'); \ClassLoader::register(); }
public function __construct() { parent::__construct(); // Disable debug mode $GLOBALS['TL_CONFIG']['debugMode'] = false; // Load required classes \ClassLoader::addNamespace('Craffft'); \ClassLoader::addClass('Craffft\\AccountMail\\Updater', 'system/modules/accountmail/library/Craffft/AccountMail/Updater.php'); \ClassLoader::register(); // Load updater $this->import('\\Craffft\\AccountMail\\Updater', 'Updater'); }
public function __construct() { parent::__construct(); // Disable debug mode $GLOBALS['TL_CONFIG']['debugMode'] = false; // Load required classes \ClassLoader::addNamespace('Photoalbums2'); \ClassLoader::addClass('Photoalbums2\\Updater', 'system/modules/photoalbums2/classes/Updater.php'); \ClassLoader::register(); // Load updater $this->import('\\Photoalbums2\\Updater', 'Updater'); }
/** * Constructs and returns the class loader. * * @param array $map Array containing path to each namespace. * * @return ClassLoader */ public static function getLoader(array $map) { if (null !== self::$loader) { return self::$loader; } self::$loader = $loader = new ClassLoader(); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $loader->register(true); return $loader; }
public function run() { error_reporting(-1); gc_enable(); //Load removed dependencies, can't use require_once() foreach ($this->loadPaths as $name => $path) { if (!class_exists($name, false) and !interface_exists($name, false)) { require $path; } } $this->loader->register(); $generationManager = new GenerationManager($this, $this->getLogger(), $this->loader); }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoLoaderInit', 'loadClassLoader'), true, true); self::$loader = $loader = new ClassLoader(); spl_autoload_unregister(array('ComposerAutoLoaderInit', 'loadClassLoader')); $class_map = (require dirname(__FILE__) . '/autoload_classmap.php'); if ($class_map) { $loader->addClassMap($class_map); } $loader->register(); return $loader; }
static function get_load() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('Composer_load', 'loadClassLoader'), true, true); self::$loader = $loader = new ClassLoader(); spl_autoload_unregister(array('Composer_load', 'loadClassLoader')); $map = (require COMPOSERDIR . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require COMPOSERDIR . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require COMPOSERDIR . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
<?php require 'core/ClassLoader()'; $loader = new ClassLoader(); $loader->registerDir(dirname(__FILE__) . '/core'); $loader->registerDir(dirname(__FILE__) . '/models'); $loader->register();
/** * Execute routes routes * * <code> * $m->lauch() * </code> * @access public * */ public function lauch() { // Use the Force... include LIBRARIES . '/Force/ClassLoader/ClassLoader.php'; // Map Classes ClassLoader::mapClasses(array('Spyc' => LIBRARIES . '/Spyc/Spyc.php', 'Arr' => LIBRARIES . '/Force/Arr/Arr.php', 'Session' => LIBRARIES . '/Force/Session/Session.php', 'Token' => LIBRARIES . '/Force/Token/Token.php', 'Request' => LIBRARIES . '/Force/Http/Request.php', 'Response' => LIBRARIES . '/Force/Http/Response.php', 'Url' => LIBRARIES . '/Force/Url/Url.php', 'File' => LIBRARIES . '/Force/FileSystem/File.php', 'Dir' => LIBRARIES . '/Force/FileSystem/Dir.php')); // Register the ClassLoader to the SPL autoload stack. ClassLoader::register(); // Load config file $this->loadConfig(); // Load language file $this->loadLanguage(); // Sanitize URL to prevent XSS - Cross-site scripting Url::runSanitizeURL(); // Send default header and set internal encoding header('Content-Type: text/html; charset=' . static::$site['charset']); function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding(static::$site['charset']); function_exists('mb_internal_encoding') and mb_internal_encoding(static::$site['charset']); // Gets the current configuration setting of magic_quotes_gpc and kill magic quotes if (get_magic_quotes_gpc()) { function stripslashesGPC(&$value) { $value = stripslashes($value); } array_walk_recursive($_GET, 'stripslashesGPC'); array_walk_recursive($_POST, 'stripslashesGPC'); array_walk_recursive($_COOKIE, 'stripslashesGPC'); array_walk_recursive($_REQUEST, 'stripslashesGPC'); } // Start the session Session::start(); $url = $_SERVER['REQUEST_URI']; $base = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); if (strpos($url, $base) === 0) { $url = substr($url, strlen($base)); } $url = trim($url, '/'); foreach ($this->routes as $pattern => $callback) { if (preg_match($pattern, $url, $params)) { array_shift($params); return call_user_func_array($callback, array_values($params)); } } }
/** * Constructor. * * @access protected */ protected function __construct() { // Use the Force... include LIBRARIES_PATH . '/Force/ClassLoader/ClassLoader.php'; // Map Classes ClassLoader::mapClasses(array('Spyc' => LIBRARIES_PATH . '/Spyc/Spyc.php', 'Arr' => LIBRARIES_PATH . '/Force/Arr/Arr.php', 'Session' => LIBRARIES_PATH . '/Force/Session/Session.php', 'Token' => LIBRARIES_PATH . '/Force/Token/Token.php', 'Request' => LIBRARIES_PATH . '/Force/Http/Request.php', 'Response' => LIBRARIES_PATH . '/Force/Http/Response.php', 'Url' => LIBRARIES_PATH . '/Force/Url/Url.php', 'File' => LIBRARIES_PATH . '/Force/FileSystem/File.php', 'Dir' => LIBRARIES_PATH . '/Force/FileSystem/Dir.php', 'Shortcode' => LIBRARIES_PATH . '/Force/Shortcode/Shortcode.php', 'Parsedown' => LIBRARIES_PATH . '/Parsedown/Parsedown.php', 'ParsedownExtra' => LIBRARIES_PATH . '/Parsedown/ParsedownExtra.php')); // Map Fenom Template Engine folder ClassLoader::directory(LIBRARIES_PATH . '/Fenom/'); // Register the ClassLoader to the SPL autoload stack. ClassLoader::register(); // Load config file static::loadConfig(); // Set default timezone @ini_set('date.timezone', static::$site['timezone']); if (function_exists('date_default_timezone_set')) { date_default_timezone_set(static::$site['timezone']); } else { putenv('TZ=' . static::$site['timezone']); } // Sanitize URL to prevent XSS - Cross-site scripting Url::runSanitizeURL(); // Send default header and set internal encoding header('Content-Type: text/html; charset=' . static::$site['charset']); function_exists('mb_language') and mb_language('uni'); function_exists('mb_regex_encoding') and mb_regex_encoding(static::$site['charset']); function_exists('mb_internal_encoding') and mb_internal_encoding(static::$site['charset']); // Gets the current configuration setting of magic_quotes_gpc and kill magic quotes if (get_magic_quotes_gpc()) { function stripslashesGPC(&$value) { $value = stripslashes($value); } array_walk_recursive($_GET, 'stripslashesGPC'); array_walk_recursive($_POST, 'stripslashesGPC'); array_walk_recursive($_COOKIE, 'stripslashesGPC'); array_walk_recursive($_REQUEST, 'stripslashesGPC'); } // Start the session Session::start(); // Load Plugins static::loadPlugins(); static::runAction('plugins_loaded'); // Get page for current requested url Morfy::$page = static::getPage(Url::getUriString()); // Load template static::runAction('before_render'); static::loadPageTemplate(Morfy::$page); static::runAction('after_render'); }
<?php ini_set('opcache.enable', 0); session_start(); require_once "classLoader.php"; require_once "constants.php"; $auto = new \ClassLoader(); $auto->register();
Log::configure('path', GELATO_LOGS_PATH); /** * Load Gelato Error Handler */ require_once __DIR__ . '/ErrorHandler/ErrorHandler.php'; /** * Set Error Handler */ set_error_handler('ErrorHandler::error'); /** * Set Fatal Error Handler */ register_shutdown_function('ErrorHandler::fatal'); /** * Set Exception Handler */ set_exception_handler('ErrorHandler::exception'); /** * Gelato Class Loader */ require_once __DIR__ . '/ClassLoader/ClassLoader.php'; /** * Map all Gelato Classes */ ClassLoader::mapClasses(array('Agent' => __DIR__ . '/Agent/Agent.php', 'Arr' => __DIR__ . '/Arr/Arr.php', 'Cache' => __DIR__ . '/Cache/Cache.php', 'Cookie' => __DIR__ . '/Cookie/Cookie.php', 'Curl' => __DIR__ . '/Curl/Curl.php', 'Date' => __DIR__ . '/Date/Date.php', 'Debug' => __DIR__ . '/Debug/Debug.php', 'File' => __DIR__ . '/FileSystem/File.php', 'Dir' => __DIR__ . '/FileSystem/Dir.php', 'Form' => __DIR__ . '/Form/Form.php', 'Html' => __DIR__ . '/Html/Html.php', 'Image' => __DIR__ . '/Image/Image.php', 'Inflector' => __DIR__ . '/Inflector/Inflector.php', 'MinifyCSS' => __DIR__ . '/Minify/MinifyCSS.php', 'MinifyHTML' => __DIR__ . '/Minify/MinifyHTML.php', 'MinifyJS' => __DIR__ . '/Minify/MinifyJS.php', 'Notification' => __DIR__ . '/Notification/Notification.php', 'Number' => __DIR__ . '/Number/Number.php', 'Registry' => __DIR__ . '/Registry/Registry.php', 'Request' => __DIR__ . '/Http/Request.php', 'Response' => __DIR__ . '/Http/Response.php', 'Token' => __DIR__ . '/Security/Token.php', 'Text' => __DIR__ . '/Text/Text.php', 'Session' => __DIR__ . '/Session/Session.php', 'Url' => __DIR__ . '/Url/Url.php', 'Valid' => __DIR__ . '/Validation/Valid.php', 'Zip' => __DIR__ . '/Zip/Zip.php')); /** * Register Gelato Class Loader */ if (GELATO_CLASS_LOADER) { ClassLoader::register(); }
private function __construct() { ClassLoader::register(); }
<?php /** * @file * Load php-taxcloud library. */ if (!class_exists('ClassLoader')) { require_once __DIR__ . '/Autoload.php'; } $classLoader = new ClassLoader(); $classLoader->registerNamespaces(array('TaxCloud' => array(__DIR__, __DIR__ . '/../tests'))); $classLoader->register();