Merge "Remove hitcounters and associated code"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index e6478a4..95cef5d 100644 (file)
@@ -112,8 +112,20 @@ class Parser {
        const OT_MSG = 3;
        const OT_PLAIN = 4; # like extractSections() - portions of the original are returned unchanged.
 
-       # Marker Suffix needs to be accessible staticly.
+       /**
+        * Prefix for temporary replacement strings generated by the preprocessor
+        * ("strip markers"). Using \x7f at the front gives us a little extra
+        * robustness since it shouldn't match when butted up against
+        * identifier-like string constructs.
+        *
+        * Must not consist of all title characters, or else it will change
+        * the behavior of <nowiki> in a link.
+        */
+       const MARKER_PREFIX = "\x7fUNIQ";
+       /** Suffix for strip markers */
        const MARKER_SUFFIX = "-QINU\x7f";
+       /** Regex which matches the state ID part of strip markers */
+       const MARKER_STATE_ID_REGEX = '[0-9a-f]{16}';
 
        # Markers used for wrapping the table of contents
        const TOC_START = '<mw:toc>';
@@ -330,18 +342,9 @@ class Parser {
                $this->mLangLinkLanguages = array();
                $this->currentRevisionCache = null;
 
-               /**
-                * Prefix for temporary replacement strings for the multipass parser.
-                * \x07 should never appear in input as it's disallowed in XML.
-                * Using it at the front also gives us a little extra robustness
-                * since it shouldn't match when butted up against identifier-like
-                * string constructs.
-                *
-                * Must not consist of all title characters, or else it will change
-                * the behavior of <nowiki> in a link.
-                */
-               $this->mUniqPrefix = "\x7fUNIQ" . self::getRandomString();
-               $this->mStripState = new StripState( $this->mUniqPrefix );
+               $stripId = self::getRandomString();
+               $this->mUniqPrefix = self::MARKER_PREFIX . $stripId;
+               $this->mStripState = new StripState( $stripId );
 
                # Clear these on every parse, bug 4549
                $this->mTplRedirCache = $this->mTplDomCache = array();