1<?php
2/**
3 * Class syntax_plugin_extranet
4 */
5class syntax_plugin_extranet extends DokuWiki_Syntax_Plugin
6{
7    /**
8     * What kind of syntax are we?
9     */
10    public function getType() {
11        return 'substition';
12    }
13
14    /**
15     * Where to sort in?
16     */
17    public function getSort() {
18        return 200;
19    }
20
21    /**
22     * Connect pattern to lexer
23     * @param string $mode
24     */
25    public function connectTo($mode) {
26        $this->Lexer->addSpecialPattern('~~NOEXTRANET~~', $mode, 'plugin_extranet');
27        $this->Lexer->addSpecialPattern('~~EXTRANET~~', $mode, 'plugin_extranet');
28    }
29
30    /**
31     * Handler to prepare matched data for the rendering process
32     *
33     * @param   string       $match   The text matched by the patterns
34     * @param   int          $state   The lexer state for the match
35     * @param   int          $pos     The character position of the matched text
36     * @param   Doku_Handler $handler The Doku_Handler object
37     * @return  array Return an array with all data you want to use in render
38     */
39    public function handle($match, $state, $pos, Doku_Handler $handler) {
40        return strtoupper(trim(substr($match, 2, -2)));
41    }
42
43    /**
44     * Handles the actual output creation.
45     *
46     * @param string $mode output format being rendered
47     * @param Doku_Renderer $renderer the current renderer object
48     * @param array $data data created by handler()
49     * @return  boolean                 rendered correctly?
50     */
51    public function render($mode, Doku_Renderer $renderer, $data) {
52        return true;
53    }
54}
55