diff options
author | rvelices <rv-github@modusoptimus.com> | 2010-09-16 17:30:56 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2010-09-16 17:30:56 +0000 |
commit | c4bb9c71dd3ca0cb3366623896d867903ce0c531 (patch) | |
tree | 971fd7cb935885c215ea4e46d9c5ae82ca5f91fd /include | |
parent | 1da8e53dd46adaf561c044ea07fc586e07533d2e (diff) |
remove_accents function improvement: shorter + faster code (less func calls)
git-svn-id: http://piwigo.org/svn/trunk@6947 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 187 |
1 files changed, 93 insertions, 94 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 822c36da0..a994fdb95 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -242,103 +242,102 @@ function remove_accents($string) if (seems_utf8($string)) { $chars = array( // Decompositions for Latin-1 Supplement - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', - chr(195).chr(191) => 'y', + "\xc3\x80"=>'A', "\xc3\x81"=>'A', + "\xc3\x82"=>'A', "\xc3\x83"=>'A', + "\xc3\x84"=>'A', "\xc3\x85"=>'A', + "\xc3\x87"=>'C', "\xc3\x88"=>'E', + "\xc3\x89"=>'E', "\xc3\x8a"=>'E', + "\xc3\x8b"=>'E', "\xc3\x8c"=>'I', + "\xc3\x8d"=>'I', "\xc3\x8e"=>'I', + "\xc3\x8f"=>'I', "\xc3\x91"=>'N', + "\xc3\x92"=>'O', "\xc3\x93"=>'O', + "\xc3\x94"=>'O', "\xc3\x95"=>'O', + "\xc3\x96"=>'O', "\xc3\x99"=>'U', + "\xc3\x9a"=>'U', "\xc3\x9b"=>'U', + "\xc3\x9c"=>'U', "\xc3\x9d"=>'Y', + "\xc3\x9f"=>'s', "\xc3\xa0"=>'a', + "\xc3\xa1"=>'a', "\xc3\xa2"=>'a', + "\xc3\xa3"=>'a', "\xc3\xa4"=>'a', + "\xc3\xa5"=>'a', "\xc3\xa7"=>'c', + "\xc3\xa8"=>'e', "\xc3\xa9"=>'e', + "\xc3\xaa"=>'e', "\xc3\xab"=>'e', + "\xc3\xac"=>'i', "\xc3\xad"=>'i', + "\xc3\xae"=>'i', "\xc3\xaf"=>'i', + "\xc3\xb1"=>'n', "\xc3\xb2"=>'o', + "\xc3\xb3"=>'o', "\xc3\xb4"=>'o', + "\xc3\xb5"=>'o', "\xc3\xb6"=>'o', + "\xc3\xb9"=>'u', "\xc3\xba"=>'u', + "\xc3\xbb"=>'u', "\xc3\xbc"=>'u', + "\xc3\xbd"=>'y', "\xc3\xbf"=>'y', // Decompositions for Latin Extended-A - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', - chr(197).chr(190) => 'z', chr(197).chr(191) => 's', + "\xc4\x80"=>'A', "\xc4\x81"=>'a', + "\xc4\x82"=>'A', "\xc4\x83"=>'a', + "\xc4\x84"=>'A', "\xc4\x85"=>'a', + "\xc4\x86"=>'C', "\xc4\x87"=>'c', + "\xc4\x88"=>'C', "\xc4\x89"=>'c', + "\xc4\x8a"=>'C', "\xc4\x8b"=>'c', + "\xc4\x8c"=>'C', "\xc4\x8d"=>'c', + "\xc4\x8e"=>'D', "\xc4\x8f"=>'d', + "\xc4\x90"=>'D', "\xc4\x91"=>'d', + "\xc4\x92"=>'E', "\xc4\x93"=>'e', + "\xc4\x94"=>'E', "\xc4\x95"=>'e', + "\xc4\x96"=>'E', "\xc4\x97"=>'e', + "\xc4\x98"=>'E', "\xc4\x99"=>'e', + "\xc4\x9a"=>'E', "\xc4\x9b"=>'e', + "\xc4\x9c"=>'G', "\xc4\x9d"=>'g', + "\xc4\x9e"=>'G', "\xc4\x9f"=>'g', + "\xc4\xa0"=>'G', "\xc4\xa1"=>'g', + "\xc4\xa2"=>'G', "\xc4\xa3"=>'g', + "\xc4\xa4"=>'H', "\xc4\xa5"=>'h', + "\xc4\xa6"=>'H', "\xc4\xa7"=>'h', + "\xc4\xa8"=>'I', "\xc4\xa9"=>'i', + "\xc4\xaa"=>'I', "\xc4\xab"=>'i', + "\xc4\xac"=>'I', "\xc4\xad"=>'i', + "\xc4\xae"=>'I', "\xc4\xaf"=>'i', + "\xc4\xb0"=>'I', "\xc4\xb1"=>'i', + "\xc4\xb2"=>'IJ', "\xc4\xb3"=>'ij', + "\xc4\xb4"=>'J', "\xc4\xb5"=>'j', + "\xc4\xb6"=>'K', "\xc4\xb7"=>'k', + "\xc4\xb8"=>'k', "\xc4\xb9"=>'L', + "\xc4\xba"=>'l', "\xc4\xbb"=>'L', + "\xc4\xbc"=>'l', "\xc4\xbd"=>'L', + "\xc4\xbe"=>'l', "\xc4\xbf"=>'L', + "\xc5\x80"=>'l', "\xc5\x81"=>'L', + "\xc5\x82"=>'l', "\xc5\x83"=>'N', + "\xc5\x84"=>'n', "\xc5\x85"=>'N', + "\xc5\x86"=>'n', "\xc5\x87"=>'N', + "\xc5\x88"=>'n', "\xc5\x89"=>'N', + "\xc5\x8a"=>'n', "\xc5\x8b"=>'N', + "\xc5\x8c"=>'O', "\xc5\x8d"=>'o', + "\xc5\x8e"=>'O', "\xc5\x8f"=>'o', + "\xc5\x90"=>'O', "\xc5\x91"=>'o', + "\xc5\x92"=>'OE', "\xc5\x93"=>'oe', + "\xc5\x94"=>'R', "\xc5\x95"=>'r', + "\xc5\x96"=>'R', "\xc5\x97"=>'r', + "\xc5\x98"=>'R', "\xc5\x99"=>'r', + "\xc5\x9a"=>'S', "\xc5\x9b"=>'s', + "\xc5\x9c"=>'S', "\xc5\x9d"=>'s', + "\xc5\x9e"=>'S', "\xc5\x9f"=>'s', + "\xc5\xa0"=>'S', "\xc5\xa1"=>'s', + "\xc5\xa2"=>'T', "\xc5\xa3"=>'t', + "\xc5\xa4"=>'T', "\xc5\xa5"=>'t', + "\xc5\xa6"=>'T', "\xc5\xa7"=>'t', + "\xc5\xa8"=>'U', "\xc5\xa9"=>'u', + "\xc5\xaa"=>'U', "\xc5\xab"=>'u', + "\xc5\xac"=>'U', "\xc5\xad"=>'u', + "\xc5\xae"=>'U', "\xc5\xaf"=>'u', + "\xc5\xb0"=>'U', "\xc5\xb1"=>'u', + "\xc5\xb2"=>'U', "\xc5\xb3"=>'u', + "\xc5\xb4"=>'W', "\xc5\xb5"=>'w', + "\xc5\xb6"=>'Y', "\xc5\xb7"=>'y', + "\xc5\xb8"=>'Y', "\xc5\xb9"=>'Z', + "\xc5\xba"=>'z', "\xc5\xbb"=>'Z', + "\xc5\xbc"=>'z', "\xc5\xbd"=>'Z', + "\xc5\xbe"=>'z', "\xc5\xbf"=>'s', // Euro Sign - chr(226).chr(130).chr(172) => 'E', + "\xe2\x82\xac"=>'E', // GBP (Pound) Sign - chr(194).chr(163) => ''); + "\xc2\xa3"=>''); $string = strtr($string, $chars); } else { |