function get_full_directories($basedir) { $fs_fulldirs = get_fs_directories($basedir); return $fs_fulldirs; }
/** * Returns an array containing sub-directories which are potentially * a category. * Directories named ".svn", "thumbnail", "pwg_high" or "pwg_representative" * are omitted. * * @param string $basedir (eg: ./galleries) * @return string[] */ function get_fs_directories($path, $recursive = true) { global $conf; $dirs = array(); $path = rtrim($path, '/'); $exclude_folders = array_merge($conf['sync_exclude_folders'], array('.', '..', '.svn', 'thumbnail', 'pwg_high', 'pwg_representative')); $exclude_folders = array_flip($exclude_folders); if (is_dir($path)) { if ($contents = opendir($path)) { while (($node = readdir($contents)) !== false) { if (is_dir($path . '/' . $node) and !isset($exclude_folders[$node])) { $dirs[] = $path . '/' . $node; if ($recursive) { $dirs = array_merge($dirs, get_fs_directories($path . '/' . $node)); } } } closedir($contents); } } return $dirs; }