You are here

function _coder_review_get_default_settings in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/coder_review.module \_coder_review_get_default_settings()

Returns an 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

string $args: (optional) A string settings argument, can be 'settings', 'active', 'core', 'all' and 'default'. Defaults to 'default'.

Return value

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

3 calls to _coder_review_get_default_settings()
coder_review_admin_settings in coder_review/coder_review.admin.inc
Page callback: Configures administrative settings via system_settings_form().
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 1295
Common functions used by both the drush and form interfaces.

Code

function _coder_review_get_default_settings($arg = 'default') {
  $settings = array(
    'coder_includes' => 0,
    'coder_includes_exclusions' => '',
    'coder_active_modules' => 0,
    'coder_core' => 0,
    'coder_all' => 0,
    'coder_contrib' => 0,
    'coder_files' => 0,
    'coder_file_list' => '',
    'coder_patches' => 0,
    'coder_modules' => array(),
    'coder_themes' => array(),
    'coder_ignore' => 1,
  );
  $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;
}