function antispam_settings_form_validate in AntiSpam 7
File
- ./
antispam.admin.inc, line 14 - The antispam admin theme.
Code
function antispam_settings_form_validate($form, &$form_state) {
// If connection enabled, then validate the entered API key.
if ($form_state['values']['antispam_connection_enabled']) {
$service_provider = $form_state['values']['antispam_service_provider'];
switch ($service_provider) {
case ANTISPAM_AKISMET_SERVICE:
$apikey = $form_state['values']['antispam_wpapikey'];
$apikey_form_element = 'antispam_wpapikey';
if (empty($apikey)) {
form_set_error('antispam_wpapikey', t('You must enter an Akismet API key in order to use the AntiSpam module.'));
}
break;
}
if (!empty($apikey)) {
if (antispam_api_cmd_verify_key($apikey, $service_provider) == ANTISPAM_API_RESULT_ERROR) {
form_set_error($apikey_form_element, t('The API key you entered is not valid.'));
}
else {
drupal_set_message(t('Your Akismet API key has been verified. Say goodbye to spam!'));
}
}
}
}