1<?php
2/**
3 * Translation Plugin: Simple multilanguage plugin
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Andreas Gohr <andi@splitbrain.org>
7 */
8// must be run within Dokuwiki
9if(!defined('DOKU_INC')) die();
10
11class syntax_plugin_autotranslation_trans extends DokuWiki_Syntax_Plugin {
12    /**
13     * What kind of syntax are we?
14     */
15    function getType() {
16        return 'substition';
17    }
18
19    /**
20     * Where to sort in?
21     */
22    function getSort() {
23        return 155;
24    }
25
26    /**
27     * Connect pattern to lexer
28     */
29    function connectTo($mode) {
30        $this->Lexer->addSpecialPattern('~~TRANS~~', $mode, 'plugin_autotranslation_trans');
31    }
32
33    /**
34     * Handle the match
35     */
36    function handle($match, $state, $pos, Doku_Handler $handler) {
37        return array();
38    }
39
40    /**
41     * Create output
42     */
43    function render($format, Doku_Renderer $renderer, $data) {
44        if($format != 'xhtml') return false;
45
46        // disable caching
47        $renderer->nocache();
48
49        /** @var helper_plugin_autotranslation $hlp */
50        $hlp =  plugin_load('helper', 'autotranslation');
51        $renderer->doc .= $hlp->showTranslations();
52        return true;
53    }
54
55}
56
57//Setup VIM: ex: et ts=4 enc=utf-8 :
58