You are here

function _coder_review_get_default_settings in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_review/coder_review.common.inc \_coder_review_get_default_settings()

Returns a active settings array for coder_review.

The name is a misnomer, but is a largely correct characterization for most of Coder's settings as the variables usually do not exist.

Parameters

$args: String settings argument, can be 'settings', 'active', 'core', 'all' and 'default'.

Return value

Associative array of settings in form setting name => setting value.

3 calls to _coder_review_get_default_settings()
coder_review_admin_settings in coder_review/coder_review.module
Configuration page.
coder_review_drush_review in coder_review/coder_review.drush.inc
Do the actual review.
coder_review_page_form in coder_review/coder_review.module
Implements hook_form().

File

coder_review/coder_review.module, line 688

Code

function _coder_review_get_default_settings($arg = 'default') {
  $settings['coder_reviews'] = variable_get('coder_reviews', _coder_review_default_reviews());
  $settings['coder_severity'] = variable_get('coder_severity', SEVERITY_NORMAL);

  // Determine any options based on the passed in URL.
  switch ($arg) {
    case 'settings':
      $settings['coder_includes'] = 1;
      break;
    case 'active':
      $settings['coder_active_modules'] = 1;
      break;
    case 'core':
      $settings['coder_core'] = 1;
      $settings['coder_includes'] = 1;
      break;
    case 'all':
      $settings['coder_core'] = 1;
      $settings['coder_includes'] = 1;
      $settings['coder_all'] = 1;
      break;
    case 'contrib':
      $settings['coder_includes'] = 1;
      $settings['coder_contrib'] = 1;
      break;
    case 'files':
      $settings['coder_files'] = 1;
      break;
    case 'patches':
      $settings['coder_patches'] = 1;
      break;
    case 'default':
      $settings['coder_active_modules'] = variable_get('coder_active_modules', 1);
      $settings['coder_core'] = variable_get('coder_core', 0);
      $settings['coder_includes'] = variable_get('coder_includes', 0);
      $settings['coder_includes_exclusions'] = variable_get('coder_includes_exclusions', '');
      $settings['coder_modules'] = variable_get('coder_modules', array());
      $settings['coder_themes'] = variable_get('coder_themes', array());
      break;
    default:
      $settings['coder_includes'] = 1;
      $settings['coder_includes_exclusions'] = variable_get('coder_includes_exclusions', '');

      // TODO: Does this need to go into coder_review_themes sometimes?
      $settings['coder_modules'] = array(
        $arg => $arg,
      );
      break;
  }
  return $settings;
}