summaryrefslogtreecommitdiffstats
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
parentcb324bd9268fc6b0c93fd22545bd989771d68b04 (diff)
convert_accented_characters() to include foreign_chars.php only when needed
-rw-r--r--application/config/foreign_chars.php6
-rw-r--r--system/helpers/text_helper.php25
2 files changed, 18 insertions, 13 deletions
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
index 1ae0cef5f..f2f981c27 100644
--- a/application/config/foreign_chars.php
+++ b/application/config/foreign_chars.php
@@ -5,9 +5,9 @@
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Academic Free License version 3.0
- *
+ *
* This source file is subject to the Academic Free License (AFL 3.0) that is
* bundled with this package in the files license_afl.txt / license_afl.rst.
* It is also available through the world wide web at this URL:
@@ -87,4 +87,4 @@ $foreign_characters = array(
);
/* End of file foreign_chars.php */
-/* Location: ./application/config/foreign_chars.php */ \ No newline at end of file
+/* Location: ./application/config/foreign_chars.php */
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);