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
9class syntax_plugin_include_editbtn extends DokuWiki_Syntax_Plugin {
10
11    function getType() {
12        return 'formatting';
13    }
14
15    function getSort() {
16        return 50;
17    }
18
19    function handle($match, $state, $pos, Doku_Handler $handler) {
20        // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser
21    }
22
23    /**
24     * Renders an include edit button
25     *
26     * @author Michael Klier <chi@chimeric.de>
27     */
28    function render($mode, Doku_Renderer $renderer, $data) {
29        list($title, $hid) = $data;
30        if ($mode == 'xhtml') {
31            if (defined('SEC_EDIT_PATTERN')) { // for DokuWiki Greebo and more recent versions
32                $renderer->startSectionEdit(0, array('target' => 'plugin_include_editbtn', 'name' => $title, 'hid' => $hid));
33            } else {
34                $renderer->startSectionEdit(0, 'plugin_include_editbtn', $title);
35            }
36
37            $renderer->finishSectionEdit();
38            return true;
39        }
40        return false;
41    }
42}
43// vim:ts=4:sw=4:et:
44