function spam_url_limit in Spam 5
Check if content has two many total urls, or if the same base url is repeated too many times.
Parameters
$url An array indicating how many time each url is found in the : content, as generated by spam_urls_count().
Return value
Weighted added to spam probability, if any.
1 call to spam_url_limit()
- spam_content_filter in ./
spam.module - Determine whether or not provided text is spam.
File
- ./
spam.module, line 1379
Code
function spam_url_limit($urls = array()) {
$weight = 0;
$limit = variable_get('spam_urls_total', 10);
if ($limit > -1) {
if ($urls['total'] > $limit) {
$weight += WEIGHT_ALWAYS_SPAM;
spam_log(SPAM_LOG, t("url limit: total of @num urls, adding weight of @weight", array(
'@num' => $urls['total'],
'@weight' => WEIGHT_ALWAYS_SPAM,
)));
}
}
$limit = variable_get('spam_urls_repeat', 5);
if ($limit > -1) {
asort($urls);
// skip past urls['total']
array_pop($urls);
$max = array_pop($urls);
if ($max > $limit) {
$weight += WEIGHT_ALWAYS_SPAM;
spam_log(SPAM_LOG, t("url limit: repeated one url @num times, adding weight of @weight", array(
'@num' => $max,
'@weight' => WEIGHT_ALWAYS_SPAM,
)));
}
}
return $weight;
}