當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。