1<?php 2/** 3 * Renderer for comments 4 * 5 * @author Andreas Gohr <andi@splitbrain.org> 6 */ 7 8/** 9 * The Renderer 10 */ 11class renderer_plugin_blogtng_comment extends Doku_Renderer_xhtml { 12 var $slideopen = false; 13 var $base=''; 14 var $tpl=''; 15 16 /** 17 * the format we produce 18 */ 19 function getFormat(){ 20 return 'blogtng_comment'; 21 } 22 23 function nocache() {} 24 function notoc() {} 25 function document_end() {} 26 27 /** 28 * Render a heading 29 * 30 * @param string $text the text to display 31 * @param int $level header level 32 * @param int $pos byte position in the original source 33 */ 34 function header($text, $level, $pos, $returnonly = false) { 35 $this->cdata($text); 36 } 37 38 function section_edit() {} 39 40 /** 41 * Open a new section 42 * 43 * @param int $level section level (as determined by the previous header) 44 */ 45 function section_open($level) {} 46 function section_close() {} 47 function footnote_open() {} 48 function footnote_close() {} 49 50 /** 51 * Execute PHP code if allowed 52 * 53 * @param string $text PHP code that is either executed or printed 54 * @param string $wrapper html element to wrap result if $conf['phpok'] is okff 55 * 56 * @author Andreas Gohr <andi@splitbrain.org> 57 */ 58 function php($text, $wrapper='code') { 59 $this->doc .= p_xhtml_cached_geshi($text, 'php', $wrapper); 60 } 61 62 /** 63 * Insert HTML if allowed 64 * 65 * @param string $text html text 66 * @param string $wrapper html element to wrap result if $conf['htmlok'] is okff 67 * 68 * @author Andreas Gohr <andi@splitbrain.org> 69 */ 70 function html($text, $wrapper='code') { 71 $this->doc .= p_xhtml_cached_geshi($text, 'html4strict', $wrapper); 72 } 73 74 /** 75 * Renders an RSS feed 76 * 77 * @author Andreas Gohr <andi@splitbrain.org> 78 * 79 * @param string $url 80 * @param array $params 81 */ 82 function rss($url, $params) {} 83 84 /** 85 * Call a syntax plugin's render function if it is allowed 86 * by the actual configuration settings. 87 * 88 * @param string $name 89 * @param mixed $data 90 * @return bool 91 */ 92 function plugin($name, $data, $state = '', $match = '') { 93 $comments_xhtml_renderer = array_map('trim', explode(',', $this->getConf('comments_xhtml_renderer'))); 94 $comments_forbid_syntax = array_map('trim', explode(',', $this->getConf('comments_forbid_syntax'))); 95 /** @var DokuWiki_Syntax_Plugin $plugin */ 96 $plugin = plugin_load('syntax',$name); 97 if($plugin != null){ 98 if (in_array($name, $comments_forbid_syntax)) { 99 return false; 100 } elseif (in_array($name, $comments_xhtml_renderer)) { 101 $plugin->render('xhtml',$this,$data); 102 } else { 103 $plugin->render($this->getFormat(), $this, $data); 104 } 105 } 106 return true; 107 } 108} 109