You are here

function text_captcha_settings_form in CAPTCHA 5.3

Same name and namespace in other branches
  1. 6 text_captcha/text_captcha.admin.inc \text_captcha_settings_form()

Administration form

2 string references to 'text_captcha_settings_form'
text_captcha_menu in text_captcha/text_captcha.module
Implementation of hook_menu().
text_captcha_settings_form_validate in text_captcha/text_captcha.module
Validate function of the administration form

File

text_captcha/text_captcha.module, line 48
Implementation of a text based CAPTCHA.

Code

function text_captcha_settings_form() {
  $form = array();

  // radio buttons for selecting the kind of words to use
  $form['text_captcha_words'] = array(
    '#type' => 'radios',
    '#title' => t('Kind of words to use in the phrase'),
    '#options' => array(
      TEXT_CAPTCHA_GENERATE_NONSENSE_WORDS => t('Generate nonsense random words.'),
      TEXT_CAPTCHA_USER_DEFINED_WORDS => t('Use user defined words.'),
    ),
    '#default_value' => variable_get('text_captcha_words', TEXT_CAPTCHA_GENERATE_NONSENSE_WORDS),
  );

  // textarea for user defined words
  $form['text_captcha_userdefined_words'] = array(
    '#type' => 'textarea',
    '#title' => t('User defined words'),
    '#default_value' => variable_get('text_captcha_userdefined_words', ''),
    '#description' => t('Enter a bunch of space separated words (at least @min).', array(
      '@min' => TEXT_CAPTCHA_USER_DEFINED_WORD_MINIMUM,
    )),
  );

  // textfield for the number of words in the CAPTCHA phrase
  $form['text_captcha_word_quantity'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of words in the phrase'),
    '#default_value' => (int) variable_get('text_captcha_word_quantity', 5),
    '#size' => 2,
    '#maxlength' => 2,
  );
  return system_settings_form($form);
}