1<?php
2/**
3 * DokuWiki Plugin Abbr (Action component)
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12class action_plugin_abbr extends DokuWiki_Action_Plugin {
13
14    /**
15     * register the eventhandlers
16     */
17    public function register(Doku_Event_Handler $controller) {
18        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'abbr_button', array ());
19    }
20
21    /**
22     * Inserts a toolbar button
23     */
24    public function abbr_button(Doku_Event $event, $param) {
25        $event->data[] = array (
26            'type' => 'picker',
27            'title' => $this->getLang('abbr_toolbar_title'),
28            'icon' => DOKU_REL.'lib/plugins/abbr/images/abbr-picker.png',
29            'list' => array(
30                array( // Type 1
31                    'type'   => 'format',
32                    'title'  => $this->getLang('abbr_type1'),
33                    'sample' => $this->getLang('abbr_type1_sample'),
34                    'icon'   => DOKU_REL.'lib/plugins/abbr/images/abbr-type1.png',
35                    'open'   => '<abbr>',
36                    'close'  => '</abbr>',
37                ),
38                array( // Type 2
39                    'type'   => 'format',
40                    'title'  => $this->getLang('abbr_type2'),
41                    'sample' => $this->getLang('abbr_type2_sample'),
42                    'icon'   => DOKU_REL.'lib/plugins/abbr/images/abbr-type2.png',
43                    'open'   => '<abbr>',
44                    'close'  => '</abbr>',
45                ),
46                array( // Type 0
47                    'type'   => 'format',
48                    'title'  => $this->getLang('abbr_type0'),
49                    'sample' => $this->getLang('abbr_type0_sample'),
50                    'icon'   => DOKU_REL.'lib/plugins/abbr/images/abbr-type0.png',
51                    'open'   => '<abbr title="">',
52                    'close'  => '</abbr>',
53                ),
54            )
55        );
56    }
57}
58