function _video_multidownload_scandir in Video 6.2
Same name and namespace in other branches
- 5 plugins/video_multidownload/video_multidownload.module \_video_multidownload_scandir()
- 6 plugins/video_multidownload/video_multidownload.module \_video_multidownload_scandir()
Scans a directory and returns an array of all the filenames in the directory. This function is only necessary to maintain PHP 4 support.
Parameters
$dir: The directory. Can be an absolute path or relative from the current working directory.
Return value
array of filenames.
1 call to _video_multidownload_scandir()
- video_multidownload_download in plugins/
video_multidownload/ video_multidownload.module
File
- plugins/
video_multidownload/ video_multidownload.module, line 324 - Enable multiple file download in video module.
Code
function _video_multidownload_scandir($dir) {
//Try a few different ways to open the directory.
if (is_dir($dir)) {
$dir_open = opendir($dir);
}
else {
if (is_dir($new_dir = getcwd() . $dir)) {
$dir_open = opendir($new_dir);
}
else {
if (is_dir($new_dir = getcwd() . '/' . $dir)) {
$dir_open = opendir($new_dir);
}
else {
//If directory does not exist.
return FALSE;
}
}
}
if (!$dir_open) {
//If opendir returned false then return false.
return FALSE;
}
//If it makes it this far $dir_open should be valid.
while (($dir_content = readdir($dir_open)) !== FALSE) {
$files[] = $dir_content;
}
return $files;
}