From b6247d470d3ced789445e829d7bdf9aaa3fa5bc9 Mon Sep 17 00:00:00 2001 From: Alex Z Date: Mon, 26 Jan 2009 18:02:13 +0000 Subject: [PATCH] add mIsPreview and mIsSectionPreview to parserOptions, set in EditPage. patch by Brad Jorsch on bug 16854 (changes to Cite in next commit) --- includes/EditPage.php | 2 ++ includes/parser/ParserOptions.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/includes/EditPage.php b/includes/EditPage.php index 3060d4c491..b236c0bc87 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1660,6 +1660,8 @@ END $parserOptions = ParserOptions::newFromUser( $wgUser ); $parserOptions->setEditSection( false ); + $parserOptions->setIsPreview( true ); + $parserOptions->setIsSectionPreview( !is_null($this->section) && $this->section !== '' ); global $wgRawHtml; if ( $wgRawHtml && !$this->mTokenOk ) { diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 5b8cd3ee64..577d51f33d 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -33,6 +33,8 @@ class ParserOptions var $mExternalLinkTarget; # Target attribute for external links var $mUser; # Stored user object, just used to initialise the skin + var $mIsPreview; # Parsing the page for a "preview" operation + var $mIsSectionPreview; # Parsing the page for a "preview" operation on a single section function getUseTeX() { return $this->mUseTeX; } function getUseDynamicDates() { return $this->mUseDynamicDates; } @@ -54,6 +56,8 @@ class ParserOptions function getEnableLimitReport() { return $this->mEnableLimitReport; } function getCleanSignatures() { return $this->mCleanSignatures; } function getExternalLinkTarget() { return $this->mExternalLinkTarget; } + function getIsPreview() { return $this->mIsPreview; } + function getIsSectionPreview() { return $this->mIsSectionPreview; } function getSkin() { if ( !isset( $this->mSkin ) ) { @@ -99,6 +103,8 @@ class ParserOptions function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); } function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); } function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); } + function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); } + function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); } function __construct( $user = null ) { $this->initialiseFromUser( $user ); @@ -156,6 +162,8 @@ class ParserOptions $this->mEnableLimitReport = false; $this->mCleanSignatures = $wgCleanSignatures; $this->mExternalLinkTarget = $wgExternalLinkTarget; + $this->mIsPreview = false; + $this->mIsSectionPreview = false; wfProfileOut( $fname ); } } -- 2.20.1