From 398af31306a1c33f13b8c9ecee738f4d2b28916f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 29 Oct 2005 12:08:48 +0000 Subject: [PATCH] * strtolower() => $wgContLang->lc() * Merged two loops into one * We're UTF-8 only, always use the /u switch on the regex --- includes/DateFormatter.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/includes/DateFormatter.php b/includes/DateFormatter.php index eee039aa68..7e1e4b683f 100755 --- a/includes/DateFormatter.php +++ b/includes/DateFormatter.php @@ -41,19 +41,12 @@ class DateFormatter $this->monthNames = $this->getMonthRegex(); for ( $i=1; $i<=12; $i++ ) { - $this->xMonths[strtolower( $wgContLang->getMonthName( $i ) )] = $i; - } - for ( $i=1; $i<=12; $i++ ) { - $this->xMonths[strtolower( $wgContLang->getMonthAbbreviation( $i ) )] = $i; - } - - # Attempt at UTF-8 support, untested at the moment - if ( $wgInputEncoding == 'UTF-8' ) { - $this->regexTrail = '(?![a-z])/iu'; - } else { - $this->regexTrail = '(?![a-z])/i'; + $this->xMonths[$wgContLang->lc( $wgContLang->getMonthName( $i ) )] = $i; + $this->xMonths[$wgContLang->lc( $wgContLang->getMonthAbbreviation( $i ) )] = $i; } + $this->regexTrail = '(?![a-z])/iu'; + # Partial regular expressions $this->prxDM = '\[\[(\d{1,2})[ _](' . $this->monthNames . ')]]'; $this->prxMD = '\[\[(' . $this->monthNames . ')[ _](\d{1,2})]]'; @@ -247,7 +240,9 @@ class DateFormatter * @return string ISO month name */ function makeIsoMonth( $monthName ) { - $n = $this->xMonths[strtolower( $monthName )]; + global $wgContLang; + + $n = $this->xMonths[$wgContLang->lc( $monthName )]; return sprintf( '%02d', $n ); } -- 2.20.1