summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_driver.php2
-rw-r--r--system/helpers/directory_helper.php6
-rw-r--r--system/helpers/file_helper.php34
-rw-r--r--user_guide/changelog.html1
-rw-r--r--user_guide/images/ci_logo.jpgbin5601 -> 5602 bytes
5 files changed, 37 insertions, 6 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 61f0d307f..139dbf7db 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -596,8 +596,6 @@ class CI_DB_driver {
return $str;
}
-
-
// --------------------------------------------------------------------
/**
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index e6ed47fd8..ad868519d 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -40,12 +40,10 @@
* @return array
*/
function directory_map($source_dir, $top_level_only = FALSE)
-{
- if ( ! isset($filedata))
- $filedata = array();
-
+{
if ($fp = @opendir($source_dir))
{
+ $filedata = array();
while (FALSE !== ($file = readdir($fp)))
{
if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE)
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index c9c21380d..4da62ade6 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -141,5 +141,39 @@ function delete_files($path, $del_dir = FALSE, $level = 0)
}
}
+// ------------------------------------------------------------------------
+
+/**
+ * Get Filenames
+ *
+ * Reads the specified directory and builds an array containing the filenames.
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access public
+ * @param string path to source
+ * @param bool whether to include the path as part of the filename
+ * @return array
+ */
+function get_filenames($source_dir, $include_path = FALSE)
+{
+ static $_filedata = array();
+
+ if ($fp = @opendir($source_dir))
+ {
+ while (FALSE !== ($file = readdir($fp)))
+ {
+ if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.')
+ {
+ get_filenames($source_dir.$file."/", $include_path);
+ }
+ elseif (substr($file, 0, 1) != ".")
+ {
+
+ $_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
+ }
+ }
+ return $_filedata;
+ }
+}
?> \ No newline at end of file
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index db656bc0a..8ad7fefaa 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -85,6 +85,7 @@ a suggestion offered by coolfactor in our forums. Please check the documentatio
<li>Added <a href="./database/results.html">$query->free_result()</a> to database class.</li>
<li>Added <a href="./database/fields.html">$query->list_fields()</a> function to database class</li>
<li>Added <a href="./database/helpers.html">$this->db->platform()</a> function</li>
+<li>Added new <a href="./helpers/file_helper.html">File Helper</a>: get_filenames()</li>
<li>Added "is_numeric" to validation, which uses the native PHP is_numeric function.</li>
<li>Improved the URI handler to make it more reliable when the $config['uri_protocol'] item is set to AUTO.</li>
<li>Moved most of the functions in the Controller class into the Loader class, allowing fewer reserved function names for controllers when running under PHP 5.</li>
diff --git a/user_guide/images/ci_logo.jpg b/user_guide/images/ci_logo.jpg
index b31a7972b..3ae0eee07 100644
--- a/user_guide/images/ci_logo.jpg
+++ b/user_guide/images/ci_logo.jpg
Binary files differ