function riddler_captcha in Captcha Riddler 6
Same name and namespace in other branches
- 8 riddler.module \riddler_captcha()
- 5 riddler.module \riddler_captcha()
- 7 riddler.module \riddler_captcha()
Implementation of hook_captcha().
File
- ./
riddler.module, line 152 - 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':
$result = array();
if ($captcha_type == 'Riddler') {
$i = rand(1, variable_get('riddler_number', 1)) - 1;
$result['form']['captcha_response'] = array(
'#type' => 'textfield',
'#title' => variable_get('riddler_question_' . $i, 'Do you hate spam? (yes or no)'),
'#description' => t('Fill in the blank'),
'#size' => 50,
'#maxlength' => 50,
'#required' => TRUE,
'#weight' => variable_get('riddler_weight', 0),
);
$result['solution'] = (string) drupal_strtolower(variable_get('riddler_answer_' . $i, 'yes'));
$result['captcha_validate'] = 'riddler_captcha_validate';
return $result;
}
break;
}
}