Add page to show the list of plugins
This commit is contained in:
@@ -77,6 +77,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
|
* Display the application settings page
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ use Pimple\Container;
|
|||||||
* @property \Core\ObjectStorage\ObjectStorageInterface $objectStorage
|
* @property \Core\ObjectStorage\ObjectStorageInterface $objectStorage
|
||||||
* @property \Core\Cache\Cache $memoryCache
|
* @property \Core\Cache\Cache $memoryCache
|
||||||
* @property \Core\Plugin\Hook $hook
|
* @property \Core\Plugin\Hook $hook
|
||||||
|
* @property \Core\Plugin\Loader $pluginLoader
|
||||||
* @property \Integration\BitbucketWebhook $bitbucketWebhook
|
* @property \Integration\BitbucketWebhook $bitbucketWebhook
|
||||||
* @property \Integration\GithubWebhook $githubWebhook
|
* @property \Integration\GithubWebhook $githubWebhook
|
||||||
* @property \Integration\GitlabWebhook $gitlabWebhook
|
* @property \Integration\GitlabWebhook $gitlabWebhook
|
||||||
|
|||||||
@@ -44,4 +44,56 @@ abstract class Base extends \Core\Base
|
|||||||
call_user_func($callback, $container);
|
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 '?';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ class Loader extends \Core\Base
|
|||||||
*/
|
*/
|
||||||
const TABLE_SCHEMA = 'plugin_schema_versions';
|
const TABLE_SCHEMA = 'plugin_schema_versions';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin instances
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $plugins = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan plugin folder and load plugins
|
* Scan plugin folder and load plugins
|
||||||
*
|
*
|
||||||
@@ -55,6 +63,7 @@ class Loader extends \Core\Base
|
|||||||
Tool::buildDic($this->container, $instance->getClasses());
|
Tool::buildDic($this->container, $instance->getClasses());
|
||||||
|
|
||||||
$instance->initialize();
|
$instance->initialize();
|
||||||
|
$this->plugins[] = $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Tabla de contenido',
|
'Table of contents' => 'Tabla de contenido',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Ayuda con permisos del proyecto',
|
'Help with project permissions' => 'Ayuda con permisos del proyecto',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1014,4 +1014,8 @@ return array(
|
|||||||
'Table of contents' => 'Table des matières',
|
'Table of contents' => 'Table des matières',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Aide avec les permissions des projets',
|
'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.',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Daftar isi',
|
'Table of contents' => 'Daftar isi',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Bantuan dengan izin proyek',
|
'Help with project permissions' => 'Bantuan dengan izin proyek',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Innholdsfortegnelse',
|
'Table of contents' => 'Innholdsfortegnelse',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Hjelp med prosjekttilganger',
|
'Help with project permissions' => 'Hjelp med prosjekttilganger',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Índice',
|
'Table of contents' => 'Índice',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Ajuda com as permissões dos projetos',
|
'Help with project permissions' => 'Ajuda com as permissões dos projetos',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Tabela de conteúdos',
|
'Table of contents' => 'Tabela de conteúdos',
|
||||||
'Gantt' => 'Gantt',
|
'Gantt' => 'Gantt',
|
||||||
'Help with project permissions' => 'Ajuda com permissões de projecto',
|
'Help with project permissions' => 'Ajuda com permissões de projecto',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
'Table of contents' => 'Сожержание',
|
'Table of contents' => 'Сожержание',
|
||||||
'Gantt' => 'Гантт',
|
'Gantt' => 'Гантт',
|
||||||
'Help with project permissions' => 'Помощь с правами доступа по проекту',
|
'Help with project permissions' => 'Помощь с правами доступа по проекту',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1012,4 +1012,8 @@ return array(
|
|||||||
// 'Table of contents' => '',
|
// 'Table of contents' => '',
|
||||||
// 'Gantt' => '',
|
// 'Gantt' => '',
|
||||||
// 'Help with project permissions' => '',
|
// 'Help with project permissions' => '',
|
||||||
|
// 'Author' => '',
|
||||||
|
// 'Version' => '',
|
||||||
|
// 'Plugins' => '',
|
||||||
|
// 'There is no plugin loaded.' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ServiceProvider;
|
namespace ServiceProvider;
|
||||||
|
|
||||||
|
use Core\Plugin\Loader;
|
||||||
use Core\ObjectStorage\FileStorage;
|
use Core\ObjectStorage\FileStorage;
|
||||||
use Core\Paginator;
|
use Core\Paginator;
|
||||||
use Core\OAuth2;
|
use Core\OAuth2;
|
||||||
@@ -117,5 +118,7 @@ class ClassProvider implements ServiceProviderInterface
|
|||||||
$container['objectStorage'] = function() {
|
$container['objectStorage'] = function() {
|
||||||
return new FileStorage(FILES_DIR);
|
return new FileStorage(FILES_DIR);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$container['pluginLoader'] = new Loader($container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
app/Template/config/plugins.php
Normal file
24
app/Template/config/plugins.php
Normal file
@@ -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 ?>
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
<li <?= $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
|
<li <?= $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
|
||||||
<?= $this->url->link(t('About'), 'config', 'index') ?>
|
<?= $this->url->link(t('About'), 'config', 'index') ?>
|
||||||
</li>
|
</li>
|
||||||
|
<li <?= $this->app->getRouterAction() === 'plugins' ? 'class="active"' : '' ?>>
|
||||||
|
<?= $this->url->link(t('Plugins'), 'config', 'plugins') ?>
|
||||||
|
</li>
|
||||||
<li <?= $this->app->getRouterAction() === 'application' ? 'class="active"' : '' ?>>
|
<li <?= $this->app->getRouterAction() === 'application' ? 'class="active"' : '' ?>>
|
||||||
<?= $this->url->link(t('Application settings'), 'config', 'application') ?>
|
<?= $this->url->link(t('Application settings'), 'config', 'application') ?>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -33,5 +33,4 @@ if (ENABLE_URL_REWRITE) {
|
|||||||
require __DIR__.'/routes.php';
|
require __DIR__.'/routes.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugin = new Core\Plugin\Loader($container);
|
$container['pluginLoader']->scan();
|
||||||
$plugin->scan();
|
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ Available methods from `Core\Plugin\Base`:
|
|||||||
- `initialize()`: Executed when the plugin is loaded
|
- `initialize()`: Executed when the plugin is loaded
|
||||||
- `getClasses()`: Return all classes that should be stored in the dependency injection container
|
- `getClasses()`: Return all classes that should be stored in the dependency injection container
|
||||||
- `on($event, $callback)`: Listen on internal events
|
- `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.
|
Your plugin registration class also inherit from `Core\Base`, that means you can access to all classes and methods of Kanboard easily.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user