MediaWiki
REL1_19
|
00001 <?php 00002 00008 class LanguageEo extends Language { 00040 function iconv( $in, $out, $string ) { 00041 if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) { 00042 return preg_replace_callback ( 00043 '/([cghjsu]x?)((?:xx)*)(?!x)/i', 00044 array( $this, 'strrtxuCallback' ), $string ); 00045 } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { 00046 # Double Xs only if they follow cxapelutaj literoj. 00047 return preg_replace_callback( 00048 '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i', 00049 array( $this, 'strrtuxCallback' ), $string ); 00050 } 00051 return parent::iconv( $in, $out, $string ); 00052 } 00053 00058 function strrtuxCallback( $matches ) { 00059 static $ux = array ( 00060 'x' => 'xx' , 'X' => 'Xx' , 00061 "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" , 00062 "\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" , 00063 "\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" , 00064 "\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" , 00065 "\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" , 00066 "\xc5\xac" => "Ux" , "\xc5\xad" => "ux" 00067 ); 00068 return strtr( $matches[1], $ux ); 00069 } 00070 00075 function strrtxuCallback( $matches ) { 00076 static $xu = array ( 00077 'xx' => 'x' , 'xX' => 'x' , 00078 'Xx' => 'X' , 'XX' => 'X' , 00079 "Cx" => "\xc4\x88" , "CX" => "\xc4\x88" , 00080 "cx" => "\xc4\x89" , "cX" => "\xc4\x89" , 00081 "Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" , 00082 "gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" , 00083 "Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" , 00084 "hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" , 00085 "Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" , 00086 "jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" , 00087 "Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" , 00088 "sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" , 00089 "Ux" => "\xc5\xac" , "UX" => "\xc5\xac" , 00090 "ux" => "\xc5\xad" , "uX" => "\xc5\xad" 00091 ); 00092 return strtr( $matches[1], $xu ) . strtr( $matches[2], $xu ); 00093 } 00094 00099 function checkTitleEncoding( $s ) { 00100 # Check for X-system backwards-compatibility URLs 00101 $ishigh = preg_match( '/[\x80-\xff]/', $s ); 00102 $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' . 00103 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); 00104 00105 if ( $ishigh and !$isutf ) { 00106 # Assume Latin1 00107 $s = utf8_encode( $s ); 00108 } else { 00109 if ( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]' . 00110 '|\xc5[\x9c\x9d\xac\xad])/', $s ) ) 00111 return $s; 00112 } 00113 00114 // if( preg_match( '/[cghjsu]x/i', $s ) ) 00115 // return $this->iconv( 'x', 'utf-8', $s ); 00116 return $s; 00117 } 00118 00119 function initEncoding() { 00120 global $wgEditEncoding; 00121 $wgEditEncoding = 'x'; 00122 } 00123 }