Replace is_file() with the faster file_exists()
(where it makes sense)

Also:
 - Implemented caching of configuration arrays for smileys, foreign characters and doctypes.
 - Implemented cascading-style loading of configuration files (except for library configs, DB and constants.php).
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index c255c15..54db14f 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -358,31 +358,35 @@
 	/**
 	 * Convert Accented Foreign Characters to ASCII
 	 *
-	 * @param	string	the text string
+	 * @param	string	$str	Input string
 	 * @return	string
 	 */
 	function convert_accented_characters($str)
 	{
-		global $foreign_characters;
+		static $_foreign_characters;
 
-		if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
+		if ( ! is_array($_foreign_characters))
 		{
-			if (is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
-			{
-				include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
-			}
-			elseif (is_file(APPPATH.'config/foreign_chars.php'))
+			if (file_exists(APPPATH.'config/foreign_chars.php'))
 			{
 				include(APPPATH.'config/foreign_chars.php');
 			}
 
-			if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
+			if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
 			{
+				include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
+			}
+
+			if (empty($foreign_characters) OR ! is_array($foreign_characters))
+			{
+				$_foreign_characters = array();
 				return $str;
 			}
+
+			$_foreign_characters = $foreign_characters;
 		}
 
-		return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str);
+		return preg_replace(array_keys($_foreign_characters), array_values($_foreign_characters), $str);
 	}
 }