From fdb9a6b64a8346e4cd19d9d7764af3b369128dab Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 23 Apr 2012 09:56:09 +1000 Subject: [PATCH] Fix notices from r94259 due to undefined variables Fix notices from r94259 due to undefined variables $previewtext and $class in the isWikitextPage()==true case. Change-Id: I6ae2486d8860d2c28d656cdbd594ebc3a1263537 --- includes/EditPage.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 69187e488a..67b94c32c0 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2588,9 +2588,7 @@ HTML $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' ); # don't parse non-wikitext pages, show message about preview - # XXX: stupid php bug won't let us use $this->getContextTitle()->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago? - - if ( $this->isCssJsSubpage || !$this->mTitle->isWikitextPage() ) { + if ( $this->mTitle->isCssJsSubpage() || !$this->mTitle->isWikitextPage() ) { if ( $this->mTitle->isCssJsSubpage() ) { $level = 'user'; } elseif ( $this->mTitle->isCssOrJsPage() ) { @@ -2601,20 +2599,23 @@ HTML # Used messages to make sure grep find them: # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview + $class = 'mw-code'; if ( $level ) { if ( preg_match( "/\\.css$/", $this->mTitle->getText() ) ) { $previewtext = "
\n" . wfMsg( "{$level}csspreview" ) . "\n
"; - $class = "mw-code mw-css"; + $class .= " mw-css"; } elseif ( preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { $previewtext = "
\n" . wfMsg( "{$level}jspreview" ) . "\n
"; - $class = "mw-code mw-js"; + $class .= " mw-js"; } else { throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' ); } + $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); + $previewHTML = $parserOutput->getText(); + } else { + $previewHTML = ''; } - $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); - $previewHTML = $parserOutput->mText; $previewHTML .= "
\n" . htmlspecialchars( $this->textbox1 ) . "\n
\n"; } else { $toparse = $this->textbox1; -- 2.20.1