Zend Framework. How to check if specific Front Controller Plugin is registered?
I currently do it this way (to check if Layout Front Controller plugin has been registered for example):
$front = Zend_Controller_Front::getInstance();
if($front->hasPlugin('Zend_Layout_Controller_Plugin_Layout')){
//....do something
};
IS this a good way? are there any other 开发者_开发问答ways to check it?
You already ask the front controller if it has the plugin registered, I think this is straight enough and there is nothing wrong with this. You could just make it a little shorter:
if (Zend_Controller_Front::getInstance()->hasPlugin('Zend_Layout_Controller_Plugin_Layout')) {
//....do something
};
精彩评论