1<?php
2
3// must be run within Dokuwiki
4if(!defined('DOKU_INC')) die();
5
6/**
7 * Class syntax_plugin_pagemod
8 */
9class syntax_plugin_pagemod extends DokuWiki_Syntax_Plugin {
10
11    /**
12     * Syntax Type
13     *
14     * @return string
15     */
16    public function getType() {
17        return 'substition';
18    }
19
20    /**
21     * Sort for applying this mode
22     *
23     * @return int
24     */
25    public function getSort() {
26        return 321;
27    }
28
29    /**
30     * @param string $mode
31     */
32    public function connectTo($mode) {
33        $this->Lexer->addSpecialPattern("<pagemod \w+(?: .+?)?>.*?</pagemod>", $mode, 'plugin_pagemod');
34    }
35
36    // We just want to hide this from view
37
38    /**
39     * Handler to prepare matched data for the rendering process
40     *
41     * @param   string       $match   The text matched by the patterns
42     * @param   int          $state   The lexer state for the match
43     * @param   int          $pos     The character position of the matched text
44     * @param   Doku_Handler $handler The Doku_Handler object
45     * @return  array Return an array with all data you want to use in render
46     */
47    public function handle($match, $state, $pos, Doku_Handler $handler) {
48        return '';
49    }
50
51    /**
52     * Handles the actual output creation.
53     *
54     * @param   $mode   string        output format being rendered
55     * @param   $renderer Doku_Renderer the current renderer object
56     * @param   $data     array         data created by handler()
57     * @return  boolean                 rendered correctly?
58     */
59    public function render($mode, Doku_Renderer $renderer, $data) {
60        return true;
61    }
62}
63