function url_spamapi in Spam 5.3
URL filter plug in for the spam module. Copyright(c) 2007-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.
File
- filters/
url/ url.module, line 10
Code
function url_spamapi($op, $type = NULL, $content = array(), $fields = array(), $extra = NULL) {
// Don't both with this hook unless the filter is actually enabled.
switch ($op) {
case 'filter':
if (!module_invoke('spam', 'filter_enabled', 'url', $type, $content, $fields, $extra)) {
return;
}
return url_spam_filter($content, $type, $fields, $extra);
case 'filter_module':
return 'url';
case 'filter_info':
return array(
'name' => t('URL filter'),
'module' => t('url'),
'description' => t('A spam url filter.'),
'help' => t('The url filter blocks posts containing spam-URLs, automatically learned with the bayesian filter module.'),
);
break;
case 'filter_install':
return array(
'status' => SPAM_FILTER_ENABLED,
'gain' => 250,
'weight' => -6,
);
case 'mark_as_spam':
case 'mark_as_not_spam':
if (!module_invoke('spam', 'filter_enabled', 'url', $type, $content, $fields, $extra)) {
return;
}
spam_log(SPAM_DEBUG, 'url_spamapi', t('@op', array(
'@op' => $op,
)), $type, $extra['id']);
$fields = spam_invoke_module($type, 'filter_fields', $extra['content']);
$urls = _url_extract($extra['content'], $type, $fields, $extra);
url_update($urls, $op == 'mark_as_spam' ? TRUE : FALSE, $type, $extra['id']);
break;
}
}