本文整理汇总了PHP中Zend_Loader_PluginLoader::addPrefixPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader_PluginLoader::addPrefixPath方法的具体用法?PHP Zend_Loader_PluginLoader::addPrefixPath怎么用?PHP Zend_Loader_PluginLoader::addPrefixPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader_PluginLoader
的用法示例。
在下文中一共展示了Zend_Loader_PluginLoader::addPrefixPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoader
public function getLoader()
{
if ($this->_loader == null) {
$this->_loader = new Zend_Loader_PluginLoader();
$this->_loader->addPrefixPath('Bc_Annotations', 'Bc/Annotations');
}
return $this->_loader;
}
示例2: getPluginLoader
/**
* Get plugin loader
*
* @return Zend_Loader_PluginLoader
*/
public function getPluginLoader()
{
if (null === $this->_loader) {
$this->_loader = new Zend_Loader_PluginLoader();
$this->_loader->addPrefixPath('Model_Table', dirname(__FILE__) . '/Table/');
}
return $this->_loader;
}
示例3: addPrefixToPaths
public function addPrefixToPaths($prefix, $path = null)
{
if (is_array($prefix)) {
$prefixToPaths = $prefix;
} else {
$prefixToPaths = array($prefix => $path);
}
foreach ($prefixToPaths as $prefix => $path) {
$this->_pluginLoader->addPrefixPath($prefix, $path);
}
return $this;
}
示例4: _initPlugins
protected function _initPlugins()
{
$this->bootstrap('frontController');
$pluginsLoader = new Zend_Loader_PluginLoader();
$pluginsLoader->addPrefixPath('Plugin', $this->getResourceLoader()->getBasePath() . '/plugins');
$pluginsLoader->load("AclAdmin");
//$pluginsLoader->load("SessionAdmin");
//$pluginsLoader->load("Acl");
$pluginsLoader->addPrefixPath('Plugin', APPLICATION_PATH . '/plugins');
$pluginsLoader->load("LayoutLoader");
if ($pluginsLoader->isLoaded('LayoutLoader')) {
Zend_Controller_Front::getInstance()->registerPlugin(new Plugin_LayoutLoader());
}
}
示例5: init
public function init()
{
$registry = Zend_Registry::getInstance();
$config = $registry->get("config");
$sysCache = $registry->get("sysCache");
$cacheFiles = new Ml_Cache_Files($sysCache);
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
$frontController = $this->getBootstrap()->getResource('FrontController');
$dispatcher = $frontController->getDispatcher();
$request = $frontController->getRequest();
$router = $frontController->getRouter();
$router->removeDefaultRoutes();
//@todo remove this patched route module and use the original instead ASAP
$compat = new Ml_Controller_Router_Route_Module(array(), $dispatcher, $request);
$router->addRoute("default", $compat);
$routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
$router->addConfig($routerConfig, "routes");
$frontController->registerPlugin(new Ml_Plugins_ReservedUsernames());
Zend_Controller_Action_HelperBroker::getStaticHelper("Redirector")->setPrependBase(false);
$frontController->setBaseUrl($config['webroot']);
$loader = new Zend_Loader_PluginLoader();
$loader->addPrefixPath('Zend_View_Helper', EXTERNAL_LIBRARY_PATH . '/Zend/View/Helper/')->addPrefixPath('Ml_View_Helper', APPLICATION_PATH . '/views/helpers');
$classFileIncCache = CACHE_PATH . '/PluginDefaultLoaderCache.php';
if (file_exists($classFileIncCache)) {
require $classFileIncCache;
}
Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->initView();
}
示例6: 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);
}
示例7: setOptions
/**
* Options setter.
* @param array|Zend_Config $options
*/
public function setOptions($options)
{
if ($options instanceof Zend_Config) {
$options = $options->toArray();
}
if (is_array($options)) {
if (isset($options['restApi']) && !$options['restApi'] instanceof Zend_Config) {
$options['restApi'] = new Zend_Config($options['restApi']);
}
if (isset($options['pluginPath']) && is_array($options['pluginPath'])) {
foreach ($options['pluginPath'] as $key => $pluginPathData) {
if (is_array($pluginPathData) && isset($pluginPathData['path']) && isset($pluginPathData['prefix'])) {
$this->_pluginLoader->addPrefixPath($pluginPathData['prefix'], $pluginPathData['path']);
}
}
unset($options['pluginPath']);
}
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (method_exists($this, $method)) {
$this->{$method}($value);
} else {
$this->log(sprintf("No set method for option %s.", $key), Zend_Log::WARN);
}
}
}
return $this;
}
示例8: getTableLoader
/**
* Returns the table loader for this instance.
* @return Zend_Loader_PluginLoader
*/
protected function getTableLoader()
{
if (!isset($this->_tableLoader)) {
$this->_tableLoader = new Zend_Loader_PluginLoader();
$this->_tableLoader->addPrefixPath('Hmd_Db_Model_Table', 'Hmd/Db/Model/Table');
}
return $this->_tableLoader;
}
示例9: _initPlugins
/**
* Load system module plugins
*/
public function _initPlugins()
{
$loader = new Zend_Loader_PluginLoader();
$loader->addPrefixPath('System_Plugin', 'application/modules/system/plugins/');
$this->bootstrap('frontController');
$front = $this->getResource('frontController');
$front->registerPlugin(new System_Plugin_Router());
}
示例10: getPluginLoader
/**
* Get plugin loader
*
* @return Zend_Loader_PluginLoader_Interface
*/
public static function getPluginLoader()
{
if (self::$pluginLoader == null) {
$pluginLoader = new Zend_Loader_PluginLoader();
$pluginLoader->addPrefixPath(__CLASS__, 'System/Serializer/Dom');
self::$pluginLoader = $pluginLoader;
}
return self::$pluginLoader;
}
示例11: getPluginLoader
/**
* Get plugin loader
*
* @return Zend_Loader_PluginLoader_Interface
*/
public static function getPluginLoader()
{
if (self::$pluginLoader == null) {
$pluginLoader = new Zend_Loader_PluginLoader();
$pluginLoader->addPrefixPath(str_replace('Abstract', '', __CLASS__), dirname(__FILE__));
self::$pluginLoader = $pluginLoader;
}
return self::$pluginLoader;
}
示例12: getPluginLoader
/**
* Get plugin loader
*
* @return Zend_Loader_PluginLoader_Interface
*/
public static function getPluginLoader()
{
if (self::$pluginLoader == null) {
$pluginLoader = new Zend_Loader_PluginLoader();
$pluginLoader->addPrefixPath('System_Acl_Loader', 'System/Acl/Loader');
self::$pluginLoader = $pluginLoader;
}
return self::$pluginLoader;
}
示例13: _initPlugins
protected function _initPlugins()
{
$this->bootstrap('frontController');
$pluginsLoader = new Zend_Loader_PluginLoader();
$pluginsLoader->addPrefixPath("Plugin", APPLICATION_PATH . '/plugins');
$front = Zend_Controller_Front::getInstance();
$pluginsLoader->load("Redirect");
if ($pluginsLoader->isLoaded("Redirect")) {
$front->registerPlugin(new Plugin_Redirect());
}
}
示例14: 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;
}
示例15: _getDefaultAdapterLoader
/**
* Returns a default adapter plugin loader
*
* @return Zend_Loader_PluginLoader
*/
protected static function _getDefaultAdapterLoader()
{
$loader = new Zend_Loader_PluginLoader();
$loader->addPrefixPath('Zend_Serializer_Adapter', dirname(__FILE__) . '/Serializer/Adapter');
return $loader;
}