summaryrefslogtreecommitdiffstats
path: root/system/helpers/text_helper.php
diff options
context:
space:
mode:
authorEric Barnes <eric@ericlbarnes.com>2011-01-11 22:10:26 +0100
committerEric Barnes <eric@ericlbarnes.com>2011-01-11 22:10:26 +0100
commit5e04480e5a4dd1b9b639eca54f5f3adbd0b39039 (patch)
tree3381aca8d83ea41e686bf7ffa35ef64705b349e8 /system/helpers/text_helper.php
parent7b3be2fbcf62791918be5fe6d5c42eb005eb7342 (diff)
Reworked convert_foreign_characters in text helper. Thanks to Mario Ricalde.
Diffstat (limited to 'system/helpers/text_helper.php')
-rw-r--r--system/helpers/text_helper.php17
1 files changed, 4 insertions, 13 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 58b08aaf8..9194b577d 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -364,30 +364,21 @@ if ( ! function_exists('highlight_phrase'))
*/
if ( ! function_exists('convert_accented_characters'))
{
- function convert_accented_characters($match)
+ function convert_accented_characters($str)
{
if ( ! file_exists(APPPATH.'config/foreign_chars'.EXT))
{
- return $match;
+ return $str;
}
include APPPATH.'config/foreign_chars'.EXT;
if ( ! isset($foreign_characters))
{
- return $match;
+ return $str;
}
- $ord = ord($match['1']);
-
- if (isset($foreign_characters[$ord]))
- {
- return $foreign_characters[$ord];
- }
- else
- {
- return $match['1'];
- }
+ return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str);
}
}