当前位置: 首页>>代码示例>>PHP>>正文


PHP AutoLoader类代码示例

本文整理汇总了PHP中AutoLoader的典型用法代码示例。如果您正苦于以下问题:PHP AutoLoader类的具体用法?PHP AutoLoader怎么用?PHP AutoLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AutoLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startAutoLoader

 private function startAutoLoader()
 {
     require_once 'AutoLoader.php';
     $auto_loader = new AutoLoader();
     $auto_loader->addNamespace('sweb', $this->sWebPath);
     $auto_loader->addNamespace($this->pageNS, $this->pagePath);
     $auto_loader->register();
 }
开发者ID:sebastian-heinz,项目名称:SuperWeb,代码行数:8,代码来源:Config.php

示例2: createInstance

 public static function createInstance()
 {
     if (self::$autoLoader === null) {
         self::$autoLoader = new AutoLoader();
     }
     return self::$autoLoader;
 }
开发者ID:nemes-zoltan,项目名称:website,代码行数:7,代码来源:AutoLoader.php

示例3: instance

 /**
  * Returns the instance of the AutoLoader Singleton or instantiates a new one
  * @return AutoLoader
  */
 public static function instance($rootDirectory = null, $reloadClassMap = true, $fileExt = null)
 {
     if (self::$instance == null) {
         self::$instance = new AutoLoader($rootDirectory, $reloadClassMap, $fileExt);
     }
     return self::$instance;
 }
开发者ID:h1ppo,项目名称:Class-Map-Autoloader-for-PHP,代码行数:11,代码来源:AutoLoader.php

示例4: createInstance

 public static function createInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new AutoLoader();
     }
     return self::$instance;
 }
开发者ID:vampirefrog,项目名称:frogmod-justice,代码行数:7,代码来源:AutoLoader.php

示例5: constructor

 /**
  * @see IController::constructor()
  */
 public function constructor()
 {
     // Link loader to controller
     // and the controller instance to itself
     $this->load = Loader::$instance;
     self::$instance =& $this;
     // Method and argument back references.
     if (isset($_GET["m"])) {
         $m = filter_var($_GET["m"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     }
     if (isset($_GET["a"])) {
         $a = filter_var($_GET["a"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     }
     if (isset($m)) {
         $this->method = $m;
     }
     if (isset($a)) {
         $this->arg = $a;
     }
     AutoLoader::getInstance();
     /*
      * Changing the working directory to "application"
      * since we don't really need anything from the system folder.
      */
     chdir("application");
 }
开发者ID:kveler,项目名称:webchat,代码行数:29,代码来源:emmacontroller.php

示例6: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new AutoLoader();
     }
     return self::$instance;
 }
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:7,代码来源:AutoLoader.php

示例7: Factory

 public static function Factory($default_page = null, $requireLogin = true)
 {
     $prefs = UserPreferences::Instance(EGS_USERNAME);
     $default_page = $prefs->getPreferenceValue('default_page', 'shared');
     if ($default_page == null) {
         $ao = AccessObject::Instance();
         $default_page = 'module,' . $ao->getDefaultModule();
     }
     if (get_config('SETUP')) {
         if (defined('MODULE')) {
             $default_page = MODULE;
         }
     }
     $router = RouteParser::Instance();
     $modules = array();
     if (!$requireLogin || isLoggedIn()) {
         foreach ($router->getDispatch() as $key => $dispatch) {
             if (($key == 'group' || $key == 'module' || strstr($key, 'submodule')) && !empty($dispatch)) {
                 $modules[$key] = $dispatch;
             }
         }
         if (empty($modules)) {
             // Default page contains permission type and permission name
             // i.e. type is group or module
             $array = explode(',', $default_page);
             $modules[$array[0]] = $array[1];
         }
     } else {
         $modules['module'] = 'login';
     }
     $al =& AutoLoader::Instance();
     return $modules;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:ModuleFactory.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     // Fancy dance to trigger a rebuild of AutoLoader::$autoloadLocalClassesLower
     $this->mergeMwGlobalArrayValue('wgAutoloadLocalClasses', ['TestAutoloadedLocalClass' => __DIR__ . '/../data/autoloader/TestAutoloadedLocalClass.php', 'TestAutoloadedCamlClass' => __DIR__ . '/../data/autoloader/TestAutoloadedCamlClass.php', 'TestAutoloadedSerializedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedSerializedClass.php']);
     AutoLoader::resetAutoloadLocalClassesLower();
     $this->mergeMwGlobalArrayValue('wgAutoloadClasses', ['TestAutoloadedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedClass.php']);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:AutoLoaderTest.php

示例9: getInstance

 /**
  * 获得实例的方法
  * @return AutoLoader AutoLoader的实例
  * @author winsen
  */
 public static function getInstance()
 {
     if (is_null(self::$obj)) {
         $class = __CLASS__;
         self::$obj = new $class();
     }
     return self::$obj;
 }
开发者ID:Winsen1990,项目名称:monolith,代码行数:13,代码来源:AutoLoader.class.php

示例10: self

 /**
  * @return AutoLoader
  */
 public static function &getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
         self::$_instance->initialize();
         return self::$_instance;
     } else {
         return self::$_instance;
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-flickr_.idea_.name,代码行数:13,代码来源:flickr_web_app_classes_AutoLoader.php

示例11: setUp

 protected function setUp()
 {
     global $wgAutoloadLocalClasses, $wgAutoloadClasses;
     parent::setUp();
     // Fancy dance to trigger a rebuild of AutoLoader::$autoloadLocalClassesLower
     $this->testLocalClasses = array('TestAutoloadedLocalClass' => __DIR__ . '/../data/autoloader/TestAutoloadedLocalClass.php', 'TestAutoloadedCamlClass' => __DIR__ . '/../data/autoloader/TestAutoloadedCamlClass.php', 'TestAutoloadedSerializedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedSerializedClass.php');
     $this->setMwGlobals('wgAutoloadLocalClasses', $this->testLocalClasses + $wgAutoloadLocalClasses);
     AutoLoader::resetAutoloadLocalClassesLower();
     $this->testExtensionClasses = array('TestAutoloadedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedClass.php');
     $this->setMwGlobals('wgAutoloadClasses', $this->testExtensionClasses + $wgAutoloadClasses);
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:11,代码来源:AutoLoaderTest.php

示例12: testRegisterUnregister

 /**
  *  make sure autoload registers and unregisters correctly
  */
 public function testRegisterUnregister()
 {
     $al_orig_count = count(spl_autoload_functions());
     $al = new AutoLoader();
     $al->register();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count + 1, $al_count);
     $al->unregister();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count, $al_count);
     $al->register();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count + 1, $al_count);
     $al_map = array();
     $al_map[0] = $al;
     $al_map[0]->unregister();
     $al_count = count(spl_autoload_functions());
     $this->assertSame($al_orig_count, $al_count);
     ///\out::e(spl_autoload_functions());
 }
开发者ID:Jaymon,项目名称:Montage,代码行数:23,代码来源:AutoLoadTest.php

示例13: feng__autoload

/**
 * Gets called, when an undefined class is being instanciated
 *d
 * @param_string $load_class_name
 */
function feng__autoload($load_class_name)
{
    static $loader = null;
    $class_name = strtoupper($load_class_name);
    // Try to get this data from index...
    if (isset($GLOBALS[AutoLoader::GLOBAL_VAR])) {
        if (isset($GLOBALS[AutoLoader::GLOBAL_VAR][$class_name])) {
            return include $GLOBALS[AutoLoader::GLOBAL_VAR][$class_name];
        }
        // if
    }
    // if
    if (!$loader) {
        $loader = new AutoLoader();
        $loader->addDir(ROOT . '/application');
        $loader->addDir(ROOT . '/environment');
        $loader->addDir(ROOT . '/library');
        $loader->setIndexFilename(ROOT . '/cache/autoloader.php');
    }
    // if
    try {
        $loader->loadClass($class_name);
    } catch (Exception $e) {
        try {
            if (function_exists("__autoload")) {
                __autoload($class_name);
            }
        } catch (Exception $ex) {
            die('Caught Exception in AutoLoader: ' . $ex->__toString());
        }
    }
    // try
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:38,代码来源:functions.php

示例14: registerDirectory

 public static function registerDirectory($dirName)
 {
     $di = new DirectoryIterator($dirName);
     foreach ($di as $file) {
         if ($file->isDir() && !$file->isLink() && !$file->isDot()) {
             // recurse into directories other than a few special ones
             self::registerDirectory($file->getPathname());
         } elseif (substr($file->getFilename(), -4) === '.php') {
             $className = self::getFullNamespacedName($file->getPathName());
             AutoLoader::registerClass($className, $file->getPathname());
         }
     }
 }
开发者ID:cjsissingh,项目名称:calendar-bundle,代码行数:13,代码来源:AutoLoader.php

示例15: load_classes

 protected static function load_classes()
 {
     $store_key = array(__DIR__, '__autoload');
     if (Store::has($store_key)) {
         $classes = Store::get($store_key);
     } else {
         $classes = array();
         $modules = array();
         $dir = path('libs');
         $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
         $pattern = '/^' . preg_quote($dir, '/') . '\\/(.+?)\\.php$/';
         foreach ($itr as $elem) {
             if ($elem->isFile() && preg_match($pattern, $elem->getPathname(), $match)) {
                 $class_name = $elem->getBasename('.php');
                 if ($class_name == basename($elem->getPath())) {
                     $modules[$class_name] = str_replace('/', '.', substr($elem->getPath(), strlen($dir) + 1));
                 } else {
                     if ($class_name !== __CLASS__) {
                         $classes[$class_name] = str_replace('/', '.', $match[1]);
                     }
                 }
             }
         }
         foreach ($modules as $module_name => $module_path) {
             foreach ($classes as $class_name => $class_path) {
                 if (strpos($class_path, $module_path) === 0) {
                     unset($classes[$class_name]);
                 }
             }
         }
         $classes = $modules + $classes;
         Store::set($store_key, $classes);
     }
     self::$classes = $classes;
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:35,代码来源:AutoLoader.php


注:本文中的AutoLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。