You are here

function spam_content_is_spam in Spam 5.3

Same name and namespace in other branches
  1. 6 spam.module \spam_content_is_spam()

API call to simply test if content is spam or not. No action is taken.

1 call to spam_content_is_spam()
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

Code

function spam_content_is_spam($content, $type, $extra = array(), $filter_test = FALSE) {
  if (user_access('bypass filters')) {
    spam_log(SPAM_DEBUG, 'spam_content_is_spam', t('bypassing filters'), $type, $id);
    return 0;
  }
  $score = spam_content_filter($content, $type, $extra, $filter_test);
  $id = spam_invoke_module($type, 'content_id', $content, $extra);
  spam_log(SPAM_DEBUG, 'spam_content_is_spam', t('checking if spam...'), $type, $id);
  if ($score >= variable_get('spam_threshold', SPAM_DEFAULT_THRESHOLD)) {
    if ($id) {
      spam_mark_as_spam($type, $id, array(
        'score' => $score,
      ));
    }
    $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);
  return $spam;
}