You are here

function example_file_scan_directory in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/tests/old/samples/example.module \example_file_scan_directory()

File

coder_upgrade/tests/old/samples/example.module, line 1783

Code

function example_file_scan_directory() {

  // Start with l() since we can use this code to get arguments. Easier with parser.
  $link = l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE);
  file_scan_directory($dir, $mask, $nomask = array(
    '.',
    '..',
    'CVS',
  ), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0);
  file_scan_directory($dir, $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth);
  file_scan_directory($dir, $mask, array(
    '.',
    '..',
    'CVS',
  ), 0, TRUE, 'filename', 0, 0);
  file_scan_directory($dir, $mask, array(
    '.',
    '..',
    'CVS',
  ), 0, TRUE, 'filename', 0);

  // Non-default values.
  file_scan_directory($dir, $mask, array(
    '.svn',
    '.cvs',
    'xx',
  ), 10, FALSE, 'basename', 5);

  // Attempt to change $mask
  $mask = '\\.module$';
  file_scan_directory($dir, $mask, array(
    ".",
    "..",
    "CVS",
  ), 0, TRUE, 'filename', 0, 0);

  // Attempt to change $nomask
  $mask = '\\.module$';
  $nomask = array(
    ".",
    "..",
    "CVS",
  );
  file_scan_directory($dir, $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth);

  // file_scan_directory() -- Change the next line but leave this alone
  file_scan_directory($dir, '\\.module$', array(
    '.',
    '..',
    'CVS',
  ), 0, TRUE, 'filename', 0, 0);
  foreach (file_scan_directory(DRUPAL_ROOT . '/includes/database', '^[a-z/]*$', array(
    '.',
    '..',
    'CVS',
  ), 0, FALSE) as $file) {
    include_once "{$file->filename}/install.inc";
    include_once "{$file->filename}/database.inc";
    $drivers[$file->basename] = $file->filename;

    /*
     This is the expected code.
        include_once "{$file->filepath}/install.inc";
        include_once "{$file->filepath}/database.inc";
        $drivers[$file->filename] = $file->filepath;
    */
  }
}