1<?php 2 3namespace dokuwiki\Ui; 4 5use dokuwiki\Extension\Event; 6 7/** 8 * DokuWiki Conflict Insterface 9 * 10 * @package dokuwiki\Ui 11 */ 12class PageView extends Ui 13{ 14 /** 15 * Show a wiki page 16 * 17 * @author Andreas Gohr <andi@splitbrain.org> 18 * 19 * @triggers HTML_SHOWREV_OUTPUT 20 * @param null|string $txt wiki text or null for showing $ID 21 * @return void 22 */ 23 public function show($txt = null) 24 { 25 global $ID; 26 global $REV; 27 global $HIGH; 28 global $INFO; 29 global $DATE_AT; 30 31 //disable section editing for old revisions or in preview 32 if ($txt || $REV) { 33 $secedit = false; 34 } else { 35 $secedit = true; 36 } 37 38 if (!is_null($txt)) { 39 //PreviewHeader 40 echo '<br id="scroll__here" />'; 41 42 // print intro for preview 43 echo p_locale_xhtml('preview'); 44 echo '<div class="preview"><div class="pad">'; 45 $html = html_secedit(p_render('xhtml', p_get_instructions($txt), $info), $secedit); 46 if ($INFO['prependTOC']) $html = tpl_toc(true) . $html; 47 echo $html; 48 echo '<div class="clearer"></div>'; 49 echo '</div></div>'; 50 51 } else { 52 if ($REV || $DATE_AT) { 53 // print intro for old revisions 54 $data = array('rev' => &$REV, 'date_at' => &$DATE_AT); 55 Event::createAndTrigger('HTML_SHOWREV_OUTPUT', $data, [$this, 'showrev']); 56 } 57 $html = p_wiki_xhtml($ID, $REV, true, $DATE_AT); 58 $html = html_secedit($html, $secedit); 59 if ($INFO['prependTOC']) $html = tpl_toc(true) . $html; 60 $html = html_hilight($html, $HIGH); 61 echo $html; 62 } 63 } 64 65 /** 66 * Show a revision warning 67 * 68 * @author Szymon Olewniczak <dokuwiki@imz.re> 69 */ 70 public function showrev() 71 { 72 print p_locale_xhtml('showrev'); 73 } 74 75 76} 77