Merge "Call setTransactionTicket() on DeferredUpdates sub-queue items too"
[lhc/web/wiklou.git] / includes / parser / ParserOptions.php
index 91cd0f4..25c2aa4 100644 (file)
@@ -117,17 +117,22 @@ class ParserOptions {
        private $mRemoveComments = true;
 
        /**
-        * Callback for current revision fetching. Used as first argument to call_user_func().
+        * @var callable Callback for current revision fetching; first argument to call_user_func().
         */
        private $mCurrentRevisionCallback =
                [ 'Parser', 'statelessFetchRevision' ];
 
        /**
-        * Callback for template fetching. Used as first argument to call_user_func().
+        * @var callable Callback for template fetching; first argument to call_user_func().
         */
        private $mTemplateCallback =
                [ 'Parser', 'statelessFetchTemplate' ];
 
+       /**
+        * @var callable|null Callback to generate a guess for {{REVISIONID}}
+        */
+       private $mSpeculativeRevIdCallback;
+
        /**
         * Enable limit report in an HTML comment on output
         */
@@ -210,6 +215,21 @@ class ParserOptions {
         */
        private $mExtraKey = '';
 
+       /**
+        * Are magic ISBN links enabled?
+        */
+       private $mMagicISBNLinks = true;
+
+       /**
+        * Are magic PMID links enabled?
+        */
+       private $mMagicPMIDLinks = true;
+
+       /**
+        * Are magic RFC links enabled?
+        */
+       private $mMagicRFCLinks = true;
+
        /**
         * Function to be called when an option is accessed.
         */
@@ -302,6 +322,11 @@ class ParserOptions {
                return $this->mTemplateCallback;
        }
 
+       /** @since 1.28 */
+       public function getSpeculativeRevIdCallback() {
+               return $this->mSpeculativeRevIdCallback;
+       }
+
        public function getEnableLimitReport() {
                return $this->mEnableLimitReport;
        }
@@ -409,6 +434,28 @@ class ParserOptions {
                return $this->getUserLangObj()->getCode();
        }
 
+       /**
+        * @since 1.28
+        * @return bool
+        */
+       public function getMagicISBNLinks() {
+               return $this->mMagicISBNLinks;
+       }
+
+       /**
+        * @since 1.28
+        * @return bool
+        */
+       public function getMagicPMIDLinks() {
+               return $this->mMagicPMIDLinks;
+       }
+       /**
+        * @since 1.28
+        * @return bool
+        */
+       public function getMagicRFCLinks() {
+               return $this->mMagicRFCLinks;
+       }
        public function setInterwikiMagic( $x ) {
                return wfSetVar( $this->mInterwikiMagic, $x );
        }
@@ -483,6 +530,11 @@ class ParserOptions {
                return wfSetVar( $this->mCurrentRevisionCallback, $x );
        }
 
+       /** @since 1.28 */
+       public function setSpeculativeRevIdCallback( $x ) {
+               return wfSetVar( $this->mSpeculativeRevIdCallback, $x );
+       }
+
        public function setTemplateCallback( $x ) {
                return wfSetVar( $this->mTemplateCallback, $x );
        }
@@ -652,7 +704,8 @@ class ParserOptions {
                        $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion,
                        $wgMaxArticleSize, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth,
                        $wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
-                       $wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion;
+                       $wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion,
+                       $wgEnableMagicLinks;
 
                // *UPDATE* ParserOptions::matches() if any of this changes as needed
                $this->mInterwikiMagic = $wgInterwikiMagic;
@@ -670,6 +723,9 @@ class ParserOptions {
                $this->mExternalLinkTarget = $wgExternalLinkTarget;
                $this->mDisableContentConversion = $wgDisableLangConversion;
                $this->mDisableTitleConversion = $wgDisableLangConversion || $wgDisableTitleConversion;
+               $this->mMagicISBNLinks = $wgEnableMagicLinks['ISBN'];
+               $this->mMagicPMIDLinks = $wgEnableMagicLinks['PMID'];
+               $this->mMagicRFCLinks = $wgEnableMagicLinks['RFC'];
 
                $this->mUser = $user;
                $this->mNumberHeadings = $user->getOption( 'numberheadings' );