Merge "Check for valid user info before calling Linker::userLink() in Linker::revUser...
[lhc/web/wiklou.git] / includes / parser / ParserOutput.php
index f2aaeed..c8113f3 100644 (file)
@@ -26,8 +26,14 @@ class ParserOutput extends CacheTime {
        /**
         * Feature flags to indicate to extensions that MediaWiki core supports and
         * uses getText() stateless transforms.
+        *
+        * @since 1.31
         */
        const SUPPORTS_STATELESS_TRANSFORMS = 1;
+
+       /**
+        * @since 1.31
+        */
        const SUPPORTS_UNWRAP_TRANSFORM = 1;
 
        /**
@@ -42,7 +48,7 @@ class ParserOutput extends CacheTime {
        public $mLanguageLinks;
 
        /**
-        * @var array $mCategoriesMap of category names to sort keys
+        * @var array $mCategories Map of category names to sort keys
         */
        public $mCategories;
 
@@ -207,6 +213,9 @@ class ParserOutput extends CacheTime {
        /** @var int|null Assumed rev ID for {{REVISIONID}} if no revision is set */
        private $mSpeculativeRevId;
 
+       /** @var int|null Assumed rev timestamp for {{REVISIONTIMESTAMP}} if no revision is set */
+       private $revisionTimestampUsed;
+
        /** string CSS classes to use for the wrapping div, stored in the array keys.
         * If no class is given, no wrapper is added.
         */
@@ -439,6 +448,22 @@ class ParserOutput extends CacheTime {
                return $this->mSpeculativeRevId;
        }
 
+       /**
+        * @param string $timestamp TS_MW timestamp
+        * @since 1.34
+        */
+       public function setRevisionTimestampUsed( $timestamp ) {
+               $this->revisionTimestampUsed = $timestamp;
+       }
+
+       /**
+        * @return string|null TS_MW timestamp or null if not used
+        * @since 1.34
+        */
+       public function getRevisionTimestampUsed() {
+               return $this->revisionTimestampUsed;
+       }
+
        public function &getLanguageLinks() {
                return $this->mLanguageLinks;
        }
@@ -471,14 +496,6 @@ class ParserOutput extends CacheTime {
                return $this->mSections;
        }
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        */
-       public function getEditSectionTokens() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return true;
-       }
-
        public function &getLinks() {
                return $this->mLinks;
        }
@@ -506,6 +523,7 @@ class ParserOutput extends CacheTime {
        public function setNoGallery( $value ) {
                $this->mNoGallery = (bool)$value;
        }
+
        public function getNoGallery() {
                return $this->mNoGallery;
        }
@@ -518,11 +536,6 @@ class ParserOutput extends CacheTime {
                return $this->mModules;
        }
 
-       public function getModuleScripts() {
-               wfDeprecated( __METHOD__, '1.33' );
-               return [];
-       }
-
        public function getModuleStyles() {
                return $this->mModuleStyles;
        }
@@ -566,14 +579,6 @@ class ParserOutput extends CacheTime {
                return $this->mLimitReportJSData;
        }
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        */
-       public function getTOCEnabled() {
-               wfDeprecated( __METHOD__, '1.31' );
-               return true;
-       }
-
        public function getEnableOOUI() {
                return $this->mEnableOOUI;
        }
@@ -598,14 +603,6 @@ class ParserOutput extends CacheTime {
                return wfSetVar( $this->mSections, $toc );
        }
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        */
-       public function setEditSectionTokens( $t ) {
-               wfDeprecated( __METHOD__, '1.31' );
-               return true;
-       }
-
        public function setIndexPolicy( $policy ) {
                return wfSetVar( $this->mIndexPolicy, $policy );
        }
@@ -618,14 +615,6 @@ class ParserOutput extends CacheTime {
                return wfSetVar( $this->mTimestamp, $timestamp );
        }
 
-       /**
-        * @deprecated since 1.31 Use getText() options.
-        */
-       public function setTOCEnabled( $flag ) {
-               wfDeprecated( __METHOD__, '1.31' );
-               return true;
-       }
-
        public function addCategory( $c, $sort ) {
                $this->mCategories[$c] = $sort;
        }
@@ -665,12 +654,15 @@ class ParserOutput extends CacheTime {
        public function setNewSection( $value ) {
                $this->mNewSection = (bool)$value;
        }
+
        public function hideNewSection( $value ) {
                $this->mHideNewSection = (bool)$value;
        }
+
        public function getHideNewSection() {
                return (bool)$this->mHideNewSection;
        }
+
        public function getNewSection() {
                return (bool)$this->mNewSection;
        }
@@ -928,17 +920,30 @@ class ParserOutput extends CacheTime {
        }
 
        /**
-        * Fairly generic flag setter thingy.
+        * Attach a flag to the output so that it can be checked later to handle special cases
+        *
         * @param string $flag
         */
        public function setFlag( $flag ) {
                $this->mFlags[$flag] = true;
        }
 
+       /**
+        * @param string $flag
+        * @return bool Whether the given flag was set to signify a special case
+        */
        public function getFlag( $flag ) {
                return isset( $this->mFlags[$flag] );
        }
 
+       /**
+        * @return string[] List of flags signifying special cases
+        * @since 1.34
+        */
+       public function getAllFlags() {
+               return array_keys( $this->mFlags );
+       }
+
        /**
         * Set a property to be stored in the page_props database table.
         *