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