summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-01-16 13:02:24 +0100
committerAndrey Andreev <narf@bofh.bg>2012-01-16 13:02:24 +0100
commit0f2ec5bde259b67f66cc353692d71d8a47f71b01 (patch)
tree0d0a7801cef4ca29b2988873daca9a5cd3344256 /system/helpers
parentcb324bd9268fc6b0c93fd22545bd989771d68b04 (diff)
convert_accented_characters() to include foreign_chars.php only when needed
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/text_helper.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index cef32847d..8e308b722 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -372,18 +372,23 @@ if ( ! function_exists('convert_accented_characters'))
{
function convert_accented_characters($str)
{
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
- {
- include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
- }
- elseif (is_file(APPPATH.'config/foreign_chars.php'))
- {
- include(APPPATH.'config/foreign_chars.php');
- }
+ global $foreign_characters;
- if ( ! isset($foreign_characters))
+ if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
{
- return $str;
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
+ {
+ include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
+ }
+ elseif (is_file(APPPATH.'config/foreign_chars.php'))
+ {
+ include(APPPATH.'config/foreign_chars.php');
+ }
+
+ if ( ! isset($foreign_characters) OR ! is_array($foreign_chars))
+ {
+ return $str;
+ }
}
return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str);