Changeset 8103 for branches/crazyhorse/wp-admin/includes/file.php
- Timestamp:
- 06/16/2008 09:08:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/includes/file.php
r8053 r8103 41 41 42 42 return $real_file; 43 } 44 //$folder = Full path to folder 45 //$levels = Levels of folders to follow, Default: 100 (PHP Loop limit) 46 function list_files( $folder = '', $levels = 100 ) { 47 if( empty($folder) ) 48 return false; 49 50 if( ! $levels ) 51 return false; 52 53 $files = array(); 54 if ( $dir = @opendir( $folder ) ) { 55 while (($file = readdir( $dir ) ) !== false ) { 56 if ( in_array($file, array('.', '..') ) ) 57 continue; 58 if ( is_dir( $folder . '/' . $file ) ) { 59 $files2 = list_files( $folder . '/' . $file, $levels - 1); 60 if( $files2 ) 61 $files = array_merge($files, $files2 ); 62 else 63 $files[] = $folder . '/' . $file . '/'; 64 } else { 65 $files[] = $folder . '/' . $file; 66 } 67 } 68 } 69 @closedir( $dir ); 70 return $files; 43 71 } 44 72
Note: See TracChangeset
for help on using the changeset viewer.