xref: /plugin/todo/action.php (revision 16a9e697cf70c660c4b4f60ef79c55abdbba4dfd)
1<?php
2
3/**
4 * ToDo Action Plugin: Inserts button for ToDo plugin into toolbar
5 *
6 * Original Example: http://www.dokuwiki.org/devel:action_plugins
7 * @author     Babbage <babbage@digitalbrink.com>
8 * @date 20130405 Leo Eibler <dokuwiki@sprossenwanne.at> \n
9 *                replace old sack() method with new jQuery method and use post instead of get \n
10 */
11
12if (!defined('DOKU_INC')) die();
13if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
14require_once (DOKU_PLUGIN . 'action.php');
15
16class action_plugin_todo extends DokuWiki_Action_Plugin {
17
18	/**
19	 * Return some info
20	 */
21	function getInfo() {
22		return array (
23			'author' => 'Babbage',
24			'email' => 'babbage@digitalbrink.com',
25			'date' => '2013-04-05',
26			'name' => 'ToDo Action Plugin',
27			'desc' => 'Inserts a ToDo button into the editor toolbar',
28			'url' => 'http://www.dokuwiki.org/plugin:todo',
29
30		);
31	}
32
33	/**
34	 * Register the eventhandlers
35	 */
36	function register(&$controller) {
37		$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_button', array ());
38	}
39
40	/**
41	 * Inserts the toolbar button
42	 */
43	function insert_button(&$event, $param) {
44		$event->data[] = array(
45			'type'   => 'format',
46			'title'  => $this->getLang('qb_todobutton'),
47			'icon'   => '../../plugins/todo/todo.png',
48			'key'    => 't',
49			'open'   => '<todo>',
50			'close'  => '</todo>',
51			'block' => false,
52		);
53	}
54
55}
56