FOF30\Platform\Joomla\Filesystem::folderFiles PHP Method

folderFiles() public method

Utility function to read the files in a folder.
public folderFiles ( string $path, string $filter = '.', mixed $recurse = false, boolean $full = false, array $exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], array $excludefilter = ['^\..*', '.*~'], boolean $naturalSort = false ) : array
$path string The path of the folder to read.
$filter string A filter for file names.
$recurse mixed True to recursively search into sub-folders, or an integer to specify the maximum depth.
$full boolean True to return the full path to the file.
$exclude array Array with names of files which should not be shown in the result.
$excludefilter array Array of filter to exclude
$naturalSort boolean False for asort, true for natsort
return array Files in the given folder.
    public function folderFiles($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\\..*', '.*~'), $naturalSort = false)
    {
        // JFolder throws idiotic errors if the path is not a folder
        try {
            $path = \JPath::clean($path);
        } catch (\Exception $e) {
            return array();
        }
        if (!@is_dir($path)) {
            return array();
        }
        // Now call JFolder
        return \JFolder::files($path, $filter, $recurse, $full, $exclude, $excludefilter, $naturalSort);
    }