From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- includes/content/JavaScriptContent.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'includes/content/JavaScriptContent.php') diff --git a/includes/content/JavaScriptContent.php b/includes/content/JavaScriptContent.php index 2ae572be..c0194c2e 100644 --- a/includes/content/JavaScriptContent.php +++ b/includes/content/JavaScriptContent.php @@ -31,8 +31,13 @@ * @ingroup Content */ class JavaScriptContent extends TextContent { - public function __construct( $text ) { - parent::__construct( $text, CONTENT_MODEL_JAVASCRIPT ); + + /** + * @param string $text JavaScript code. + * @param string $modelId the content model name + */ + public function __construct( $text, $modelId = CONTENT_MODEL_JAVASCRIPT ) { + parent::__construct( $text, $modelId ); } /** @@ -42,7 +47,8 @@ class JavaScriptContent extends TextContent { * @param Title $title * @param User $user * @param ParserOptions $popts - * @return Content + * + * @return JavaScriptContent */ public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) { global $wgParser; @@ -52,15 +58,19 @@ class JavaScriptContent extends TextContent { $text = $this->getNativeData(); $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts ); - return new JavaScriptContent( $pst ); + return new static( $pst ); } + /** + * @return string JavaScript wrapped in a
 tag.
+	 */
 	protected function getHtml() {
 		$html = "";
 		$html .= "
\n";
-		$html .= $this->getHighlightHtml();
+		$html .= htmlspecialchars( $this->getNativeData() );
 		$html .= "\n
\n"; return $html; } + } -- cgit v1.2.3-54-g00ecf