Move some member variable initialization to the declarations and out of constructors...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 25 Jul 2008 01:27:51 +0000 (01:27 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 25 Jul 2008 01:27:51 +0000 (01:27 +0000)
includes/OutputPage.php
includes/parser/ParserOutput.php

index 6c4b748..219d1cb 100644 (file)
@@ -6,20 +6,22 @@ if ( ! defined( 'MEDIAWIKI' ) )
  * @todo document
  */
 class OutputPage {
  * @todo document
  */
 class OutputPage {
-       var $mMetatags, $mKeywords;
-       var $mLinktags, $mPagetitle, $mBodytext, $mDebugtext;
-       var $mHTMLtitle, $mIsarticle, $mPrintable;
-       var $mSubtitle, $mRedirect, $mStatusCode;
-       var $mLastModified, $mETag, $mCategoryLinks;
-       var $mScripts, $mLinkColours, $mPageLinkTitle;
+       var $mMetatags = array(), $mKeywords = array(), $mLinktags = array();
+       var $mPagetitle = '', $mBodytext = '', $mDebugtext = '';
+       var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false;
+       var $mSubtitle = '', $mRedirect = '', $mStatusCode;
+       var $mLastModified = '', $mETag = false;
+       var $mCategoryLinks = array(), $mLanguageLinks = array();
+       var $mScripts = '', $mLinkColours, $mPageLinkTitle = '', $mHeadItems = array();
+       var $mTemplateIds = array();
 
        var $mAllowUserJs;
 
        var $mAllowUserJs;
-       var $mSuppressQuickbar;
-       var $mOnloadHandler;
-       var $mDoNothing;
-       var $mContainsOldMagic, $mContainsNewMagic;
-       var $mIsArticleRelated;
-       protected $mParserOptions; // lazy initialised, use parserOptions()
+       var $mSuppressQuickbar = false;
+       var $mOnloadHandler = '';
+       var $mDoNothing = false;
+       var $mContainsOldMagic = 0, $mContainsNewMagic = 0;
+       var $mIsArticleRelated = true;
+       protected $mParserOptions = null; // lazy initialised, use parserOptions()
        var $mShowFeedLinks = false;
        var $mFeedLinksAppendQuery = false;
        var $mEnableClientCache = true;
        var $mShowFeedLinks = false;
        var $mFeedLinksAppendQuery = false;
        var $mEnableClientCache = true;
@@ -29,6 +31,8 @@ class OutputPage {
        var $mNoGallery = false;
        var $mPageTitleActionText = '';
        var $mParseWarnings = array();
        var $mNoGallery = false;
        var $mPageTitleActionText = '';
        var $mParseWarnings = array();
+       var $mSquidMaxage = 0;
+       var $mRevisionId = null;
 
        private $mIndexPolicy = 'index';
        private $mFollowPolicy = 'follow';
 
        private $mIndexPolicy = 'index';
        private $mFollowPolicy = 'follow';
@@ -40,24 +44,6 @@ class OutputPage {
        function __construct() {
                global $wgAllowUserJs;
                $this->mAllowUserJs = $wgAllowUserJs;
        function __construct() {
                global $wgAllowUserJs;
                $this->mAllowUserJs = $wgAllowUserJs;
-               $this->mMetatags = $this->mKeywords = $this->mLinktags = array();
-               $this->mHTMLtitle = $this->mPagetitle = $this->mBodytext =
-               $this->mRedirect = $this->mLastModified = $this->mSubtitle =
-               $this->mDebugtext = $this->mOnloadHandler = $this->mPageLinkTitle = '';
-               $this->mIsArticleRelated = $this->mIsarticle = $this->mPrintable = true;
-               $this->mSuppressQuickbar = $this->mPrintable = false;
-               $this->mLanguageLinks = array();
-               $this->mCategoryLinks = array();
-               $this->mDoNothing = false;
-               $this->mContainsOldMagic = $this->mContainsNewMagic = 0;
-               $this->mParserOptions = null;
-               $this->mSquidMaxage = 0;
-               $this->mScripts = '';
-               $this->mHeadItems = array();
-               $this->mETag = false;
-               $this->mRevisionId = null;
-               $this->mNewSectionLink = false;
-               $this->mTemplateIds = array();
        }
 
        public function redirect( $url, $responsecode = '302' ) {
        }
 
        public function redirect( $url, $responsecode = '302' ) {
index a15a71d..3595138 100644 (file)
@@ -5,26 +5,26 @@
  */
 class ParserOutput
 {
  */
 class ParserOutput
 {
-       var $mText,             # The output text
-               $mLanguageLinks,    # List of the full text of language links, in the order they appear
-               $mCategories,       # Map of category names to sort keys
-               $mContainsOldMagic, # Boolean variable indicating if the input contained variables like {{CURRENTDAY}}
-               $mCacheTime,        # Time when this object was generated, or -1 for uncacheable. Used in ParserCache.
-               $mVersion,          # Compatibility check
-               $mTitleText,        # title text of the chosen language variant
-               $mLinks,            # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
-               $mTemplates,        # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
-               $mTemplateIds,      # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
-               $mImages,           # DB keys of the images used, in the array key only
-               $mExternalLinks,    # External link URLs, in the key only
-               $mNewSection,       # Show a new section link?
-               $mNoGallery,        # No gallery on category page? (__NOGALLERY__)
-               $mHeadItems,        # Items to put in the <head> section
-               $mOutputHooks,      # Hook tags as per $wgParserOutputHooks
-               $mWarnings,         # Warning text to be returned to the user. Wikitext formatted, in the key only
-               $mSections,         # Table of contents
-               $mProperties;       # Name/value pairs to be cached in the DB
-       private $mIndexPolicy = '';     # 'index' or 'noindex'?  Any other value will result in no change.
+       var $mText,                       # The output text
+               $mLanguageLinks,              # List of the full text of language links, in the order they appear
+               $mCategories,                 # Map of category names to sort keys
+               $mContainsOldMagic,           # Boolean variable indicating if the input contained variables like {{CURRENTDAY}}
+               $mTitleText,                  # title text of the chosen language variant
+               $mCacheTime = '',             # Time when this object was generated, or -1 for uncacheable. Used in ParserCache.
+               $mVersion = Parser::VERSION,  # Compatibility check
+               $mLinks = array(),            # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
+               $mTemplates = array(),        # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
+               $mTemplateIds = array(),      # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
+               $mImages = array(),           # DB keys of the images used, in the array key only
+               $mExternalLinks = array(),    # External link URLs, in the key only
+               $mNewSection = false,         # Show a new section link?
+               $mNoGallery = false,          # No gallery on category page? (__NOGALLERY__)
+               $mHeadItems = array(),        # Items to put in the <head> section
+               $mOutputHooks = array(),      # Hook tags as per $wgParserOutputHooks
+               $mWarnings = array(),         # Warning text to be returned to the user. Wikitext formatted, in the key only
+               $mSections = array(),         # Table of contents
+               $mProperties = array();       # Name/value pairs to be cached in the DB
+       private $mIndexPolicy = '';           # 'index' or 'noindex'?  Any other value will result in no change.
 
        /**
         * Overridden title for display
 
        /**
         * Overridden title for display
@@ -38,21 +38,7 @@ class ParserOutput
                $this->mLanguageLinks = $languageLinks;
                $this->mCategories = $categoryLinks;
                $this->mContainsOldMagic = $containsOldMagic;
                $this->mLanguageLinks = $languageLinks;
                $this->mCategories = $categoryLinks;
                $this->mContainsOldMagic = $containsOldMagic;
-               $this->mCacheTime = '';
-               $this->mVersion = Parser::VERSION;
                $this->mTitleText = $titletext;
                $this->mTitleText = $titletext;
-               $this->mSections = array();
-               $this->mLinks = array();
-               $this->mTemplates = array();
-               $this->mImages = array();
-               $this->mExternalLinks = array();
-               $this->mNewSection = false;
-               $this->mNoGallery = false;
-               $this->mHeadItems = array();
-               $this->mTemplateIds = array();
-               $this->mOutputHooks = array();
-               $this->mWarnings = array();
-               $this->mProperties = array();
        }
 
        function getText()                   { return $this->mText; }
        }
 
        function getText()                   { return $this->mText; }