diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/normal | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/normal')
-rw-r--r-- | includes/normal/RandomTest.php | 2 | ||||
-rw-r--r-- | includes/normal/UtfNormal.php | 32 |
2 files changed, 17 insertions, 17 deletions
diff --git a/includes/normal/RandomTest.php b/includes/normal/RandomTest.php index f2ec460e..d96cb09a 100644 --- a/includes/normal/RandomTest.php +++ b/includes/normal/RandomTest.php @@ -54,7 +54,7 @@ function donorm( $str ) { # UnicodeString constructor fails if the string ends with a head byte. # Add a junk char at the end, we'll strip it off - return rtrim( utf8_normalize( $str . "\x01", UNORM_NFC ), "\x01" ); + return rtrim( utf8_normalize( $str . "\x01", UtfNormal::UNORM_NFC ), "\x01" ); } function wfMsg($x) { diff --git a/includes/normal/UtfNormal.php b/includes/normal/UtfNormal.php index 919278c9..b5aad301 100644 --- a/includes/normal/UtfNormal.php +++ b/includes/normal/UtfNormal.php @@ -28,17 +28,6 @@ * @defgroup UtfNormal UtfNormal */ -/** - * For using the ICU wrapper - */ -define( 'UNORM_NONE', 1 ); -define( 'UNORM_NFD', 2 ); -define( 'UNORM_NFKD', 3 ); -define( 'UNORM_NFC', 4 ); -define( 'UNORM_DEFAULT', UNORM_NFC ); -define( 'UNORM_NFKC', 5 ); -define( 'UNORM_FCD', 6 ); - define( 'NORMALIZE_ICU', function_exists( 'utf8_normalize' ) ); define( 'NORMALIZE_INTL', function_exists( 'normalizer_normalize' ) ); @@ -57,6 +46,17 @@ define( 'NORMALIZE_INTL', function_exists( 'normalizer_normalize' ) ); * @ingroup UtfNormal */ class UtfNormal { + /** + * For using the ICU wrapper + */ + const UNORM_NONE = 1; + const UNORM_NFD = 2; + const UNORM_NFKD = 3; + const UNORM_NFC = 4; + const UNORM_NFKC = 5; + const UNORM_FCD = 6; + const UNORM_DEFAULT = self::UNORM_NFC; + static $utfCombiningClass = null; static $utfCanonicalComp = null; static $utfCanonicalDecomp = null; @@ -82,7 +82,7 @@ class UtfNormal { # UnicodeString constructor fails if the string ends with a # head byte. Add a junk char at the end, we'll strip it off. - return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" ); + return rtrim( utf8_normalize( $string . "\x01", self::UNORM_NFC ), "\x01" ); } elseif( NORMALIZE_INTL ) { $string = self::replaceForNativeNormalize( $string ); $norm = normalizer_normalize( $string, Normalizer::FORM_C ); @@ -121,7 +121,7 @@ class UtfNormal { if( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_C ); elseif( NORMALIZE_ICU ) - return utf8_normalize( $string, UNORM_NFC ); + return utf8_normalize( $string, self::UNORM_NFC ); elseif( UtfNormal::quickIsNFC( $string ) ) return $string; else @@ -139,7 +139,7 @@ class UtfNormal { if( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_D ); elseif( NORMALIZE_ICU ) - return utf8_normalize( $string, UNORM_NFD ); + return utf8_normalize( $string, self::UNORM_NFD ); elseif( preg_match( '/[\x80-\xff]/', $string ) ) return UtfNormal::NFD( $string ); else @@ -158,7 +158,7 @@ class UtfNormal { if( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_KC ); elseif( NORMALIZE_ICU ) - return utf8_normalize( $string, UNORM_NFKC ); + return utf8_normalize( $string, self::UNORM_NFKC ); elseif( preg_match( '/[\x80-\xff]/', $string ) ) return UtfNormal::NFKC( $string ); else @@ -177,7 +177,7 @@ class UtfNormal { if( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_KD ); elseif( NORMALIZE_ICU ) - return utf8_normalize( $string, UNORM_NFKD ); + return utf8_normalize( $string, self::UNORM_NFKD ); elseif( preg_match( '/[\x80-\xff]/', $string ) ) return UtfNormal::NFKD( $string ); else |