function antispam_get_counter in AntiSpam 7
Same name and namespace in other branches
- 6 antispam.module \antispam_get_counter()
Get today's counter value for the specified counter type.
1 call to antispam_get_counter()
- antispam_increase_counter in ./
antispam.module - Increase today's counter value for the specified counter type by 1.
File
- ./
antispam.module, line 263 - Primary hook implementations for the Antispam module.
Code
function antispam_get_counter($counter_type) {
$rec = db_query("SELECT * FROM {antispam_counter} WHERE date=:date", array(
':date' => mktime(0, 0, 0, date("m"), date("d"), date("Y")),
))
->fetchObject();
// No counter record for today.
if (empty($rec)) {
return 0;
}
switch ($counter_type) {
case ANTISPAM_COUNT_ALL:
return $rec->spam_detected + $rec->ham_detected;
case ANTISPAM_COUNT_SPAM_DETECTED:
return $rec->spam_detected;
case ANTISPAM_COUNT_HAM_DETECTED:
return $rec->ham_detected;
case ANTISPAM_COUNT_FALSE_NEGATIVE:
return $rec->false_negative;
case ANTISPAM_COUNT_FALSE_POSITIVE:
return $rec->false_positive;
// Just in case.
default:
return 0;
}
}