Stylize languages/*, languages/classes/*, but not languages/messages/*
authorSam Reed <reedy@users.mediawiki.org>
Thu, 29 Jul 2010 09:43:18 +0000 (09:43 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 29 Jul 2010 09:43:18 +0000 (09:43 +0000)
72 files changed:
languages/Language.php
languages/LanguageConverter.php
languages/Names.php
languages/classes/LanguageAm.php
languages/classes/LanguageAr.php
languages/classes/LanguageBat_smg.php
languages/classes/LanguageBe.php
languages/classes/LanguageBe_tarask.php
languages/classes/LanguageBg.php
languages/classes/LanguageBh.php
languages/classes/LanguageBs.php
languages/classes/LanguageCs.php
languages/classes/LanguageCu.php
languages/classes/LanguageCy.php
languages/classes/LanguageDsb.php
languages/classes/LanguageEo.php
languages/classes/LanguageEt.php
languages/classes/LanguageFi.php
languages/classes/LanguageFr.php
languages/classes/LanguageGa.php
languages/classes/LanguageGan.php
languages/classes/LanguageGd.php
languages/classes/LanguageGv.php
languages/classes/LanguageHe.php
languages/classes/LanguageHi.php
languages/classes/LanguageHr.php
languages/classes/LanguageHsb.php
languages/classes/LanguageHu.php
languages/classes/LanguageHy.php
languages/classes/LanguageKaa.php
languages/classes/LanguageKk.deps.php
languages/classes/LanguageKk.php
languages/classes/LanguageKk_cyrl.php
languages/classes/LanguageKm.php
languages/classes/LanguageKsh.php
languages/classes/LanguageKu.deps.php
languages/classes/LanguageKu.php
languages/classes/LanguageKu_ku.php
languages/classes/LanguageLa.php
languages/classes/LanguageLn.php
languages/classes/LanguageLt.php
languages/classes/LanguageLv.php
languages/classes/LanguageMg.php
languages/classes/LanguageMk.php
languages/classes/LanguageMl.php
languages/classes/LanguageMo.php
languages/classes/LanguageMt.php
languages/classes/LanguageMy.php
languages/classes/LanguageNso.php
languages/classes/LanguagePl.php
languages/classes/LanguageRo.php
languages/classes/LanguageRu.php
languages/classes/LanguageSe.php
languages/classes/LanguageSh.php
languages/classes/LanguageSk.php
languages/classes/LanguageSl.php
languages/classes/LanguageSma.php
languages/classes/LanguageSr.deps.php
languages/classes/LanguageSr.php
languages/classes/LanguageSr_ec.php
languages/classes/LanguageSr_el.deps.php
languages/classes/LanguageSr_el.php
languages/classes/LanguageTg.php
languages/classes/LanguageTi.php
languages/classes/LanguageTl.php
languages/classes/LanguageTr.php
languages/classes/LanguageTyv.php
languages/classes/LanguageUk.php
languages/classes/LanguageWa.php
languages/classes/LanguageYue.php
languages/classes/LanguageZh.deps.php
languages/classes/LanguageZh.php

index 89e5230..4003fb1 100644 (file)
@@ -6,7 +6,7 @@
  * @ingroup Language
  */
 
-if( !defined( 'MEDIAWIKI' ) ) {
+if ( !defined( 'MEDIAWIKI' ) ) {
        echo "This file is part of MediaWiki, it is not a valid entry point.\n";
        exit( 1 );
 }
@@ -23,7 +23,7 @@ global $wgInputEncoding, $wgOutputEncoding;
 $wgInputEncoding    = 'UTF-8';
 $wgOutputEncoding      = 'UTF-8';
 
-if( function_exists( 'mb_strtoupper' ) ) {
+if ( function_exists( 'mb_strtoupper' ) ) {
        mb_internal_encoding( 'UTF-8' );
 }
 
@@ -41,7 +41,7 @@ class FakeConverter {
        function getVariants() { return array( $this->mLang->getCode() ); }
        function getPreferredVariant() { return $this->mLang->getCode(); }
        function getConvRuleTitle() { return false; }
-       function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) {}
+       function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) { }
        function getExtraHashOptions() { return ''; }
        function getParsedTitle() { return ''; }
        function markNoConversion( $text, $noParse = false ) { return $text; }
@@ -129,7 +129,7 @@ class Language {
         */
        static function factory( $code ) {
                if ( !isset( self::$mLangObjCache[$code] ) ) {
-                       if( count( self::$mLangObjCache ) > 10 ) {
+                       if ( count( self::$mLangObjCache ) > 10 ) {
                                // Don't keep a billion objects around, that's stupid.
                                self::$mLangObjCache = array();
                        }
@@ -161,7 +161,7 @@ class Language {
                        throw new MWException( "Language fallback loop detected when creating class $class\n" );
                }
 
-               if( !class_exists( $class ) ) {
+               if ( !class_exists( $class ) ) {
                        $fallback = Language::getFallbackFor( $code );
                        ++$recursionLevel;
                        $lang = Language::newFromCode( $fallback );
@@ -209,7 +209,7 @@ class Language {
         * Hook which will be called if this is the content language.
         * Descendants can use this to register hook functions or modify globals
         */
-       function initContLang() {}
+       function initContLang() { }
 
        /**
         * @deprecated Use User::getDefaultOptions()
@@ -274,7 +274,7 @@ class Language {
         */
        function getFormattedNamespaces() {
                $ns = $this->getNamespaces();
-               foreach( $ns as $k => $v ) {
+               foreach ( $ns as $k => $v ) {
                        $ns[$k] = strtr( $v, '_', ' ' );
                }
                return $ns;
@@ -464,7 +464,7 @@ class Language {
                global $IP;
                $names = array();
                $dir = opendir( "$IP/languages/messages" );
-               while( false !== ( $file = readdir( $dir ) ) ) {
+               while ( false !== ( $file = readdir( $dir ) ) ) {
                        $code = self::getCodeFromFileName( $file, 'Messages' );
                        if ( $code && isset( $allNames[$code] ) ) {
                                $names[$code] = $allNames[$code];
@@ -558,15 +558,15 @@ class Language {
 
                $minDiff = 0;
                if ( $data[0] == 'System' || $tz == '' ) {
-                       # Global offset in minutes.
-                       if( isset( $wgLocalTZoffset ) ) {
+                       #  Global offset in minutes.
+                       if ( isset( $wgLocalTZoffset ) ) {
                                $minDiff = $wgLocalTZoffset;
                        }
                } else if ( $data[0] == 'Offset' ) {
                        $minDiff = intval( $data[1] );
                } else {
                        $data = explode( ':', $tz );
-                       if( count( $data ) == 2 ) {
+                       if ( count( $data ) == 2 ) {
                                $data[0] = intval( $data[0] );
                                $data[1] = intval( $data[1] );
                                $minDiff = abs( $data[0] ) * 60 + $data[1];
@@ -588,12 +588,12 @@ class Language {
                # will normalize out-of-range values so we don't have to split $minDiff
                # into hours and minutes.
                $t = mktime( (
-                 (int)substr( $ts, 8, 2) ), # Hours
+                 (int)substr( $ts, 8, 2 ) ), # Hours
                  (int)substr( $ts, 10, 2 ) + $minDiff, # Minutes
                  (int)substr( $ts, 12, 2 ), # Seconds
                  (int)substr( $ts, 4, 2 ), # Month
                  (int)substr( $ts, 6, 2 ), # Day
-                 (int)substr( $ts, 0, 4 ) ); #Year
+                 (int)substr( $ts, 0, 4 ) ); # Year
 
                $date = date( 'YmdHis', $t );
                wfRestoreWarnings();
@@ -967,7 +967,7 @@ class Language {
                                } elseif ( $roman ) {
                                        $s .= self::romanNumeral( $num );
                                        $roman = false;
-                               } elseif( $hebrewNum ) {
+                               } elseif ( $hebrewNum ) {
                                        $s .= self::hebrewNumeral( $num );
                                        $hebrewNum = false;
                                } else {
@@ -1002,12 +1002,12 @@ class Language {
 
 
                // Add days of the past months of this year
-               for( $i = 0; $i < $gm; $i++ ) {
+               for ( $i = 0; $i < $gm; $i++ ) {
                        $gDayNo += self::$GREG_DAYS[$i];
                }
 
                // Leap years
-               if ( $gm > 1 && ( ( $gy%4 === 0 && $gy%100 !== 0 || ( $gy%400 == 0 ) ) ) ) {
+               if ( $gm > 1 && ( ( $gy % 4 === 0 && $gy % 100 !== 0 || ( $gy % 400 == 0 ) ) ) ) {
                        $gDayNo++;
                }
 
@@ -1068,11 +1068,11 @@ class Language {
                                                                (int)( ( 275 * $zm ) / 9 ) + $zd + 1729777;
                }
 
-               $zl = $zjd-1948440 + 10632;
+               $zl = $zjd -1948440 + 10632;
                $zn = (int)( ( $zl - 1 ) / 10631 );
                $zl = $zl - 10631 * $zn + 354;
-               $zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ((int)( ( 50 * $zl ) / 17719 ) ) + ( (int)( $zl / 5670 ) ) * ( (int)( ( 43 * $zl ) / 15238 ) );
-               $zl = $zl - ( (int)( ( 30 - $zj ) / 15 ) ) * ((int)( ( 17719 * $zj ) / 50 ) ) - ( (int)( $zj / 16 ) ) * ( (int)( ( 15238 * $zj ) / 43 ) ) + 29;
+               $zj = ( (int)( ( 10985 - $zl ) / 5316 ) ) * ( (int)( ( 50 * $zl ) / 17719 ) ) + ( (int)( $zl / 5670 ) ) * ( (int)( ( 43 * $zl ) / 15238 ) );
+               $zl = $zl - ( (int)( ( 30 - $zj ) / 15 ) ) * ( (int)( ( 17719 * $zj ) / 50 ) ) - ( (int)( $zj / 16 ) ) * ( (int)( ( 15238 * $zj ) / 43 ) ) + 29;
                $zm = (int)( ( 24 * $zl ) / 709 );
                $zd = $zl - (int)( ( 709 * $zm ) / 24 );
                $zy = 30 * $zn + $zj - 30;
@@ -1102,7 +1102,7 @@ class Language {
 
                # Month number when September = 1, August = 12
                $month += 4;
-               if( $month > 12 ) {
+               if ( $month > 12 ) {
                        # Next year
                        $month -= 12;
                        $year++;
@@ -1111,15 +1111,15 @@ class Language {
 
                # Calculate day of year from 1 September
                $dayOfYear = $day;
-               for( $i = 1; $i < $month; $i++ ) {
-                       if( $i == 6 ) {
+               for ( $i = 1; $i < $month; $i++ ) {
+                       if ( $i == 6 ) {
                                # February
                                $dayOfYear += 28;
                                # Check if the year is leap
-                               if( $year % 400 == 0 || ( $year % 4 == 0 && $year % 100 > 0 ) ) {
+                               if ( $year % 400 == 0 || ( $year % 4 == 0 && $year % 100 > 0 ) ) {
                                        $dayOfYear++;
                                }
-                       } elseif( $i == 8 || $i == 10 || $i == 1 || $i == 3 ) {
+                       } elseif ( $i == 8 || $i == 10 || $i == 1 || $i == 3 ) {
                                $dayOfYear += 30;
                        } else {
                                $dayOfYear += 31;
@@ -1130,7 +1130,7 @@ class Language {
                $start = self::hebrewYearStart( $hebrewYear );
 
                # Calculate next year's start
-               if( $dayOfYear <= $start ) {
+               if ( $dayOfYear <= $start ) {
                        # Day is before the start of the year - it is the previous year
                        # Next year's start
                        $nextStart = $start;
@@ -1139,7 +1139,7 @@ class Language {
                        $hebrewYear--;
                        # Add days since previous year's 1 September
                        $dayOfYear += 365;
-                       if( ( $year % 400 == 0 ) || ( $year % 100 != 0 && $year % 4 == 0 ) ) {
+                       if ( ( $year % 400 == 0 ) || ( $year % 100 != 0 && $year % 4 == 0 ) ) {
                                # Leap year
                                $dayOfYear++;
                        }
@@ -1158,7 +1158,7 @@ class Language {
                # Add 12 (or 13 for leap years) days to ignore the difference between
                # Hebrew and Gregorian year (353 at least vs. 365/6) - now the
                # difference is only about the year type
-               if( ( $year % 400 == 0 ) || ( $year % 100 != 0 && $year % 4 == 0 ) ) {
+               if ( ( $year % 400 == 0 ) || ( $year % 100 != 0 && $year % 4 == 0 ) ) {
                        $diff += 13;
                } else {
                        $diff += 12;
@@ -1178,14 +1178,14 @@ class Language {
                $hebrewDay = $hebrewDayOfYear;
                $hebrewMonth = 1;
                $days = 0;
-               while( $hebrewMonth <= 12 ) {
+               while ( $hebrewMonth <= 12 ) {
                        # Calculate days in this month
-                       if( $isLeap && $hebrewMonth == 6 ) {
+                       if ( $isLeap && $hebrewMonth == 6 ) {
                                # Adar in a leap year
-                               if( $isLeap ) {
+                               if ( $isLeap ) {
                                        # Leap year - has Adar I, with 30 days, and Adar II, with 29 days
                                        $days = 30;
-                                       if( $hebrewDay <= $days ) {
+                                       if ( $hebrewDay <= $days ) {
                                                # Day in Adar I
                                                $hebrewMonth = 13;
                                        } else {
@@ -1193,23 +1193,23 @@ class Language {
                                                $hebrewDay -= $days;
                                                # Try Adar II
                                                $days = 29;
-                                               if( $hebrewDay <= $days ) {
+                                               if ( $hebrewDay <= $days ) {
                                                        # Day in Adar II
                                                        $hebrewMonth = 14;
                                                }
                                        }
                                }
-                       } elseif( $hebrewMonth == 2 && $yearPattern == 2 ) {
+                       } elseif ( $hebrewMonth == 2 && $yearPattern == 2 ) {
                                # Cheshvan in a complete year (otherwise as the rule below)
                                $days = 30;
-                       } elseif( $hebrewMonth == 3 && $yearPattern == 0 ) {
+                       } elseif ( $hebrewMonth == 3 && $yearPattern == 0 ) {
                                # Kislev in an incomplete year (otherwise as the rule below)
                                $days = 29;
                        } else {
                                # Odd months have 30 days, even have 29
                                $days = 30 - ( $hebrewMonth - 1 ) % 2;
                        }
-                       if( $hebrewDay <= $days ) {
+                       if ( $hebrewDay <= $days ) {
                                # In the current month
                                break;
                        } else {
@@ -1232,21 +1232,21 @@ class Language {
                $a = intval( ( 12 * ( $year - 1 ) + 17 ) % 19 );
                $b = intval( ( $year - 1 ) % 4 );
                $m = 32.044093161144 + 1.5542417966212 * $a +  $b / 4.0 - 0.0031777940220923 * ( $year - 1 );
-               if( $m < 0 ) {
+               if ( $m < 0 ) {
                        $m--;
                }
                $Mar = intval( $m );
-               if( $m < 0 ) {
+               if ( $m < 0 ) {
                        $m++;
                }
                $m -= $Mar;
 
-               $c = intval( ( $Mar + 3 * ( $year - 1 ) + 5 * $b + 5 ) % 7);
-               if( $c == 0 && $a > 11 && $m >= 0.89772376543210 ) {
+               $c = intval( ( $Mar + 3 * ( $year - 1 ) + 5 * $b + 5 ) % 7 );
+               if ( $c == 0 && $a > 11 && $m >= 0.89772376543210 ) {
                        $Mar++;
-               } else if( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) {
+               } else if ( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) {
                        $Mar += 2;
-               } else if( $c == 2 || $c == 4 || $c == 6 ) {
+               } else if ( $c == 2 || $c == 4 || $c == 6 ) {
                        $Mar++;
                }
 
@@ -1388,14 +1388,14 @@ class Language {
                                        $num = 0;
                                } else {
                                        $s .= $table[$i][intval( ( $num / $pow10 ) )];
-                                       if( $pow10 == 1000 ) {
+                                       if ( $pow10 == 1000 ) {
                                                $s .= "'";
                                        }
                                }
                        }
                        $num = $num % $pow10;
                }
-               if( strlen( $s ) == 2 ) {
+               if ( strlen( $s ) == 2 ) {
                        $str = $s . "'";
                } else  {
                        $str = substr( $s, 0, strlen( $s ) - 2 ) . '"';
@@ -1443,8 +1443,8 @@ class Language {
        function dateFormat( $usePrefs = true ) {
                global $wgUser;
 
-               if( is_bool( $usePrefs ) ) {
-                       if( $usePrefs ) {
+               if ( is_bool( $usePrefs ) ) {
+                       if ( $usePrefs ) {
                                $datePreference = $wgUser->getDatePreference();
                        } else {
                                $datePreference = (string)User::getDefaultOption( 'date' );
@@ -1454,7 +1454,7 @@ class Language {
                }
 
                // return int
-               if( $datePreference == '' ) {
+               if ( $datePreference == '' ) {
                        return 'default';
                }
 
@@ -1530,7 +1530,7 @@ class Language {
         *                        validateTimeZone() in Special:Preferences
         * @return string
         */
-       function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false) {
+       function timeanddate( $ts, $adj = false, $format = true, $timecorrection = false ) {
                $ts = wfTimestamp( TS_MW, $ts );
                if ( $adj ) {
                        $ts = $this->userAdjust( $ts, $timecorrection );
@@ -1746,18 +1746,18 @@ class Language {
        }
 
        function checkTitleEncoding( $s ) {
-               if( is_array( $s ) ) {
+               if ( is_array( $s ) ) {
                        wfDebugDieBacktrace( 'Given array to checkTitleEncoding.' );
                }
                # Check for non-UTF-8 URLs
-               $ishigh = preg_match( '/[\x80-\xff]/', $s);
-               if( !$ishigh ) {
+               $ishigh = preg_match( '/[\x80-\xff]/', $s );
+               if ( !$ishigh ) {
                        return $s;
                }
 
                $isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
-               if( $isutf8 ) {
+               if ( $isutf8 ) {
                        return $s;
                }
 
@@ -1797,7 +1797,7 @@ class Language {
         * @return String
         */
        function normalizeForSearch( $string ) {
-               return self::convertDoubleWidth($string);
+               return self::convertDoubleWidth( $string );
        }
 
        /**
@@ -1808,7 +1808,7 @@ class Language {
                static $full = null;
                static $half = null;
 
-               if( $full === null ) {
+               if ( $full === null ) {
                        $fullWidth = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                        $halfWidth = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
                        $full = str_split( $fullWidth, 3 );
@@ -1904,7 +1904,7 @@ class Language {
                # wgInputEncoding, this text will be further converted
                # to wgOutputEncoding.
                global $wgEditEncoding;
-               if( $wgEditEncoding == '' || $wgEditEncoding == 'UTF-8' ) {
+               if ( $wgEditEncoding == '' || $wgEditEncoding == 'UTF-8' ) {
                        return $s;
                } else {
                        return $this->iconv( 'UTF-8', $wgEditEncoding, $s );
@@ -1914,12 +1914,12 @@ class Language {
        function recodeInput( $s ) {
                # Take the previous into account.
                global $wgEditEncoding;
-               if( $wgEditEncoding != '' ) {
+               if ( $wgEditEncoding != '' ) {
                        $enc = $wgEditEncoding;
                } else {
                        $enc = 'UTF-8';
                }
-               if( $enc == 'UTF-8' ) {
+               if ( $enc == 'UTF-8' ) {
                        return $s;
                } else {
                        return $this->iconv( $enc, 'UTF-8', $s );
@@ -2058,7 +2058,7 @@ class Language {
                        }
                }
 
-               if( !is_array( $rawEntry ) ) {
+               if ( !is_array( $rawEntry ) ) {
                        error_log( "\"$rawEntry\" is not a valid magic thingie for \"$mw->mId\"" );
                } else {
                        $mw->mCaseSensitive = $rawEntry[0];
@@ -2179,7 +2179,7 @@ class Language {
         * @param $_ mixed
         * @return string
         */
-       function commafy($_) {
+       function commafy( $_ ) {
                return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
        }
 
@@ -2202,13 +2202,13 @@ class Language {
        function listToText( $l ) {
                $s = '';
                $m = count( $l ) - 1;
-               if( $m == 1 ) {
+               if ( $m == 1 ) {
                        return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
                } else {
                        for ( $i = $m; $i >= 0; $i-- ) {
                                if ( $i == $m ) {
                                        $s = $l[$i];
-                               } else if( $i == $m - 1 ) {
+                               } else if ( $i == $m - 1 ) {
                                        $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
                                } else {
                                        $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
@@ -2381,8 +2381,8 @@ class Language {
                $entityState = 0; // 0-not entity, 1-entity
                $tag = $ret = $ch = '';
                $openTags = array();
-               $textLen = strlen($text);
-               for( $pos = 0; $pos < $textLen; ++$pos ) {
+               $textLen = strlen( $text );
+               for ( $pos = 0; $pos < $textLen; ++$pos ) {
                        $ch = $text[$pos];
                        $lastCh = $pos ? $text[$pos - 1] : '';
                        $ret .= $ch; // add to result string
@@ -2460,7 +2460,7 @@ class Language {
        // like strcspn() but adds the skipped chars to $ret
        private function truncate_skip( &$ret, $text, $search, $start, $len = -1 ) {
                $skipCount = 0;
-               if( $start < strlen( $text ) ) {
+               if ( $start < strlen( $text ) ) {
                        $skipCount = strcspn( $text, $search, $start, $len );
                        $ret .= substr( $text, $start, $skipCount );
                }
@@ -2472,11 +2472,11 @@ class Language {
        // (b) clear $tag value
        private function truncate_endBracket( &$tag, $tagType, $lastCh, &$openTags ) {
                $tag = ltrim( $tag );
-               if( $tag != '' ) {
-                       if( $tagType == 0 && $lastCh != '/' ) {
+               if ( $tag != '' ) {
+                       if ( $tagType == 0 && $lastCh != '/' ) {
                                $openTags[] = $tag; // tag opened (didn't close itself)
-                       } else if( $tagType == 1 ) {
-                               if( $openTags && $tag == $openTags[count( $openTags ) - 1] ) {
+                       } else if ( $tagType == 1 ) {
+                               if ( $openTags && $tag == $openTags[count( $openTags ) - 1] ) {
                                        array_pop( $openTags ); // tag closed
                                }
                        }
@@ -2574,7 +2574,7 @@ class Language {
                        return $str;
                }
 
-               foreach ( explode( ',', $scBlockExpiryOptions) as $option ) {
+               foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) {
                        if ( strpos( $option, ':' ) === false ) {
                                continue;
                        }
@@ -2905,13 +2905,13 @@ class Language {
        function formatSize( $size ) {
                // For small sizes no decimal places necessary
                $round = 0;
-               if( $size > 1024 ) {
+               if ( $size > 1024 ) {
                        $size = $size / 1024;
-                       if( $size > 1024 ) {
+                       if ( $size > 1024 ) {
                                $size = $size / 1024;
                                // For MB and bigger two decimal places are smarter
                                $round = 2;
-                               if( $size > 1024 ) {
+                               if ( $size > 1024 ) {
                                        $size = $size / 1024;
                                        $msg = 'size-gigabytes';
                                } else {
index f1a4c23..956cecf 100644 (file)
@@ -447,7 +447,7 @@ class LanguageConverter {
 
        /**
         * Apply manual conversion rules.
-        * 
+        *
         * @param $convRule Object: Object of ConverterRule
         */
        protected function applyManualConv( $convRule ) {
@@ -456,7 +456,7 @@ class LanguageConverter {
                // Bug 24072: $mConvRuleTitle was overwritten by other manual
                // rule(s) not for title, this breaks the title conversion.
                $newConvRuleTitle = $convRule->getTitle();
-               if( $newConvRuleTitle ) {
+               if ( $newConvRuleTitle ) {
                        // So I add an empty check for getTitle()
                        $this->mConvRuleTitle = $newConvRuleTitle;
                }
@@ -532,7 +532,7 @@ class LanguageConverter {
                $variant = $this->getPreferredVariant();
                return $this->convertTo( $text, $variant );
        }
-       
+
        /**
         * Same as convert() except a extra parameter to custom variant.
         *
@@ -562,7 +562,7 @@ class LanguageConverter {
                while ( $startPos < $length ) {
                        $m = false;
                        $pos = strpos( $text, '-{', $startPos );
-                       
+
                        if ( $pos === false ) {
                                // No more markup, append final segment
                                $out .= $this->autoConvert( substr( $text, $startPos ), $variant );
@@ -595,7 +595,7 @@ class LanguageConverter {
        protected function recursiveConvertRule( $text, $variant, &$startPos, $depth = 0 ) {
                // Quick sanity check (no function calls)
                if ( $text[$startPos] !== '-' || $text[$startPos + 1] !== '{' ) {
-                       throw new MWException( __METHOD__.': invalid input string' );
+                       throw new MWException( __METHOD__ . ': invalid input string' );
                }
 
                $startPos += 2;
@@ -628,7 +628,7 @@ class LanguageConverter {
                                                $inner .= '-{';
                                                if ( !$warningDone ) {
                                                        $inner .= '<span class="error">' .
-                                                               wfMsgForContent( 'language-converter-depth-warning', 
+                                                               wfMsgForContent( 'language-converter-depth-warning',
                                                                        $this->mMaxDepth ) .
                                                                '</span>';
                                                        $warningDone = true;
@@ -647,7 +647,7 @@ class LanguageConverter {
                                        $this->applyManualConv( $rule );
                                        return $rule->getDisplay();
                                default:
-                                       throw new MWException( __METHOD__.': invalid regex match' );
+                                       throw new MWException( __METHOD__ . ': invalid regex match' );
                        }
                }
 
@@ -841,7 +841,7 @@ class LanguageConverter {
 
                if ( strpos( $code, '/' ) === false ) {
                        $txt = $wgMessageCache->get( 'Conversiontable', true, $code );
-                       if( $txt === false ){
+                       if ( $txt === false ) {
                                # FIXME: this method doesn't seem to be expecting
                                # this possible outcome...
                                $txt = '&lt;Conversiontable&gt;';
@@ -1277,7 +1277,7 @@ class ConverterRule {
                        }
                        /*for unidirectional array fill to convert tables */
                        if ( ( $manLevel[$v] == 'bidirectional' || $manLevel[$v] == 'unidirectional' )
-                               && isset( $unidtable[$v] ) ) 
+                               && isset( $unidtable[$v] ) )
                        {
                                if ( isset( $this->mConvTable[$v] ) ) {
                                        $this->mConvTable[$v] = array_merge( $this->mConvTable[$v], $unidtable[$v] );
index 08163ee..36121ee 100644 (file)
        'kri' => 'Krio', # Krio
        'krj' => 'Kinaray-a', # Kinaray-a
        'ks' => 'कश्मीरी - (كشميري)',       # Kashmiri
-       'ksh' => 'Ripoarisch',  # Ripuarian 
+       'ksh' => 'Ripoarisch',  # Ripuarian
        'ku'  => 'Kurdî',      # Kurdish
        'ku-latn' => "\xE2\x80\xAAKurdî (latînî)\xE2\x80\xAC",       # Northern Kurdish Latin script
        'ku-arab' => "\xE2\x80\xABكوردي (عەرەبی)\xE2\x80\xAC",       # Northern Kurdish Arabic script
        'lzh' => '文言',      # Literary Chinese -- (bug 8217) lzh instead of zh-classical, http://www.sil.org/iso639-3/codes.asp?order=639_3&letter=l
        'lzz' => 'Lazuri',      # Laz
        'mai' => 'मैथिली', # Maithili
-       'map-bms' => 'Basa Banyumasan', # Banyumasan 
+       'map-bms' => 'Basa Banyumasan', # Banyumasan
        'mdf' => 'Мокшень',              # Moksha
        'mg' => 'Malagasy',             # Malagasy
        'mh' => 'Ebon',                 # Marshallese
        'rue' => 'русиньскый язык',       # Rusyn
        'ruq' => 'Vlăheşte',  # Megleno-Romanian (falls back to ruq-latn)
        'ruq-cyrl' => 'Влахесте',       # Megleno-Romanian (Cyrillic script)
-       #'ruq-grek' => 'Βλαεστε',        # Megleno-Romanian (Greek script)
+       # 'ruq-grek' => 'Βλαεστε',       # Megleno-Romanian (Greek script)
        'ruq-latn' => 'Vlăheşte',     # Megleno-Romanian (Latin script)
        'rw' => 'Kinyarwanda',  # Kinyarwanda, should possibly be Kinyarwandi
        'sa' => 'संस्कृत',        # Sanskrit
index cf31c70..a82c7c4 100644 (file)
@@ -8,9 +8,9 @@ class LanguageAm extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 70a53f8..77c4602 100644 (file)
@@ -7,18 +7,18 @@
  */
 class LanguageAr extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 6 );
 
                if ( $count == 0 ) {
                        $index = 0;
                } elseif ( $count == 1 ) {
                        $index = 1;
-               } elseif( $count == 2 ) {
+               } elseif ( $count == 2 ) {
                        $index = 2;
-               } elseif( $count % 100 >= 3 && $count % 100 <= 10 ) {
+               } elseif ( $count % 100 >= 3 && $count % 100 <= 10 ) {
                        $index = 3;
-               } elseif( $count % 100 >= 11 && $count % 100 <= 99 ) {
+               } elseif ( $count % 100 >= 11 && $count % 100 <= 99 ) {
                        $index = 4;
                } else {
                        $index = 5;
@@ -27,10 +27,10 @@ class LanguageAr extends Language {
        }
 
        /**
-        * Temporary hack for bug 9413: replace Arabic presentation forms with their 
-        * standard equivalents. 
+        * Temporary hack for bug 9413: replace Arabic presentation forms with their
+        * standard equivalents.
         *
-        * FIXME: This is language-specific for now only to avoid the negative 
+        * FIXME: This is language-specific for now only to avoid the negative
         * performance impact of enabling it for all languages.
         */
        function normalize( $s ) {
index 8d3450a..5b6c92a 100644 (file)
@@ -8,15 +8,15 @@
 class LanguageBat_smg extends Language {
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 4 );
 
                $count = abs( $count );
-               if ( $count === 0 || ($count%100 === 0 || ($count%100 >= 10 && $count%100 < 20)) ) {
+               if ( $count === 0 || ( $count % 100 === 0 || ( $count % 100 >= 10 && $count % 100 < 20 ) ) ) {
                        return $forms[2];
-               } elseif ( $count%10 === 1 ) {
+               } elseif ( $count % 10 === 1 ) {
                        return $forms[0];
-               } elseif ( $count%10 === 2 ) {
+               } elseif ( $count % 10 === 2 ) {
                        return $forms[1];
                } else {
                        return $forms[3];
index b86a5f3..0b14733 100644 (file)
 class LanguageBe extends Language {
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                // FIXME: CLDR defines 4 plural forms instead of 3
                //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index 82fc294..b29d877 100644 (file)
@@ -19,19 +19,19 @@ class LanguageBe_tarask extends Language {
        */
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                // FIXME: CLDR defines 4 plural forms instead of 3
                //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
@@ -40,9 +40,9 @@ class LanguageBe_tarask extends Language {
                        }
                }
        }
-       
+
        /*
-        * The Belarusian language uses apostrophe sign, 
+        * The Belarusian language uses apostrophe sign,
         * but the characters used for this could be both U+0027 and U+2019.
         * This function unifies apostrophe sign in search index values
         * to enable seach using both apostrophe signs.
@@ -61,16 +61,16 @@ class LanguageBe_tarask extends Language {
                wfProfileOut( __METHOD__ );
                return $s;
        }
-       
+
        /*
         * Four-digit number should be without group commas (spaces)
         * So "1 234 567", "12 345" but "1234"
         */
-       function commafy($_) {
-               if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) {
+       function commafy( $_ ) {
+               if ( preg_match( '/^-?\d{1,4}(\.\d*)?$/', $_ ) ) {
                        return $_;
                } else {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                }
        }
 }
index bb10675..d6d3409 100644 (file)
@@ -9,9 +9,9 @@ class LanguageBg extends Language {
         * ISO number formatting: 123 456 789,99.
         * Avoid tripple grouping by numbers with whole part up to 4 digits.
         */
-       function commafy($_) {
-               if (!preg_match('/^\d{1,4}$/',$_)) {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+       function commafy( $_ ) {
+               if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index 80119ec..fa6005f 100644 (file)
@@ -8,9 +8,9 @@ class LanguageBh extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index df522f8..6432109 100644 (file)
@@ -7,15 +7,15 @@
 class LanguageBs extends Language {
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
                // FIXME: CLDR defines 4 plural forms instead of 3. Plural for decimals is missing.
                //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
@@ -32,7 +32,7 @@ class LanguageBs extends Language {
         */
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['bs'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['bs'][$case][$word] ) ) {
                        return $wgGrammarForms['bs'][$case][$word];
                }
                switch ( $case ) {
index ca1669b..935aed4 100644 (file)
@@ -12,7 +12,7 @@ class LanguageCs extends Language {
        #   {{plural:count|form1|form0,2+}} for single form plurals
        # in a message
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
                switch ( $count ) {
index e4ef7b0..1aecbca 100644 (file)
@@ -9,36 +9,36 @@ class LanguageCu extends Language {
        # Invoked with {{grammar:case|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['сu'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['сu'][$case][$word] ) ) {
                        return $wgGrammarForms['сu'][$case][$word];
                }
 
                # These rules are not perfect, but they are currently only used for site names so it doesn't
                # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
 
-               #join and array_slice instead mb_substr
+               # join and array_slice instead mb_substr
                $ar = array();
                preg_match_all( '/./us', $word, $ar );
-               if (!preg_match("/[a-zA-Z_]/us", $word))
+               if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
                        switch ( $case ) {
-                               case 'genitive': #родительный падеж
-                                       if ((join('',array_slice($ar[0],-4))=='вики') || (join('',array_slice($ar[0],-4))=='Вики'))
-                                               {}
-                                       elseif (join('',array_slice($ar[0],-2))=='ї')
-                                               $word = join('',array_slice($ar[0],0,-2)).'їѩ';
+                               case 'genitive': # родительный падеж
+                                       if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) )
+                                               { }
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
                                        break;
-                               case 'accusative': #винительный падеж
-                                       #stub
+                               case 'accusative': # винительный падеж
+                                       # stub
                                        break;
                        }
                return $word;
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 4 );
 
-               switch ($count % 10) {
+               switch ( $count % 10 ) {
                        case 1:  return $forms[0];
                        case 2:  return $forms[1];
                        case 3:
index 9a39539..d7727de 100644 (file)
@@ -7,7 +7,7 @@
  */
 class LanguageCy extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                // FIXME: CLDR defines 4 plural forms; very different, actually.
                // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#cy
index 4ea1b89..1c97c8a 100644 (file)
@@ -27,7 +27,7 @@ class LanguageDsb extends Language {
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 4 );
 
                switch ( abs( $count ) % 100 ) {
index 822a43f..d879235 100644 (file)
@@ -8,7 +8,7 @@ class LanguageEo extends Language {
        function iconv( $in, $out, $string ) {
                # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
                # Ni ankaŭ konvertu X-sistemajn surogotajn
-               if( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0) {
+               if ( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0 ) {
                        $xu = array (
                                'xx' => 'x' , 'xX' => 'x' ,
                                'Xx' => 'X' , 'XX' => 'X' ,
@@ -27,7 +27,7 @@ class LanguageEo extends Language {
                                ) ;
                        return preg_replace ( '/([cghjsu]x?)((?:xx)*)(?!x)/ei',
                          'strtr( "$1", $xu ) . strtr( "$2", $xu )', $string );
-               } else if( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
+               } else if ( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
                        $ux = array (
                                'x' => 'xx' , 'X' => 'Xx' ,
                                "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" ,
@@ -38,7 +38,7 @@ class LanguageEo extends Language {
                                "\xc5\xac" => "Ux" , "\xc5\xad" => "ux"
                        ) ;
                        # Double Xs only if they follow cxapelutaj literoj.
-                       return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
+                       return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]' .
                          '|\xc5[\x9c\x9d\xac\xad])x*)/ei', 'strtr( "$1", $ux )', $string );
                }
                return parent::iconv( $in, $out, $string );
@@ -46,20 +46,20 @@ class LanguageEo extends Language {
 
        function checkTitleEncoding( $s ) {
                # Check for X-system backwards-compatibility URLs
-               $ishigh = preg_match( '/[\x80-\xff]/', $s);
+               $ishigh = preg_match( '/[\x80-\xff]/', $s );
                $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                        '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
 
-               if($ishigh and !$isutf) {
+               if ( $ishigh and !$isutf ) {
                        # Assume Latin1
                        $s = utf8_encode( $s );
                } else {
-                       if( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
+                       if ( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]' .
                                '|\xc5[\x9c\x9d\xac\xad])/', $s ) )
                        return $s;
                }
 
-               //if( preg_match( '/[cghjsu]x/i', $s ) )
+               // if( preg_match( '/[cghjsu]x/i', $s ) )
                //      return $this->iconv( 'x', 'utf-8', $s );
                return $s;
        }
index c6729d9..226c2d7 100644 (file)
@@ -9,9 +9,9 @@ class LanguageEt extends Language {
        /**
         * Avoid grouping whole numbers between 0 to 9999
         */
-       function commafy($_) {
-               if (!preg_match('/^\d{1,4}$/',$_)) {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+       function commafy( $_ ) {
+               if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index d1348f0..30da174 100644 (file)
@@ -12,7 +12,7 @@ class LanguageFi extends Language {
        # Invoked with {{GRAMMAR:case|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['fi'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['fi'][$case][$word] ) ) {
                        return $wgGrammarForms['fi'][$case][$word];
                }
 
@@ -38,18 +38,18 @@ class LanguageFi extends Language {
                                $word .= 'n';
                                break;
                        case 'elative':
-                               $word .= ($aou ? 'sta' : 'stä');
+                               $word .= ( $aou ? 'sta' : 'stä' );
                                break;
                        case 'partitive':
-                               $word .= ($aou ? 'a' : 'ä');
+                               $word .= ( $aou ? 'a' : 'ä' );
                                break;
                        case 'illative':
                                # Double the last letter and add 'n'
                                # mb_substr has a compatibility function in GlobalFunctions.php
-                               $word = $word . mb_substr($word, -1) . 'n';
+                               $word = $word . mb_substr( $word, -1 ) . 'n';
                                break;
                        case 'inessive':
-                               $word .= ($aou ? 'ssa' : 'ssä');
+                               $word .= ( $aou ? 'ssa' : 'ssä' );
                                break;
                }
                return $word;
@@ -113,15 +113,15 @@ class LanguageFi extends Language {
                );
 
                $final = '';
-               $tokens = explode ( ' ', $str);
-               foreach( $tokens as $item ) {
-                       if ( !is_numeric($item) ) {
-                               if ( count ( explode( '-', $item ) ) == 3 && strlen($item) == 10 ) {
+               $tokens = explode ( ' ', $str );
+               foreach ( $tokens as $item ) {
+                       if ( !is_numeric( $item ) ) {
+                               if ( count ( explode( '-', $item ) ) == 3 && strlen( $item ) == 10 ) {
                                        list( $yyyy, $mm, $dd ) = explode( '-', $item );
-                                       $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000");
+                                       $final .= ' ' . $this->date( "{$yyyy}{$mm}{$dd}00000000" );
                                        continue;
                                }
-                               if( isset( $weekds[$item] ) ) {
+                               if ( isset( $weekds[$item] ) ) {
                                        $final .= ' ' . $weekds[$item];
                                        continue;
                                }
index 7341bb8..dec1204 100644 (file)
@@ -9,9 +9,9 @@ class LanguageFr extends Language {
         * Use singular form for zero (see bug 7309)
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 344fdc8..a55e5f3 100644 (file)
@@ -9,13 +9,13 @@ class LanguageGa extends Language {
        # Invoked with {{GRAMMAR:transformation|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['ga'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['ga'][$case][$word] ) ) {
                        return $wgGrammarForms['ga'][$case][$word];
                }
 
                switch ( $case ) {
                case 'ainmlae':
-                       switch ($word) {
+                       switch ( $word ) {
                        case 'an Domhnach':
                                $word = 'Dé Domhnaigh'; break;
                        case 'an Luan':
@@ -36,14 +36,14 @@ class LanguageGa extends Language {
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ga
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == 1 ) {
                        $index = 0;
-               } elseif( $count == 2 ) {
+               } elseif ( $count == 2 ) {
                        $index = 1;
                } else {
                        $index = 2;
index 54202e4..da5e1d2 100644 (file)
@@ -1,35 +1,35 @@
 <?php
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageZh.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageZh.php' );
 
 /**
  * @ingroup Language
  */
 class GanConverter extends LanguageConverter {
 
-       function __construct($langobj, $maincode,
-                                                               $variants=array(),
-                                                               $variantfallbacks=array(),
+       function __construct( $langobj, $maincode,
+                                                               $variants = array(),
+                                                               $variantfallbacks = array(),
                                                                $flags = array(),
                                                                $manualLevel = array() ) {
                $this->mDescCodeSep = ':';
                $this->mDescVarSep = ';';
-               parent::__construct($langobj, $maincode,
+               parent::__construct( $langobj, $maincode,
                                                                        $variants,
                                                                        $variantfallbacks,
                                                                        $flags,
-                                                                       $manualLevel);
+                                                                       $manualLevel );
                $names = array(
                        'gan'      => '原文',
                        'gan-hans' => '简体',
                        'gan-hant' => '繁體',
                );
-               $this->mVariantNames = array_merge($this->mVariantNames,$names);
+               $this->mVariantNames = array_merge( $this->mVariantNames, $names );
        }
 
        function loadDefaultTables() {
-               require( dirname(__FILE__)."/../../includes/ZhConversion.php" );
+               require( dirname( __FILE__ ) . "/../../includes/ZhConversion.php" );
                $this->mTables = array(
                        'gan-hans' => new ReplacementArray( $zh2Hans ),
                        'gan-hant' => new ReplacementArray( $zh2Hant ),
@@ -41,7 +41,7 @@ class GanConverter extends LanguageConverter {
           to mark anything.
           $noParse is there for compatibility with LanguageConvert::markNoConversion
         */
-       function markNoConversion($text, $noParse = false) {
+       function markNoConversion( $text, $noParse = false ) {
                return $text;
        }
 
@@ -62,20 +62,20 @@ class LanguageGan extends LanguageZh {
                global $wgHooks;
                parent::__construct();
 
-               $variants = array('gan','gan-hans','gan-hant');
+               $variants = array( 'gan', 'gan-hans', 'gan-hant' );
                $variantfallbacks = array(
-                       'gan'      => array('gan-hans','gan-hant'),
-                       'gan-hans' => array('gan'),
-                       'gan-hant' => array('gan'),
+                       'gan'      => array( 'gan-hans', 'gan-hant' ),
+                       'gan-hans' => array( 'gan' ),
+                       'gan-hant' => array( 'gan' ),
                );
-               $ml=array(
+               $ml = array(
                        'gan'      => 'disable',
                );
 
                $this->mConverter = new GanConverter( $this, 'gan',
                                                                $variants, $variantfallbacks,
                                                                array(),
-                                                               $ml);
+                                                               $ml );
 
                $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
        }
@@ -84,13 +84,13 @@ class LanguageGan extends LanguageZh {
        function segmentForDiff( $text ) {
                return preg_replace(
                        "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
-                       "' ' .\"$1\"", $text);
+                       "' ' .\"$1\"", $text );
        }
 
        function unsegmentForDiff( $text ) {
                return preg_replace(
                        "/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e",
-                       "\"$1\"", $text);
+                       "\"$1\"", $text );
        }
 
        // word segmentation
@@ -103,7 +103,7 @@ class LanguageGan extends LanguageZh {
                $terms = implode( '|', $termsArray );
                $terms = self::convertDoubleWidth( $terms );
                $terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) );
-               $ret = array_unique( explode('|', $terms) );
+               $ret = array_unique( explode( '|', $terms ) );
                return $ret;
        }
 }
index 6c307f6..1b1b278 100644 (file)
@@ -18,7 +18,7 @@ class LanguageGd extends Language {
         *
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 4 );
 
                $count = abs( $count );
index 5683826..6e25e21 100644 (file)
@@ -9,14 +9,14 @@
 class LanguageGv extends Language {
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                $forms = $this->preConvertPlural( $forms, 4 );
 
-               if ($count > 0 && ($count % 20) === 0 ) {
+               if ( $count > 0 && ( $count % 20 ) === 0 ) {
                        return $forms[0];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1: return $forms[1];
                                case 2: return $forms[2];
                                default: return $forms[3];
index 373d921..95beca7 100644 (file)
@@ -20,7 +20,7 @@ class LanguageHe extends Language {
         */
        public function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['he'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['he'][$case][$word] ) ) {
                        return $wgGrammarForms['he'][$case][$word];
                }
 
@@ -29,7 +29,7 @@ class LanguageHe extends Language {
                        case 'תחילית':
                                # Duplicate the "Waw" if prefixed
                                if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
-                                       $word = "ו".$word;
+                                       $word = "ו" . $word;
                                }
 
                                # Remove the "He" if prefixed
@@ -39,7 +39,7 @@ class LanguageHe extends Language {
 
                                # Add a hyphen if non-Hebrew letters
                                if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
-                                       $word = "־".$word;
+                                       $word = "־" . $word;
                                }
                }
 
@@ -54,12 +54,12 @@ class LanguageHe extends Language {
         * @return String: the suited form of word
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == '1' ) {
                        return $forms[0];
-               } elseif ( $count == '2' && isset($forms[2]) ) {
+               } elseif ( $count == '2' && isset( $forms[2] ) ) {
                        return $forms[2];
                } else {
                        return $forms[1];
index 705c73b..14d32a3 100644 (file)
@@ -8,9 +8,9 @@ class LanguageHi extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index d8e8487..888029b 100644 (file)
@@ -7,15 +7,15 @@
 class LanguageHr extends Language {
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                // FIXME: CLDR defines 4 plural forms instead of 3. Plural for for decimals is missing.
                //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index f141878..1b83f5a 100644 (file)
@@ -28,7 +28,7 @@ class LanguageHsb extends Language {
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 4 );
 
                switch ( abs( $count ) % 100 ) {
index 7845bdb..44ce330 100644 (file)
@@ -7,7 +7,7 @@
 class LanguageHu extends Language {
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms[$this->getCode()][$case][$word]) ) {
+               if ( isset( $wgGrammarForms[$this->getCode()][$case][$word] ) ) {
                        return $wgGrammarForms[$this->getCode()][$case][$word];
                }
 
index 73777de..527a55f 100644 (file)
@@ -10,58 +10,58 @@ class LanguageHy extends Language {
        # Invoked with {{grammar:case|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['hy'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['hy'][$case][$word] ) ) {
                        return $wgGrammarForms['hy'][$case][$word];
                }
 
                # These rules are not perfect, but they are currently only used for site names so it doesn't
                # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
 
-               #join and array_slice instead mb_substr
+               # join and array_slice instead mb_substr
                $ar = array();
                preg_match_all( '/./us', $word, $ar );
-               if (!preg_match("/[a-zA-Z_]/us", $word))
+               if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
                        switch ( $case ) {
-                               case 'genitive': #սեռական հոլով
-                                       if (join('',array_slice($ar[0],-1))=='ա')
-                                               $word = join('',array_slice($ar[0],0,-1)).'այի';
-                                       elseif (join('',array_slice($ar[0],-1))=='ո')
-                                               $word=join('',array_slice($ar[0],0,-1)).'ոյի';
-                                       elseif (join('',array_slice($ar[0],-4))=='գիրք')
-                                               $word=join('',array_slice($ar[0],0,-4)).'գրքի';
+                               case 'genitive': # սեռական հոլով
+                                       if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' )
+                                               $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
+                                       elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' )
+                                               $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
+                                       elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' )
+                                               $word = join( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
                                        else
-                                               $word.='ի';
+                                               $word .= 'ի';
                                        break;
-                               case 'dative':  #Տրական հոլով
-                                       #stub
+                               case 'dative':  # Տրական հոլով
+                                       # stub
                                        break;
-                               case 'accusative': #Հայցական հոլով
-                                       #stub
+                               case 'accusative': # Հայցական հոլով
+                                       # stub
                                        break;
                                case 'instrumental':  #
-                                       #stub
+                                       # stub
                                        break;
                                case 'prepositional': #
-                                       #stub
+                                       # stub
                                        break;
                        }
                return $word;
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return (abs($count) <= 1) ? $forms[0] : $forms[1];
+               return ( abs( $count ) <= 1 ) ? $forms[0] : $forms[1];
        }
 
        /*
         * Armenian numeric format is "12 345,67" but "1234,56"
         */
 
-       function commafy($_) {
-               if (!preg_match('/^\d{1,4}$/',$_)) {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+       function commafy( $_ ) {
+               if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index f9f61db..4c6710e 100644 (file)
@@ -51,7 +51,7 @@ class LanguageKaa extends Language {
         */
        function commafy( $_ ) {
                if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
-                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index aa7361b..0a2a8af 100644 (file)
@@ -5,5 +5,5 @@
 // changed on a subsequent page view.
 // see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageKk_cyrl.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageKk_cyrl.php' );
index 318b82a..c9b016b 100644 (file)
@@ -1,15 +1,15 @@
 <?php
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageKk_cyrl.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageKk_cyrl.php' );
 
 define( 'KK_C_UC', 'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase
 define( 'KK_C_LC', 'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase
 define( 'KK_L_UC', 'AÄBCÇDEÉFGĞHIİÏJKLMNÑOÖPQRSŞTUÜVWXYÝZ' ); # Kazakh Latin uppercase
 define( 'KK_L_LC', 'aäbcçdeéfgğhıiïjklmnñoöpqrsştuüvwxyýz' ); # Kazakh Latin lowercase
-//define( 'KK_A', 'ٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ' ); # Kazakh Arabic
+// define( 'KK_A', 'ٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ' ); # Kazakh Arabic
 define( 'H_HAMZA', 'ٴ' ); # U+0674 ARABIC LETTER HIGH HAMZA
-//define( 'ZWNJ', '‌' ); # U+200C ZERO WIDTH NON-JOINER
+// define( 'ZWNJ', '‌' ); # U+200C ZERO WIDTH NON-JOINER
 
 /** Kazakh (Қазақша)
  * converter routines
@@ -18,10 +18,10 @@ define( 'H_HAMZA', 'ٴ' ); # U+0674 ARABIC LETTER HIGH HAMZA
  */
 class KkConverter extends LanguageConverter {
 
-       function __construct($langobj, $maincode,
-                                                               $variants=array(),
-                                                               $variantfallbacks=array(),
-                                                               $flags = array()) {
+       function __construct( $langobj, $maincode,
+                                                               $variants = array(),
+                                                               $variantfallbacks = array(),
+                                                               $flags = array() ) {
                parent::__construct( $langobj, $maincode,
                        $variants, $variantfallbacks, $flags );
 
@@ -46,9 +46,9 @@ class KkConverter extends LanguageConverter {
                        'kk-cyrl' => new ReplacementArray( $kk2Cyrl ),
                        'kk-latn' => new ReplacementArray( $kk2Latn ),
                        'kk-arab' => new ReplacementArray( $kk2Arab ),
-                       'kk-kz'   => new ReplacementArray( array_merge($kk2Cyrl, $kk2KZ) ),
-                       'kk-tr'   => new ReplacementArray( array_merge($kk2Latn, $kk2TR) ),
-                       'kk-cn'   => new ReplacementArray( array_merge($kk2Arab, $kk2CN) ),
+                       'kk-kz'   => new ReplacementArray( array_merge( $kk2Cyrl, $kk2KZ ) ),
+                       'kk-tr'   => new ReplacementArray( array_merge( $kk2Latn, $kk2TR ) ),
+                       'kk-cn'   => new ReplacementArray( array_merge( $kk2Arab, $kk2CN ) ),
                        'kk'      => new ReplacementArray()
                );
        }
@@ -62,24 +62,24 @@ class KkConverter extends LanguageConverter {
        function loadRegs() {
 
                $this->mCyrl2Latn = array(
-                       ## Punctuation
+                       # # Punctuation
                        '/№/u' => 'No.',
-                       ## Е after vowels
+                       # # Е after vowels
                        '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])Е/u' => '$1YE',
                        '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1ye',
-                       ## leading ЁЮЯЩ
-                       '/^Ё(['.KK_C_UC.']|$)/u' => 'YO$1', '/^Ё(['.KK_C_LC.']|$)/u' => 'Yo$1',
-                       '/^Ю(['.KK_C_UC.']|$)/u' => 'YU$1', '/^Ю(['.KK_C_LC.']|$)/u' => 'Yu$1',
-                       '/^Я(['.KK_C_UC.']|$)/u' => 'YA$1', '/^Я(['.KK_C_LC.']|$)/u' => 'Ya$1',
-                       '/^Щ(['.KK_C_UC.']|$)/u' => 'ŞÇ$1', '/^Щ(['.KK_C_LC.']|$)/u' => 'Şç$1',
-                       ## other ЁЮЯ
+                       # # leading ЁЮЯЩ
+                       '/^Ё([' . KK_C_UC . ']|$)/u' => 'YO$1', '/^Ё([' . KK_C_LC . ']|$)/u' => 'Yo$1',
+                       '/^Ю([' . KK_C_UC . ']|$)/u' => 'YU$1', '/^Ю([' . KK_C_LC . ']|$)/u' => 'Yu$1',
+                       '/^Я([' . KK_C_UC . ']|$)/u' => 'YA$1', '/^Я([' . KK_C_LC . ']|$)/u' => 'Ya$1',
+                       '/^Щ([' . KK_C_UC . ']|$)/u' => 'ŞÇ$1', '/^Щ([' . KK_C_LC . ']|$)/u' => 'Şç$1',
+                       # # other ЁЮЯ
                        '/Ё/u' => 'YO', '/ё/u' => 'yo',
                        '/Ю/u' => 'YU', '/ю/u' => 'yu',
                        '/Я/u' => 'YA', '/я/u' => 'ya',
                        '/Щ/u' => 'ŞÇ', '/щ/u' => 'şç',
-                       ## soft and hard signs
+                       # # soft and hard signs
                        '/[ъЪ]/u' => 'ʺ', '/[ьЬ]/u' => 'ʹ',
-                       ## other characters
+                       # # other characters
                        '/А/u' => 'A', '/а/u' => 'a', '/Ә/u' => 'Ä', '/ә/u' => 'ä',
                        '/Б/u' => 'B', '/б/u' => 'b', '/В/u' => 'V', '/в/u' => 'v',
                        '/Г/u' => 'G', '/г/u' => 'g', '/Ғ/u' => 'Ğ', '/ғ/u' => 'ğ',
@@ -101,24 +101,24 @@ class KkConverter extends LanguageConverter {
                );
 
                $this->mLatn2Cyrl = array(
-                       ## Punctuation
+                       # # Punctuation
                        '/#|No\./' => '№',
-                       ## Şç
-                       '/ŞÇʹ/u'=> 'ЩЬ', '/Şçʹ/u'=> 'Щь', '/Şçʹ/u'=> 'Щь',
+                       # # Şç
+                       '/ŞÇʹ/u' => 'ЩЬ', '/Şçʹ/u' => 'Щь', '/Şçʹ/u' => 'Щь',
                        '/Ş[Çç]/u' => 'Щ', '/şç/u' => 'щ',
-                       ## soft and hard signs
-                       '/(['.KK_L_UC.'])ʺ(['.KK_L_UC.'])/u' => '$1Ъ$2',
-                       '/ʺ(['.KK_L_LC.'])/u' => 'ъ$1',
-                       '/(['.KK_L_UC.'])ʹ(['.KK_L_UC.'])/u' => '$1Ь$2',
-                       '/ʹ(['.KK_L_LC.'])/u' => 'ь$1',
+                       # # soft and hard signs
+                       '/([' . KK_L_UC . '])ʺ([' . KK_L_UC . '])/u' => '$1Ъ$2',
+                       '/ʺ([' . KK_L_LC . '])/u' => 'ъ$1',
+                       '/([' . KK_L_UC . '])ʹ([' . KK_L_UC . '])/u' => '$1Ь$2',
+                       '/ʹ([' . KK_L_LC . '])/u' => 'ь$1',
                        '/ʺ/u' => 'ъ',
                        '/ʹ/u' => 'ь',
-                       ## Ye Yo Yu Ya.
+                       # # Ye Yo Yu Ya.
                        '/Y[Ee]/u' => 'Е', '/ye/u' => 'е',
                        '/Y[Oo]/u' => 'Ё', '/yo/u' => 'ё',
                        '/Y[UWuw]/u' => 'Ю', '/y[uw]/u' => 'ю',
                        '/Y[Aa]/u' => 'Я', '/ya/u' => 'я',
-                       ## other characters
+                       # # other characters
                        '/A/u' => 'А', '/a/u' => 'а', '/Ä/u' => 'Ә', '/ä/u' => 'ә',
                        '/B/u' => 'Б', '/b/u' => 'б', '/C/u' => 'Ц', '/c/u' => 'ц',
                        '/Ç/u' => 'Ч', '/ç/u' => 'ч', '/D/u' => 'Д', '/d/u' => 'д',
@@ -140,14 +140,14 @@ class KkConverter extends LanguageConverter {
                );
 
                $this->mCyLa2Arab = array(
-                       ## Punctuation -> Arabic
+                       # # Punctuation -> Arabic
                        '/#|№|No\./u' => '؀', # &#x0600;
                        '/\,/' => '،', # &#x060C;
                        '/;/'  => '؛', # &#x061B;
                        '/\?/' => '؟', # &#x061F;
                        '/%/'  => '٪', # &#x066A;
                        '/\*/' => '٭', # &#x066D;
-                       ## Digits -> Arabic
+                       # # Digits -> Arabic
                        '/0/' => '۰', # &#x06F0;
                        '/1/' => '۱', # &#x06F1;
                        '/2/' => '۲', # &#x06F2;
@@ -158,7 +158,7 @@ class KkConverter extends LanguageConverter {
                        '/7/' => '۷', # &#x06F7;
                        '/8/' => '۸', # &#x06F8;
                        '/9/' => '۹', # &#x06F9;
-                       ## Cyrillic -> Arabic
+                       # # Cyrillic -> Arabic
                        '/Аллаһ/ui' => 'ﷲ',
                        '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1يە',
                        '/[еэ]/ui' => 'ە', '/[ъь]/ui' => '',
@@ -166,14 +166,14 @@ class KkConverter extends LanguageConverter {
                        '/[и]/ui' => 'ىي', '/ё/ui' => 'يو', '/ю/ui' => 'يۋ', '/я/ui' => 'يا', '/[й]/ui' => 'ي',
                        '/ц/ui' => 'تس', '/щ/ui' => 'شش',
                        '/һ/ui' => 'ح', '/ч/ui' => 'تش',
-                       #'/һ/ui' => 'ھ', '/ч/ui' => 'چ',
+                       # '/һ/ui' => 'ھ', '/ч/ui' => 'چ',
                        '/б/ui' => 'ب', '/в/ui' => 'ۆ', '/г/ui' => 'گ', '/ғ/ui' => 'ع',
                        '/д/ui' => 'د', '/ж/ui' => 'ج', '/з/ui' => 'ز', '/к/ui' => 'ك',
                        '/қ/ui' => 'ق', '/л/ui' => 'ل', '/м/ui' => 'م', '/н/ui' => 'ن',
                        '/ң/ui' => 'ڭ', '/п/ui' => 'پ', '/р/ui' => 'ر', '/с/ui' => 'س',
                        '/т/ui' => 'ت', '/у/ui' => 'ۋ', '/ф/ui' => 'ف', '/х/ui' => 'ح',
                        '/ш/ui' => 'ش',
-                       ## Latin -> Arabic // commented for now...
+                       # # Latin -> Arabic // commented for now...
                        /*'/Allah/ui' => 'ﷲ',
                        '/[eé]/ui' => 'ە', '/[yý]/ui' => 'ي', '/[ʺʹ]/ui' => '',
                        '/[aä]/ui' => 'ا', '/[oö]/ui' => 'و', '/[uü]/ui' => 'ۇ',
@@ -195,13 +195,13 @@ class KkConverter extends LanguageConverter {
                update: delete all rule parsing because it's not used
                                currently, and just produces a couple of bugs
        */
-       function parseManualRule($rule, $flags=array()) {
-               if(in_array('T',$flags)){
-                       return parent::parseManualRule($rule, $flags);
+       function parseManualRule( $rule, $flags = array() ) {
+               if ( in_array( 'T', $flags ) ) {
+                       return parent::parseManualRule( $rule, $flags );
                }
 
                // otherwise ignore all formatting
-               foreach($this->mVariants as $v) {
+               foreach ( $this->mVariants as $v ) {
                        $carray[$v] = $rule;
                }
 
@@ -216,35 +216,35 @@ class KkConverter extends LanguageConverter {
         */
        function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
                // check for user namespace
-               if(is_object($nt)){
+               if ( is_object( $nt ) ) {
                        $ns = $nt->getNamespace();
-                       if($ns==NS_USER || $ns==NS_USER_TALK)
+                       if ( $ns == NS_USER || $ns == NS_USER_TALK )
                                return;
                }
 
-               $oldlink=$link;
+               $oldlink = $link;
                parent::findVariantLink( $link, $nt, $ignoreOtherCond );
-               if( $this->getPreferredVariant()==$this->mMainLanguageCode )
-                       $link=$oldlink;
+               if ( $this->getPreferredVariant() == $this->mMainLanguageCode )
+                       $link = $oldlink;
        }
 
        /*
         * An ugly function wrapper for parsing Image titles
         * (to prevent image name conversion)
         */
-       function autoConvert($text, $toVariant=false) {
+       function autoConvert( $text, $toVariant = false ) {
                global $wgTitle;
-               if(is_object($wgTitle) && $wgTitle->getNameSpace()==NS_FILE){
+               if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
                        $imagename = $wgTitle->getNsText();
-                       if(preg_match("/^$imagename:/",$text)) return $text;
+                       if ( preg_match( "/^$imagename:/", $text ) ) return $text;
                }
-               return parent::autoConvert($text,$toVariant);
+               return parent::autoConvert( $text, $toVariant );
        }
 
        /**
         *  It translates text into variant
         */
-       function translate( $text, $toVariant ){
+       function translate( $text, $toVariant ) {
                global $wgContLanguageCode;
                $text = parent::translate( $text, $toVariant );
 
@@ -262,7 +262,7 @@ class KkConverter extends LanguageConverter {
                                break;
                        case 'kk-arab':
                        case 'kk-cn':
-                               $letters = KK_C_UC.KK_C_LC./*KK_L_UC.KK_L_LC.'ʺʹ'.*/',;\?%\*№0123456789';
+                               $letters = KK_C_UC . KK_C_LC . /*KK_L_UC.KK_L_LC.'ʺʹ'.*/',;\?%\*№0123456789';
                                $wgContLanguageCode = 'kk-Arab';
                                break;
                        default:
@@ -272,60 +272,60 @@ class KkConverter extends LanguageConverter {
                // disable conversion variables like $1, $2...
                $varsfix = '\$[0-9]';
 
-               $matches = preg_split( '/' . $varsfix . '[^' . $letters . ']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
+               $matches = preg_split( '/' . $varsfix . '[^' . $letters . ']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
                $mstart = 0;
                $ret = '';
-               foreach( $matches as $m ) {
-                       $ret .= substr( $text, $mstart, $m[1]-$mstart );
+               foreach ( $matches as $m ) {
+                       $ret .= substr( $text, $mstart, $m[1] -$mstart );
                        $ret .= $this->regsConverter( $m[0], $toVariant );
-                       $mstart = $m[1] + strlen($m[0]);
+                       $mstart = $m[1] + strlen( $m[0] );
                }
                return $ret;
        }
 
        function regsConverter( $text, $toVariant ) {
-               if ($text == '') return $text;
+               if ( $text == '' ) return $text;
 
                $pat = array();
                $rep = array();
                switch( $toVariant ) {
                        case 'kk-arab':
                        case 'kk-cn':
-                               $letters = KK_C_LC.KK_C_UC/*.KK_L_LC.KK_L_UC*/;
+                               $letters = KK_C_LC . KK_C_UC/*.KK_L_LC.KK_L_UC*/;
                                $front = 'әөүіӘӨҮІ'/*.'äöüiÄÖÜİ'*/;
                                $excludes = 'еэгғкқЕЭГҒКҚ'/*.'eégğkqEÉGĞKQ'*/;
                                // split text to words
-                               $matches = preg_split( '/[\b\s\-\.:]+/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
+                               $matches = preg_split( '/[\b\s\-\.:]+/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
                                $mstart = 0;
                                $ret = '';
-                               foreach( $matches as $m ) {
+                               foreach ( $matches as $m ) {
                                        $ret .= substr( $text, $mstart, $m[1] - $mstart );
                                        // is matched the word to front vowels?
                                        // exclude a words matched to е, э, г, к, к, қ,
                                        // them should be without hamza
-                                       if ( preg_match('/['.$front.']/u', $m[0]) && !preg_match('/['.$excludes.']/u', $m[0]) ) {
-                                               $ret .= preg_replace('/['.$letters.']+/u', H_HAMZA.'$0', $m[0]);
+                                       if ( preg_match( '/[' . $front . ']/u', $m[0] ) && !preg_match( '/[' . $excludes . ']/u', $m[0] ) ) {
+                                               $ret .= preg_replace( '/[' . $letters . ']+/u', H_HAMZA . '$0', $m[0] );
                                        } else {
                                                $ret .= $m[0];
                                        }
-                                       $mstart = $m[1] + strlen($m[0]);
+                                       $mstart = $m[1] + strlen( $m[0] );
                                }
                                $text =& $ret;
-                               foreach( $this->mCyLa2Arab as $pat => $rep ) {
+                               foreach ( $this->mCyLa2Arab as $pat => $rep ) {
                                        $text = preg_replace( $pat, $rep, $text );
                                }
                                return $text;
                                break;
                        case 'kk-latn':
                        case 'kk-tr':
-                               foreach( $this->mCyrl2Latn as $pat => $rep ) {
+                               foreach ( $this->mCyrl2Latn as $pat => $rep ) {
                                        $text = preg_replace( $pat, $rep, $text );
                                }
                                return $text;
                                break;
                        case 'kk-cyrl':
                        case 'kk-kz':
-                               foreach( $this->mLatn2Cyrl as $pat => $rep ) {
+                               foreach ( $this->mLatn2Cyrl as $pat => $rep ) {
                                        $text = preg_replace( $pat, $rep, $text );
                                }
                                return $text;
@@ -339,8 +339,8 @@ class KkConverter extends LanguageConverter {
         * We want our external link captions to be converted in variants,
         * so we return the original text instead -{$text}-, except for URLs
         */
-       function markNoConversion( $text, $noParse=false ) {
-               if( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
+       function markNoConversion( $text, $noParse = false ) {
+               if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
                        return parent::markNoConversion( $text );
                return $text;
        }
@@ -399,7 +399,7 @@ class LanguageKk extends LanguageKk_cyrl {
         */
        function ucfirst ( $string ) {
                $variant = $this->getPreferredVariant();
-               if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'i' ) {
+               if ( ( $variant == 'kk-latn' || $variant == 'kk-tr' ) && $string[0] == 'i' ) {
                        $string = 'İ' . substr( $string, 1 );
                } else {
                        $string = parent::ucfirst( $string );
@@ -413,7 +413,7 @@ class LanguageKk extends LanguageKk_cyrl {
         */
        function lcfirst ( $string ) {
                $variant = $this->getPreferredVariant();
-               if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'I' ) {
+               if ( ( $variant == 'kk-latn' || $variant == 'kk-tr' ) && $string[0] == 'I' ) {
                        $string = 'ı' . substr( $string, 1 );
                } else {
                        $string = parent::lcfirst( $string );
index d57d58d..51749dd 100644 (file)
@@ -27,10 +27,10 @@ class LanguageKk_cyrl extends Language {
                $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
                // Preceding letters
                $Nasals = array( "м", "н", "ң" );
-               $Sonants = array( "и", "й", "л", "р", "у", "ю");
+               $Sonants = array( "и", "й", "л", "р", "у", "ю" );
                $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
                $Sibilants = array( "ж", "з" );
-               $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з");
+               $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" );
 
                // Possessives
                $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
@@ -44,7 +44,7 @@ class LanguageKk_cyrl extends Language {
                // Now convert the word
                switch ( $case ) {
                        case "dc1":
-                       case "genitive": #ilik
+                       case "genitive": # ilik
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "тің";
@@ -57,7 +57,7 @@ class LanguageKk_cyrl extends Language {
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "ның";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
+                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "дің";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -66,7 +66,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc2":
-                       case "dative": #barıs
+                       case "dative": # barıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ке";
@@ -82,7 +82,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc21":
-                       case "possessive dative": #täweldık + barıs
+                       case "possessive dative": # täweldık + barıs
                                if ( in_array( $wordEnding, $firstPerson ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "е";
@@ -104,7 +104,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc3":
-                       case "accusative": #tabıs
+                       case "accusative": # tabıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ті";
@@ -112,13 +112,13 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "ты";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ні";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "ны";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonorants) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                               } elseif ( in_array( $wordEnding, $Sonorants ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ді";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "ды";
@@ -126,7 +126,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc31":
-                       case "possessive accusative": #täweldık + tabıs
+                       case "possessive accusative": # täweldık + tabıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ді";
@@ -138,7 +138,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc4":
-                       case "locative": #jatıs
+                       case "locative": # jatıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "те";
@@ -146,7 +146,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "та";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "де";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "да";
@@ -154,7 +154,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc41":
-                       case "possessive locative": #täweldık + jatıs
+                       case "possessive locative": # täweldık + jatıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "де";
@@ -162,7 +162,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "да";
                                        }
                                } elseif ( in_array( $wordEnding, $thirdPerson  ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "нде";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "нда";
@@ -170,20 +170,20 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc5":
-                       case "ablative": #şığıs
+                       case "ablative": # şığıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "тен";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "тан";
                                        }
-                               } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
+                               } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ден";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "дан";
                                        }
-                               }  elseif ( in_array($wordEnding, $Nasals ) ) {
+                               }  elseif ( in_array( $wordEnding, $Nasals ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "нен";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -192,14 +192,14 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc51":
-                       case "possessive ablative": #täweldık + şığıs
+                       case "possessive ablative": # täweldık + şığıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "нен";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "нан";
                                        }
-                               } elseif ( in_array($wordEnding, $secondPerson  ) ) {
+                               } elseif ( in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ден";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -208,7 +208,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc6":
-                       case "comitative": #kömektes
+                       case "comitative": # kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "пен";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -218,7 +218,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc61":
-                       case "possessive comitative": #täweldık + kömektes
+                       case "possessive comitative": # täweldık + kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "пенен";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -227,7 +227,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "бенен";
                                }
                                break;
-                       default: #dc0 #nominative #ataw
+                       default: # dc0 #nominative #ataw
                }
                return $word;
        }
@@ -247,10 +247,10 @@ class LanguageKk_cyrl extends Language {
                $allVowels = array( "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" );
                // Preceding letters
                $Nasals = array( "m", "n", "ñ" );
-               $Sonants = array( "ï", "y", "ý", "l", "r", "w");
+               $Sonants = array( "ï", "y", "ý", "l", "r", "w" );
                $Consonants = array( "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" );
                $Sibilants = array( "j", "z" );
-               $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z");
+               $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" );
 
                // Possessives
                $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
@@ -264,7 +264,7 @@ class LanguageKk_cyrl extends Language {
                // Now convert the word
                switch ( $case ) {
                        case "dc1":
-                       case "genitive": #ilik
+                       case "genitive": # ilik
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "tiñ";
@@ -277,7 +277,7 @@ class LanguageKk_cyrl extends Language {
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "nıñ";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
+                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "diñ";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -286,7 +286,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc2":
-                       case "dative": #barıs
+                       case "dative": # barıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ke";
@@ -302,7 +302,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc21":
-                       case "possessive dative": #täweldık + barıs
+                       case "possessive dative": # täweldık + barıs
                                if ( in_array( $wordEnding, $firstPerson ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "e";
@@ -324,7 +324,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc3":
-                       case "accusative": #tabıs
+                       case "accusative": # tabıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ti";
@@ -332,13 +332,13 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "tı";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ni";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "nı";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonorants) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                               } elseif ( in_array( $wordEnding, $Sonorants ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "di";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "dı";
@@ -346,7 +346,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc31":
-                       case "possessive accusative": #täweldık + tabıs
+                       case "possessive accusative": # täweldık + tabıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "di";
@@ -358,7 +358,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc4":
-                       case "locative": #jatıs
+                       case "locative": # jatıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "te";
@@ -366,7 +366,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "ta";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "de";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "da";
@@ -374,7 +374,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc41":
-                       case "possessive locative": #täweldık + jatıs
+                       case "possessive locative": # täweldık + jatıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "de";
@@ -382,7 +382,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "da";
                                        }
                                } elseif ( in_array( $wordEnding, $thirdPerson  ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "nde";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "nda";
@@ -390,20 +390,20 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc5":
-                       case "ablative": #şığıs
+                       case "ablative": # şığıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ten";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "tan";
                                        }
-                               } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
+                               } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "den";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "dan";
                                        }
-                               }  elseif ( in_array($wordEnding, $Nasals ) ) {
+                               }  elseif ( in_array( $wordEnding, $Nasals ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "nen";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -412,14 +412,14 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc51":
-                       case "possessive ablative": #täweldık + şığıs
+                       case "possessive ablative": # täweldık + şığıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "nen";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "nan";
                                        }
-                               } elseif ( in_array($wordEnding, $secondPerson  ) ) {
+                               } elseif ( in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "den";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -428,7 +428,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc6":
-                       case "comitative": #kömektes
+                       case "comitative": # kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "pen";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -438,7 +438,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc61":
-                       case "possessive comitative": #täweldık + kömektes
+                       case "possessive comitative": # täweldık + kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "penen";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -447,7 +447,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "benen";
                                }
                                break;
-                       default: #dc0 #nominative #ataw
+                       default: # dc0 #nominative #ataw
                }
                return $word;
        }
@@ -467,10 +467,10 @@ class LanguageKk_cyrl extends Language {
                $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
                // Preceding letters
                $Nasals = array( "م", "ن", "ڭ" );
-               $Sonants = array( "ي", "ي", "ل", "ر", "ۋ");
+               $Sonants = array( "ي", "ي", "ل", "ر", "ۋ" );
                $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
                $Sibilants = array( "ج", "ز" );
-               $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز");
+               $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" );
 
                // Possessives
                $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
@@ -484,7 +484,7 @@ class LanguageKk_cyrl extends Language {
                // Now convert the word
                switch ( $case ) {
                        case "dc1":
-                       case "genitive": #ilik
+                       case "genitive": # ilik
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "تٸڭ";
@@ -497,7 +497,7 @@ class LanguageKk_cyrl extends Language {
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "نىڭ";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
+                               } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دٸڭ";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -506,7 +506,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc2":
-                       case "dative": #barıs
+                       case "dative": # barıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "كە";
@@ -522,7 +522,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc21":
-                       case "possessive dative": #täweldık + barıs
+                       case "possessive dative": # täweldık + barıs
                                if ( in_array( $wordEnding, $firstPerson ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ە";
@@ -544,7 +544,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc3":
-                       case "accusative": #tabıs
+                       case "accusative": # tabıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "تٸ";
@@ -552,13 +552,13 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "تى";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "نٸ";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "نى";
                                        }
-                               } elseif ( in_array( $wordEnding, $Sonorants) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                               } elseif ( in_array( $wordEnding, $Sonorants ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دٸ";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "دى";
@@ -566,7 +566,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc31":
-                       case "possessive accusative": #täweldık + tabıs
+                       case "possessive accusative": # täweldık + tabıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دٸ";
@@ -578,7 +578,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc4":
-                       case "locative": #jatıs
+                       case "locative": # jatıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "تە";
@@ -586,7 +586,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "تا";
                                        }
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دە";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "دا";
@@ -594,7 +594,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc41":
-                       case "possessive locative": #täweldık + jatıs
+                       case "possessive locative": # täweldık + jatıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دە";
@@ -602,7 +602,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "دا";
                                        }
                                } elseif ( in_array( $wordEnding, $thirdPerson  ) ) {
-                                       if ( in_array( $wordLastVowel, $frontVowels) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "ندە";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "ندا";
@@ -610,20 +610,20 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc5":
-                       case "ablative": #şığıs
+                       case "ablative": # şığıs
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "تەن";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "تان";
                                        }
-                               } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
+                               } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دەن";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "دان";
                                        }
-                               }  elseif ( in_array($wordEnding, $Nasals ) ) {
+                               }  elseif ( in_array( $wordEnding, $Nasals ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "نەن";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -632,14 +632,14 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc51":
-                       case "possessive ablative": #täweldık + şığıs
+                       case "possessive ablative": # täweldık + şığıs
                                if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "نەن";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
                                                $word = $word . "نان";
                                        }
-                               } elseif ( in_array($wordEnding, $secondPerson  ) ) {
+                               } elseif ( in_array( $wordEnding, $secondPerson  ) ) {
                                        if ( in_array( $wordLastVowel, $frontVowels ) ) {
                                                $word = $word . "دەن";
                                        } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
@@ -648,7 +648,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc6":
-                       case "comitative": #kömektes
+                       case "comitative": # kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "پەن";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -658,7 +658,7 @@ class LanguageKk_cyrl extends Language {
                                }
                                break;
                        case "dc61":
-                       case "possessive comitative": #täweldık + kömektes
+                       case "possessive comitative": # täweldık + kömektes
                                if ( in_array( $wordEnding, $Consonants ) ) {
                                                $word = $word . "پەنەن";
                                } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
@@ -667,7 +667,7 @@ class LanguageKk_cyrl extends Language {
                                                $word = $word . "بەنەن";
                                }
                                break;
-                       default: #dc0 #nominative #ataw
+                       default: # dc0 #nominative #ataw
                }
                return $word;
        }
@@ -677,7 +677,7 @@ class LanguageKk_cyrl extends Language {
                $ar = array();
 
                // Put the word in a form we can play with since we're using UTF-8
-               $ar = preg_split('//u', parent::lc($word), -1, PREG_SPLIT_NO_EMPTY);
+               $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
 
                // Here's an array with the order of the letters in the word reversed
                // so we can find a match quicker *shrug*
@@ -712,7 +712,7 @@ class LanguageKk_cyrl extends Language {
         */
        function commafy( $_ ) {
                if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
-                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index 831feb9..128152f 100644 (file)
@@ -6,7 +6,7 @@
  * @author Niklas Laxström
  */
 class LanguageKm extends Language {
-       function commafy($_) {
+       function commafy( $_ ) {
                /* NO-op for Khmer. Cannot use
                 * $separatorTransformTable = array( ',' => '' )
                 * That would break when parsing and doing strstr '' => 'foo';
index b21cc4d..5bd7e9c 100644 (file)
@@ -22,7 +22,7 @@ class LanguageKsh extends Language {
         * Handle cases of (1, other, 0) or (1, other)
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == 1 ) {
index 43e2916..a187b77 100644 (file)
@@ -5,5 +5,5 @@
 // changed on a subsequent page view.
 // see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageKu_ku.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageKu_ku.php' );
index 5ce68c5..bd1e0aa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageKu_ku.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageKu_ku.php' );
 
 /** Kurdish
  * converter routines
@@ -18,8 +18,8 @@ class KuConverter extends LanguageConverter {
 //  و ك=> ku -- ist auch richtig
 
                /* Doppel- und Halbvokale */
-               'ڵ' => 'll', #ll
-               'ڕ'  => 'rr', #rr
+               'ڵ' => 'll', # ll
+               'ڕ'  => 'rr', # rr
                'ا'  => 'a',
                # 'ئێ' => 'ê', # initial e
                'ە'  => 'e',
@@ -69,7 +69,7 @@ class KuConverter extends LanguageConverter {
                # 'rr' => 'ڕ', # selbiges für doppel-r
 
                /* Einzelne Großbuchstaben */
-               //' C' => 'ج',
+               // ' C' => 'ج',
 
                /* Vowels */
                'a' => 'ا',
@@ -140,25 +140,25 @@ class KuConverter extends LanguageConverter {
         */
        function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
                // check for user namespace
-               if(is_object($nt)){
+               if ( is_object( $nt ) ) {
                        $ns = $nt->getNamespace();
-                       if($ns==NS_USER || $ns==NS_USER_TALK)
+                       if ( $ns == NS_USER || $ns == NS_USER_TALK )
                                return;
                }
 
-               $oldlink=$link;
+               $oldlink = $link;
                parent::findVariantLink( $link, $nt, $ignoreOtherCond );
-               if( $this->getPreferredVariant() == $this->mMainLanguageCode )
-                       $link=$oldlink;
+               if ( $this->getPreferredVariant() == $this->mMainLanguageCode )
+                       $link = $oldlink;
        }
 
        /*
         * We want our external link captions to be converted in variants,
         * so we return the original text instead -{$text}-, except for URLs
         */
-       function markNoConversion($text, $noParse=false) {
-               if($noParse || preg_match("/^https?:\/\/|ftp:\/\/|irc:\/\//",$text))
-                   return parent::markNoConversion($text);
+       function markNoConversion( $text, $noParse = false ) {
+               if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
+                   return parent::markNoConversion( $text );
                return $text;
        }
 
@@ -166,20 +166,20 @@ class KuConverter extends LanguageConverter {
         * An ugly function wrapper for parsing Image titles
         * (to prevent image name conversion)
         */
-       function autoConvert($text, $toVariant=false) {
+       function autoConvert( $text, $toVariant = false ) {
                global $wgTitle;
-               if(is_object($wgTitle) && $wgTitle->getNameSpace()==NS_FILE){
+               if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
                        $imagename = $wgTitle->getNsText();
-                       if(preg_match("/^$imagename:/",$text)) return $text;
+                       if ( preg_match( "/^$imagename:/", $text ) ) return $text;
                }
-               return parent::autoConvert($text,$toVariant);
+               return parent::autoConvert( $text, $toVariant );
        }
 
        /**
         *  It translates text into variant, specials:
         *    - ommiting roman numbers
         */
-       function translate($text, $toVariant){
+       function translate( $text, $toVariant ) {
                $breaks = '[^\w\x80-\xff]';
 
                /* From Kazakh interface, maybe we need it later
@@ -207,7 +207,7 @@ class KuConverter extends LanguageConverter {
                return $ret;
                */
 
-               if( !isset( $this->mTables[$toVariant] ) ) {
+               if ( !isset( $this->mTables[$toVariant] ) ) {
                        throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
                }
 
index cf2107e..a9ec64e 100644 (file)
@@ -12,7 +12,7 @@ class LanguageKu_ku extends Language {
        function commafy( $_ ) {
 
                if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
-                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index c26d0e8..81fc30c 100644 (file)
@@ -15,7 +15,7 @@ class LanguageLa extends Language {
         */
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['la'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
                        return $wgGrammarForms['la'][$case][$word];
                }
 
index bcf5f6e..7511dac 100644 (file)
@@ -10,9 +10,9 @@ class LanguageLn extends Language {
 
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 87519d9..4291e79 100644 (file)
@@ -11,15 +11,15 @@ class LanguageLt extends Language {
                3 - penkiolika (15) lapų
        */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count%10==1 && $count%100!=11) return $forms[0];
-               if ($count%10>=2 && ($count%100<10 || $count%100>=20)) return $forms[1];
+               if ( $count % 10 == 1 && $count % 100 != 11 ) return $forms[0];
+               if ( $count % 10 >= 2 && ( $count % 100 < 10 || $count % 100 >= 20 ) ) return $forms[1];
                return $forms[2];
        }
 }
index 719da52..fea2d21 100644 (file)
@@ -20,7 +20,7 @@ class LanguageLv extends Language {
         * @return String
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                // FIXME: CLDR defines 3 plural forms instead of 2.  Form for 0 is missing.
                //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lv
index 8593a29..98f9d81 100644 (file)
@@ -8,9 +8,9 @@ class LanguageMg extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 268365d..142c7fd 100644 (file)
@@ -9,7 +9,7 @@ class LanguageMk extends Language {
         * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mk
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
                if ( $count % 10 === 1 && $count % 100 !== 11 ) {
index 98b5fc9..b86ff31 100644 (file)
@@ -2,13 +2,13 @@
 
 class LanguageMl extends Language {
        /**
-        * Temporary hack for the issue described at 
+        * Temporary hack for the issue described at
         * http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46396
-        * Convert Unicode 5.0 style Malayalam input to Unicode 5.1. Similar to 
-        * bug 9413. Also fixes miscellaneous problems due to mishandling of ZWJ, 
+        * Convert Unicode 5.0 style Malayalam input to Unicode 5.1. Similar to
+        * bug 9413. Also fixes miscellaneous problems due to mishandling of ZWJ,
         * e.g. bug 11162.
-        * 
-        * FIXME: This is language-specific for now only to avoid the negative 
+        *
+        * FIXME: This is language-specific for now only to avoid the negative
         * performance impact of enabling it for all languages.
         */
        function normalize( $s ) {
index 83cfafb..477158f 100644 (file)
@@ -7,7 +7,7 @@ class LanguageMo extends Language {
        function convertPlural( $count, $forms ) {
                // Plural rules per
                // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mo
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                $forms = $this->preConvertPlural( $forms, 3 );
 
index fff779a..fb271bf 100644 (file)
@@ -9,13 +9,13 @@
 
 class LanguageMt extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                $forms = $this->preConvertPlural( $forms, 4 );
 
                if ( $count === 1 ) $index = 0;
-               elseif ( $count === 0 || ( $count%100>1 && $count%100<11) ) $index = 1;
-               elseif ( $count%100>10 && $count%100<20 ) $index = 2;
+               elseif ( $count === 0 || ( $count % 100 > 1 && $count % 100 < 11 ) ) $index = 1;
+               elseif ( $count % 100 > 10 && $count % 100 < 20 ) $index = 2;
                else $index = 3;
                return $forms[$index];
        }
index d76b99e..ac8843c 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 class LanguageMy extends Language {
-       function commafy($_) {
+       function commafy( $_ ) {
                /* NO-op. Cannot use
                 * $separatorTransformTable = array( ',' => '' )
                 * That would break when parsing and doing strstr '' => 'foo';
index 1b56e76..409bc35 100644 (file)
@@ -8,9 +8,9 @@ class LanguageNso extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index bb79891..1d96bc4 100644 (file)
@@ -6,7 +6,7 @@
  */
 class LanguagePl extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
                $count = abs( $count );
                if ( $count == 1 )
@@ -22,9 +22,9 @@ class LanguagePl extends Language {
                }
        }
 
-       function commafy($_) {
-               if (!preg_match('/^\d{1,4}(.\d+)?$/',$_)) {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+       function commafy( $_ ) {
+               if ( !preg_match( '/^\d{1,4}(.\d+)?$/', $_ ) ) {
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index 928f79f..f2d6798 100644 (file)
@@ -7,7 +7,7 @@ class LanguageRo extends Language {
        function convertPlural( $count, $forms ) {
                // Plural rules per
                // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ro
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                $forms = $this->preConvertPlural( $forms, 3 );
 
index bb737e8..8f02704 100644 (file)
@@ -11,45 +11,45 @@ class LanguageRu extends Language {
        # Invoked with {{grammar:case|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['ru'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['ru'][$case][$word] ) ) {
                        return $wgGrammarForms['ru'][$case][$word];
                }
 
                # These rules are not perfect, but they are currently only used for site names so it doesn't
                # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
 
-               #join and array_slice instead mb_substr
+               # join and array_slice instead mb_substr
                $ar = array();
                preg_match_all( '/./us', $word, $ar );
-               if (!preg_match("/[a-zA-Z_]/us", $word))
+               if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
                        switch ( $case ) {
-                               case 'genitive': #родительный падеж
-                                       if ((join('',array_slice($ar[0],-4))=='вики') || (join('',array_slice($ar[0],-4))=='Вики'))
-                                               {}
-                                       elseif (join('',array_slice($ar[0],-1))=='ь')
-                                               $word = join('',array_slice($ar[0],0,-1)).'я';
-                                       elseif (join('',array_slice($ar[0],-2))=='ия')
-                                               $word=join('',array_slice($ar[0],0,-2)).'ии';
-                                       elseif (join('',array_slice($ar[0],-2))=='ка')
-                                               $word=join('',array_slice($ar[0],0,-2)).'ки';
-                                       elseif (join('',array_slice($ar[0],-2))=='ти')
-                                               $word=join('',array_slice($ar[0],0,-2)).'тей';
-                                       elseif (join('',array_slice($ar[0],-2))=='ды')
-                                               $word=join('',array_slice($ar[0],0,-2)).'дов';
-                                       elseif (join('',array_slice($ar[0],-3))=='ник')
-                                               $word=join('',array_slice($ar[0],0,-3)).'ника';
+                               case 'genitive': # родительный падеж
+                                       if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' ) )
+                                               { }
+                                       elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ь' )
+                                               $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'я';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ия' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ии';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ки';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'тей';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ды' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дов';
+                                       elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' )
+                                               $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
                                        break;
-                               case 'dative':  #дательный падеж
-                                       #stub
+                               case 'dative':  # дательный падеж
+                                       # stub
                                        break;
-                               case 'accusative': #винительный падеж
-                                       #stub
+                               case 'accusative': # винительный падеж
+                                       # stub
                                        break;
-                               case 'instrumental':  #творительный падеж
-                                       #stub
+                               case 'instrumental':  # творительный падеж
+                                       # stub
                                        break;
-                               case 'prepositional': #предложный падеж
-                                       #stub
+                               case 'prepositional': # предложный падеж
+                                       # stub
                                        break;
                        }
                return $word;
@@ -71,19 +71,19 @@ class LanguageRu extends Language {
         */
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                // FIXME: CLDR defines 4 plural forms. Form with decimals missing.
                // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ru
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
@@ -98,11 +98,11 @@ class LanguageRu extends Language {
         * See manual of style at http://ru.wikipedia.org/wiki/Википедия:Оформление_статей
         * So "1 234 567", "12 345" but "1234"
         */
-       function commafy($_) {
-               if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) {
+       function commafy( $_ ) {
+               if ( preg_match( '/^-?\d{1,4}(\.\d*)?$/', $_ ) ) {
                        return $_;
                } else {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                }
        }
 }
index aac943d..98a9057 100644 (file)
@@ -5,14 +5,14 @@
  */
 class LanguageSe extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#se
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == 1 ) {
                        $index = 0;
-               } elseif( $count == 2 ) {
+               } elseif ( $count == 2 ) {
                        $index = 1;
                } else {
                        $index = 2;
index 29f06f4..df3a1f9 100644 (file)
@@ -5,19 +5,19 @@
  */
 class LanguageSh extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                // FIXME: CLDR defines 4 plural forms. Form with decimals missing.
                // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index 7ddbcbd..ea74d1b 100644 (file)
@@ -6,7 +6,7 @@
  */
 class LanguageSk extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == 1 ) {
index 734b274..09138ea 100644 (file)
@@ -12,7 +12,7 @@ class LanguageSl extends Language {
         */
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['sl'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['sl'][$case][$word] ) ) {
                        return $wgGrammarForms['sl'][$case][$word];
                }
 
@@ -27,7 +27,7 @@ class LanguageSl extends Language {
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 5 );
 
                if ( $count % 100 == 1 ) {
index 5167fb0..2f8e1a3 100644 (file)
@@ -5,14 +5,14 @@
  */
 class LanguageSma extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
                // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sma
                $forms = $this->preConvertPlural( $forms, 3 );
 
                if ( $count == 1 ) {
                        $index = 1;
-               } elseif( $count == 2 ) {
+               } elseif ( $count == 2 ) {
                        $index = 2;
                } else {
                        $index = 3;
index ffdd234..a377037 100644 (file)
@@ -5,5 +5,5 @@
 // changed on a subsequent page view.
 // see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html
 
-require_once( dirname(__FILE__).'/LanguageSr_ec.php' );
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageSr_ec.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
index 693660f..06074f3 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageSr_ec.php' );
-require_once( dirname(__FILE__).'/LanguageSr_el.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageSr_ec.php' );
+require_once( dirname( __FILE__ ) . '/LanguageSr_el.php' );
 
 /**
  * There are two levels of conversion for Serbian: the script level
@@ -45,15 +45,15 @@ class SrConverter extends LanguageConverter {
                'O' => 'О', 'P'  => 'П', 'R' => 'Р', 'S' => 'С', 'Š'  => 'Ш',
                'T' => 'Т', 'U'  => 'У', 'V' => 'В', 'Z' => 'З', 'Ž'  => 'Ж',
 
-               'DŽ' => 'Џ', 'd!ž' => 'дж', 'D!ž'=> 'Дж', 'D!Ž'=> 'ДЖ',
-               'Lj' => 'Љ', 'l!j' => 'лј', 'L!j'=> 'Лј', 'L!J'=> 'ЛЈ',
-               'Nj' => 'Њ', 'n!j' => 'нј', 'N!j'=> 'Нј', 'N!J'=> 'НЈ'
+               'DŽ' => 'Џ', 'd!ž' => 'дж', 'D!ž' => 'Дж', 'D!Ž' => 'ДЖ',
+               'Lj' => 'Љ', 'l!j' => 'лј', 'L!j' => 'Лј', 'L!J' => 'ЛЈ',
+               'Nj' => 'Њ', 'n!j' => 'нј', 'N!j' => 'Нј', 'N!J' => 'НЈ'
        );
 
        function loadDefaultTables() {
                $this->mTables = array(
                        'sr-ec' => new ReplacementArray( $this->mToCyrillics ),
-                       'sr-el' => new ReplacementArray( $this->mToLatin),
+                       'sr-el' => new ReplacementArray( $this->mToLatin ),
                        'sr'    => new ReplacementArray()
                );
        }
@@ -63,13 +63,13 @@ class SrConverter extends LanguageConverter {
                update: delete all rule parsing because it's not used
                        currently, and just produces a couple of bugs
        */
-       function parseManualRule($rule, $flags=array()) {
-               if(in_array('T',$flags)){
-                       return parent::parseManualRule($rule, $flags);
+       function parseManualRule( $rule, $flags = array() ) {
+               if ( in_array( 'T', $flags ) ) {
+                       return parent::parseManualRule( $rule, $flags );
                }
 
                // otherwise ignore all formatting
-               foreach($this->mVariants as $v) {
+               foreach ( $this->mVariants as $v ) {
                        $carray[$v] = $rule;
                }
 
@@ -84,25 +84,25 @@ class SrConverter extends LanguageConverter {
         */
        function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
                // check for user namespace
-               if(is_object($nt)){
+               if ( is_object( $nt ) ) {
                        $ns = $nt->getNamespace();
-                       if($ns==NS_USER || $ns==NS_USER_TALK)
+                       if ( $ns == NS_USER || $ns == NS_USER_TALK )
                                return;
                }
 
-               $oldlink=$link;
+               $oldlink = $link;
                parent::findVariantLink( $link, $nt, $ignoreOtherCond );
-               if($this->getPreferredVariant()==$this->mMainLanguageCode)
-                       $link=$oldlink;
+               if ( $this->getPreferredVariant() == $this->mMainLanguageCode )
+                       $link = $oldlink;
        }
 
        /*
         * We want our external link captions to be converted in variants,
         * so we return the original text instead -{$text}-, except for URLs
         */
-       function markNoConversion($text, $noParse=false) {
-               if($noParse || preg_match("/^https?:\/\/|ftp:\/\/|irc:\/\//",$text))
-                       return parent::markNoConversion($text);
+       function markNoConversion( $text, $noParse = false ) {
+               if ( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
+                       return parent::markNoConversion( $text );
                return $text;
        }
 
@@ -110,39 +110,39 @@ class SrConverter extends LanguageConverter {
         * An ugly function wrapper for parsing Image titles
         * (to prevent image name conversion)
         */
-       function autoConvert($text, $toVariant=false) {
+       function autoConvert( $text, $toVariant = false ) {
                global $wgTitle;
-               if(is_object($wgTitle) && $wgTitle->getNameSpace()==NS_FILE){
+               if ( is_object( $wgTitle ) && $wgTitle->getNameSpace() == NS_FILE ) {
                        $imagename = $wgTitle->getNsText();
-                       if(preg_match("/^$imagename:/",$text)) return $text;
+                       if ( preg_match( "/^$imagename:/", $text ) ) return $text;
                }
-               return parent::autoConvert($text,$toVariant);
+               return parent::autoConvert( $text, $toVariant );
        }
 
        /**
         *  It translates text into variant, specials:
         *    - ommiting roman numbers
         */
-       function translate($text, $toVariant){
+       function translate( $text, $toVariant ) {
                $breaks = '[^\w\x80-\xff]';
 
                // regexp for roman numbers
                $roman = 'M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})';
 
-               $reg = '/^'.$roman.'$|^'.$roman.$breaks.'|'.$breaks.$roman.'$|'.$breaks.$roman.$breaks.'/';
+               $reg = '/^' . $roman . '$|^' . $roman . $breaks . '|' . $breaks . $roman . '$|' . $breaks . $roman . $breaks . '/';
 
-               $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
+               $matches = preg_split( $reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
 
-               $m = array_shift($matches);
-               if( !isset( $this->mTables[$toVariant] ) ) {
+               $m = array_shift( $matches );
+               if ( !isset( $this->mTables[$toVariant] ) ) {
                        throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) );
                }
                $ret = $this->mTables[$toVariant]->replace( $m[0] );
-               $mstart = $m[1]+strlen($m[0]);
-               foreach($matches as $m) {
-                       $ret .= substr($text, $mstart, $m[1]-$mstart);
-                       $ret .= parent::translate($m[0], $toVariant);
-                       $mstart = $m[1] + strlen($m[0]);
+               $mstart = $m[1] + strlen( $m[0] );
+               foreach ( $matches as $m ) {
+                       $ret .= substr( $text, $mstart, $m[1] -$mstart );
+                       $ret .= parent::translate( $m[0], $toVariant );
+                       $mstart = $m[1] + strlen( $m[0] );
                }
 
                return $ret;
@@ -158,7 +158,7 @@ class LanguageSr extends LanguageSr_ec {
 
                parent::__construct();
 
-               $variants = array('sr', 'sr-ec', 'sr-el');
+               $variants = array( 'sr', 'sr-ec', 'sr-el' );
                $variantfallbacks = array(
                        'sr'    => 'sr-ec',
                        'sr-ec' => 'sr',
@@ -169,24 +169,24 @@ class LanguageSr extends LanguageSr_ec {
                        'S' => 'S', 'писмо' => 'S', 'pismo' => 'S',
                        'W' => 'W', 'реч'   => 'W', 'reč'   => 'W', 'ријеч' => 'W', 'riječ' => 'W'
                );
-               $this->mConverter = new SrConverter($this, 'sr', $variants, $variantfallbacks, $flags);
+               $this->mConverter = new SrConverter( $this, 'sr', $variants, $variantfallbacks, $flags );
                $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                // FIXME: CLDR defines 4 plural forms. Form with decimals missing.
                // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ru
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index c730019..f62ffd5 100644 (file)
@@ -5,13 +5,13 @@
  */
 class LanguageSr_ec extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index cec44dc..67154c2 100644 (file)
@@ -5,4 +5,4 @@
 // changed on a subsequent page view.
 // see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html
 
-require_once( dirname(__FILE__).'/LanguageSr_ec.php' );
+require_once( dirname( __FILE__ ) . '/LanguageSr_ec.php' );
index 6ad55f4..2252bdb 100644 (file)
@@ -5,13 +5,13 @@
  */
 class LanguageSr_el extends Language {
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
index 3a2840d..a89d6ee 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
 
 /**
  * Converts Tajiki to latin orthography
index 1974915..54ae55c 100644 (file)
@@ -8,9 +8,9 @@ class LanguageTi extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 23b6ad6..6578bde 100644 (file)
@@ -8,9 +8,9 @@ class LanguageTl extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 }
index 57b0fd0..245b5b0 100644 (file)
@@ -7,7 +7,7 @@
  */
 class LanguageTr extends Language {
        function ucfirst ( $string ) {
-               if ( !empty($string) && $string[0] == 'i' ) {
+               if ( !empty( $string ) && $string[0] == 'i' ) {
                        return 'İ' . substr( $string, 1 );
                } else {
                        return parent::ucfirst( $string );
index d77f796..1666190 100644 (file)
@@ -16,37 +16,37 @@ class LanguageTyv extends Language {
         */
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['tyv'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['tyv'][$case][$word] ) ) {
                        return $wgGrammarForms['tyv'][$case][$word];
                }
 
        // Set up some constants...
-               $allVowels = array("е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я", "a", "e", "i", "o", "ö", "u", "ü", "y");
-               $frontVowels = array("е", "и", "э", "ө", "ү", "e", "i", "ö", "ü");
-               $backVowels = array("а", "ё", "о", "у", "ы", "ю", "я", "a", "o", "u", "y");
-               $unroundFrontVowels = array("е", "и", "э", "e", "i");
-               $roundFrontVowels = array("ө", "ү", "ö", "ü");
-               $unroundBackVowels = array("а", "ы", "я", "a", "y");
-               $roundBackVowels = array("ё", "о", "у", "ю", "o", "u");
-               $voicedPhonemes = array("д", "б", "з", "ж", "г", "d", "b", "z", "g");
-               $unvoicedPhonemes = array("т", "п", "с", "ш", "к", "ч", "х", "t", "p", "s", "k", "x");
-               $directiveUnvoicedStems = array("т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң", "t", "p", "s", "k", "x", "l", "m", "n", "ŋ");
-               $directiveVoicedStems = array("д", "б", "з", "ж", "г", "р", "й", "d", "b", "z", "g", "r", "j");
+               $allVowels = array( "е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я", "a", "e", "i", "o", "ö", "u", "ü", "y" );
+               $frontVowels = array( "е", "и", "э", "ө", "ү", "e", "i", "ö", "ü" );
+               $backVowels = array( "а", "ё", "о", "у", "ы", "ю", "я", "a", "o", "u", "y" );
+               $unroundFrontVowels = array( "е", "и", "э", "e", "i" );
+               $roundFrontVowels = array( "ө", "ү", "ö", "ü" );
+               $unroundBackVowels = array( "а", "ы", "я", "a", "y" );
+               $roundBackVowels = array( "ё", "о", "у", "ю", "o", "u" );
+               $voicedPhonemes = array( "д", "б", "з", "ж", "г", "d", "b", "z", "g" );
+               $unvoicedPhonemes = array( "т", "п", "с", "ш", "к", "ч", "х", "t", "p", "s", "k", "x" );
+               $directiveUnvoicedStems = array( "т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң", "t", "p", "s", "k", "x", "l", "m", "n", "ŋ" );
+               $directiveVoicedStems = array( "д", "б", "з", "ж", "г", "р", "й", "d", "b", "z", "g", "r", "j" );
 
 //             $allSonants = array("л", "м", "н", "ң", "р", "й");
 //             $allNasals = array("м", "н", "ң");
 
        // Put the word in a form we can play with since we're using UTF-8
                preg_match_all( '/./us', $word, $ar );
-       
-               $wordEnding = $ar[0][count($ar[0]) - 1]; //Here's the last letter in the word
-               $wordReversed = array_reverse($ar[0]); //Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
+
+               $wordEnding = $ar[0][count( $ar[0] ) - 1]; // Here's the last letter in the word
+               $wordReversed = array_reverse( $ar[0] ); // Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
 
        // Find the last vowel in the word
                $wordLastVowel = NULL;
                foreach ( $wordReversed as $xvalue ) {
                        foreach ( $allVowels as $yvalue ) {
-                               if ( strcmp($xvalue, $yvalue) == 0 ) {
+                               if ( strcmp( $xvalue, $yvalue ) == 0 ) {
                                        $wordLastVowel = $xvalue;
                                        break;
                                } else {
@@ -63,157 +63,157 @@ class LanguageTyv extends Language {
        // Now convert the word
                switch ( $case ) {
                        case "genitive":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "түң";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "тиң";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "туң";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "тың";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "түң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тиң";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "туң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тың";
                                        } else {
                                        }
-                               } elseif ( $wordEnding === "л" || $wordEnding === "l") {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "дүң";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "диң";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "дуң";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "дың";
+                               } elseif ( $wordEnding === "л" || $wordEnding === "l" ) {
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дүң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "диң";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дуң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дың";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "нүң";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ниң";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "нуң";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ның";
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "нүң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ниң";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "нуң";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ның";
                                        } else {
                                        }
                                }
                                break;
                        case "dative":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ке";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "ка";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ке";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ка";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ге";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "га";
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ге";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "га";
                                        } else {
                                        }
                                }
                                break;
                        case "accusative":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "тү";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ти";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ту";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ты";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тү";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ти";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ту";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ты";
                                        } else {
                                        }
-                               } elseif ( $wordEnding === "л"  || $wordEnding === "l") {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "дү";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ди";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ду";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ды";
+                               } elseif ( $wordEnding === "л"  || $wordEnding === "l" ) {
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дү";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ди";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ду";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ды";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "нү";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ни";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ну";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "ны";
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "нү";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ни";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ну";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ны";
                                        } else {
                                        }
                                }
                                break;
                        case "locative":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "те";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "та";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "те";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "та";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "де";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "да";
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "де";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "да";
                                        } else {
                                        }
                                }
                                break;
                        case "ablative":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "тен";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "тан";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тен";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тан";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $frontVowels) ) {
-                                               $word = implode("",$ar[0]) . "ден";
-                                       } elseif ( in_array($wordLastVowel, $backVowels) ) {
-                                               $word = implode("",$ar[0]) . "дан";
+                                       if ( in_array( $wordLastVowel, $frontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "ден";
+                                       } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дан";
                                        } else {
                                        }
                                }
                                break;
                        case "directive1":
-                               if ( in_array($wordEnding, $directiveVoicedStems) ) {
-                                       $word = implode("",$ar[0]) . "же";
-                               } elseif ( in_array($wordEnding, $directiveUnvoicedStems) ) {
-                                       $word = implode("",$ar[0]) . "че";
+                               if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
+                                       $word = implode( "", $ar[0] ) . "же";
+                               } elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
+                                       $word = implode( "", $ar[0] ) . "че";
                                } else {
                                }
                                break;
                        case "directive2":
-                               if ( in_array($wordEnding, $unvoicedPhonemes) ) {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "түве";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "тиве";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "туве";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "тыве";
+                               if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "түве";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тиве";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "туве";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "тыве";
                                        } else {
                                        }
                                } else {
-                                       if ( in_array($wordLastVowel, $roundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "дүве";
-                                       } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
-                                               $word = implode("",$ar[0]) . "диве";
-                                       } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "дуве";
-                                       } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
-                                               $word = implode("",$ar[0]) . "дыве";
+                                       if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дүве";
+                                       } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "диве";
+                                       } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дуве";
+                                       } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
+                                               $word = implode( "", $ar[0] ) . "дыве";
                                        } else {
                                        }
                                }
index 4b1dfde..88655ff 100644 (file)
@@ -9,67 +9,67 @@ class LanguageUk extends Language {
        # Invoked with {{grammar:case|word}}
        function convertGrammar( $word, $case ) {
                global $wgGrammarForms;
-               if ( isset($wgGrammarForms['uk'][$case][$word]) ) {
+               if ( isset( $wgGrammarForms['uk'][$case][$word] ) ) {
                        return $wgGrammarForms['uk'][$case][$word];
                }
 
                # These rules are not perfect, but they are currently only used for site names so it doesn't
                # matter if they are wrong sometimes. Just add a special case for your site name if necessary.
 
-               #join and array_slice instead mb_substr
+               # join and array_slice instead mb_substr
                $ar = array();
                preg_match_all( '/./us', $word, $ar );
-               if (!preg_match("/[a-zA-Z_]/us", $word))
+               if ( !preg_match( "/[a-zA-Z_]/us", $word ) )
                        switch ( $case ) {
-                               case 'genitive': #родовий відмінок
-                                       if ((join('',array_slice($ar[0],-4))=='вікі') || (join('',array_slice($ar[0],-4))=='Вікі'))
-                                               {}
-                                       elseif (join('',array_slice($ar[0],-1))=='ь')
-                                               $word = join('',array_slice($ar[0],0,-1)).'я';
-                                       elseif (join('',array_slice($ar[0],-2))=='ія')
-                                               $word=join('',array_slice($ar[0],0,-2)).'ії';
-                                       elseif (join('',array_slice($ar[0],-2))=='ка')
-                                               $word=join('',array_slice($ar[0],0,-2)).'ки';
-                                       elseif (join('',array_slice($ar[0],-2))=='ти')
-                                               $word=join('',array_slice($ar[0],0,-2)).'тей';
-                                       elseif (join('',array_slice($ar[0],-2))=='ди')
-                                               $word=join('',array_slice($ar[0],0,-2)).'дів';
-                                       elseif (join('',array_slice($ar[0],-3))=='ник')
-                                               $word=join('',array_slice($ar[0],0,-3)).'ника';
+                               case 'genitive': # родовий відмінок
+                                       if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) )
+                                               { }
+                                       elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ь' )
+                                               $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'я';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ії';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ка' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ки';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ти' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'тей';
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ди' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дів';
+                                       elseif ( join( '', array_slice( $ar[0], -3 ) ) == 'ник' )
+                                               $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
                                        break;
-                               case 'dative':  #давальний відмінок
-                                       #stub
+                               case 'dative':  # давальний відмінок
+                                       # stub
                                        break;
-                               case 'accusative': #знахідний відмінок
-                                       if ((join('',array_slice($ar[0],-4))=='вікі') || (join('',array_slice($ar[0],-4))=='Вікі'))
-                                               {}
-                                       elseif (join('',array_slice($ar[0],-2))=='ія')
-                                               $word=join('',array_slice($ar[0],0,-2)).'ію';
+                               case 'accusative': # знахідний відмінок
+                                       if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вікі' ) || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вікі' ) )
+                                               { }
+                                       elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ія' )
+                                               $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ію';
                                        break;
-                               case 'instrumental':  #орудний відмінок
-                                       #stub
+                               case 'instrumental':  # орудний відмінок
+                                       # stub
                                        break;
-                               case 'prepositional': #місцевий відмінок
-                                       #stub
+                               case 'prepositional': # місцевий відмінок
+                                       # stub
                                        break;
                        }
                return $word;
        }
 
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
 
-               //if no number with word, then use $form[0] for singular and $form[1] for plural or zero
-               if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
+               // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
+               if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
 
                // FIXME: CLDR defines 4 plural forms. Form for decimals is missing/
                // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#uk
                $forms = $this->preConvertPlural( $forms, 3 );
 
-               if ($count > 10 && floor(($count % 100) / 10) == 1) {
+               if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
                        return $forms[2];
                } else {
-                       switch ($count % 10) {
+                       switch ( $count % 10 ) {
                                case 1:  return $forms[0];
                                case 2:
                                case 3:
@@ -83,9 +83,9 @@ class LanguageUk extends Language {
         * Ukrainian numeric format is "12 345,67" but "1234,56"
         */
 
-       function commafy($_) {
-               if (!preg_match('/^\d{1,4}$/',$_)) {
-                       return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
+       function commafy( $_ ) {
+               if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+                       return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
                }
index 4a4296c..4500f6a 100644 (file)
@@ -13,17 +13,17 @@ class LanguageWa extends Language {
         * Use singular form for zero
         */
        function convertPlural( $count, $forms ) {
-               if ( !count($forms) ) { return ''; }
+               if ( !count( $forms ) ) { return ''; }
                $forms = $this->preConvertPlural( $forms, 2 );
 
-               return ($count <= 1) ? $forms[0] : $forms[1];
+               return ( $count <= 1 ) ? $forms[0] : $forms[1];
        }
 
-       ###
-       ### Dates in Walloon are "1î d' <monthname>" for 1st of the month,
-       ### "<day> di <monthname>" for months starting by a consoun, and
-       ### "<day> d' <monthname>" for months starting with a vowel
-       ###
+       ## #
+       ## # Dates in Walloon are "1î d' <monthname>" for 1st of the month,
+       ## # "<day> di <monthname>" for months starting by a consoun, and
+       ## # "<day> d' <monthname>" for months starting with a vowel
+       ## #
        function date( $ts, $adj = false, $format = true, $tc = false ) {
                if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
                $datePreference = $this->dateFormat( $format );
@@ -32,13 +32,13 @@ class LanguageWa extends Language {
                #
                # we also output this format for YMD (eg: 2001 January 15)
                if ( $datePreference == 'ISO 8601' ) {
-                      $d = substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
+                      $d = substr( $ts, 0, 4 ) . '-' . substr( $ts, 4, 2 ) . '-' . substr( $ts, 6, 2 );
                       return $d;
                }
 
                # dd/mm/YYYY format
                if ( $datePreference == 'walloon short' ) {
-                      $d = substr($ts, 6, 2). '/' . substr($ts, 4, 2). '/' .substr($ts, 0, 4);
+                      $d = substr( $ts, 6, 2 ) . '/' . substr( $ts, 4, 2 ) . '/' . substr( $ts, 0, 4 );
                       return $d;
                }
 
@@ -47,17 +47,17 @@ class LanguageWa extends Language {
                # we output this in all other cases
                $m = substr( $ts, 4, 2 );
                $n = substr( $ts, 6, 2 );
-               if ($n == 1) {
+               if ( $n == 1 ) {
                    $d = "1î d' " . $this->getMonthName( $m ) .
                        " " .  substr( $ts, 0, 4 );
-               } else if ($n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23) {
-                   $d = (0 + $n) . " d' " . $this->getMonthName( $m ) .
+               } else if ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
+                   $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
                        " " .  substr( $ts, 0, 4 );
-               } else if ($m == 4 || $m == 8 || $m == 10) {
-                   $d = (0 + $n) . " d' " . $this->getMonthName( $m ) .
+               } else if ( $m == 4 || $m == 8 || $m == 10 ) {
+                   $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
                        " " .  substr( $ts, 0, 4 );
                } else {
-                   $d = (0 + $n) . " di " . $this->getMonthName( $m ) .
+                   $d = ( 0 + $n ) . " di " . $this->getMonthName( $m ) .
                        " " .  substr( $ts, 0, 4 );
                }
                return $d;
index f988548..3bcc482 100644 (file)
@@ -17,7 +17,7 @@ class LanguageYue extends Language {
                $s = self::insertSpace( $string, $reg );
                return $s;
        }
-       
+
        function normalizeForSearch( $string ) {
                wfProfileIn( __METHOD__ );
 
index 542170a..41874ff 100644 (file)
@@ -5,5 +5,5 @@
 // changed on a subsequent page view.
 // see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html
 
-require_once( dirname(__FILE__).'/LanguageZh_hans.php' );
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageZh_hans.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
index 0b88dbb..0055a33 100644 (file)
@@ -1,25 +1,25 @@
 <?php
 
-require_once( dirname(__FILE__).'/../LanguageConverter.php' );
-require_once( dirname(__FILE__).'/LanguageZh_hans.php' );
+require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' );
+require_once( dirname( __FILE__ ) . '/LanguageZh_hans.php' );
 
 /**
  * @ingroup Language
  */
 class ZhConverter extends LanguageConverter {
 
-       function __construct($langobj, $maincode,
-                                                               $variants=array(),
-                                                               $variantfallbacks=array(),
+       function __construct( $langobj, $maincode,
+                                                               $variants = array(),
+                                                               $variantfallbacks = array(),
                                                                $flags = array(),
                                                                $manualLevel = array() ) {
                $this->mDescCodeSep = ':';
                $this->mDescVarSep = ';';
-               parent::__construct($langobj, $maincode,
+               parent::__construct( $langobj, $maincode,
                                                                        $variants,
                                                                        $variantfallbacks,
                                                                        $flags,
-                                                                       $manualLevel);
+                                                                       $manualLevel );
                $names = array(
                        'zh'      => '原文',
                        'zh-hans' => '简体',
@@ -31,20 +31,20 @@ class ZhConverter extends LanguageConverter {
                        'zh-sg'   => '新加坡',
                        'zh-my'   => '大马',
                );
-               $this->mVariantNames = array_merge($this->mVariantNames,$names);
+               $this->mVariantNames = array_merge( $this->mVariantNames, $names );
        }
 
        function loadDefaultTables() {
-               require( dirname(__FILE__)."/../../includes/ZhConversion.php" );
+               require( dirname( __FILE__ ) . "/../../includes/ZhConversion.php" );
                $this->mTables = array(
                        'zh-hans' => new ReplacementArray( $zh2Hans ),
                        'zh-hant' => new ReplacementArray( $zh2Hant ),
-                       'zh-cn'   => new ReplacementArray( array_merge($zh2Hans, $zh2CN) ),
-                       'zh-hk'   => new ReplacementArray( array_merge($zh2Hant, $zh2HK) ),
-                       'zh-mo'   => new ReplacementArray( array_merge($zh2Hant, $zh2HK) ),
-                       'zh-my'   => new ReplacementArray( array_merge($zh2Hans, $zh2SG) ),
-                       'zh-sg'   => new ReplacementArray( array_merge($zh2Hans, $zh2SG) ),
-                       'zh-tw'   => new ReplacementArray( array_merge($zh2Hant, $zh2TW) ),
+                       'zh-cn'   => new ReplacementArray( array_merge( $zh2Hans, $zh2CN ) ),
+                       'zh-hk'   => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
+                       'zh-mo'   => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
+                       'zh-my'   => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
+                       'zh-sg'   => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
+                       'zh-tw'   => new ReplacementArray( array_merge( $zh2Hant, $zh2TW ) ),
                        'zh'      => new ReplacementArray
                );
        }
@@ -62,7 +62,7 @@ class ZhConverter extends LanguageConverter {
           to mark anything.
           $noParse is there for compatibility with LanguageConvert::markNoConversion
         */
-       function markNoConversion($text, $noParse = false) {
+       function markNoConversion( $text, $noParse = false ) {
                return $text;
        }
 
@@ -83,20 +83,20 @@ class LanguageZh extends LanguageZh_hans {
                global $wgHooks;
                parent::__construct();
 
-               $variants = array('zh','zh-hans','zh-hant','zh-cn','zh-hk','zh-mo','zh-my','zh-sg','zh-tw');
-               
+               $variants = array( 'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw' );
+
                $variantfallbacks = array(
-                       'zh'      => array('zh-hans','zh-hant','zh-cn','zh-tw','zh-hk','zh-sg','zh-mo','zh-my'),
-                       'zh-hans' => array('zh-cn','zh-sg','zh-my'),
-                       'zh-hant' => array('zh-tw','zh-hk','zh-mo'),
-                       'zh-cn'   => array('zh-hans','zh-sg','zh-my'),
-                       'zh-sg'   => array('zh-hans','zh-cn','zh-my'),
-                       'zh-my'   => array('zh-hans','zh-sg','zh-cn'),
-                       'zh-tw'   => array('zh-hant','zh-hk','zh-mo'),
-                       'zh-hk'   => array('zh-hant','zh-mo','zh-tw'),
-                       'zh-mo'   => array('zh-hant','zh-hk','zh-tw'),
+                       'zh'      => array( 'zh-hans', 'zh-hant', 'zh-cn', 'zh-tw', 'zh-hk', 'zh-sg', 'zh-mo', 'zh-my' ),
+                       'zh-hans' => array( 'zh-cn', 'zh-sg', 'zh-my' ),
+                       'zh-hant' => array( 'zh-tw', 'zh-hk', 'zh-mo' ),
+                       'zh-cn'   => array( 'zh-hans', 'zh-sg', 'zh-my' ),
+                       'zh-sg'   => array( 'zh-hans', 'zh-cn', 'zh-my' ),
+                       'zh-my'   => array( 'zh-hans', 'zh-sg', 'zh-cn' ),
+                       'zh-tw'   => array( 'zh-hant', 'zh-hk', 'zh-mo' ),
+                       'zh-hk'   => array( 'zh-hant', 'zh-mo', 'zh-tw' ),
+                       'zh-mo'   => array( 'zh-hant', 'zh-hk', 'zh-tw' ),
                );
-               $ml=array(
+               $ml = array(
                        'zh'      => 'disable',
                        'zh-hans' => 'unidirectional',
                        'zh-hant' => 'unidirectional',
@@ -105,7 +105,7 @@ class LanguageZh extends LanguageZh_hans {
                $this->mConverter = new ZhConverter( $this, 'zh',
                                                                $variants, $variantfallbacks,
                                                                array(),
-                                                               $ml);
+                                                               $ml );
 
                $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
        }
@@ -114,13 +114,13 @@ class LanguageZh extends LanguageZh_hans {
        function segmentForDiff( $text ) {
                return preg_replace(
                        "/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
-                       "' ' .\"$1\"", $text);
+                       "' ' .\"$1\"", $text );
        }
 
        function unsegmentForDiff( $text ) {
                return preg_replace(
                        "/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e",
-                       "\"$1\"", $text);
+                       "\"$1\"", $text );
        }
 
        /**
@@ -149,7 +149,7 @@ class LanguageZh extends LanguageZh_hans {
                $terms = implode( '|', $termsArray );
                $terms = self::convertDoubleWidth( $terms );
                $terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) );
-               $ret = array_unique( explode('|', $terms) );
+               $ret = array_unique( explode( '|', $terms ) );
                return $ret;
        }
 }