/** * Loads a plugin in the plugin namespace by name over the Enlight_Config. * * * @param $name * @param bool $throwException * @return \Enlight_Plugin_Namespace_Config|\Enlight_Plugin_PluginCollection */ public function load($name, $throwException = true) { $item = $this->Storage()->plugins->{$name}; if ($item === null || $this->plugins->offsetExists($name) || !(class_exists($item->class) || class_exists($item->class . 'Dummy'))) { return parent::load($name, $throwException); } /** @var $item \Enlight_Config */ $classname = $item->get('class'); if (!class_exists($classname)) { $classname .= 'Dummy'; } /** @var $plugin Enlight_Plugin_Bootstrap_Config */ $plugin = new $classname($name, $item); return parent::registerPlugin($plugin, $throwException); }
/** * Registers the given plugin namespace. The instance of the Enlight_Plugin_PluginManager is * set into the namespace by using the Enlight_Plugin_Namespace::setManager() function. * The namespace name is used as array key. * * @param Enlight_Plugin_Namespace $namespace * @return Enlight_Plugin_PluginManager */ public function registerNamespace(Enlight_Plugin_Namespace $namespace) { $namespace->setManager($this); $this->plugins[$namespace->getName()] = $namespace; return $this; }
/** * Registers a plugin in the collection. * * @param Enlight_Plugin_Bootstrap_Config $plugin * @return Enlight_Plugin_Namespace_Config */ public function registerPlugin(Enlight_Plugin_Bootstrap_Config $plugin) { parent::registerPlugin($plugin); $plugin->install(); return $this; }
/** * Loads a plugin in the plugin namespace by name over the Enlight_Config. * * * @param $name * @param bool $throwException * @return \Enlight_Plugin_Namespace_Config|\Enlight_Plugin_PluginCollection */ public function load($name, $throwException = true) { $item = $this->Storage()->plugins->{$name}; if ($item === null || $this->plugins->offsetExists($name) || !class_exists($item->class)) { return parent::load($name, $throwException); } /** @var $plugin Enlight_Plugin_Bootstrap_Config */ $plugin = new $item->class($name, $item); return parent::registerPlugin($plugin, $throwException); }
public function testSetManager() { $manager = $this->getMock('Enlight_Plugin_PluginCollection', array('Application'), array(), '', false); $this->namespace->setManager($manager); $this->assertInstanceOf('Enlight_Plugin_PluginCollection', $this->namespace->Manager()); }