X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=blobdiff_plain;f=includes%2Fcontent%2FJavaScriptContent.php;h=4804758fe038b5a0af201d0dd018c5a6d164ed6c;hb=f74400487fdb4c48833f566524d4079bce098250;hp=4bde7389199aebd21efb8d068efdb57e8233b163;hpb=098e23fb9dc76bc715095f51c9547986874eea37;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/JavaScriptContent.php b/includes/content/JavaScriptContent.php index 4bde738919..4804758fe0 100644 --- a/includes/content/JavaScriptContent.php +++ b/includes/content/JavaScriptContent.php @@ -25,6 +25,8 @@ * @author Daniel Kinzler */ +use MediaWiki\MediaWikiServices; + /** * Content for JavaScript pages. * @@ -56,12 +58,12 @@ class JavaScriptContent extends TextContent { * @return JavaScriptContent */ public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) { - global $wgParser; // @todo Make pre-save transformation optional for script pages // See T34858 - $text = $this->getNativeData(); - $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts ); + $text = $this->getText(); + $pst = MediaWikiServices::getInstance()->getParser() + ->preSaveTransform( $text, $title, $user, $popts ); return new static( $pst ); } @@ -72,7 +74,7 @@ class JavaScriptContent extends TextContent { protected function getHtml() { $html = ""; $html .= "
\n"; - $html .= htmlspecialchars( $this->getNativeData() ); + $html .= htmlspecialchars( $this->getText() ); $html .= "\n\n"; return $html; @@ -101,12 +103,12 @@ class JavaScriptContent extends TextContent { return $this->redirectTarget; } $this->redirectTarget = null; - $text = $this->getNativeData(); + $text = $this->getText(); if ( strpos( $text, '/* #REDIRECT */' ) === 0 ) { // Extract the title from the url preg_match( '/title=(.*?)\\\\u0026action=raw/', $text, $matches ); if ( isset( $matches[1] ) ) { - $title = Title::newFromText( $matches[1] ); + $title = Title::newFromText( urldecode( $matches[1] ) ); if ( $title ) { // Have a title, check that the current content equals what // the redirect content should be