* strtolower() => $wgContLang->lc()
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sat, 29 Oct 2005 12:08:48 +0000 (12:08 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sat, 29 Oct 2005 12:08:48 +0000 (12:08 +0000)
* Merged two loops into one
* We're UTF-8 only, always use the /u switch on the regex

includes/DateFormatter.php

index eee039a..7e1e4b6 100755 (executable)
@@ -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 );
        }