summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-01-28 22:00:20 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-01-28 22:00:20 +0100
commit269b942a2bf7b022795e591d9b0ad04526ee7e09 (patch)
treef465bb5a700d4cc5d72ca6e55e251640a46b869b /system/libraries
parenta25530f6594c7ba45b3faa9537fda9f807069759 (diff)
added ability to "extend" helpers
* modified Loader to check for prefixed helpers in application/helpers folder * surrounded provided helper functions with if (! function_exists('foo')) conditionals so the user's helper functions take precedent.
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Loader.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index 320a43a00..a59d6e38e 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -366,8 +366,23 @@ class CI_Loader {
{
continue;
}
+
+ $ext_helper = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.EXT;
- if (file_exists(APPPATH.'helpers/'.$helper.EXT))
+ // Is this a helper extension request?
+ if (file_exists($ext_helper))
+ {
+ $base_helper = BASEPATH.'helpers/'.$helper.EXT;
+
+ if ( ! file_exists($base_helper))
+ {
+ show_error('Unable to load the requested file: helpers/'.$helper.EXT);
+ }
+
+ include_once($ext_helper);
+ include_once($base_helper);
+ }
+ elseif (file_exists(APPPATH.'helpers/'.$helper.EXT))
{
include_once(APPPATH.'helpers/'.$helper.EXT);
}