X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=b2d8511de867992199510fa3ff13584873b779d8;hp=f41ee01dcef4419709adef9aa977e570a9baa082;hb=ee56f00ddf0609082f8ae9a4dc3e6e1b6f54ddfd;hpb=f82b304f130608d1330972c370e9c8f82a0f1f47 diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index f41ee01dce..b2d8511de8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -270,15 +270,15 @@ class Parser { $this->mPreprocessorClass = $conf['preprocessorClass']; } elseif ( defined( 'HPHP_VERSION' ) ) { # Preprocessor_Hash is much faster than Preprocessor_DOM under HipHop - $this->mPreprocessorClass = 'Preprocessor_Hash'; + $this->mPreprocessorClass = Preprocessor_Hash::class; } elseif ( extension_loaded( 'domxml' ) ) { # PECL extension that conflicts with the core DOM extension (T15770) wfDebug( "Warning: you have the obsolete domxml extension for PHP. Please remove it!\n" ); - $this->mPreprocessorClass = 'Preprocessor_Hash'; + $this->mPreprocessorClass = Preprocessor_Hash::class; } elseif ( extension_loaded( 'dom' ) ) { - $this->mPreprocessorClass = 'Preprocessor_DOM'; + $this->mPreprocessorClass = Preprocessor_DOM::class; } else { - $this->mPreprocessorClass = 'Preprocessor_Hash'; + $this->mPreprocessorClass = Preprocessor_Hash::class; } wfDebug( __CLASS__ . ": using preprocessor: {$this->mPreprocessorClass}\n" ); } @@ -4679,7 +4679,7 @@ class Parser { * Wrapper for preprocess() * * @param string $text The text to preprocess - * @param ParserOptions $options Options + * @param ParserOptions $options * @param Title|null $title Title object or null to use $wgTitle * @return string */ @@ -5210,7 +5210,7 @@ class Parser { # Special case; width and height come in one variable together if ( $type === 'handler' && $paramName === 'width' ) { - $parsedWidthParam = $this->parseWidthParam( $value ); + $parsedWidthParam = self::parseWidthParam( $value ); if ( isset( $parsedWidthParam['width'] ) ) { $width = $parsedWidthParam['width']; if ( $handler->validateParam( 'width', $width ) ) { @@ -5972,7 +5972,7 @@ class Parser { /** * Remove any strip markers found in the given text. * - * @param string $text Input string + * @param string $text * @return string */ public function killMarkers( $text ) { @@ -6053,11 +6053,12 @@ class Parser { * Parsed a width param of imagelink like 300px or 200x300px * * @param string $value + * @param bool $parseHeight * * @return array * @since 1.20 */ - public function parseWidthParam( $value ) { + public static function parseWidthParam( $value, $parseHeight = true ) { $parsedWidthParam = []; if ( $value === '' ) { return $parsedWidthParam; @@ -6065,7 +6066,7 @@ class Parser { $m = []; # (T15500) In both cases (width/height and width only), # permit trailing "px" for backward compatibility. - if ( preg_match( '/^([0-9]*)x([0-9]*)\s*(?:px)?\s*$/', $value, $m ) ) { + if ( $parseHeight && preg_match( '/^([0-9]*)x([0-9]*)\s*(?:px)?\s*$/', $value, $m ) ) { $width = intval( $m[1] ); $height = intval( $m[2] ); $parsedWidthParam['width'] = $width;