1<?php
2/**
3 * DokuWiki Plugin codebuttontrumod (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Alexey Trushnikov <integrarium@gmail.com>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) {    die(); }
11if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
12require_once (DOKU_PLUGIN . 'action.php');
13
14
15class action_plugin_codebuttontrumod extends DokuWiki_Action_Plugin
16{
17
18    /**
19     * Return some info
20     */
21    function getInfo() {
22        return array (
23            'author' => 'Trushnikov Alexey',
24            'date' => '2019-08-04',
25            'name' => 'Toolbar Code Button',
26            'desc' => 'Inserts a code button into the toolbar',
27            'url' => 'https://github.com/integrarium/dokuwiki_plugin_codebuttontrumod/',
28        );
29    }
30
31    /**
32     * Registers a callback function for a given event
33     *
34     * @param Doku_Event_Handler $controller DokuWiki's event controller object
35     *
36     * @return void
37     */
38    public function register(Doku_Event_Handler $controller)
39    {
40        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
41
42    }
43
44    /**
45     * Inserts the toolbar button
46     */
47    function insert_button(& $event, $param) {
48        $event->data[] = array (
49            'type' => 'format',
50            'title' => $this->getLang('insertcode'),
51            'icon' => '../../plugins/codebuttontrumod/image/code.png',
52            'open' => '<code | download>\n',
53            'close' => '\n</code>',
54        );
55    }
56
57 /**
58     * [Custom event handler which performs action]
59     *
60     * Called for event:
61     *
62     * @param Doku_Event $event  event object by reference
63     * @param mixed      $param  [the parameters passed as fifth argument to register_hook() when this
64     *                           handler was registered]
65     *
66     * @return void
67     */
68
69}
70
71