You are here

function foo_captcha_captcha in CAPTCHA Pack 5

Same name and namespace in other branches
  1. 8 foo_captcha/foo_captcha.module \foo_captcha_captcha()
  2. 6 foo_captcha/foo_captcha.module \foo_captcha_captcha()
  3. 7 foo_captcha/foo_captcha.module \foo_captcha_captcha()

Implementation of hook_captcha().

File

foo_captcha/foo_captcha.module, line 48

Code

function foo_captcha_captcha($op, $captcha_type = '', $response = '') {
  switch ($op) {
    case 'list':
      return array(
        'Foo CAPTCHA',
      );
      break;
    case 'generate':
      if ($captcha_type == 'Foo CAPTCHA') {
        $captcha = array();
        $captcha['solution'] = 'foo';
        $captcha['form']['captcha_response'] = array(
          '#type' => 'textfield',
          '#title' => t('Enter "foo"'),
          '#required' => TRUE,
        );
        $captcha['preprocess'] = TRUE;
        return $captcha;
      }
      break;
    case 'preprocess':
      if ($captcha_type == 'Foo CAPTCHA') {
        if (variable_get('foo_captcha_case_insensitive', TRUE)) {
          $response = strtolower($response);
        }
        return $response;
      }
      break;
  }
}