X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FCoreParserFunctions.php;h=0e30b3c867ff791612dfa9415c795486c41a0a8d;hb=90232b6f36ee5a1473f2e865cc7a72d0014db4c7;hp=ad56afc4130cc71338de855509274ca2eef3943a;hpb=5612400c8271ac2762fd2ce9acfcc9a58e47f0ee;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index ad56afc413..0e30b3c867 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -830,7 +830,7 @@ class CoreParserFunctions { $restrictions = $titleObject->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have # multiple values in the future - return implode( $restrictions, ',' ); + return implode( ',', $restrictions ); } return ''; } @@ -882,7 +882,7 @@ class CoreParserFunctions { * Unicode-safe str_pad with the restriction that $length is forced to be <= 500 * @param Parser $parser * @param string $string - * @param int $length + * @param string $length * @param string $padding * @param int $direction * @return string @@ -897,7 +897,12 @@ class CoreParserFunctions { } # The remaining length to add counts down to 0 as padding is added - $length = min( $length, 500 ) - mb_strlen( $string ); + $length = min( (int)$length, 500 ) - mb_strlen( $string ); + if ( $length <= 0 ) { + // Nothing to add + return $string; + } + # $finalPadding is just $padding repeated enough times so that # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length $finalPadding = ''; @@ -1005,10 +1010,10 @@ class CoreParserFunctions { if ( $argA == 'nowiki' ) { // {{filepath: | option [| size] }} $isNowiki = true; - $parsedWidthParam = $parser->parseWidthParam( $argB ); + $parsedWidthParam = Parser::parseWidthParam( $argB ); } else { // {{filepath: [| size [|option]] }} - $parsedWidthParam = $parser->parseWidthParam( $argA ); + $parsedWidthParam = Parser::parseWidthParam( $argA ); $isNowiki = ( $argB == 'nowiki' ); } @@ -1339,7 +1344,7 @@ class CoreParserFunctions { foreach ( $sources[0] as $sourceTitle ) { $names[] = $sourceTitle->getPrefixedText(); } - return implode( $names, '|' ); + return implode( '|', $names ); } return ''; }