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


PHP Zend_Loader_PluginLoader::load方法代码示例

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


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

示例1: _initPlugins

 protected function _initPlugins()
 {
     $this->bootstrap('frontController');
     $pluginsLoader = new Zend_Loader_PluginLoader();
     $pluginsLoader->addPrefixPath('Plugin', $this->getResourceLoader()->getBasePath() . '/plugins');
     $pluginsLoader->load("LayoutLoader");
     $pluginsLoader->load("AclUtils");
     if ($pluginsLoader->isLoaded('LayoutLoader')) {
         Zend_Controller_Front::getInstance()->registerPlugin(new Plugin_LayoutLoader());
     }
 }
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:11,代码来源:Bootstrap.php

示例2: _initPlugins

 protected function _initPlugins()
 {
     $this->bootstrap('frontController');
     $pluginsLoader = new Zend_Loader_PluginLoader();
     $pluginsLoader->addPrefixPath("Plugin", APPLICATION_PATH . '/plugins');
     $pluginsLoader->load("Layout");
     if ($pluginsLoader->isLoaded("Layout")) {
         $front = Zend_Controller_Front::getInstance()->registerPlugin(new Plugin_Layout());
     }
     $pluginsLoader->load("Acl");
     if ($pluginsLoader->isLoaded("Acl")) {
         $front = Zend_Controller_Front::getInstance()->registerPlugin(new Plugin_Acl());
     }
 }
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:14,代码来源:Bootstrap.php

示例3: __construct

 /**
  * 构造函数
  * 
  * @param string $backend
  * @param string $frontend
  * @throws ZtChart_Model_Assemble_Exception
  */
 public function __construct($backend, $frontend = 'PHPArray')
 {
     $loader = new Zend_Loader_PluginLoader(array('ZtChart_Model_Assemble_Backend_' => realpath(__DIR__ . '/Assemble/Backend'), 'ZtChart_Model_Assemble_Frontend_' => realpath(__DIR__ . '/Assemble/Frontend')));
     $backendName = is_array($backend) ? key($backend) : $backend;
     if (false === ($backendClass = $loader->load($backendName, false))) {
         throw new ZtChart_Model_Assemble_Exception("Specified backend class '{$backendName}' could not be found");
     }
     $this->_backend = new $backendClass($backend);
     $frontendName = is_array($frontend) ? key($frontend) : $frontend;
     if (false === ($frontendClass = $loader->load($frontendName, false))) {
         throw new ZtChart_Model_Assemble_Exception("Specified frontend class '{$frontendName}' could not be found");
     }
     $this->_frontend = new $frontendClass($frontend);
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:21,代码来源:Assemble.php

示例4: _loadAclClasses

 /**
  * Load ACL classes from Brightfame Framework
  *
  * @return void
  */
 protected function _loadAclClasses()
 {
     $loader = new Zend_Loader_PluginLoader(array('Brightfame_Acl_Role' => APPLICATION_PATH . '/../library/Brightfame/Acl/Role/'));
     foreach (array('Guest', 'Member', 'Administrator') as $role) {
         $loader->load($role);
     }
 }
开发者ID:robsta,项目名称:brightfamecms,代码行数:12,代码来源:Auth.php

示例5: loadForm

 /**
  * Load a form with the provided options.
  *
  * @param string            $name    The name of the form to be loaded
  * @param array|Zend_Config $options Options to be passed to the form
  *                                   constructor.
  *
  * @return Zend_Form
  */
 public function loadForm($name, $options = null)
 {
     $module = $this->getRequest()->getModuleName();
     $front = $this->getFrontController();
     $default = $front->getDispatcher()->getDefaultModule();
     if (empty($module)) {
         $module = $default;
     }
     $moduleDirectory = $front->getControllerDirectory($module);
     $formsDirectory = dirname($moduleDirectory) . '/forms';
     $prefix = ('default' == $module ? '' : ucfirst($module) . '_') . 'Form_';
     $this->pluginLoader->addPrefixPath($prefix, $formsDirectory);
     $name = ucfirst((string) $name);
     $formClass = $this->pluginLoader->load($name);
     return new $formClass($options);
 }
开发者ID:louiesabado,项目名称:simple-php-contact-form,代码行数:25,代码来源:FormLoader.php

示例6: __construct

 /**
  * 构造函数
  * 
  * @param string $daemon
  * @param array|Zend_Config $config
  * @param ZtChart_Model_Monitor_Console $console
  */
 public function __construct($daemon, $config = array(), ZtChart_Model_Monitor_Console $console = null)
 {
     if ($config instanceof Zend_Config) {
         $config = $config->toArray();
     }
     if (null === $console) {
         $console = ZtChart_Model_Monitor_Console::getInstance();
     }
     $loader = new Zend_Loader_PluginLoader(array('ZtChart_Model_Monitor_Daemon' => realpath(__DIR__ . '/Monitor/Daemon')));
     if (false === ($daemonClass = $loader->load($daemon, false))) {
         throw new ZtChart_Model_Monitor_Exception("Specified daemon class '{$daemon}' could not be found.");
     } else {
         if (!is_subclass_of($daemonClass, 'ZtChart_Model_Monitor_Daemon_Abstract')) {
             throw new ZtChart_Model_Monitor_Exception("Specified daemon class '{$daemon}' is illegal.");
         } else {
             $this->_daemon = new $daemonClass($console, $config);
         }
     }
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:26,代码来源:Monitor.php

示例7: loadValidator

 /**
  * Lazy-load a validator
  *
  * @param  array $validator Validator definition
  * @return Zend_Validate_Interface
  * @see Zend_Form_Element::loadValidator() (function from Zend_Form_Element borrowed and modified)
  */
 protected function loadValidator(array $validator)
 {
     $origName = $validator['name'];
     $name = $this->pluginLoader->load($validator['name']);
     if (array_key_exists($name, $this->validators)) {
         throw new Webdesktop_Model_Exception(sprintf('Validator instance already exists for validator "%s"', $origName));
     }
     if (empty($validator['options'])) {
         $instance = new $name();
     } else {
         $r = new ReflectionClass($name);
         if ($r->hasMethod('__construct')) {
             $instance = $r->newInstanceArgs((array) $validator['options']);
         } else {
             $instance = $r->newInstance();
         }
     }
     $this->validators[$origName] = $instance;
     return $instance;
 }
开发者ID:kevindragon221,项目名称:Webdesktop,代码行数:27,代码来源:Ajax.php

示例8: getManipulatorInstance

 /**
  * Returns an manipulator instance based on its name.
  *
  * @param string $manipulator
  * @return Gem_Manipulator_Adapter_Interface
  */
 public static function getManipulatorInstance($manipulator)
 {
     $args = array();
     if (is_array($manipulator)) {
         $args = $manipulator;
         $manipulator = array_shift($args);
     }
     // TODO: Move to allow other plugins...
     $loader = new Zend_Loader_PluginLoader();
     $loader->addPrefixPath('Yag_Manipulator_Adapter', 'Yag/Manipulator/Adapter/');
     $className = $loader->load($manipulator);
     $class = new ReflectionClass($className);
     if (!$class->implementsInterface('Yag_Manipulator_Adapter_Interface')) {
         require_once 'Yag/Manipulator/Exception.php';
         throw new Gem_Manipulator_Exception('Manipulator must implement interface "Yag_Manipulator_Adapter_Interface".');
     }
     if ($class->hasMethod('__construct')) {
         $object = $class->newInstanceArgs($args);
     } else {
         $object = $class->newInstance();
     }
     return $object;
 }
开发者ID:johannilsson,项目名称:yag,代码行数:29,代码来源:Manipulator.php

示例9: setupPlugins

 /**
  * It loads plugins.
  * @param Zend_Config $method
  */
 protected function setupPlugins($method)
 {
     if (empty($this->_loadedPlugins) && !empty($this->_plugins)) {
         foreach ($this->_plugins as $pluginName => $options) {
             try {
                 $classname = $this->_pluginLoader->load($pluginName);
                 $r = new ReflectionClass($classname);
                 if ($r->isSubclassOf('App_Rest_Plugin_Abstract')) {
                     $this->_loadedPlugins[$pluginName] = new $classname($this, $method, $options);
                 } else {
                     unset($this->_plugins[$pluginName]);
                     $this->log(sprintf("Loading plugin %s.Class %s is not a App_Rest_Plugin_Abstract descendent", $pluginName, $classname), Zend_Log::CRIT);
                 }
             } catch (Zend_Loader_PluginLoader_Exception $e) {
                 $this->log($e->getMessage(), Zend_Log::CRIT);
             }
         }
     } else {
         foreach ($this->_loadedPlugins as $plugin) {
             $plugin->setRestMethod($method);
         }
     }
     return $this;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:28,代码来源:Service.php

示例10: testClassFilesAreSearchedInLifoOrder

 public function testClassFilesAreSearchedInLifoOrder()
 {
     $loader = new Zend_Loader_PluginLoader(array());
     $loader->addPrefixPath('Zend_View_Helper', $this->libPath . '/Zend/View/Helper');
     $loader->addPrefixPath('ZfTest', dirname(__FILE__) . '/_files/ZfTest');
     try {
         $className = $loader->load('FormSubmit');
     } catch (Exception $e) {
         $paths = $loader->getPaths();
         $this->fail(sprintf("Failed loading helper; paths: %s", var_export($paths, 1)));
     }
     $this->assertEquals($className, $loader->getClassName('FormSubmit'));
     $this->assertEquals('ZfTest_FormSubmit', $loader->getClassName('FormSubmit'));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:PluginLoaderTest.php

示例11: factory

 /**
  * 工厂方法,返回指定游戏的在线人数日志数据表对象
  * 
  * @param integer $gameType
  * @param string $datetime
  * @param mixed $config
  * @return ZtChart_Model_DbTable_Infoserver
  */
 public static function factory($gameType, $datetime = null, $config = array())
 {
     $loader = new Zend_Loader_PluginLoader(array(__CLASS__ => realpath(__DIR__ . '/Infoserver')));
     if (false !== ($class = $loader->load(ZtChart_Model_GameType::getShortName($gameType), false))) {
         $infoserver = new $class($gameType, $datetime, $config);
     } else {
         $infoserver = new self($gameType, $datetime, $config);
     }
     return $infoserver;
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:18,代码来源:Infoserver.php

示例12: testPrefixesEndingInBackslashDenoteNamespacedClasses

 /**
  * @group ZF-7350
  */
 public function testPrefixesEndingInBackslashDenoteNamespacedClasses()
 {
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         $this->markTestSkipped(__CLASS__ . '::' . __METHOD__ . ' requires PHP 5.3.0 or greater');
         return;
     }
     $loader = new Zend_Loader_PluginLoader(array());
     $loader->addPrefixPath('Zfns\\', dirname(__FILE__) . '/_files/Zfns');
     try {
         $className = $loader->load('Foo');
     } catch (Exception $e) {
         $paths = $loader->getPaths();
         $this->fail(sprintf("Failed loading helper; paths: %s", var_export($paths, 1)));
     }
     $this->assertEquals('Zfns\\Foo', $className);
     $this->assertEquals('Zfns\\Foo', $loader->getClassName('Foo'));
 }
开发者ID:omusico,项目名称:logica,代码行数:20,代码来源:PluginLoaderTest.php

示例13: _getAdapter

 /**
  * 取得Auth适配器
  * 
  * @param string $adapter
  * @return Zend_Auth_Adapter_Interface
  */
 protected function _getAdapter($adapter = null)
 {
     if (empty($adapter)) {
         $adapter = $this->_adapter;
     }
     $pluginLoader = new Zend_Loader_PluginLoader(array('ZtChart_Model_Auth_Adapter_' => realpath(__DIR__ . '/../models/Auth/Adapter'), 'Zend_Auth_Adapter_' => 'Zend/Auth/Adapter'));
     if (false === ($adapterClass = $pluginLoader->load($adapter, false))) {
         throw new Zend_Application_Resource_Exception("Specified Auth Adapter '{$adapter}' could not be found");
     }
     return new $adapterClass();
 }
开发者ID:starflash,项目名称:ZtChart-ZF1-Example,代码行数:17,代码来源:Auth.php

示例14: _initPlugins

 /**
  * init additional plugins
  *
  * @return void
  */
 protected function _initPlugins()
 {
     // get front controller instance
     $front = Zend_Controller_Front::getInstance();
     // create loader
     $loader = new Zend_Loader_PluginLoader();
     $loader->addPrefixPath('Plugin', Zend_Registry::get('config')->resources->frontController->pluginsDirectory);
     $pluginAuthentication = $loader->load('Authentication');
     // register plugin
     $front->registerPlugin(new $pluginAuthentication());
 }
开发者ID:google-code-backups,项目名称:rsslounge,代码行数:16,代码来源:Bootstrap.php

示例15: testWin32UnderscoreSpacedShortNamesWillLoad

 /**
  * @issue ZF-2741
  */
 public function testWin32UnderscoreSpacedShortNamesWillLoad()
 {
     $loader = new Zend_Loader_PluginLoader(array());
     $loader->addPrefixPath('Zend_Filter', $this->libPath . '/Zend/Filter');
     try {
         // Plugin loader will attempt to load "c:\path\to\library/Zend/Filter/Word\UnderscoreToDash.php"
         $className = $loader->load('Word_UnderscoreToDash');
     } catch (Exception $e) {
         $paths = $loader->getPaths();
         $this->fail(sprintf("Failed loading helper; paths: %s", var_export($paths, 1)));
     }
     $this->assertEquals($className, $loader->getClassName('Word_UnderscoreToDash'));
 }
开发者ID:lortnus,项目名称:zf1,代码行数:16,代码来源:PluginLoaderTest.php


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