1<?php
2/**
3 * EditSections2 Plugin for DokuWiki / syntax.php
4 *
5 * We use this syntax plugin class only for the renderer functionality.
6 * No syntax is provided.
7 *
8 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
9 * @author  Kazutaka Miyasaka <kazmiya@gmail.com>
10 */
11
12// must be run within DokuWiki
13if (!defined('DOKU_INC')) {
14    die();
15}
16
17if (!defined('DOKU_PLUGIN')) {
18    define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
19}
20
21require_once(DOKU_PLUGIN . 'syntax.php');
22
23class syntax_plugin_editsections2 extends DokuWiki_Syntax_Plugin
24{
25    /**
26     * Returns some info
27     */
28    function getInfo()
29    {
30        return confToHash(DOKU_PLUGIN . '/editsections2/plugin.info.txt');
31    }
32
33    /**
34     * Dummy (only for compatibility reasons)
35     */
36    function getType()
37    {
38        return 'baseonly';
39    }
40
41    /**
42     * Dummy (only for compatibility reasons)
43     */
44    function getSort()
45    {
46        return 999;
47    }
48
49    /**
50     * Dummy (only for compatibility reasons)
51     */
52    function connectTo($mode)
53    {
54        // connect to nowhere
55    }
56
57    /**
58     * Dummy (only for compatibility reasons)
59     */
60    function handle($match, $state, $pos, &$handler)
61    {
62        // do nothing
63    }
64
65    /**
66     * Starts section to put a secedit marker above the first heading
67     */
68    function render($format, &$renderer, $data)
69    {
70        // no need to handle DokuWiki Lemming or earlier
71        if (
72            $format === 'xhtml'
73            && function_exists('html_secedit_get_button')
74        ) {
75            $renderer->startSectionEdit(-1, 'section', 'dummy');
76        }
77    }
78}
79