X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FDateFormatter.php;h=fb79442e68a44b8b093fc0b7e75f36e914d95c25;hb=b00021f0e7f7b11cf4a85406388ec66579d6e2b9;hp=2aefc0396fcbe01469534328b35f8d2f30d44d74;hpb=1054deece9c03a448f03cf3fd03493458d9bee09;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index 2aefc0396f..fb79442e68 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -21,6 +21,8 @@ * @ingroup Parser */ +use MediaWiki\MediaWikiServices; + /** * Date formatter, recognises dates in plain text and formats them according to user preferences. * @todo preferences, OutputPage @@ -131,9 +133,9 @@ class DateFormatter { * @return DateFormatter */ public static function getInstance( Language $lang = null ) { - global $wgContLang, $wgMainCacheType; + global $wgMainCacheType; - $lang = $lang ?: $wgContLang; + $lang = $lang ?? MediaWikiServices::getInstance()->getContentLanguage(); $cache = ObjectCache::getLocalServerInstance( $wgMainCacheType ); static $dateFormatter = false; @@ -211,10 +213,7 @@ class DateFormatter { */ private function replace( $matches ) { # Extract information from $matches - $linked = true; - if ( isset( $this->mLinked ) ) { - $linked = $this->mLinked; - } + $linked = $this->mLinked ?? true; $bits = []; $key = $this->keys[$this->mSource];