Index: trunk/extensions/Preview/Preview.php |
— | — | @@ -0,0 +1,30 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if (!defined('MEDIAWIKI')) |
| 5 | + die; |
| 6 | + |
| 7 | +$wgSpecialPages['Preview'] = 'SpecialPreview'; |
| 8 | + |
| 9 | +class SpecialPreview extends SpecialPage { |
| 10 | + function __construct() { |
| 11 | + parent::__construct( 'Preview' ); |
| 12 | + } |
| 13 | + |
| 14 | + function execute( $subpage ) { |
| 15 | + global $wgRequest, $wgOut; |
| 16 | + |
| 17 | + $wgOut->setPageTitle( 'Wikitext Preview' ); |
| 18 | + |
| 19 | + if ( $wikitext = $wgRequest->getText( 'wikitext' ) ) { |
| 20 | + $wgOut->addHTML( Xml::fieldset( 'Wikitext preview', $wgOut->parse( $wikitext ) ) ); |
| 21 | + } |
| 22 | + |
| 23 | + $f = Xml::textarea( 'wikitext', $wikitext ); |
| 24 | + $f .= Xml::submitButton( 'Preview wikitext' ); |
| 25 | + |
| 26 | + $f .= Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ); |
| 27 | + $f = Xml::tags( 'form', array( 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL() ), $f ); |
| 28 | + |
| 29 | + $wgOut->addHTML( Xml::fieldset( 'Preview wikitext', $f ) ); |
| 30 | + } |
| 31 | +} |