1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace dokuwiki\Extension; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Admin Plugin Prototype |
7
|
|
|
* |
8
|
|
|
* Implements an admin interface in a plugin |
9
|
|
|
* |
10
|
|
|
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
11
|
|
|
* @author Christopher Smith <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
abstract class AdminPlugin extends Plugin |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Return the text that is displayed at the main admin menu |
18
|
|
|
* (Default localized language string 'menu' is returned, override this function for setting another name) |
19
|
|
|
* |
20
|
|
|
* @param string $language language code |
21
|
|
|
* @return string menu string |
22
|
|
|
*/ |
23
|
|
|
public function getMenuText($language) |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
$menutext = $this->getLang('menu'); |
26
|
|
|
if (!$menutext) { |
27
|
|
|
$info = $this->getInfo(); |
28
|
|
|
$menutext = $info['name'] . ' ...'; |
29
|
|
|
} |
30
|
|
|
return $menutext; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Return the path to the icon being displayed in the main admin menu. |
35
|
|
|
* By default it tries to find an 'admin.svg' file in the plugin directory. |
36
|
|
|
* (Override this function for setting another image) |
37
|
|
|
* |
38
|
|
|
* Important: you have to return a single path, monochrome SVG icon! It has to be |
39
|
|
|
* under 2 Kilobytes! |
40
|
|
|
* |
41
|
|
|
* We recommend icons from https://materialdesignicons.com/ or to use a matching |
42
|
|
|
* style. |
43
|
|
|
* |
44
|
|
|
* @return string full path to the icon file |
45
|
|
|
*/ |
46
|
|
|
public function getMenuIcon() |
47
|
|
|
{ |
48
|
|
|
$plugin = $this->getPluginName(); |
49
|
|
|
return DOKU_PLUGIN . $plugin . '/admin.svg'; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Determine position in list in admin window |
54
|
|
|
* Lower values are sorted up |
55
|
|
|
* |
56
|
|
|
* @return int |
57
|
|
|
*/ |
58
|
|
|
public function getMenuSort() |
59
|
|
|
{ |
60
|
|
|
return 1000; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Carry out required processing |
65
|
|
|
*/ |
66
|
|
|
public function handle() |
67
|
|
|
{ |
68
|
|
|
// some plugins might not need this |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Output html of the admin page |
73
|
|
|
*/ |
74
|
|
|
abstract public function html(); |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Return true for access only by admins (config:superuser) or false if managers are allowed as well |
78
|
|
|
* |
79
|
|
|
* @return bool |
80
|
|
|
*/ |
81
|
|
|
public function forAdminOnly() |
82
|
|
|
{ |
83
|
|
|
return true; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Return array with ToC items. Items can be created with the html_mktocitem() |
88
|
|
|
* |
89
|
|
|
* @see html_mktocitem() |
90
|
|
|
* @see tpl_toc() |
91
|
|
|
* |
92
|
|
|
* @return array |
93
|
|
|
*/ |
94
|
|
|
public function getTOC() |
95
|
|
|
{ |
96
|
|
|
return array(); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
//Setup VIM: ex: et ts=4 : |
100
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.