src/Folder.php
public static function files($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'Thumbs.db'), $excludefilter = array('^\..*', '.*~'), $naturalSort = true)
  {
    $path = Path::clean($path);

    if ( !is_dir($path) ){
      throw new Exception(Helper::getTranslation('NOT_A_FOLDER'));
    }

    if ( count($excludefilter) ){
      $excludefilter_string = '/(' . implode('|', $excludefilter) . ')/';
    }
    else {
      $excludefilter_string = '';
    }

    $arr = Folder::_items($path, $filter, $recurse, $full, $exclude, $excludefilter_string, true);

    if ( $naturalSort ){
      natsort($arr);
    }
    else {
      asort($arr);
    }
    return array_values($arr);
  }
public static function files($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'Thumbs.db'), $excludefilter = array('^\..*', '.*~'), $naturalSort = true)
  {
    $path = Path::clean($path);

    if ( !is_dir($path) ){
      throw new Exception(Helper::getTranslation('NOT_A_FOLDER'));
    }

    if ( count($excludefilter) ){
      $excludefilter_string = '/(' . implode('|', $excludefilter) . ')/';
    }
    else {
      $excludefilter_string = '';
    }

    $arr = Folder::_items($path, $filter, $recurse, $full, $exclude, $excludefilter_string, true);

    if ( $naturalSort ){
      natsort($arr);
    }
    else {
      asort($arr);
    }
    return array_values($arr);
  }
public static function files ( $ path , $ filter = '.' , $ recurse = false , $ full = false , $ exclude = array ( '.svn' , 'CVS' , '.DS_Store' , '__MACOSX' , 'Thumbs.db' ) , $ excludefilter = array ( '^\..*' , '.*~' ) , $ naturalSort = true ) { $ path = Path :: clean ( $ path ) ; if ( ! is_dir ( $ path ) ) { throw new Exception ( Helper :: getTranslation ( 'NOT_A_FOLDER' ) ) ; } if ( count ( $ excludefilter ) ) { $ excludefilter_string = '/(' . implode ( '|' , $ excludefilter ) . ')/' ; } else { $ excludefilter_string = '' ; } $ arr = Folder :: _items ( $ path , $ filter , $ recurse , $ full , $ exclude , $ excludefilter_string , true ) ; if ( $ naturalSort ) { natsort ( $ arr ) ; } else { asort ( $ arr ) ; } return array_values ( $ arr ) ; }
Utility function to read the files in a folder.

@param   string    $path           The path of the folder to read.
@param   string    $filter         A filter for file 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 file.
@param   array     $exclude        Array with names of files which should not be shown in the result.
@param   array     $excludefilter  Array of filter to exclude
@param   boolean   $naturalSort    False for asort, true for natsort
@return   array     Array of files
@throws   Exception
Utility function to read the files in a folder .