xref: /plugin/include/syntax/editbtn.php (revision afa996bc2ef19982ae3f733592699dcbfb6fd847)
1<?php
2/**
3 * Include plugin (editbtn header component)
4 *
5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author  Michael Klier <chi@chimeric.de>
7 */
8
9if (!defined('DOKU_INC'))
10    define('DOKU_INC', realpath(dirname(__FILE__) . '/../../') . '/');
11if (!defined('DOKU_PLUGIN'))
12    define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
13require_once (DOKU_PLUGIN . 'syntax.php');
14
15class syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin {
16
17    function getType() {
18        return 'formatting';
19    }
20
21    function getSort() {
22        return 50;
23    }
24
25    function handle($match, $state, $pos, &$handler) {
26        // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
27    }
28
29    /**
30     * Renders an include edit button
31     *
32     * @author Michael Klier <chi@chimeric.de>
33     */
34    function render($mode, &$renderer, $data) {
35        list($title) = $data;
36        if ($mode == 'xhtml') {
37            $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
38            $renderer->finishSectionEdit();
39            return true;
40        }
41        return false;
42    }
43}
44// vim:ts=4:sw=4:et:
45