diff --git a/classes/Tools.php b/classes/Tools.php index b721973d6..97fc28ec5 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1097,24 +1097,29 @@ class ToolsCore */ public static function replaceAccentedChars($str) { - $str = preg_replace('/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u', 'a', $str); - $str = preg_replace('/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u', 'c', $str); - $str = preg_replace('/[\x{010F}]/u', 'd', $str); - $str = preg_replace('/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}\x{0118}]/u', 'e', $str); - $str = preg_replace('/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u', 'i', $str); - $str = preg_replace('/[\x{0142}\x{0141}\x{013E}\x{013A}]/u', 'l', $str); - $str = preg_replace('/[\x{00F1}\x{0148}]/u', 'n', $str); - $str = preg_replace('/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{00D3}]/u', 'o', $str); - $str = preg_replace('/[\x{0159}\x{0155}]/u', 'r', $str); - $str = preg_replace('/[\x{015B}\x{015A}\x{0161}]/u', 's', $str); - $str = preg_replace('/[\x{00DF}]/u', 'ss', $str); - $str = preg_replace('/[\x{0165}]/u', 't', $str); - $str = preg_replace('/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u', 'u', $str); - $str = preg_replace('/[\x{00FD}\x{00FF}]/u', 'y', $str); - $str = preg_replace('/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u', 'z', $str); - $str = preg_replace('/[\x{00E6}]/u', 'ae', $str); - $str = preg_replace('/[\x{0153}]/u', 'oe', $str); - return $str; + $patterns = array( + '/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u', + '/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u', + '/[\x{010F}]/u', + '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}\x{0118}]/u', + '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u', + '/[\x{0142}\x{0141}\x{013E}\x{013A}]/u', + '/[\x{00F1}\x{0148}]/u', + '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{00D3}]/u', + '/[\x{0159}\x{0155}]/u', + '/[\x{015B}\x{015A}\x{0161}]/u', + '/[\x{00DF}]/u', + '/[\x{0165}]/u', + '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u', + '/[\x{00FD}\x{00FF}]/u', + '/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u', + '/[\x{00E6}]/u', + '/[\x{0153}]/u' + ); + + $replacements = array('a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe'); + + return preg_replace($patterns, $replacements, $str); } /** @@ -2235,7 +2240,7 @@ FileETag INode MTime Size for ($len; $len > 0; $len--) $str .= '.0'; } - + public static function modRewriteActive() { return Tools::apacheModExists('mod_rewrite'); @@ -2266,4 +2271,5 @@ function cmpPriceDesc($a, $b) elseif ((float)($a['price_tmp']) > (float)($b['price_tmp'])) return (-1); return (0); -} \ No newline at end of file +} +