public static array
folders
(mixed $path, mixed $filter = '.', mixed $recurse = false, mixed $full = false, mixed $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), mixed $excludeFilter = array('^\\..*'))
/**
* Utility function to read the folders in a folder.
*
* @param string $path The path of the folder to read.
* @param string $filter A filter for folder names.
* @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth.
* @param boolean $full True to return the full path to the folders.
* @param array $exclude Array with names of folders which should not be shown in the result.
* @param array $excludeFilter Array with regular expressions matching folders which should not be shown in the result.
*
* @return array Folders in the given folder.
*
* @since 1.7.0
*/
public static function folders($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludeFilter = array('^\\..*'))
{
// Check to make sure the path valid and clean
$path = Path::clean($path);
// Is the path a folder?
if (!is_dir($path)) {
Log::add(Text::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', __METHOD__, $path), Log::WARNING, 'jerror');
return false;
}
// Compute the excludefilter string
if (\count($excludeFilter)) {
$excludeFilterString = '/(' . implode('|', $excludeFilter) . ')/';
} else {
$excludeFilterString = '';
}
// Get the folders
$arr = self::_items($path, $filter, $recurse, $full, $exclude, $excludeFilterString, false);
// Sort the folders
asort($arr);
return array_values($arr);
}