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_notrans extends DokuWiki_Syntax_Plugin {
12
13    /**
14     * for th helper plugin
15     */
16    private $hlp = null;
17
18    /**
19     * Constructor. Load helper plugin
20     */
21    function __construct(){
22        $this->hlp =& plugin_load('helper', 'autotranslation');
23    }
24
25    /**
26     * What kind of syntax are we?
27     */
28    function getType(){
29        return 'substition';
30    }
31
32    /**
33     * Where to sort in?
34     */
35    function getSort(){
36        return 155;
37    }
38
39
40    /**
41     * Connect pattern to lexer
42     */
43    function connectTo($mode) {
44        $this->Lexer->addSpecialPattern('~~NOTRANS~~',$mode,'plugin_autotranslation_notrans');
45    }
46
47
48    /**
49     * Handle the match
50     */
51    function handle($match, $state, $pos, Doku_Handler $handler){
52        return array('notrans');
53    }
54
55    /**
56     * Create output
57     */
58    function render($format, Doku_Renderer $renderer, $data) {
59        // store info in metadata
60        if($format == 'metadata'){
61            $renderer->meta['plugin']['autotranslation']['notrans'] = true;
62        }
63        return false;
64    }
65
66    // for backward compatibility
67    function _showTranslations(){
68        return $this->hlp->showTranslations();
69    }
70
71}
72
73//Setup VIM: ex: et ts=4 enc=utf-8 :
74