summaryrefslogtreecommitdiffstats
path: root/system/helpers/smiley_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-01-29 14:05:02 +0100
committerAndrey Andreev <narf@bofh.bg>2013-01-29 14:05:02 +0100
commit0687911229be13e100724dbf8b15b95146b591a9 (patch)
tree0a843814096d353120efd4a2e648cc3cab05293e /system/helpers/smiley_helper.php
parentc26d34ff12458760eb843454d3224e1dad1fb2e0 (diff)
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).
Diffstat (limited to 'system/helpers/smiley_helper.php')
-rw-r--r--system/helpers/smiley_helper.php28
1 files changed, 21 insertions, 7 deletions
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index c2f50ec73..d9a693493 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -213,16 +213,30 @@ if ( ! function_exists('_get_smiley_array'))
*/
function _get_smiley_array()
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
- {
- include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
- }
- elseif (file_exists(APPPATH.'config/smileys.php'))
+ static $_smileys;
+
+ if ( ! is_array($smileys))
{
- 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;
}
}