You are here

function _file_list in Coder 7.2

Returns all available file paths matching the regular expression.

Parameters

??? $path: ???

??? $regex: ???

bool $recurse: (optional) ??? Defaults to TRUE.

Return value

array ???

2 calls to _file_list()
coder_review_page_form in coder_review/coder_review.module
Implements hook_form().
drush_coder_review in coder_review/coder_review.drush.inc
Performs the actual review for drush.

File

coder_review/coder_review.common.inc, line 1677
Common functions used by both the drush and form interfaces.

Code

function _file_list($path, $regex, $recurse = TRUE) {
  $files = array();
  foreach (scandir($path) as $file) {
    if ($file != '.' && $file != '..' && is_dir("{$path}/{$file}")) {
      if ($recurse) {
        $files += _file_list("{$path}/{$file}", $regex);
      }
    }
    elseif (preg_match($regex, $file)) {
      $files["{$path}/{$file}"] = "{$path}/{$file}";
    }
  }
  return $files;
}