From: Aryeh Gregor Date: Thu, 26 Jul 2018 12:39:15 +0000 (+0300) Subject: Update CoreParserFunctions to use ContentLanguage X-Git-Tag: 1.34.0-rc.0~4490^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=81c60356ff5836e68ea23a24e915baf3493d7283;p=lhc%2Fweb%2Fwiklou.git Update CoreParserFunctions to use ContentLanguage Bug: T200246 Change-Id: I4e32195b46967d70e69eeccf3ecd1887e8ae7da8 --- diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 3c47de3f45..ae7ca6d428 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -135,14 +135,13 @@ class CoreParserFunctions { } public static function ns( $parser, $part1 = '' ) { - global $wgContLang; if ( intval( $part1 ) || $part1 == "0" ) { $index = intval( $part1 ); } else { - $index = $wgContLang->getNsIndex( str_replace( ' ', '_', $part1 ) ); + $index = $parser->getContentLanguage()->getNsIndex( str_replace( ' ', '_', $part1 ) ); } if ( $index !== false ) { - return $wgContLang->getFormattedNsText( $index ); + return $parser->getContentLanguage()->getFormattedNsText( $index ); } else { return [ 'found' => false ]; } @@ -197,13 +196,11 @@ class CoreParserFunctions { } public static function lcfirst( $parser, $s = '' ) { - global $wgContLang; - return $wgContLang->lcfirst( $s ); + return $parser->getContentLanguage()->lcfirst( $s ); } public static function ucfirst( $parser, $s = '' ) { - global $wgContLang; - return $wgContLang->ucfirst( $s ); + return $parser->getContentLanguage()->ucfirst( $s ); } /** @@ -212,8 +209,7 @@ class CoreParserFunctions { * @return string */ public static function lc( $parser, $s = '' ) { - global $wgContLang; - return $parser->markerSkipCallback( $s, [ $wgContLang, 'lc' ] ); + return $parser->markerSkipCallback( $s, [ $parser->getContentLanguage(), 'lc' ] ); } /** @@ -222,8 +218,7 @@ class CoreParserFunctions { * @return string */ public static function uc( $parser, $s = '' ) { - global $wgContLang; - return $parser->markerSkipCallback( $s, [ $wgContLang, 'uc' ] ); + return $parser->markerSkipCallback( $s, [ $parser->getContentLanguage(), 'uc' ] ); } public static function localurl( $parser, $s = '', $arg = null ) { @@ -742,7 +737,6 @@ class CoreParserFunctions { * @return string */ public static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) { - global $wgContLang; static $magicWords = null; if ( is_null( $magicWords ) ) { $magicWords = $parser->getMagicWordFactory()->newArray( [ @@ -772,7 +766,7 @@ class CoreParserFunctions { if ( !$title ) { # invalid title return self::formatRaw( 0, $raw, $parser->getFunctionLang() ); } - $wgContLang->findVariantLink( $name, $title, true ); + $parser->getContentLanguage()->findVariantLink( $name, $title, true ); // Normalize name for cache $name = $title->getDBkey();