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