-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.php
170 lines (162 loc) · 6.03 KB
/
action.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/**
* Action Plugin: Inserts a button into the toolbar to add color tags
*
* @author Chimeforest
*/
if (!defined('DOKU_INC')) die();
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once (DOKU_PLUGIN . 'action.php');
class action_plugin_colorbutton extends DokuWiki_Action_Plugin {
/**
* Return some info
*/
function getInfo() {
return array (
'author' => 'Chimeforest',
'date' => '2013-12-31',
'name' => 'Toolbar Color Button',
'desc' => 'Inserts a button for the color plugin into the toolbar',
'url' => 'TBA',
);
}
/**
* Register the eventhandlers
*/
function register(&$controller) {
$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
}
/**
* Inserts the toolbar button
*/
function insert_button(& $event, $param) {
//Color for the spoiler function
$spoiler = $this->getConf('spoiler');
$event->data[] = array (
'type' => 'picker',
'title' => $this->getLang('colortext'),
'icon' => '../../plugins/colorbutton/img/color.png',
'list' => array(
array(
'type' => 'format',
'title' => $this->getLang('spoilertext'),
'icon' => '../../plugins/colorbutton/img/spoiler.png',
'open' => "<color $spoiler/$spoiler>",
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('redtext'),
'icon' => '../../plugins/colorbutton/img/red.png',
'open' => '<color red>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('orangetext'),
'icon' => '../../plugins/colorbutton/img/orange.png',
'open' => '<color orange>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('yellowtext'),
'icon' => '../../plugins/colorbutton/img/yellow.png',
'open' => '<color yellow>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('greentext'),
'icon' => '../../plugins/colorbutton/img/green.png',
'open' => '<color green>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('bluetext'),
'icon' => '../../plugins/colorbutton/img/blue.png',
'open' => '<color blue>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('indigotext'),
'icon' => '../../plugins/colorbutton/img/indigo.png',
'open' => '<color indigo>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('purpletext'),
'icon' => '../../plugins/colorbutton/img/purple.png',
'open' => '<color purple>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('whiteblacktext'),
'icon' => '../../plugins/colorbutton/img/whiteblack.png',
'open' => '<color white/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('redblacktext'),
'icon' => '../../plugins/colorbutton/img/redblack.png',
'open' => '<color red/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('orangeblacktext'),
'icon' => '../../plugins/colorbutton/img/orangeblack.png',
'open' => '<color orange/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('yellowblacktext'),
'icon' => '../../plugins/colorbutton/img/yellowblack.png',
'open' => '<color yellow/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('greenblacktext'),
'icon' => '../../plugins/colorbutton/img/greenblack.png',
'open' => '<color green/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('blueblacktext'),
'icon' => '../../plugins/colorbutton/img/blueblack.png',
'open' => '<color blue/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('indigoblacktext'),
'icon' => '../../plugins/colorbutton/img/indigoblack.png',
'open' => '<color indigo/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('purpleblacktext'),
'icon' => '../../plugins/colorbutton/img/purpleblack.png',
'open' => '<color purple/black>',
'close' => '</color>',
),
array(
'type' => 'format',
'title' => $this->getLang('customtext'),
'icon' => '../../plugins/colorbutton/img/custom.png',
'open' => '<color TEXTCOLOR/BGCOLOR>',
'close' => '</color>',
)
)
);
}
}