X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FJavaScriptContent.php;h=4804758fe038b5a0af201d0dd018c5a6d164ed6c;hb=25ee9366b06a44087e8f0cba1f2b27324259ef52;hp=4bde7389199aebd21efb8d068efdb57e8233b163;hpb=6871d732a1614f6d3272478e0e02c353c0b10e46;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