_autoFind = $autoFind; $this->_useUnderscore = $useUnderscore; } /** * on every dispatch assign helpers * @return void */ public function preDispatch() { if ($this->_autoFindHelpers) { //find all helpers foreach (Zend_Controller_Action_HelperBroker::getExistingHelpers() as $helper) { $name = $helper->getName(); $this->assign($name, $helper); } } $controller = $this->getActionController(); //current action controller foreach($this->_plugins as $name => $plugin) { $controller->$name = $plugin; } } /** * add an object to be added * * @param string $name * @param object $obj * @return void */ public function assign($name, $obj) { if ($this->_useUnderscore) { $name = '_' . ltrim($name, '_'); //remove any possible underscores that are there and add one } $this->_plugins[$name] = $obj; return $this; //return self for chaining } }