* Add 'reupload' and 'reupload-shared' permission keys to restrict new
[lhc/web/wiklou.git] / languages / LanguageUtf8.php
index 681940e..67433b8 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+/**
+  * @package MediaWiki
+  * @subpackage Language
+  */
 
 if( defined( "MEDIAWIKI" ) ) {
 
@@ -11,15 +15,15 @@ global $wgDBname, $wgMemc;
 $wgInputEncoding    = "UTF-8";
 $wgOutputEncoding      = "UTF-8";
 
-if (function_exists('mb_internal_encoding')) {
+if( function_exists( 'mb_strtoupper' ) ) {
        mb_internal_encoding('UTF-8');
 } else {
        # Hack our own case conversion routines
-       
+
        # Loading serialized arrays is faster than parsing code :P
        $wikiUpperChars = $wgMemc->get( $key1 = "$wgDBname:utf8:upper" );
        $wikiLowerChars = $wgMemc->get( $key2 = "$wgDBname:utf8:lower" );
-       
+
        if(empty( $wikiUpperChars) || empty($wikiLowerChars )) {
                require_once( "includes/Utf8Case.php" );
                $wgMemc->set( $key1, $wikiUpperChars );
@@ -27,11 +31,14 @@ if (function_exists('mb_internal_encoding')) {
        }
 }
 
-# Base stuff useful to all UTF-8 based language files
+/**
+ * Base stuff useful to all UTF-8 based language files
+ * @package MediaWiki
+ */
 class LanguageUtf8 extends Language {
 
        # These two functions use mbstring library, if it is loaded
-       # or compiled and character mapping arrays otherwise. 
+       # or compiled and character mapping arrays otherwise.
        # In case of language-specific character mismatch
        # it should be dealt with in Language classes.
 
@@ -55,7 +62,7 @@ class LanguageUtf8 extends Language {
                }
                return ucfirst( $string );
        }
-       
+
        function lcfirst( $string ) {
                if (function_exists('mb_strtolower')) {
                        return mb_strtolower(mb_substr($string,0,1)).mb_substr($string,1);
@@ -76,7 +83,7 @@ class LanguageUtf8 extends Language {
                # all strtolower on stripped output or argument
                # should be removed and all stripForSearch
                # methods adjusted to that.
-               
+
                wfProfileIn( "LanguageUtf8::stripForSearch" );
                if( function_exists( 'mb_strtolower' ) ) {
                        $out = preg_replace(
@@ -104,10 +111,13 @@ class LanguageUtf8 extends Language {
        function checkTitleEncoding( $s ) {
                global $wgInputEncoding;
 
+               if( is_array( $s ) ) {
+                       wfDebugDieBacktrace( 'Given array to checkTitleEncoding.' );
+               }
                # Check for non-UTF-8 URLs
                $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 ) return $s;
@@ -118,7 +128,7 @@ class LanguageUtf8 extends Language {
        function firstChar( $s ) {
                preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
                '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})/', $s, $matches);
-               
+
                return isset( $matches[1] ) ? $matches[1] : "";
        }