• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AutoLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了AutoLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: registerDirectory

 /**
  * Store the filename (sans extension) & full path of all ".php" files found
  */
 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') {
             // save the class name / path of a .php file found
             $className = toCamelCase(substr($file->getFilename(), 0, -4));
             AutoLoader::registerClass($className, $file->getPathname());
         }
     }
 }
开发者ID:szchkt,项目名称:leaklog-web,代码行数:17,代码来源:auto_loader.php


示例16: method_missing

 public function method_missing()
 {
     $as = AutoLoader::get_asset_server();
     if (!$this->filename) {
         $this->filename = array_pop($this->route_array);
     }
     $this->filename = substr($this->filename, 0, strrpos($this->filename, "."));
     if (!$this->type) {
         $this->type = $this->route_array[2];
     }
     $this->response->add_header("Content-Type", $as->mime($this->type));
     $this->hash = $this->route_array[1];
     $this->response->write($as->built_bundle($this->filename, $this->type, $this->hash));
 }
开发者ID:phpwax,项目名称:asset,代码行数:14,代码来源:BuildController.php


示例17: testAll

 public function testAll()
 {
     $defaults = array('AutoCoupon', 'TotalAction');
     $all = AutoLoader::ListModules('TotalAction', true);
     foreach ($defaults as $d) {
         $this->assertContains($d, $all);
     }
     foreach ($all as $class) {
         $obj = new $class();
         $this->assertInstanceOf('TotalAction', $obj, $class . ' is not a TotalAction');
         $result = $obj->apply();
         $this->assertInternalType('boolean', $result, $class . ' apply() does not return boolean');
     }
 }
开发者ID:phpsmith,项目名称:IS4C,代码行数:14,代码来源:TotalActionsTest.php


示例18: testExpireCache

 public function testExpireCache()
 {
     $cache = file_get_contents(AutoLoader::instance()->getCacheLocation());
     $this->assertGreaterThan(0, strlen($cache));
     AutoLoader::instance()->expireCache();
     try {
         if (!($cache = file_get_contents(AutoLoader::instance()->getCacheLocation()))) {
             $this->assertTrue(true);
         } else {
             $this->assertTrue(false);
         }
     } catch (Exception $ex) {
         $this->assertTrue(true);
     }
 }
开发者ID:h1ppo,项目名称:Class-Map-Autoloader-for-PHP,代码行数:15,代码来源:AutoLoaderTest.php


示例19: registerDirectory

 /**
  * Store the filename (sans extension) & full path of all ".php" files found
  */
 public static function registerDirectory($dirName, $namespace = '')
 {
     $di = new DirectoryIterator($dirName);
     foreach ($di as $file) {
         /** @var DirectoryIterator $file */
         if ($file->isDir() && !$file->isLink() && !$file->isDot()) {
             // recurse into directories other than a few special ones
             self::registerDirectory($file->getPathname(), (empty($namespace) ? '' : $namespace . '\\') . $file->getBasename());
         } elseif (substr($file->getFilename(), -4) === '.php') {
             // save the class name / path of a .php file found
             $className = substr($file->getFilename(), 0, -4);
             AutoLoader::registerClass($className, $file->getPathname(), $namespace);
         }
     }
 }
开发者ID:okanjo,项目名称:taxjar,代码行数:18,代码来源:bootstrap.php


示例20: registerDirectory

 public static function registerDirectory($dirName, $mainDir = '')
 {
     $di = new \DirectoryIterator($dirName);
     if (empty($mainDir)) {
         $mainDir = $dirName;
     }
     foreach ($di as $file) {
         if ($file->isDir() && !$file->isLink() && !$file->isDot()) {
             self::registerDirectory($file->getPathname(), $mainDir);
         } elseif (substr($file->getFilename(), -4) === '.php') {
             $namespace = 'Mautic' . str_replace('/', '\\', substr(str_replace($mainDir, '', $file->getPathname()), 0, -4));
             AutoLoader::registerClass($namespace, $file->getPathname());
         }
     }
 }
开发者ID:JamilHossain,项目名称:mautic-joomla,代码行数:15,代码来源:AutoLoader.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Autoload类代码示例发布时间:2022-05-23
下一篇:
PHP Authorizer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap