You are here

protected function FeedsFileFetcher::listFiles in Feeds 7.2

Returns an array of files in a directory.

Parameters

string $dir: A stream wrapper URI that is a directory.

Return value

array An array of stream wrapper URIs pointing to files. The array is empty if no files could be found. Never contains directories.

1 call to FeedsFileFetcher::listFiles()
FeedsFileFetcher::fetch in plugins/FeedsFileFetcher.inc
Implements FeedsFetcher::fetch().

File

plugins/FeedsFileFetcher.inc, line 81
Home of the FeedsFileFetcher and related classes.

Class

FeedsFileFetcher
Fetches data via HTTP.

Code

protected function listFiles($dir) {

  // Seperate out string into array of extensions. Make sure its regex safe.
  $config = $this
    ->getConfig();
  $extensions = array_filter(array_map('preg_quote', explode(' ', $config['allowed_extensions'])));
  $regex = '/\\.(' . implode('|', $extensions) . ')$/';
  $files = array();
  foreach (file_scan_directory($dir, $regex) as $file) {
    $files[] = $file->uri;
  }
  return $files;
}