Merge "Do not run exact db match if offset is > 0"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 0fb021c..a32acc2 100644 (file)
@@ -251,7 +251,7 @@ class Parser {
        protected $mProfiler;
 
        /**
-        * @var \MediaWiki\Linker\LinkRenderer
+        * @var LinkRenderer
         */
        protected $mLinkRenderer;
 
@@ -887,10 +887,10 @@ class Parser {
        }
 
        /**
-        * Get a \MediaWiki\Linker\LinkRenderer instance to make links with
+        * Get a LinkRenderer instance to make links with
         *
         * @since 1.28
-        * @return \MediaWiki\Linker\LinkRenderer
+        * @return LinkRenderer
         */
        public function getLinkRenderer() {
                if ( !$this->mLinkRenderer ) {
@@ -4138,12 +4138,13 @@ class Parser {
                        # * <b> (r105284)
                        # * <bdi> (bug 72884)
                        # * <span dir="rtl"> and <span dir="ltr"> (bug 35167)
+                       # * <s> and <strike> (T35715)
                        # We strip any parameter from accepted tags (second regex), except dir="rtl|ltr" from <span>,
                        # to allow setting directionality in toc items.
                        $tocline = preg_replace(
                                [
-                                       '#<(?!/?(span|sup|sub|bdi|i|b)(?: [^>]*)?>).*?>#',
-                                       '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b))(?: .*?)?>#'
+                                       '#<(?!/?(span|sup|sub|bdi|i|b|s|strike)(?: [^>]*)?>).*?>#',
+                                       '#<(/?(?:span(?: dir="(?:rtl|ltr)")?|sup|sub|bdi|i|b|s|strike))(?: .*?)?>#'
                                ],
                                [ '', '<$1>' ],
                                $safeHeadline
@@ -6028,62 +6029,4 @@ class Parser {
                OutputPage::setupOOUI();
                $this->mOutput->setEnableOOUI( true );
        }
-
-       /**
-        * Escapes the given text so that it may be output using addWikiText()
-        * without any linking, formatting, etc. making its way through. This
-        * is achieved by substituting certain characters with HTML entities.
-        * As required by the callers, "<nowiki>" is not used.
-        *
-        * @since 1.28
-        *
-        * @param string $text Text to be escaped
-        * @return string
-        */
-       public function escapeWikitext( $text ) {
-               static $repl = null, $repl2 = null;
-               if ( $repl === null ) {
-                       $repl = [
-                               '"' => '&#34;', '&' => '&#38;', "'" => '&#39;', '<' => '&#60;',
-                               '=' => '&#61;', '>' => '&#62;', '[' => '&#91;', ']' => '&#93;',
-                               '{' => '&#123;', '|' => '&#124;', '}' => '&#125;', ';' => '&#59;',
-                               "\n#" => "\n&#35;", "\r#" => "\r&#35;",
-                               "\n*" => "\n&#42;", "\r*" => "\r&#42;",
-                               "\n:" => "\n&#58;", "\r:" => "\r&#58;",
-                               "\n " => "\n&#32;", "\r " => "\r&#32;",
-                               "\n\n" => "\n&#10;", "\r\n" => "&#13;\n",
-                               "\n\r" => "\n&#13;", "\r\r" => "\r&#13;",
-                               "\n\t" => "\n&#9;", "\r\t" => "\r&#9;", // "\n\t\n" is treated like "\n\n"
-                               "\n----" => "\n&#45;---", "\r----" => "\r&#45;---",
-                               '__' => '_&#95;', '://' => '&#58;//',
-                       ];
-
-                       $magicLinks = array_keys( array_filter( [
-                               'ISBN' => $this->mOptions->getMagicISBNLinks(),
-                               'PMID' => $this->mOptions->getMagicPMIDLinks(),
-                               'RFC' => $this->mOptions->getMagicRFCLinks(),
-                       ] ) );
-                       // We have to catch everything "\s" matches in PCRE
-                       foreach ( $magicLinks as $magic ) {
-                               $repl["$magic "] = "$magic&#32;";
-                               $repl["$magic\t"] = "$magic&#9;";
-                               $repl["$magic\r"] = "$magic&#13;";
-                               $repl["$magic\n"] = "$magic&#10;";
-                               $repl["$magic\f"] = "$magic&#12;";
-                       }
-
-                       // And handle protocols that don't use "://"
-                       global $wgUrlProtocols;
-                       $repl2 = [];
-                       foreach ( $wgUrlProtocols as $prot ) {
-                               if ( substr( $prot, -1 ) === ':' ) {
-                                       $repl2[] = preg_quote( substr( $prot, 0, -1 ), '/' );
-                               }
-                       }
-                       $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : '/^(?!)/';
-               }
-               $text = substr( strtr( "\n$text", $repl ), 1 );
-               $text = preg_replace( $repl2, '$1&#58;', $text );
-               return $text;
-       }
 }