*/ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_multilingual extends DokuWiki_Syntax_Plugin { /** * for th helper plugin */ var $hlp = null; /** * Constructor. Load helper plugin */ function syntax_plugin_multilingual(){ $this->hlp =& plugin_load('helper', 'multilingual'); } /** * return some info */ function getInfo(){ return confToHash(dirname(__FILE__).'/info.txt'); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } /** * Where to sort in? */ function getSort(){ return 155; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern('~~NOTRANS~~',$mode,'plugin_multilingual'); } /** * Handle the match */ function handle($match, $state, $pos, Doku_Handler $handler){ return array('notrans'); } /** * Create output */ function render($format, Doku_Renderer $renderer, $data) { // store info in metadata if($format == 'metadata'){ $renderer->meta['plugin']['multilingual']['notrans'] = true; } return false; } /** * Displays the available and configured translations. Needs to be placed in the template. */ function _showTranslations(){ global $ACT; global $ID; global $conf; if($ACT != 'show') return; if($this->hlp->tns && strpos($ID,$this->hlp->tns) !== 0) return; $skiptrans = trim($this->getConf('skiptrans')); if($skiptrans && preg_match('/'.$skiptrans.'/ui',':'.$ID)) return; $meta = p_get_metadata($ID); if($meta['plugin']['multilingual']['notrans']) return; $rx = '/^'.$this->hlp->tns.'(('.join('|',$this->hlp->trans).'):)?/'; $idpart = preg_replace($rx,'',$ID); $out = '