function riddler_captcha in Captcha Riddler 7
Same name and namespace in other branches
- 8 riddler.module \riddler_captcha()
- 5 riddler.module \riddler_captcha()
- 6 riddler.module \riddler_captcha()
Implementation of hook_captcha().
File
- ./
riddler.module, line 223 - Adds a question and answer type to the Captcha module.
Code
function riddler_captcha($op, $captcha_type = '') {
switch ($op) {
case 'list':
return array(
'Riddler',
);
break;
case 'generate':
if ($captcha_type == 'Riddler') {
$result = array();
$riddles = riddler_get_riddles();
$key = array_rand($riddles);
$result['form']['captcha_response'] = array(
'#type' => 'textfield',
'#title' => t(filter_xss($riddles[$key]['question'])),
'#description' => t('Fill in the blank.'),
'#size' => 50,
'#maxlength' => 50,
'#required' => TRUE,
'#weight' => variable_get('riddler_weight', 0),
);
$result['solution'] = t(filter_xss((string) drupal_strtolower($riddles[$key]['answer'])));
$result['captcha_validate'] = 'riddler_captcha_validate';
return $result;
}
break;
}
}