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