summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Controller/Config.php13
-rw-r--r--app/Core/Base.php1
-rw-r--r--app/Core/Plugin/Base.php52
-rw-r--r--app/Core/Plugin/Loader.php9
-rw-r--r--app/Locale/cs_CZ/translations.php4
-rw-r--r--app/Locale/da_DK/translations.php4
-rw-r--r--app/Locale/de_DE/translations.php4
-rw-r--r--app/Locale/es_ES/translations.php4
-rw-r--r--app/Locale/fi_FI/translations.php4
-rw-r--r--app/Locale/fr_FR/translations.php4
-rw-r--r--app/Locale/hu_HU/translations.php4
-rw-r--r--app/Locale/id_ID/translations.php4
-rw-r--r--app/Locale/it_IT/translations.php4
-rw-r--r--app/Locale/ja_JP/translations.php4
-rwxr-xr-xapp/Locale/nb_NO/translations.php4
-rw-r--r--app/Locale/nl_NL/translations.php4
-rw-r--r--app/Locale/pl_PL/translations.php4
-rw-r--r--app/Locale/pt_BR/translations.php4
-rw-r--r--app/Locale/pt_PT/translations.php4
-rw-r--r--app/Locale/ru_RU/translations.php4
-rw-r--r--app/Locale/sr_Latn_RS/translations.php4
-rw-r--r--app/Locale/sv_SE/translations.php4
-rw-r--r--app/Locale/th_TH/translations.php4
-rw-r--r--app/Locale/tr_TR/translations.php4
-rw-r--r--app/Locale/zh_CN/translations.php4
-rw-r--r--app/ServiceProvider/ClassProvider.php3
-rw-r--r--app/Template/config/plugins.php24
-rw-r--r--app/Template/config/sidebar.php3
-rw-r--r--app/common.php3
-rw-r--r--doc/plugins.markdown4
30 files changed, 194 insertions, 2 deletions
diff --git a/app/Controller/Config.php b/app/Controller/Config.php
index 790bdcd3..1ae390c8 100644
--- a/app/Controller/Config.php
+++ b/app/Controller/Config.php
@@ -78,6 +78,19 @@ class Config extends Base
}
/**
+ * Display the plugin page
+ *
+ * @access public
+ */
+ public function plugins()
+ {
+ $this->response->html($this->layout('config/plugins', array(
+ 'plugins' => $this->pluginLoader->plugins,
+ 'title' => t('Settings').' > '.t('Plugins'),
+ )));
+ }
+
+ /**
* Display the application settings page
*
* @access public
diff --git a/app/Core/Base.php b/app/Core/Base.php
index fe42ba09..b919d551 100644
--- a/app/Core/Base.php
+++ b/app/Core/Base.php
@@ -23,6 +23,7 @@ use Pimple\Container;
* @property \Core\ObjectStorage\ObjectStorageInterface $objectStorage
* @property \Core\Cache\Cache $memoryCache
* @property \Core\Plugin\Hook $hook
+ * @property \Core\Plugin\Loader $pluginLoader
* @property \Integration\BitbucketWebhook $bitbucketWebhook
* @property \Integration\GithubWebhook $githubWebhook
* @property \Integration\GitlabWebhook $gitlabWebhook
diff --git a/app/Core/Plugin/Base.php b/app/Core/Plugin/Base.php
index 580d41ad..1f61ab33 100644
--- a/app/Core/Plugin/Base.php
+++ b/app/Core/Plugin/Base.php
@@ -44,4 +44,56 @@ abstract class Base extends \Core\Base
call_user_func($callback, $container);
});
}
+
+ /**
+ * Get plugin name
+ *
+ * This method should be overrided by your Plugin class
+ *
+ * @access public
+ * @return string
+ */
+ public function getPluginName()
+ {
+ return ucfirst(substr(get_called_class(), 7, -7));
+ }
+
+ /**
+ * Get plugin description
+ *
+ * This method should be overrided by your Plugin class
+ *
+ * @access public
+ * @return string
+ */
+ public function getPluginDescription()
+ {
+ return '';
+ }
+
+ /**
+ * Get plugin author
+ *
+ * This method should be overrided by your Plugin class
+ *
+ * @access public
+ * @return string
+ */
+ public function getPluginAuthor()
+ {
+ return '?';
+ }
+
+ /**
+ * Get plugin version
+ *
+ * This method should be overrided by your Plugin class
+ *
+ * @access public
+ * @return string
+ */
+ public function getPluginVersion()
+ {
+ return '?';
+ }
}
diff --git a/app/Core/Plugin/Loader.php b/app/Core/Plugin/Loader.php
index 04b2bfff..9a884dae 100644
--- a/app/Core/Plugin/Loader.php
+++ b/app/Core/Plugin/Loader.php
@@ -22,6 +22,14 @@ class Loader extends \Core\Base
const TABLE_SCHEMA = 'plugin_schema_versions';
/**
+ * Plugin instances
+ *
+ * @access public
+ * @var array
+ */
+ public $plugins = array();
+
+ /**
* Scan plugin folder and load plugins
*
* @access public
@@ -55,6 +63,7 @@ class Loader extends \Core\Base
Tool::buildDic($this->container, $instance->getClasses());
$instance->initialize();
+ $this->plugins[] = $instance;
}
/**
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index 6c5cf0fb..975f9629 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index d0fa1a18..5b49a00d 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 71a1d7eb..eb6b99fa 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 3a80d2fb..c2c1e3ec 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Tabla de contenido',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Ayuda con permisos del proyecto',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index e8940ba9..8b097f34 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 4c149b9a..2838fe2b 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -1014,4 +1014,8 @@ return array(
'Table of contents' => 'Table des matières',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Aide avec les permissions des projets',
+ 'Author' => 'Auteur',
+ 'Version' => 'Version',
+ 'Plugins' => 'Extensions',
+ 'There is no plugin loaded.' => 'Il n\'y a aucune extension chargée.',
);
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index 0bb99954..610e45a4 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 1945e60b..ab246c02 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Daftar isi',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Bantuan dengan izin proyek',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 5d6d33f6..e3a8214b 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index b46ec1c4..c700ff82 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 8ee800e6..c8246034 100755
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Innholdsfortegnelse',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Hjelp med prosjekttilganger',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 7c623914..08d6a613 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index e7683d9a..7d8cb0b6 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 57cfe761..0301e31a 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Índice',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Ajuda com as permissões dos projetos',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index cb2fc53e..0e9592d3 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Tabela de conteúdos',
'Gantt' => 'Gantt',
'Help with project permissions' => 'Ajuda com permissões de projecto',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index 53303506..566f48c8 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -1012,4 +1012,8 @@ return array(
'Table of contents' => 'Сожержание',
'Gantt' => 'Гантт',
'Help with project permissions' => 'Помощь с правами доступа по проекту',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 562b8f22..3b91389f 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index c37759c7..60d8f32b 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 1fdb5d34..87cea152 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 44f973d1..230b66f0 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 5ad5e9c8..c8cd2691 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -1012,4 +1012,8 @@ return array(
// 'Table of contents' => '',
// 'Gantt' => '',
// 'Help with project permissions' => '',
+ // 'Author' => '',
+ // 'Version' => '',
+ // 'Plugins' => '',
+ // 'There is no plugin loaded.' => '',
);
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index 78a089ee..a89b78bb 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -2,6 +2,7 @@
namespace ServiceProvider;
+use Core\Plugin\Loader;
use Core\ObjectStorage\FileStorage;
use Core\Paginator;
use Core\OAuth2;
@@ -117,5 +118,7 @@ class ClassProvider implements ServiceProviderInterface
$container['objectStorage'] = function() {
return new FileStorage(FILES_DIR);
};
+
+ $container['pluginLoader'] = new Loader($container);
}
}
diff --git a/app/Template/config/plugins.php b/app/Template/config/plugins.php
new file mode 100644
index 00000000..8501bda9
--- /dev/null
+++ b/app/Template/config/plugins.php
@@ -0,0 +1,24 @@
+<div class="page-header">
+ <h2><?= t('Plugins') ?></h2>
+</div>
+
+<?php if (empty($plugins)): ?>
+ <p class="alert"><?= t('There is no plugin loaded.') ?></p>
+<?php else: ?>
+ <table class="table-stripped">
+ <tr>
+ <th class="column-20"><?= t('Name') ?></th>
+ <th class="column-20"><?= t('Author') ?></th>
+ <th class="column-10"><?= t('Version') ?></th>
+ <th><?= t('Description') ?></th>
+ </tr>
+
+ <?php foreach($plugins as $plugin): ?>
+ <tr>
+ <td><?= $this->e($plugin->getPluginName()) ?></td>
+ <td><?= $this->e($plugin->getPluginAuthor()) ?></td>
+ <td><?= $this->e($plugin->getPluginVersion()) ?></td>
+ <td><?= $this->e($plugin->getPluginDescription()) ?></td>
+ </tr>
+ <?php endforeach ?>
+<?php endif ?> \ No newline at end of file
diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php
index ed4f01e7..4195cde1 100644
--- a/app/Template/config/sidebar.php
+++ b/app/Template/config/sidebar.php
@@ -4,6 +4,9 @@
<li <?= $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
<?= $this->url->link(t('About'), 'config', 'index') ?>
</li>
+ <li <?= $this->app->getRouterAction() === 'plugins' ? 'class="active"' : '' ?>>
+ <?= $this->url->link(t('Plugins'), 'config', 'plugins') ?>
+ </li>
<li <?= $this->app->getRouterAction() === 'application' ? 'class="active"' : '' ?>>
<?= $this->url->link(t('Application settings'), 'config', 'application') ?>
</li>
diff --git a/app/common.php b/app/common.php
index dcd571bc..e63d82bb 100644
--- a/app/common.php
+++ b/app/common.php
@@ -33,5 +33,4 @@ if (ENABLE_URL_REWRITE) {
require __DIR__.'/routes.php';
}
-$plugin = new Core\Plugin\Loader($container);
-$plugin->scan();
+$container['pluginLoader']->scan();
diff --git a/doc/plugins.markdown b/doc/plugins.markdown
index 1127a636..a17f1af4 100644
--- a/doc/plugins.markdown
+++ b/doc/plugins.markdown
@@ -70,6 +70,10 @@ Available methods from `Core\Plugin\Base`:
- `initialize()`: Executed when the plugin is loaded
- `getClasses()`: Return all classes that should be stored in the dependency injection container
- `on($event, $callback)`: Listen on internal events
+- `getPluginName()`: Get plugin name
+- `getPluginAuthor()`: Get plugin author
+- `getPluginVersion()`: Get plugin version
+- `getPluginDescription()`: Get plugin description
Your plugin registration class also inherit from `Core\Base`, that means you can access to all classes and methods of Kanboard easily.