diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-01-28 22:00:20 +0100 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-01-28 22:00:20 +0100 |
commit | 269b942a2bf7b022795e591d9b0ad04526ee7e09 (patch) | |
tree | f465bb5a700d4cc5d72ca6e55e251640a46b869b /system/helpers/directory_helper.php | |
parent | a25530f6594c7ba45b3faa9537fda9f807069759 (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/helpers/directory_helper.php')
-rw-r--r-- | system/helpers/directory_helper.php | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 4a499de5c..5a23944cb 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -39,29 +39,31 @@ * @param bool whether to limit the result to the top level only
* @return array
*/
-function directory_map($source_dir, $top_level_only = FALSE)
-{
- if ($fp = @opendir($source_dir))
- {
- $filedata = array();
- while (FALSE !== ($file = readdir($fp)))
+if (! function_exists('directory_map'))
+{
+ function directory_map($source_dir, $top_level_only = FALSE)
+ {
+ if ($fp = @opendir($source_dir))
{
- if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE)
+ $filedata = array();
+ while (FALSE !== ($file = readdir($fp)))
{
- $temp_array = array();
+ if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE)
+ {
+ $temp_array = array();
- $temp_array = directory_map($source_dir.$file."/");
+ $temp_array = directory_map($source_dir.$file."/");
- $filedata[$file] = $temp_array;
- }
- elseif (substr($file, 0, 1) != ".")
- {
- $filedata[] = $file;
+ $filedata[$file] = $temp_array;
+ }
+ elseif (substr($file, 0, 1) != ".")
+ {
+ $filedata[] = $file;
+ }
}
+ return $filedata;
}
- return $filedata;
}
}
-
?>
\ No newline at end of file |