$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 );
$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;
$tail = '';
$text = '';
} else {
- $tail = $q[1];
- $text = $q[2];
+ list( , $tail, $text ) = $q;
}
}
if ( $useLinkPrefixExtension ) {
if ( preg_match( $e2, $s, $m ) ) {
- $prefix = $m[2];
- $s = $m[1];
+ list( , $s, $prefix ) = $m;
} else {
$prefix = '';
}
$ts = wfTimestamp( TS_UNIX, $this->mOptions->getTimestamp() );
Hooks::run( 'ParserGetVariableValueTs', [ &$parser, &$ts ] );
+ // In miser mode, disable words that always cause double-parses on page save (T137900)
+ static $slowRevWords = [ 'revisionid' => true ]; // @TODO: 'revisiontimestamp'
+ if (
+ isset( $slowRevWords[$index] ) &&
+ $this->siteConfig->get( 'MiserMode' ) &&
+ !$this->mOptions->getInterfaceMessage() &&
+ // @TODO: disallow this word on all namespaces
+ MWNamespace::isContent( $this->mTitle->getNamespace() )
+ ) {
+ return $this->mRevisionId ? '-' : '';
+ };
+
$pageLang = $this->getFunctionLang();
switch ( $index ) {
$name = strtolower( $name );
$attributes = Sanitizer::decodeTagAttributes( $attrText );
if ( isset( $params['attributes'] ) ) {
- $attributes = $attributes + $params['attributes'];
+ $attributes += $params['attributes'];
}
if ( isset( $this->mTagHooks[$name] ) ) {
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 );
'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'] );
# * bottom
# * text-bottom
- global $wgMediaInTargetLanguage;
-
# Protect LanguageConverter markup when splitting into parts
$parts = StringUtils::delimiterExplode(
'-{', '}-', '|', $options, true /* allow nesting */
# 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 ] );