You are here

function ascii_art_captcha_settings_form in CAPTCHA Pack 7

Same name and namespace in other branches
  1. 5 ascii_art_captcha/ascii_art_captcha.module \ascii_art_captcha_settings_form()
  2. 6 ascii_art_captcha/ascii_art_captcha.admin.inc \ascii_art_captcha_settings_form()

Function for the settings form

1 string reference to 'ascii_art_captcha_settings_form'
ascii_art_captcha_menu in ascii_art_captcha/ascii_art_captcha.module
Implements hook_menu().

File

ascii_art_captcha/ascii_art_captcha.admin.inc, line 11
Functionality and helper functions for ASCII ART CAPTCHA administration.

Code

function ascii_art_captcha_settings_form() {
  $form = array();
  $available_fonts = _ascii_art_captcha_available_fonts();
  $form['ascii_art_captcha_code_length'] = array(
    '#type' => 'select',
    '#title' => t('Code length'),
    '#options' => drupal_map_assoc(array(
      4,
      5,
      6,
      7,
      8,
      9,
      10,
    )),
    '#default_value' => variable_get('ascii_art_captcha_code_length', 6),
  );
  $form['ascii_art_captcha_font'] = array(
    '#type' => 'select',
    '#title' => t('Font'),
    '#options' => $available_fonts,
    '#default_value' => variable_get('ascii_art_captcha_font', 'standard'),
    '#description' => t('Define the ASCII art font to use. Note that some characters are not very recognizable in some (small/weird) fonts. Make sure to disable the right character sets in these cases.'),
  );

  // font size
  $font_sizes = array(
    0 => t('default'),
  );
  foreach (array(
    4,
    6,
    8,
    9,
    10,
    11,
    12,
  ) as $pt) {
    $font_sizes[$pt] = $pt . 'pt';
  }
  $form['ascii_art_captcha_font_size'] = array(
    '#type' => 'select',
    '#title' => t('Font size'),
    '#options' => $font_sizes,
    '#default_value' => variable_get('ascii_art_captcha_font_size', 0),
    '#description' => t('Set the font size for the ASCII art.'),
  );
  $form['ascii_art_captcha_allowed_characters'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Character sets to use'),
    '#options' => array(
      'upper' => t('upper case characters'),
      'lower' => t('lower case characters'),
      'digit' => t('digits'),
    ),
    '#default_value' => variable_get('ascii_art_captcha_allowed_characters', drupal_map_assoc(array(
      'upper',
      'lower',
      'digit',
    ))),
    '#description' => t('Enable the character sets to use in the code. Choose wisely by taking the recognizability of the used font into account.'),
  );
  $form['#validate'][] = 'ascii_art_captcha_settings_form_validate';
  return system_settings_form($form);
}