function coder_format_recursive in Coder 7.2
Same name and namespace in other branches
- 5.2 scripts/coder_format/coder_format.inc \coder_format_recursive()
- 5 scripts/coder_format/coder_format.inc \coder_format_recursive()
- 6.2 scripts/coder_format/coder_format.inc \coder_format_recursive()
- 6 scripts/coder_format/coder_format.inc \coder_format_recursive()
- 7 scripts/coder_format/coder_format.inc \coder_format_recursive()
Recursively process .module and .inc files in directory with coder_format_file().
Parameters
$directory: Path to a directory to process recursively.
$undo: Boolean whether or not to undo batch replacements.
2 calls to coder_format_recursive()
- coder_format.php in scripts/
coder_format/ coder_format.php - Coder format shell invocation script.
- drush_coder_format in ./
coder.drush.inc - Performs the desired coder-format command for drush.
File
- scripts/
coder_format/ coder_format.inc, line 16 - Coder format helper functions.
Code
function coder_format_recursive($directory, $undo = FALSE) {
// Convert Windows paths (only cosmetical).
$directory = str_replace('\\', '/', $directory);
// Check if directory exists.
if (!is_dir($directory)) {
drupal_set_message(t('%directory not found.', array(
'%directory' => $directory,
)), 'error');
return FALSE;
}
// Fetch files to process.
$mask = '\\.php$|\\.module$|\\.inc$|\\.install|\\.profile$';
$nomask = array(
'.',
'..',
'CVS',
'.svn',
'.git',
);
if (function_exists('drush_scan_directory')) {
$files = drush_scan_directory($directory, '/' . $mask . '/', $nomask, 0, TRUE);
}
else {
$files = file_scan_directory($directory, $mask, $nomask, 0, TRUE);
}
foreach ($files as $file) {
coder_format_file($file->filename, $undo);
}
}