return true;
}
- /**
- * Load related modules when needed
- *
- * @param string $cls Name of the class to be loaded
- *
- * @return boolean hook value; true means continue processing, false means stop.
- */
-
- function onAutoload($cls)
- {
- $dir = dirname(__FILE__);
-
- switch ($cls)
- {
- case 'TrainAction':
- case 'SpamAction':
- include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
- return false;
- case 'Spam_score':
- include_once $dir . '/'.$cls.'.php';
- return false;
- case 'SpamFilter':
- case 'SpamNoticeStream':
- case 'TrainSpamForm':
- case 'TrainHamForm':
- include_once $dir . '/'.strtolower($cls).'.php';
- return false;
- default:
- return true;
- }
- }
-
/**
* When a notice is saved, check its spam score
*
}
function onNoticeDeleteRelated($notice) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (!empty($score)) {
$score->delete();
}
if (!empty($notice)) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (empty($score)) {
// If it's empty, we can train it.
function onPluginVersion(&$versions)
{
$versions[] = array('name' => 'ActivitySpam',
- 'version' => STATUSNET_VERSION,
+ 'version' => GNUSOCIAL_VERSION,
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:ActivitySpam',
'description' =>
if ($this->hideSpam) {
if ($bResult) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (!empty($score) && $score->is_spam) {
if (empty($profile) ||
/**
* Pre-cache our spam scores if needed.
*/
- function onEndNoticeListPrefill(&$notices, &$profiles, $avatarSize) {
+ function onEndNoticeListPrefill(array &$notices, array &$profiles, array $notice_ids, Profile $scoped=null) {
if ($this->hideSpam) {
- foreach ($notices as $notice) {
- $ids[] = $notice->id;
- }
- Memcached_DataObject::multiGet('Spam_score', 'notice_id', $ids);
+ Spam_score::multiGet('notice_id', $notice_ids);
}
return true;
}