You are here

function email_verify_admin_settings in Email Verify 7.2

Same name and namespace in other branches
  1. 7 email_verify.admin.inc \email_verify_admin_settings()

Email Verify administration settings form.

Return value

array The admin settings form.

1 string reference to 'email_verify_admin_settings'
email_verify_menu in ./email_verify.module
Implements hook_menu().

File

./email_verify.admin.inc, line 14
This is for the administrative settings for this module.

Code

function email_verify_admin_settings($form, &$form_state) {
  $form['email_verify_activate'] = array(
    '#type' => 'fieldset',
    '#title' => t('Activate module'),
    '#collapsible' => TRUE,
  );
  $form['email_verify_activate']['email_verify_active'] = array(
    '#type' => 'checkbox',
    '#title' => t('Activate this module to verify email adresses'),
    '#default_value' => email_verify_activated(),
    '#description' => t('When activated, Email Verify will check email addresses for validity.'),
  );
  $form['email_verify_activate']['email_verify_test_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Testing options'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t("If the test fails when checking whether this module will work on your system or not, you can try changing the options below to see if they will work better for you."),
  );
  $form['email_verify_activate']['email_verify_test_options']['email_verify_test_options_host_name'] = array(
    '#type' => 'textfield',
    '#title' => t("Host name"),
    '#default_value' => variable_get('email_verify_test_options_host_name', 'drupal.org'),
    '#description' => t('The name of the host to test with. The default is "drupal.org".'),
  );

  // The test is to see if port 25 is open, so offering to change the port
  // number will not give the correct results. However, there might be some
  // valid use case for being able to set the port number, so this is being left
  // here, but commented out, for now.
  // $form['email_verify_enable']['email_verify_test_options']['email_verify_test_options_port_number'] = array(
  //   '#type' => 'textfield',
  //   '#title' => t("Port number"),
  //   '#default_value' => variable_get('email_verify_test_options_port_number', 25),
  //   '#description' => t('The number of the port to test with. The default is "25".'),
  // );
  $form['email_verify_activate']['email_verify_test_options']['email_verify_test_options_timeout'] = array(
    '#type' => 'textfield',
    '#title' => t("Timeout"),
    '#default_value' => variable_get('email_verify_test_options_timeout', 15),
    '#description' => t('The connection timeout, in seconds. The default is "15".'),
  );
  $form['email_verify_debug_mode'] = array(
    '#type' => 'fieldset',
    '#title' => t('Debug mode'),
    '#collapsible' => TRUE,
  );
  $form['email_verify_debug_mode']['email_verify_debug_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable'),
    '#default_value' => variable_get('email_verify_debug_mode', FALSE),
    '#description' => t('Check this box to get verbose information about each email address verification made.'),
  );
  $form['email_verify_debug_mode']['email_verify_debug_mode_record_log'] = array(
    '#type' => 'checkbox',
    '#title' => t('Record debugging information in the database log'),
    '#default_value' => variable_get('email_verify_debug_mode_record_log', FALSE),
    '#states' => array(
      'enabled' => array(
        ':input[name="email_verify_debug_mode"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['email_verify_debug_mode']['email_verify_debug_mode_display_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display debugging information on the page'),
    '#default_value' => variable_get('email_verify_debug_mode_display_page', FALSE),
    '#states' => array(
      'enabled' => array(
        ':input[name="email_verify_debug_mode"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $date_types = system_get_date_types();
  $options = array();
  foreach ($date_types as $date_type) {
    $options[$date_type['type']] = $date_type['title'];
  }
  $form['email_verify_debug_mode']['email_verify_debug_mode_date_format'] = array(
    '#type' => 'select',
    '#title' => t('Date/time format'),
    '#default_value' => variable_get('email_verify_debug_mode_date_format', ''),
    '#options' => $options,
    '#description' => t('Select the date format to use when displaying the dates and times in the debug information.<br />
      Date types and formats can be modified in the system !datetime settings pages.', array(
      '!datetime' => l(t('Date and time'), 'admin/config/regional/date-time'),
    )),
    '#states' => array(
      'enabled' => array(
        ':input[name="email_verify_debug_mode"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['email_verify_forms_to_check'] = array(
    '#type' => 'fieldset',
    '#title' => t('Forms to check'),
    '#collapsible' => TRUE,
  );
  $form['email_verify_forms_to_check']['email_verify_forms'] = array(
    '#type' => 'textarea',
    '#description' => t('
      Enter a list of form IDs and field IDs of the forms and corresponding
      email address fields on which to verify the email addresses. Each
      form/field combination should be on a separate line and the form ID and
      field ID should be separated with a comma and should look something like
      this: <br />user_register_form, mail<br />user_profile_form, mail
    '),
    '#default_value' => variable_get('email_verify_forms', ''),
  );
  $form['email_verify_methods'] = array(
    '#type' => 'fieldset',
    '#title' => t('Methods to use'),
    '#collapsible' => TRUE,
    '#description' => t("Check the boxes for the various methods to use when verifying email addresses. If you find you're getting lots of false positives and/or false negatives, try changing which options are enabled."),
  );
  $form['email_verify_methods']['email_verify_methods_checkdnsrr'] = array(
    '#type' => 'checkbox',
    '#title' => t("Check for any DNS records"),
    '#default_value' => variable_get('email_verify_methods_checkdnsrr', 1),
    '#description' => t("Use PHP's checkdnsrr() function to see if there are any DNS records associated with the email address' domain name."),
  );
  $form['email_verify_methods']['email_verify_methods_gethostbyname'] = array(
    '#type' => 'checkbox',
    '#title' => t("Check for a valid IPv4 address"),
    '#default_value' => variable_get('email_verify_methods_gethostbyname', 1),
    '#description' => t("Use PHP's gethostbyname() function to see if a valid IPv4 address is associated with the email address' domain name."),
  );
  $form['email_verify_methods']['email_verify_methods_add_dot'] = array(
    '#type' => 'checkbox',
    '#title' => t("Add a dot to the domain"),
    '#default_value' => variable_get('email_verify_methods_add_dot', 1),
    '#description' => t("For hosts that add their own domain to the end of the domain in the email address, this adds an additional '.' to the end of the email address domain, so that the check will not fail at the wrong time."),
  );

  // $form['email_verify_methods']['email_verify_methods_extra_chars'] = array(
  //   '#type' => 'checkbox',
  //   '#title' => t("Allow non-basic ASCII characters"),
  //   '#default_value' => variable_get('email_verify_methods_extra_chars', 1),
  //   '#description' => t("Check email addresses with domains with characters that are not in the basic ASCII set: http://php.net/manual/en/function.idn-to-ascii.php."),
  // );
  $form['#submit'] = array(
    'email_verify_admin_settings_submit',
  );
  return system_settings_form($form);
}