1<?php 2 3require_once __DIR__.'/lightmenu.class.php'; 4 5use dokuwiki\Extension\SyntaxPlugin; 6 7class syntax_plugin_lightmenu extends SyntaxPlugin 8{ 9 public function getType() 10 { 11 return 'substition'; 12 } 13 14 public function getPType() 15 { 16 return 'block'; 17 } 18 19 public function getSort() 20 { 21 return 121; 22 } 23 24 public function connectTo($mode) 25 { 26 $this->Lexer->addSpecialPattern('<lightmenu[^>]*>', $mode, 'plugin_lightmenu'); 27 $this->Lexer->addSpecialPattern('<lm:[^>]*>', $mode, 'plugin_lightmenu'); 28 } 29 30 public function handle($match, $state, $pos, Doku_Handler $handler) 31 { 32 global $conf; 33 34 if (preg_match('|^<lightmenu([^>]*)>$|',$match,$matches)) 35 return lightmenu::get_data($matches[1]); 36 37 return null; 38 } 39 40 public function render($format, Doku_Renderer $renderer, $data) 41 { 42 if ($data === null) 43 return false; 44 if ($format == 'xhtml') 45 { 46 $renderer->doc .= lightmenu::render($data); 47 return true; 48 } 49 return false; 50 } 51} 52