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


PHP ClassLoader::addClassDirectory方法代码示例

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


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

示例1: realpath

<?php

error_reporting(-1);
date_default_timezone_set('UTC');
define('PATH_ROOT', realpath(dirname(__DIR__)));
define('PATH_SYSTEM', PATH_ROOT . '/vendor/wb-crowdfusion/crowdfusion/system');
if (!file_exists(PATH_ROOT . '/composer.lock')) {
    die("Dependencies must be installed using composer:\n\nphp composer.phar install\n\n" . "See http://getcomposer.org for help with installing composer\n");
}
include PATH_ROOT . '/vendor/autoload.php';
require PATH_SYSTEM . '/context/ApplicationContext.php';
$loader = new ClassLoader();
$loader->addDirectory(PATH_SYSTEM . '/core/classes/');
$loader->addClassDirectory(PATH_SYSTEM . '/../tests/');
开发者ID:wb-crowdfusion,项目名称:crowdfusion-active-edits,代码行数:14,代码来源:bootstrap.php

示例2: realpath

<?php

error_reporting(-1);
date_default_timezone_set('UTC');
define('PATH_ROOT', realpath(dirname(__DIR__)));
define('PATH_SYSTEM', PATH_ROOT . '/vendor/wb-crowdfusion/crowdfusion/system');
if (!file_exists(PATH_ROOT . '/composer.lock')) {
    die("Dependencies must be installed using composer:\n\nphp composer.phar install\n\n" . "See http://getcomposer.org for help with installing composer\n");
}
include PATH_ROOT . '/vendor/autoload.php';
require PATH_SYSTEM . '/context/ApplicationContext.php';
$loader = new ClassLoader();
$loader->addDirectory(PATH_SYSTEM . '/core/classes/');
$loader->addDirectory(PATH_ROOT . '/classes/');
$loader->addClassDirectory(PATH_ROOT . '/tests/');
开发者ID:wb-crowdfusion,项目名称:wb-lib,代码行数:15,代码来源:bootstrap.php

示例3: loadPluginDirectory

 protected function loadPluginDirectory(Configuration $configurationLoader, SplFileInfo $dir, $checkStatus = true)
 {
     $pluginName = $dir->getBasename();
     $realPath = $dir->getRealPath();
     if ($checkStatus) {
         // read .plugin file for plugin info
         $plugin = $this->getPluginStatus($pluginName);
         if (is_null($plugin) || $plugin['enabled'] !== true) {
             return null;
         }
         // no plugin file, plugin is not installed
         if ($plugin['priority'] > $this->lastPriority) {
             $this->lastPriority = $plugin['priority'];
         }
     } else {
         $plugin = array("enabled" => true, "priority" => ++$this->lastPriority);
     }
     $plugin = array_merge(array('directory' => $realPath), $plugin);
     // add classes to classpath
     ClassLoader::addDirectory($realPath, $this->autoloadExtension, $this->bypassDirectoriesForAutoload);
     // ADD PSR-0/PEAR Compliant Classes
     if (file_exists($realPath . DIRECTORY_SEPARATOR . 'autoload_psr-0.php')) {
         $psrDirectories = (include $realPath . DIRECTORY_SEPARATOR . 'autoload_psr-0.php');
         foreach ($psrDirectories as $psrDir) {
             ClassLoader::addClassDirectory($realPath . DIRECTORY_SEPARATOR . $psrDir);
         }
     }
     if (file_exists($realPath . DIRECTORY_SEPARATOR . 'autoload_pear.php')) {
         $pearDirectories = (include $realPath . DIRECTORY_SEPARATOR . 'autoload_pear.php');
         foreach ($pearDirectories as $pearPrefix => $pearDir) {
             ClassLoader::addClassDirectory($realPath . DIRECTORY_SEPARATOR . $pearDir, $this->autoloadExtension, false, $pearPrefix);
         }
     }
     $plugin['id'] = $pluginName;
     if (!empty($this->bootstrapFile) && file_exists($realPath . DIRECTORY_SEPARATOR . $this->bootstrapFile)) {
         $plugin['bootstrapped'] = true;
     }
     // locate plugin context
     if (!empty($this->pluginContextFile) && ($contextXML = $realPath . DIRECTORY_SEPARATOR . $this->pluginContextFile) && file_exists($contextXML)) {
         $plugin['context'] = $this->loadContextFile($configurationLoader, $contextXML);
     } else {
         if (file_exists($realPath . DIRECTORY_SEPARATOR . $this->sharedContextFile)) {
             $plugin['context'] = $this->loadContextFile($configurationLoader, $realPath . DIRECTORY_SEPARATOR . $this->sharedContextFile);
         }
     }
     return $plugin;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:47,代码来源:ApplicationContext.php


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