1<?php
2/**
3 * DokuWiki Plugin codebash (Action Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Dan Cunningham
7 */
8
9if (!defined('DOKU_INC')) die();
10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
11require_once (DOKU_PLUGIN . 'action.php');
12
13class action_plugin_codebash extends DokuWiki_Action_Plugin {
14
15     /**
16     * Register the eventhandlers
17     */
18    public function register(Doku_Event_Handler $controller) {
19        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
20    }
21
22    /**
23     * Inserts the toolbar button
24     */
25    function insert_button(Doku_Event $event, $param) {
26        $event->data[] = array (
27            'type' => 'format',
28            'title' => $this->getLang('insertcode'),
29            'icon' => '../../plugins/codebash/pix/code.png',
30            'open' => '<code bash>',
31            'close' => '</code>',
32        );
33    }
34
35}
36