douzuita7325
2014-09-03 17:53
浏览 55
已采纳

Zend Framework 1.2 - 按模块配置

I have some plugins in zend framework and at the same time I have an application with various modules, I would like to know how to load plugins without all run on each request.

In module admin I have a function in bootstrap file:

public function _initPlugins() {
        Zend_Controller_Front::getInstance()->registerPlugin(new Admin_Plugin_SecurityCheck());
    }

In module affiliates I have a function in bootstrap file:

public function _initPlugins() {
        Zend_Controller_Front::getInstance()->registerPlugin(new Affiliates_Plugin_SecurityCheck());
    }

I just want to load plugins and settings per module and not in all modules. How can you do this? Thank you.

图片转代码服务由CSDN问答提供 功能建议

我在zend框架中有一些插件,同时我有一个带有各种模块的应用程序,我想 知道如何在每次请求都没有运行的情况下加载插件。

在模块管理员中我在bootstrap文件中有一个函数:

  public function  _initPlugins(){
 Zend_Controller_Front :: getInstance() - > registerPlugin(new Admin_Plugin_SecurityCheck()); 
} 
   
 
 

在模块分支机构中我有一个功能 在bootstrap文件中:

  public function _initPlugins(){
 Zend_Controller_Front :: getInstance() - > registerPlugin(new Affiliates_Plugin_SecurityCheck()); 
} 
   
 
 

我只想加载每个模块的插件和设置,而不是所有模块。 你怎么能这样做? 谢谢。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongrong9938 2014-09-03 18:22
    已采纳

    You can replace standard Zend_Application_Resource_Modules resource, which load modules.

    For this:

    1. Create Your_Application_Resource_ModulesCustom, which extends from Zend_Application_Resource_Modules and disable automatic call of _initPlugins for modules.
    2. When you determine, which module must be loaded, you should manually call _initPlugins for this module.
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题