function antispam_api_cmd_spam_check in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.module \antispam_api_cmd_spam_check()
AntiSpam API: Generic Data Check.
Return value
integer -1 = Error, 0 = Ham, 1 = Spam.
1 call to antispam_api_cmd_spam_check()
- antispam_webform_check in ./
antispam.module - Webform: Check submitted values for spam.
File
- ./
antispam.module, line 2117 - Primary hook implementations for the Antispam module.
Code
function antispam_api_cmd_spam_check($body, $name = NULL, $mail = NULL, $homepage = NULL) {
$provider = antispam_get_service_provider();
$api_host = antispam_get_api_host($provider);
$api_key = antispam_get_api_key($provider);
if (empty($api_key)) {
return array(
ANTISPAM_API_RESULT_ERROR,
);
}
$content = new stdClass();
$content->body = $body;
$content->name = $name;
$content->mail = $mail;
$content->homepage = $homepage;
$api_result = antispam_api_cmd_comment_check('other', $content);
if ($api_result[0] == ANTISPAM_API_RESULT_IS_HAM) {
return 0;
}
elseif ($api_result[0] == ANTISPAM_API_RESULT_IS_SPAM) {
return 1;
}
else {
return -1;
}
}