diff --git a/foo_captcha/foo_capcha.admin.inc b/foo_captcha/foo_capcha.admin.inc new file mode 100644 index 0000000000000000000000000000000000000000..44e0a2e5c1306e8605514960aa151fd167f66109 --- /dev/null +++ b/foo_captcha/foo_capcha.admin.inc @@ -0,0 +1,19 @@ + 'checkbox', + '#title' => t('Ignore spaces in the response'), + '#default_value' => variable_get('foo_captcha_ignore_spaces', FALSE), + ); + return system_settings_form($form); +} \ No newline at end of file diff --git a/foo_captcha/foo_captcha.info b/foo_captcha/foo_captcha.info index f9d2349342ca9ae869db98c8be0445f28bcbc216..69550fce1930354c80539835a2fbe740849843ce 100644 --- a/foo_captcha/foo_captcha.info +++ b/foo_captcha/foo_captcha.info @@ -1,5 +1,6 @@ -name = "Foo CAPTCHA" -description = "The foo CAPTCHA requires the user to enter the word 'foo'." +name = Foo CAPTCHA +description = The foo CAPTCHA requires the user to enter the word 'foo'. package = "Spam control" dependencies[] = captcha -core = 6.x +core = 7.x +configure = admin/config/people/captcha/foo_captcha diff --git a/foo_captcha/foo_captcha.install b/foo_captcha/foo_captcha.install index 029de4ce4eccc43a0734498ea3688952d63c1f51..62a82b3c435e36ede5e9a611f3e2441ba3967ca7 100644 --- a/foo_captcha/foo_captcha.install +++ b/foo_captcha/foo_captcha.install @@ -1,7 +1,13 @@ '. t('This is a very simple CAPTCHA, which requires users to enter "foo" in a textfield.') .'

'; + case 'admin/config/people/captcha/foo_captcha': + return '

' . t('This is a very simple CAPTCHA, which requires users to enter "foo" in a textfield.') . '

'; } } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function foo_captcha_menu() { $items = array(); - $items['admin/user/captcha/foo_captcha'] = array( + $items['admin/config/people/captcha/foo_captcha'] = array( 'title' => 'Foo CAPTCHA', 'page callback' => 'drupal_get_form', 'page arguments' => array('foo_captcha_settings_form'), 'access arguments' => array('administer CAPTCHA settings'), + 'file' => 'foo_captcha.admin.inc', 'type' => MENU_LOCAL_TASK, ); return $items; } /** - * Function for the settings form + * Implements hook_captcha(). */ -function foo_captcha_settings_form() { - $form = array(); - $form['foo_captcha_ignore_spaces'] = array( - '#type' => 'checkbox', - '#title' => t('Ignore spaces in the response'), - '#default_value' => variable_get('foo_captcha_ignore_spaces', FALSE), - ); - return system_settings_form($form); -} - -/** - * Implementation of hook_captcha(). - */ -function foo_captcha_captcha($op, $captcha_type='') { +function foo_captcha_captcha($op, $captcha_type = '') { switch ($op) { case 'list': return array('Foo CAPTCHA'); - break; case 'generate': if ($captcha_type == 'Foo CAPTCHA') { $captcha = array(); @@ -65,7 +52,7 @@ function foo_captcha_captcha($op, $captcha_type='') { /** * Process the response to the foo CAPTCHA before validation. */ -function foo_captcha_process($element, $edit, &$form_state, $complete_form) { +function foo_captcha_process($element, $edit) { if (variable_get('foo_captcha_ignore_spaces', FALSE)) { $element['#value'] = preg_replace('/\s*/', '', $element['#value']); }