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/smiley_helper.php b/system/helpers/smiley_helper.php
index c2f50ec..d9a6934 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -213,16 +213,30 @@
*/
function _get_smiley_array()
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
+ static $_smileys;
+
+ if ( ! is_array($smileys))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
- }
- elseif (file_exists(APPPATH.'config/smileys.php'))
- {
- include(APPPATH.'config/smileys.php');
+ if (file_exists(APPPATH.'config/smileys.php'))
+ {
+ include(APPPATH.'config/smileys.php');
+ }
+
+ if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
+ {
+ include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
+ }
+
+ if (empty($smileys) OR ! is_array($smileys))
+ {
+ $_smileys = array();
+ return FALSE;
+ }
+
+ $_smileys = $smileys;
}
- return (isset($smileys) && is_array($smileys)) ? $smileys : FALSE;
+ return $_smileys;
}
}