Merge "Disable expensive {{REVISIONID}} magic word in miser mode"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index b0c4bf9..a1a784b 100644 (file)
@@ -1029,7 +1029,7 @@ class Parser {
                $matches = [];
 
                $taglist = implode( '|', $elements );
-               $start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?" . ">)|<(!--)/i";
+               $start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?>)|<(!--)/i";
 
                while ( $text != '' ) {
                        $p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE );
@@ -1045,10 +1045,7 @@ class Parser {
                                $inside = $p[5];
                        } else {
                                # tag
-                               $element = $p[1];
-                               $attributes = $p[2];
-                               $close = $p[3];
-                               $inside = $p[4];
+                               list( , $element, $attributes, $close, $inside ) = $p;
                        }
 
                        $marker = self::MARKER_PREFIX . "-$element-" . sprintf( '%08X', $n++ ) . self::MARKER_SUFFIX;
@@ -1072,8 +1069,7 @@ class Parser {
                                        $tail = '';
                                        $text = '';
                                } else {
-                                       $tail = $q[1];
-                                       $text = $q[2];
+                                       list( , $tail, $text ) = $q;
                                }
                        }
 
@@ -2240,8 +2236,7 @@ class Parser {
 
                        if ( $useLinkPrefixExtension ) {
                                if ( preg_match( $e2, $s, $m ) ) {
-                                       $prefix = $m[2];
-                                       $s = $m[1];
+                                       list( , $s, $prefix ) = $m;
                                } else {
                                        $prefix = '';
                                }
@@ -3991,7 +3986,7 @@ class Parser {
                        $name = strtolower( $name );
                        $attributes = Sanitizer::decodeTagAttributes( $attrText );
                        if ( isset( $params['attributes'] ) ) {
-                               $attributes = $attributes + $params['attributes'];
+                               $attributes += $params['attributes'];
                        }
 
                        if ( isset( $this->mTagHooks[$name] ) ) {
@@ -4534,7 +4529,7 @@ class Parser {
                if ( $enoughToc && $isMain && !$this->mForceTocPosition ) {
                        // append the TOC at the beginning
                        // Top anchor now in skin
-                       $sections[0] = $sections[0] . $toc . "\n";
+                       $sections[0] .= $toc . "\n";
                }
 
                $full .= implode( '', $sections );
@@ -5134,7 +5129,7 @@ class Parser {
                                'img_link' => 'gallery-internal-link',
                        ];
                        if ( $handler ) {
-                               $paramMap = $paramMap + $handler->getParamMap();
+                               $paramMap += $handler->getParamMap();
                                // We don't want people to specify per-image widths.
                                // Additionally the width parameter would need special casing anyhow.
                                unset( $paramMap['img_width'] );
@@ -5294,8 +5289,6 @@ class Parser {
                #  * bottom
                #  * text-bottom
 
-               global $wgMediaInTargetLanguage;
-
                # Protect LanguageConverter markup when splitting into parts
                $parts = StringUtils::delimiterExplode(
                        '-{', '}-', '|', $options, true /* allow nesting */
@@ -5456,9 +5449,7 @@ class Parser {
                        # Use the "caption" for the tooltip text
                        $params['frame']['title'] = $this->stripAltText( $caption, $holders );
                }
-               if ( $wgMediaInTargetLanguage ) {
-                       $params['handler']['targetlang'] = $this->getTargetLanguage()->getCode();
-               }
+               $params['handler']['targetlang'] = $this->getTargetLanguage()->getCode();
 
                Hooks::run( 'ParserMakeImageParams', [ $title, $file, &$params, $this ] );