/** * Initialize this resource * * @return Firal_Event_Dispatcher */ public function init() { $dispatcher = new Firal_Event_Dispatcher(); Firal_Plugin::setDefaultDispatcher($dispatcher); // initialize the plugins $options = $this->getOptions(); // loop through the plugins path, and initialize them $dir = new DirectoryIterator($options['path']); foreach ($dir as $file) { if ($file->isFile() && substr($file->getFilename(), -4, 4) == '.php') { $class = 'Plugin_' . $this->_formatPluginName(substr($file->getFilename(), 0, -4)); include_once $file->getPath() . DIRECTORY_SEPARATOR . $file->getFilename(); if (!class_exists($class)) { throw new Firal_Application_Resource_RuntimeException("Plugin file '{$file->getFilename()}' is found, but '{$class}' does not exist."); } // initialize the plugin new $class(); } } return $dispatcher; }
public function setUp() { $this->_dispatcher = new Firal_Event_Dispatcher(); Firal_Plugin::setDefaultDispatcher($this->_dispatcher); $this->triggered = false; }