]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/ActivitySpam/ActivitySpamPlugin.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / ActivitySpam / ActivitySpamPlugin.php
index 0f84006a6589be9d046b3a18e7ed2c60981b8400..ca31c7ac8e7ea596a7d39fd6c1c3f5db39b704f8 100644 (file)
@@ -100,7 +100,7 @@ class ActivitySpamPlugin extends Plugin
      * @return boolean hook value; true means continue processing, false means stop.
      */
 
-    function onEndNoticeSave($notice)
+    function onEndNoticeSave(Notice $notice)
     {
         try {
 
@@ -118,7 +118,7 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onNoticeDeleteRelated($notice) {
+    function onNoticeDeleteRelated(Notice $notice) {
         $score = Spam_score::getKV('notice_id', $notice->id);
         if (!empty($score)) {
             $score->delete();
@@ -126,7 +126,7 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onUserRightsCheck($profile, $right, &$result) {
+    function onUserRightsCheck(Profile $profile, $right, &$result) {
         switch ($right) {
         case self::REVIEWSPAM:
         case self::TRAINSPAM:
@@ -144,6 +144,9 @@ class ActivitySpamPlugin extends Plugin
 
     function onEndShowNoticeOptionItems($nli)
     {
+        // FIXME: Cannot use type-hint NoticeListItem as NoticeListItemAdapter exists, too!
+        assert(is_object($nli));
+
         $profile = Profile::current();
 
         if (!empty($profile) && $profile->hasRight(self::TRAINSPAM)) {
@@ -175,12 +178,12 @@ class ActivitySpamPlugin extends Plugin
     /**
      * Map URLs to actions
      *
-     * @param Net_URL_Mapper $m path-to-action mapper
+     * @param URLMapper $m path-to-action mapper
      *
      * @return boolean hook value; true means continue processing, false means stop.
      */
 
-    function onRouterInitialized($m)
+    public function onRouterInitialized(URLMapper $m)
     {
         $m->connect('main/train/spam',
                     array('action' => 'train', 'category' => 'spam'));
@@ -191,7 +194,7 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onEndShowStyles($action)
+    function onEndShowStyles(Action $action)
     {
         $action->element('style', null,
                          '.form-train-spam input.submit { background: url('.$this->path('icons/bullet_black.png').') no-repeat 0px 0px } ' . "\n" .
@@ -199,7 +202,7 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onEndPublicGroupNav($nav)
+    function onEndPublicGroupNav(Menu $nav)
     {
         $user = common_current_user();
 
@@ -215,10 +218,10 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'ActivitySpam',
-                            'version' => STATUSNET_VERSION,
+                            'version' => GNUSOCIAL_VERSION,
                             'author' => 'Evan Prodromou',
                             'homepage' => 'http://status.net/wiki/Plugin:ActivitySpam',
                             'description' =>
@@ -226,7 +229,7 @@ class ActivitySpamPlugin extends Plugin
         return true;
     }
 
-    function onEndNoticeInScope($notice, $profile, &$bResult)
+    function onEndNoticeInScope(Notice $notice, Profile $profile, &$bResult)
     {
         if ($this->hideSpam) {
             if ($bResult) {
@@ -249,12 +252,9 @@ class ActivitySpamPlugin extends Plugin
     /**
      * 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;
-            }
-            Spam_score::multiGet('notice_id', $ids);
+            Spam_score::multiGet('notice_id', $notice_ids);
         }
         return true;
     }