1<?php 2// must be run within Dokuwiki 3if (!defined('DOKU_INC')) die(); 4 5class helper_plugin_xml extends DokuWiki_Plugin { 6 7 /** 8 * Hooks for handling other plugins 9 * 10 * Since we generally outputs xml-ized instructions, 11 * we don't really need the plugins themselves to manage them. 12 * 13 * Feel free to add or modify hooks for plugins below to match your need. 14 */ 15 function _xml_extension(&$renderer,$name,$data) { 16 switch ($name) { 17 case 'htmlcomment': 18 list($state, $match) = $data; 19 $renderer->doc .= '<!--'; 20 if (HTMLCOMMENT_SAFE) { 21 $renderer->doc .= $renderer->_xmlEntities($match); 22 } else { 23 $renderer->doc .= $match; 24 } 25 $renderer->doc .= '-->'; 26 return true; 27 case 'info': 28 $renderer->doc .= '<macro name="info" type="'.$data[0].'" />'.DOKU_LF; 29 return true; 30 case 'pageredirect': 31 list($page, $message) = $data; 32 $renderer->doc .= '<macro name="pageredirect" target="'.$page.'" />'.DOKU_LF; 33 return true; 34 case 'plaintext': 35 $renderer->doc .= '<plaintext>'; 36 $renderer->doc .= $renderer->_xmlEntities($data); 37 $renderer->doc .= '</plaintext>'; 38 return true; 39 case 'tag_tag': 40 $renderer->doc .= '<tags>'; 41 foreach ($data as $tag) { 42 $renderer->doc .= '<tag target="'.$renderer->_xmlEntities($tag).'" />'; 43 } 44 $renderer->doc .= '</tags>'.DOKU_LF; 45 return true; 46 case 'tag_topic': 47 list($ns, $tag, $flags) = $data; 48 $renderer->doc .= '<topic namespace="'.$ns.'" tags="'.$tag.'" flags="'.implode(' ',$flags).'" />'.DOKU_LF; 49 return true; 50 } 51 return false; 52 } 53}