function _coder_page_form_includes in Coder 6.2
Same name and namespace in other branches
- 5.2 coder.module \_coder_page_form_includes()
- 5 coder.module \_coder_page_form_includes()
- 6 coder.module \_coder_page_form_includes()
Add results to form array for display on form page.
Parameters
$form: Form array variable to be modified.
$coder_args: Coder settings, see do_coder_reviews() for details.
$name: Name of form element.
$files: Array of file objects to check and display the results of, see file_scan_directory().
$offset: Integer offset to munge filenames with.
$exclusions: Exclusions that should be ignored in $files.
$ignores: Array of lines per file to be skipped for defined reviews.
Return value
Statistics array in form: string filename => array value of '#stats' from do_coder_reviews().
1 call to _coder_page_form_includes()
- coder_page_form in ./
coder.module - Implementation of hook_form().
File
- ./
coder.module, line 924
Code
function _coder_page_form_includes(&$form, $coder_args, $name, $files, $offset, $exclusions, $ignores) {
$stats = array();
$coder_args['#name'] = $name;
$weight = 0;
$exclusions = str_replace(array(
"\r\n",
"\r",
"\n",
'/',
'*',
'.',
), array(
'|',
'|',
'|',
'\\/',
'.*',
'\\.',
), $exclusions);
foreach ($files as $file) {
if (!empty($exclusions) && preg_match("/{$exclusions}/", $file->filename)) {
continue;
// don't review this files.
}
$filename = drupal_substr($file->filename, $offset);
$php_extensions = variable_get('coder_review_php_ext', array(
'inc',
'php',
'install',
'test',
));
$coder_args['#filename'] = $filename;
$coder_args['#php_extensions'] = $php_extensions;
$coder_args['#include_extensions'] = _coder_get_reviews_extensions($php_extensions, $coder_args['#reviews']);
$coder_args['#ignore_lines'] = isset($ignores[$filename]) && is_array($ignores[$filename]) ? $ignores[$filename] : array();
$results = do_coder_reviews($coder_args);
$stats[$filename] = $results['#stats'];
unset($results['#stats']);
// Output the results in a collapsible fieldset.
$form[$name][$filename] = array(
'#type' => 'fieldset',
'#title' => $filename,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => ++$weight,
);
if (empty($results)) {
$results[] = t('No Problems Found');
}
else {
$form[$name][$filename]['#collapsed'] = FALSE;
$form[$name]['#collapsed'] = FALSE;
}
$form[$name][$filename]['output'] = array(
'#value' => theme('coder', $name, $filename, $results),
);
}
return $stats;
}