1<?php
2/**
3 * DokuWiki Plugin admnote (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Klaus Vormweg <klaus.vormweg@gmx.de>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) {
11    die();
12}
13
14class action_plugin_admnote_buttons extends DokuWiki_Action_Plugin {
15    /**
16     * Registers a callback function for a given event
17     *
18     * @param Doku_Event_Handler $controller DokuWiki's event controller object
19     *
20     * @return void
21     */
22    public function register(Doku_Event_Handler $controller) {
23        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array());
24    }
25
26    /**
27     * Event handler which performs action
28     *
29     * Called for event:
30     *
31     * @param Doku_Event $event  event object by reference
32     * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
33     *                           handler was registered]
34     *
35     * @return void
36     */
37    function handle_toolbar(Doku_Event $event, $param) {
38        $event->data[] = array (
39            'type' => 'picker',
40            'title' => $this->getLang('adm'),
41            'icon' => '../../plugins/admnote/images/notepicker.png',
42            'list' => array(
43                array(
44                    'type'   => 'format',
45                    'title'  => $this->getLang('adm_abstract'),
46                    'icon'   => '../../plugins/admnote/images/abstract.png',
47                    'open'   => '<adm abstract>',
48                    'close'  => '</adm>'
49                ),
50                array(
51                    'type'   => 'format',
52                    'title'  => $this->getLang('adm_bug'),
53                    'icon'   => '../../plugins/admnote/images/bug.png',
54                    'open'   => '<adm bug>',
55                    'close'  => '</adm>'
56                ),
57                array(
58                    'type'   => 'format',
59                    'title'  => $this->getLang('adm_danger'),
60                    'icon'   => '../../plugins/admnote/images/danger.png',
61                    'open'   => '<adm danger>',
62                    'close'  => '</adm>'
63                ),
64                array(
65                    'type'   => 'format',
66                    'title'  => $this->getLang('adm_example'),
67                    'icon'   => '../../plugins/admnote/images/example.png',
68                    'open'   => '<adm example>',
69                    'close'  => '</adm>'
70                ),
71                array(
72                    'type'   => 'format',
73                    'title'  => $this->getLang('adm_failure'),
74                    'icon'   => '../../plugins/admnote/images/failure.png',
75                    'open'   => '<adm failure>',
76                    'close'  => '</adm>'
77                ),
78                array(
79                    'type'   => 'format',
80                    'title'  => $this->getLang('adm_information'),
81                    'icon'   => '../../plugins/admnote/images/information.png',
82                    'open'   => '<adm information>',
83                    'close'  => '</adm>'
84                ),
85                array(
86                    'type'   => 'format',
87                    'title'  => $this->getLang('adm_note'),
88                    'icon'   => '../../plugins/admnote/images/note.png',
89                    'open'   => '<adm note>',
90                    'close'  => '</adm>'
91                ),
92                array(
93                    'type'   => 'format',
94                    'title'  => $this->getLang('adm_question'),
95                    'icon'   => '../../plugins/admnote/images/question.png',
96                    'open'   => '<adm question>',
97                    'close'  => '</adm>'
98                ),
99                array(
100                    'type'   => 'format',
101                    'title'  => $this->getLang('adm_quote'),
102                    'icon'   => '../../plugins/admnote/images/quote.png',
103                    'open'   => '<adm quote>',
104                    'close'  => '</adm>'
105                ),
106                array(
107                    'type'   => 'format',
108                    'title'  => $this->getLang('adm_achievement'),
109                    'icon'   => '../../plugins/admnote/images/achievement.png',
110                    'open'   => '<adm achievement>',
111                    'close'  => '</adm>'
112                ),
113                array(
114                    'type'   => 'format',
115                    'title'  => $this->getLang('adm_tip'),
116                    'icon'   => '../../plugins/admnote/images/tip.png',
117                    'open'   => '<adm tip>',
118                    'close'  => '</adm>'
119                ),
120                array(
121                    'type'   => 'format',
122                    'title'  => $this->getLang('adm_warning'),
123                    'icon'   => '../../plugins/admnote/images/warning.png',
124                    'open'   => '<adm warning>',
125                    'close'  => '</adm>'
126                )
127            )
128        );
129    }
130}
131