Exemple #1
0
function listdiraux($dir, &$files, $extension = null)
{
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file == '.' or $file == '..') {
            continue;
        }
        if (!is_null($extension)) {
            if (!in_array(pathinfo($file, PATHINFO_EXTENSION), $extension, true)) {
                continue;
            }
        }
        $filepath = $dir == '.' ? $file : $dir . '/' . $file;
        if (is_link($filepath)) {
            continue;
        }
        if (is_file($filepath)) {
            $files[] = $filepath;
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
Exemple #2
0
/**
* Recurses a directory structure and creates a list of files
*
* @param  string 	$dir	Starting directory
* @param  string[]  $files  By reference, the current file list
* @return null
*/
function listdiraux($dir, &$files)
{
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (preg_match('/v6$/', $file)) {
            /*
             * This is only v5 documentation
             */
            continue;
        }
        $filepath = $dir == '.' ? $file : $dir . '/' . $file;
        if (is_link($filepath)) {
            continue;
        }
        if (is_file($filepath)) {
            $files[] = $filepath;
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}
Exemple #3
0
function listdiraux($dir, &$files)
{
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        $filepath = $dir == '.' ? $file : $dir . '/' . $file;
        if (is_link($filepath)) {
            continue;
        }
        if (is_file($filepath)) {
            $files[] = $filepath;
        } else {
            if (is_dir($filepath)) {
                listdiraux($filepath, $files);
            }
        }
    }
    closedir($handle);
}