diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-20 12:51:05 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-20 12:51:05 -0400 |
commit | 8d69c49da595c60dae51c77d48f397ab97fdf318 (patch) | |
tree | 7fba4edb18c5c4c161e76828d5847733aca8d27b /app/Core/Plugin/Loader.php | |
parent | cbf896e74e666f102f475787202d3402f229a919 (diff) |
Manage plugins from the user interface and from the command line
Diffstat (limited to 'app/Core/Plugin/Loader.php')
-rw-r--r-- | app/Core/Plugin/Loader.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/Core/Plugin/Loader.php b/app/Core/Plugin/Loader.php index 400517b7..f2f6add7 100644 --- a/app/Core/Plugin/Loader.php +++ b/app/Core/Plugin/Loader.php @@ -18,16 +18,16 @@ class Loader extends \Kanboard\Core\Base /** * Plugin instances * - * @access public + * @access protected * @var array */ - public $plugins = array(); + protected $plugins = array(); /** * Get list of loaded plugins * * @access public - * @return array + * @return Base[] */ public function getPlugins() { @@ -52,7 +52,7 @@ class Loader extends \Kanboard\Core\Base if ($fileInfo->isDir() && substr($fileInfo->getFilename(), 0, 1) !== '.') { $pluginName = $fileInfo->getFilename(); $this->loadSchema($pluginName); - $this->initializePlugin($this->loadPlugin($pluginName)); + $this->initializePlugin($pluginName, $this->loadPlugin($pluginName)); } } } @@ -95,9 +95,10 @@ class Loader extends \Kanboard\Core\Base * Initialize plugin * * @access public - * @param Base $plugin + * @param string $pluginName + * @param Base $plugin */ - public function initializePlugin(Base $plugin) + public function initializePlugin($pluginName, Base $plugin) { if (method_exists($plugin, 'onStartup')) { $this->dispatcher->addListener('app.bootstrap', array($plugin, 'onStartup')); @@ -107,6 +108,6 @@ class Loader extends \Kanboard\Core\Base Tool::buildDICHelpers($this->container, $plugin->getHelpers()); $plugin->initialize(); - $this->plugins[] = $plugin; + $this->plugins[$pluginName] = $plugin; } } |