You are here

function ascii_art_captcha_settings_form in CAPTCHA Pack 5

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

Function for the settings form

2 string references to 'ascii_art_captcha_settings_form'
ascii_art_captcha_menu in ascii_art_captcha/ascii_art_captcha.module
Implementation of hook_menu().
ascii_art_captcha_settings_form_validate in ascii_art_captcha/ascii_art_captcha.module
Validation function for the settings

File

ascii_art_captcha/ascii_art_captcha.module, line 52

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' => array(
      4 => 4,
      5 => 5,
      6 => 6,
      7 => 7,
      8 => 8,
      9 => 9,
      10 => 10,
    ),
    '#default_value' => (int) 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' => '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', array(
      'upper' => 'upper',
      'lower' => 'lower',
      'digit' => 'digit',
    )),
    '#description' => t('Enable the character sets to use in the code. Choose wisely by taking the recognizability of the used font into account.'),
  );
  return system_settings_form($form);
}