/**
* Returns an array of all folder names within the source folder or FALSE
* if SourceFolder does not exist.
*
* @param string $SourceFolder
*/
public static function folders($SourceFolders)
{
if (!is_array($SourceFolders)) {
$SourceFolders = array($SourceFolders);
}
$BlackList = Gdn::config('Garden.FolderBlacklist');
if (!is_array($BlackList)) {
$BlackList = array('.', '..');
}
$Result = array();
foreach ($SourceFolders as $SourceFolder) {
if ($DirectoryHandle = opendir($SourceFolder)) {
while (($Item = readdir($DirectoryHandle)) !== false) {
$SubFolder = combinePaths(array($SourceFolder, $Item));
if (!in_array($Item, $BlackList) && is_dir($SubFolder)) {
$Result[] = $Item;
}
}
closedir($DirectoryHandle);
}
}
if (count($Result) == 0) {
return false;
}
return $Result;
}