Repository navigation
Expand file tree
/
Copy pathPlugin.php
More file actions
98 lines (82 loc) · 4.34 KB
/
Copy pathPlugin.php
File metadata and controls
98 lines (82 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace Kanboard\Plugin\PluginManager;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Security\Role;
use Kanboard\Core\Translator;
use Kanboard\Plugin\PluginManager\AgeHelper;
use Kanboard\Plugin\PluginManager\PluginManagerHelper;
/**
* Registers PluginManager routes, assets, helpers and administrator-only access.
*
* Related test file: tests/SecurityBoundaryTest.php.
*/
class Plugin extends Base
{
public function initialize()
{
// Keep every PluginManager page and action inside Kanboard's administrator boundary.
$this->applicationAccessMap->add('PluginManagerController', '*', Role::APP_ADMIN);
// Template Override
// - Override name should be camelCase e.g. pluginNameExampleCamelCase
$this->template->setTemplateOverride('plugin/show', 'pluginManager:plugin/show');
$this->template->setTemplateOverride('plugin/directory', 'pluginManager:plugin/directory');
$this->template->setTemplateOverride('plugin/sidebar', 'pluginManager:plugin/sidebar');
$this->template->setTemplateOverride('plugin/remove', 'pluginManager:plugin/remove');
// Views - Template Hook
// - Override name should start lowercase e.g. pluginNameExampleCamelCase
$this->template->hook->attach('template:config:sidebar', 'pluginManager:config/sidebar');
// Routes
// 'install' and 'update' plugin functions do not work with routes
$this->route->addRoute('/extensions/plugin-problems', 'PluginManagerController', 'show', 'PluginManager');
$this->route->addRoute('/extensions/plugin-info', 'PluginManagerController', 'showPluginInfo', 'PluginManager');
$this->route->addRoute('/extensions/manual-plugins', 'PluginManagerController', 'showManualPlugins', 'PluginManager');
$this->route->addRoute('/extensions/:pluginId/uninstall', 'PluginController', 'confirm');
// CSS - Asset Hook
// - Keep filename lowercase
$this->hook->on('template:layout:css', array('template' => 'plugins/PluginManager/Assets/css/plugin-manager.css'));
$this->hook->on('template:layout:css', array('template' => 'plugins/PluginManager/Assets/css/plugin-manager-icons.css'));
if (!file_exists('plugins/ContentCleaner') || !file_exists('plugins/KanboardSupport')) {
$this->hook->on('template:layout:css', array('template' => 'plugins/PluginManager/Assets/css/messages.css'));
}
// JS - Asset Hook
// - Keep filename lowercase
$this->hook->on('template:layout:js', array('template' => 'plugins/PluginManager/Assets/js/plugin-manager-top-btn.js'));
if (!file_exists('plugins/Glancer')) {
$this->hook->on('template:layout:js', array('template' => 'plugins/PluginManager/Assets/js/clipboard-v2.0.11.min.js'));
}
$this->hook->on('template:layout:js', array('template' => 'plugins/PluginManager/Assets/js/plugin-manager.js'));
// Helper
$this->helper->register('ageHelper', '\Kanboard\Plugin\PluginManager\Helper\AgeHelper');
$this->helper->register('pluginManagerHelper', '\Kanboard\Plugin\PluginManager\Helper\PluginManagerHelper');
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
}
public function getPluginName()
{
return 'PluginManager';
}
public function getPluginDescription()
{
return t('Plugin Manager provides an improved user-friendly layout for handling plugins. All plugins are broken down into a new structure to help users troubleshoot plugin-related problems. New features include listing and installing Manual Plugins both locally and remotely. The new Plugin Problems section lists information on how to troubleshoot issues with plugins adding quick links to KanboardSupport and ContentCleaner to extend troubleshooting to the whole application.');
}
public function getPluginAuthor()
{
return 'aljawaid';
}
public function getPluginVersion()
{
return '5.0.1';
}
public function getCompatibleVersion()
{
// Examples: '>=1.0.37' '<1.0.37' '<=1.0.37'
// PluginManager 5.0.1 is tested on Kanboard 1.2.54 with PHP 8.2-8.5.
return '>=1.2.54';
}
public function getPluginHomepage()
{
return 'https://github.com/aljawaid/PluginManager';
}
}