| @@ 443-459 (lines=17) @@ | ||
| 440 | * @param string $directory Full path to a directory |
|
| 441 | * @return array A list of files and dirs in the directory |
|
| 442 | */ |
|
| 443 | function my_directory_to_array($directory) |
|
| 444 | { |
|
| 445 | $array_items = array(); |
|
| 446 | if ($handle = opendir($directory)) { |
|
| 447 | while (false !== ($file = readdir($handle))) { |
|
| 448 | if ($file != "." && $file != "..") { |
|
| 449 | if (is_dir($directory."/".$file)) { |
|
| 450 | $array_items = array_merge($array_items, my_directory_to_array($directory.'/'.$file)); |
|
| 451 | $file = $directory."/".$file; |
|
| 452 | $array_items[] = preg_replace("/\/\//si", '/', $file); |
|
| 453 | } |
|
| 454 | } |
|
| 455 | } |
|
| 456 | closedir($handle); |
|
| 457 | } |
|
| 458 | return $array_items; |
|
| 459 | } |
|
| 460 | ||
| 461 | /** |
|
| 462 | * This function returns the value of a parameter from the configuration file |
|
| @@ 1022-1038 (lines=17) @@ | ||
| 1019 | * @author Julio Montoya |
|
| 1020 | * @version April 2008 |
|
| 1021 | */ |
|
| 1022 | function directory_to_array($directory) |
|
| 1023 | { |
|
| 1024 | $array_items = array(); |
|
| 1025 | if ($handle = @opendir($directory)) { |
|
| 1026 | while (false !== ($file = readdir($handle))) { |
|
| 1027 | if ($file != '.' && $file != '..') { |
|
| 1028 | if (is_dir($directory.'/'.$file)) { |
|
| 1029 | $array_items = array_merge($array_items, directory_to_array($directory.'/'.$file)); |
|
| 1030 | $file = $directory.'/'.$file; |
|
| 1031 | $array_items[] = preg_replace("/\/\//si", '/', $file); |
|
| 1032 | } |
|
| 1033 | } |
|
| 1034 | } |
|
| 1035 | closedir($handle); |
|
| 1036 | } |
|
| 1037 | ||
| 1038 | return $array_items; |
|
| 1039 | } |
|
| 1040 | ||
| 1041 | /** |
|