generated from aljawaid/KanboardSkeletonPlugin
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.php
137 lines (122 loc) · 9.12 KB
/
Plugin.php
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
namespace Kanboard\Plugin\URLCleaner;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
class Plugin extends Base
{
public function initialize()
{
// CSS - Asset Hook
// - Keep filename lowercase
$this->hook->on('template:layout:css', array('template' => 'plugins/URLCleaner/Assets/css/url-cleaner.css'));
// Views - Add Menu Item - Template Hook
// - Override name should start lowercase e.g. pluginNameExampleCamelCase
$this->template->hook->attach('template:config:sidebar', 'uRLCleaner:config/sidebar');
// Extra Page - Routes
// - Example: $this->route->addRoute('/my/custom/route', 'MyController', 'show', 'PluginNameExampleStudlyCaps');
// - Must have the corresponding action in the matching controller
$this->route->addRoute('/settings/url-cleaner', 'URLCleanerController', 'show', 'URLCleaner');
if ($this->configModel->get('clean-url-options', '') == 'enable') {
// CORE
if (APP_VERSION < '1.2.28') {
$this->route->addRoute('/my-activity', 'ActivityController', 'user');
$this->route->addRoute('/project/:project_id/task/:task_id/move', 'TaskMovePositionController', 'show');
$this->route->addRoute('/project/:project_id/overview/:search', 'ProjectOverviewController', 'show');
$this->route->addRoute('/project/:project_id/task/:task_id/edit', 'TaskModificationController', 'edit');
$this->route->addRoute('/project/:project_id/task/:task_id/close', 'TaskStatusController', 'close');
$this->route->addRoute('/project/:project_id/task/:task_id/email', 'TaskMailController', 'create');
$this->route->addRoute('/project/:project_id/task/:task_id/duplicate', 'TaskDuplicationController', 'duplicate');
$this->route->addRoute('/project/:project_id/task/:task_id/copy', 'TaskDuplicationController', 'copy');
$this->route->addRoute('/project/:project_id/task/:task_id/move-to-project', 'TaskDuplicationController', 'move');
$this->route->addRoute('/project/:project_id/task/:task_id/files/screenshots/attach', 'TaskFileController', 'screenshot');
$this->route->addRoute('/project/:project_id/task/:task_id/files/attach', 'TaskFileController', 'create');
$this->route->addRoute('/project/:project_id/task/:task_id/files/screenshots/add', 'TaskPopoverController', 'screenshot');
$this->route->addRoute('/project/:project_id/task/:task_id/link/external/add', 'TaskExternalLinkController', 'find');
$this->route->addRoute('/project/:project_id/task/:task_id/link/internal/add', 'TaskInternalLinkController', 'create');
$this->route->addRoute('/project/:project_id/task/:task_id/comments/add', 'CommentController', 'create');
$this->route->addRoute('/project/:project_id/task/:task_id/subtask/add', 'SubtaskController', 'create');
$this->route->addRoute('/project/:project_id/task/:task_id/recurrence/edit', 'TaskRecurrenceController', 'edit');
$this->route->addRoute('/project/:project_id/redirect/:redirect/task/:task_id/delete', 'TaskSuppressionController', 'confirm');
$this->route->addRoute('/project/:project_id/task/:task_id/delete', 'TaskSuppressionController', 'confirm');
$this->route->addRoute('/project/:project_id/board/:search', 'BoardViewController', 'show');
$this->route->addRoute('/project/:project_id/task/list/:search', 'TaskListController', 'show');
$this->route->addRoute('/user/:user_id/notifications/show', 'WebNotificationController', 'show');
$this->route->addRoute('/settings/email', 'ConfigController', 'email');
if (!file_exists('plugins/CostControl')) {
$this->route->addRoute('/settings/currencies/rates', 'CurrencyController', 'show');
$this->route->addRoute('/settings/currencies/add', 'CurrencyController', 'create');
$this->route->addRoute('/settings/currencies/change', 'CurrencyController', 'change');
}
$this->route->addRoute('/settings/link-labels', 'LinkController', 'show');
$this->route->addRoute('/settings/link-labels/add', 'LinkController', 'create');
$this->route->addRoute('/settings/link-labels/:link_id/edit', 'LinkController', 'edit');
$this->route->addRoute('/settings/link-labels/:link_id/delete', 'LinkController', 'confirm');
}
//PLUGINS
$this->route->addRoute('/bigboard', 'Bigboard', 'index', 'Bigboard');
$this->route->addRoute('/help', 'WikiController', 'index', 'Wiki');
$this->route->addRoute('/help', 'WikiController', 'index', 'wiki');
$this->route->addRoute('/help/overview/:search', 'WikiController', 'index', 'wiki');
$this->route->addRoute('/project/:project_id/help/show/:search', 'WikiController', 'show', 'wiki');
$this->route->addRoute('/project/:project_id/help/create', 'WikiController', 'create', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/show', 'WikiController', 'detail', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/show', 'WikiController', 'detail', 'Wiki');
$this->route->addRoute('/help/page/:wiki_id/edit', 'WikiController', 'edit', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/attach', 'WikiFileController', 'create', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/delete', 'WikiController', 'confirm', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/editions', 'WikiController', 'editions', 'wiki');
$this->route->addRoute('/project/:project_id/help/page/:wiki_id/editions/restore/:edition', 'WikiController', 'confirm_restore', 'wiki');
$this->route->addRoute('/settings/wiki', 'ConfigController', 'show', 'Wiki');
$this->route->addRoute('/my-calendar', 'CalendarController', 'user', 'Calendar');
$this->route->addRoute('/settings/calendar', 'ConfigController', 'show', 'Calendar');
$this->route->addRoute('/project/:project_id/calendar/:search', 'CalendarController', 'project', 'Calendar');
$this->route->addRoute('/settings/custom-fields', 'MetadataTypesController', 'config', 'MetaMagik');
$this->route->addRoute('/settings/custom-fields/:key/edit', 'MetadataTypesController', 'editType', 'metaMagik');
$this->route->addRoute('/settings/custom-fields/:key/delete', 'MetadataTypesController', 'confirmTask', 'metaMagik');
$this->route->addRoute('/project/:project_id/metadata', 'MetadataController', 'project', 'metaMagik');
$this->route->addRoute('/project/:project_id/task/:task_id/metadata', 'MetadataController', 'task', 'metaMagik');
$this->route->addRoute('/user/:user_id/metadata', 'MetadataController', 'user', 'metaMagik');
$this->route->addRoute('/user/:user_id/metadata/:key/edit', 'MetadataController', 'editUser', 'metaMagik');
$this->route->addRoute('/user/:user_id/metadata/:key/delete', 'MetadataController', 'confirmUser', 'metaMagik');
$this->route->addRoute('/project/:project_id/analytics/metadata/total', 'AnalyticExtensionController', 'fieldTotalDistribution', 'metaMagik');
$this->route->addRoute('/project/:project_id/analytics/metadata/range', 'AnalyticExtensionController', 'fieldTotalDistributionRange', 'metaMagik');
}
// Helper
// - Example: $this->helper->register('helperClassNameCamelCase', '\Kanboard\Plugin\PluginNameExampleStudlyCaps\Helper\HelperNameExampleStudlyCaps');
// - Add each Helper in the 'use' section at the top of this file
$this->helper->register('cleanURLHelper', '\Kanboard\Plugin\URLCleaner\Helper\CleanURLHelper');
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
}
public function getPluginName()
{
// Plugin Name MUST be identical to namespace for Plugin Directory to detect updated versions - do not translate the plugin name here
return 'URLCleaner';
}
public function getPluginDescription()
{
return t('This simple tool extends the rewriting of browser URLs for your Kanboard application. Sanitize those long URLs automatically creating neat pretty easy to remember bookmarks. This plugin extends URLs from the core and from plugins. URL Rewriting must be correctly configured for this plugin to function properly.');
}
public function getPluginAuthor()
{
return 'aljawaid';
}
public function getPluginVersion()
{
return '2.0.0';
}
public function getCompatibleVersion()
{
// Examples:
// >=1.0.37
// <1.0.37
// <=1.0.37
return '>=1.2.20';
}
public function getPluginHomepage()
{
return 'https://github.com/aljawaid/URLCleaner';
}
}