Skip to content

Commit 6104f56

Browse files
committed
PLATFORM-6983 Fix PvXDecode
1 parent c10b83c commit 6104f56

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

specials/SpecialPvXDecode.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ class SpecialPvXDecode extends SpecialPage {
2121
* @return void
2222
*/
2323
public function __construct() {
24-
global $wgRequest, $wgUser;
25-
2624
parent::__construct( 'PvXDecode' );
27-
28-
$this->wgRequest = $wgRequest;
29-
$this->wgUser = $wgUser;
30-
$this->output = $this->getOutput();
31-
3225
$this->DB = wfGetDB( DB_PRIMARY );
3326

3427
require_once( GWBBCODE_ROOT . '/gwbbcode.inc.php' );
@@ -38,22 +31,25 @@ public function __construct() {
3831
* Main Execute for the Specil Page
3932
* @param $par - Not used, but expected to be there by mediawiki.
4033
* @return void - echos to page.
34+
* @throws MWException
4135
*/
4236
public function execute( $par = null ) {
43-
$name = $this->wgRequest->getText( 'wpName' );
44-
$build = $this->wgRequest->getText( 'wpBuild' );
37+
$request = $this->getRequest();
38+
$output = $this->getOutput();
39+
$name = $request->getText( 'wpName' );
40+
$build = $request->getText( 'wpBuild' );
4541

4642
if ( $build ) {
47-
if ( strlen( $name ) > 1 ) {
43+
if ( strlen( $name ) >= 1 ) {
4844
$rout = template_to_gwbbcode( $name . ";" . $build );
4945
} else {
5046
$rout = template_to_gwbbcode( $build );
5147
}
5248

53-
$this->output->addWikiText( "== Preview ==" );
54-
$this->output->addWikiText( "<pvxbig>" . $rout . "</pvxbig>" );
55-
$this->output->addHtml( "<br>" );
56-
$this->output->addWikiText( "== PvXcode ==" );
49+
$output->addWikiTextAsContent( "== Preview ==" );
50+
$output->addWikiTextAsContent( "<pvxbig>" . $rout . "</pvxbig>" );
51+
$output->addHtml( "<br>" );
52+
$output->addWikiTextAsContent( "== PvXcode ==" );
5753
$out =
5854
"<p><textarea cols='80' rows='10' wrap='virtual'>\n<pvxbig>\n" . $rout . "\n</pvxbig>\n</textarea></p>";
5955

@@ -76,15 +72,15 @@ public function execute( $par = null ) {
7672
}
7773
$this->setHeaders();
7874

79-
$this->output->addHtml( $out );
75+
$output->addHTML( $out );
8076
}
8177

8278
/**
8379
* Return the group name for this special page.
8480
*
8581
* @return string
8682
*/
87-
protected function getGroupName() {
83+
protected function getGroupName(): string {
8884
// Change to display in a different category on Special:SpecialPages.
8985
return 'pvx';
9086
}

0 commit comments

Comments
 (0)