For the "languages/" directory :
authorNick Jenkins <nickj@users.mediawiki.org>
Fri, 12 Jan 2007 07:26:32 +0000 (07:26 +0000)
committerNick Jenkins <nickj@users.mediawiki.org>
Fri, 12 Jan 2007 07:26:32 +0000 (07:26 +0000)
* removing unused global declarations.
* adding one or two if/else braces.
* adding one or two array declarations.

languages/Language.php
languages/LanguageConverter.php
languages/classes/LanguageKo.php

index 7176391..f523b95 100644 (file)
@@ -316,6 +316,7 @@ class Language {
                $messageFiles = glob( "$IP/languages/messages/Messages*.php" );
                $names = array();
                foreach ( $messageFiles as $file ) {
+                       $m = array();
                        if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $file, $m ) ) {
                                $code = str_replace( '_', '-', strtolower( $m[1] ) );
                                if ( isset( $wgLanguageNames[$code] ) ) {
@@ -803,15 +804,17 @@ class Language {
        }
 
        function uc( $str, $first = false ) {
-               if ( function_exists( 'mb_strtoupper' ) )
-                       if ( $first )
-                               if ( self::isMultibyte( $str ) )
+               if ( function_exists( 'mb_strtoupper' ) ) {
+                       if ( $first ) {
+                               if ( self::isMultibyte( $str ) ) {
                                        return mb_strtoupper( mb_substr( $str, 0, 1 ) ) . mb_substr( $str, 1 );
-                               else
+                               } else {
                                        return ucfirst( $str );
-                       else
+                               }
+                       } else {
                                return self::isMultibyte( $str ) ? mb_strtoupper( $str ) : strtoupper( $str );
-               else
+                       }
+               } else {
                        if ( self::isMultibyte( $str ) ) {
                                list( $wikiUpperChars ) = $this->getCaseMaps();
                                $x = $first ? '^' : '';
@@ -820,8 +823,10 @@ class Language {
                                        array($this,"ucCallback"),
                                        $str
                                );
-                       } else
+                       } else {
                                return $first ? ucfirst( $str ) : strtoupper( $str );
+                       }
+               }
        }
        
        function lcfirst( $str ) {
@@ -992,6 +997,7 @@ class Language {
         * @return string
         */
        function firstChar( $s ) {
+               $matches = array();
                preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);
 
@@ -1241,6 +1247,7 @@ class Language {
                if( $length > 0 ) {
                        $string = substr( $string, 0, $length );
                        $char = ord( $string[strlen( $string ) - 1] );
+                       $m = array();
                        if ($char >= 0xc0) {
                                # We got the first byte only of a multibyte char; remove it.
                                $string = substr( $string, 0, -1 );
@@ -1537,11 +1544,9 @@ class Language {
                        $memcKey = wfMemcKey('localisation', $code );
                        $cache = $wgMemc->get( $memcKey );
                        if ( $cache ) {
-                               $expired = false;
                                # Check file modification times
                                foreach ( $cache['deps'] as $file => $mtime ) {
                                        if ( !file_exists( $file ) || filemtime( $file ) > $mtime ) {
-                                               $expired = true;
                                                break;
                                        }
                                }
@@ -1701,7 +1706,7 @@ class Language {
         * Do any necessary post-cache-load settings adjustment
         */
        function fixUpSettings() {
-               global $wgExtraNamespaces, $wgMetaNamespace, $wgMetaNamespaceTalk, $wgMessageCache, 
+               global $wgExtraNamespaces, $wgMetaNamespace, $wgMetaNamespaceTalk,
                        $wgNamespaceAliases, $wgAmericanDates;
                wfProfileIn( __METHOD__ );
                if ( $wgExtraNamespaces ) {
index 316bcb1..4c0b562 100644 (file)
@@ -36,7 +36,6 @@ class LanguageConverter {
                                                                $variantfallbacks=array(),
                                                                $markup=array(),
                                                                $flags = array()) {
-               global $wgLegalTitleChars;
                $this->mLangObj = $langobj;
                $this->mMainLanguageCode = $maincode;
                $this->mVariants = $variants;
@@ -408,10 +407,11 @@ class LanguageConverter {
                                $carray = $this->parseManualRule($rules, $flags);
 
                                $disp = '';
-                               if(array_key_exists($plang, $carray))
+                               if(array_key_exists($plang, $carray)) {
                                        $disp = $carray[$plang];
-                               else if(array_key_exists($fallback, $carray))
+                               } else if(array_key_exists($fallback, $carray)) {
                                        $disp = $carray[$fallback];
+                               }
                        } else{
                                // if we don't do content convert, still strip the -{}- tags
                                $disp = $rules;
@@ -621,7 +621,6 @@ class LanguageConverter {
                        // not in cache, or we need a fresh reload.
                        // we will first load the default tables
                        // then update them using things in MediaWiki:Zhconversiontable/*
-                       global $wgMessageCache;
                        $this->loadDefaultTables();
                        foreach($this->mVariants as $var) {
                                $cached = $this->parseCachedTable($var);
index 55d2811..b71b133 100644 (file)
@@ -7,6 +7,7 @@
 
 class LanguageKo extends Language {
        function firstChar( $s ) {
+               $matches = array();
                preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);