function spam_content_is_spam in Spam 6
Same name and namespace in other branches
- 5.3 spam.module \spam_content_is_spam()
API call to simply test if content is spam or not. No action is taken.
5 calls to spam_content_is_spam()
- spam_comment in content/
spam_content_comment.inc - Drupal _comment() hook.
- spam_content_insert in ./
spam.module - This function is called when new content is first posted to your website.
- spam_content_update in ./
spam.module - This function is called when content on your website is updated.
- spam_nodeapi in content/
spam_content_node.inc - Drupal _nodeapi() hook.
- spam_scan in ./
spam.module - API call for scanning content for spam. If spam is found, the appropriate action will be taken.
File
- ./
spam.module, line 88 - Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.
Code
function spam_content_is_spam($content, $type, $extra = array(), $filter_test = FALSE) {
static $scores = array();
$id = spam_invoke_module($type, 'content_id', $content, $extra);
if (!isset($scores["{$type}-{$id}"])) {
$score = spam_content_filter($content, $type, $extra, $filter_test);
spam_log(SPAM_DEBUG, 'spam_content_is_spam', t('checking if spam...'), $type, $id);
if ($score >= variable_get('spam_threshold', SPAM_DEFAULT_THRESHOLD)) {
$spam = 1;
}
else {
$spam = 0;
}
spam_log(SPAM_DEBUG, 'spam_content_is_spam', t('score(@score) spam(@spam)', array(
'@score' => $score,
'@spam' => $spam,
)), $type, $id);
$scores["{$type}-{$id}"] = array(
'score' => $score,
'is_spam' => $spam,
);
}
return $scores["{$type}-{$id}"];
}