]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Activity/ActivityPlugin.php
Merge branch 'master' into mmn_fixes
[quix0rs-gnu-social.git] / plugins / Activity / ActivityPlugin.php
index 59fb674fba7d58e35ac1c5d9325a2697752f8a32..0f306a427c2d2706576df2418d52666ec9818d87 100644 (file)
@@ -72,7 +72,7 @@ class ActivityPlugin extends Plugin
         // TRANS: Text for "started following" item in activity plugin.
         // TRANS: %1$s is a profile URL, %2$s is a profile name,
         // TRANS: %3$s is a profile URL, %4$s is a profile name.
-        $rendered = sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'),
+        $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> started following <a href="%3$s">%4$s</a>.'),
                             $profile->getUrl(),
                             $profile->getBestName(),
                             $other->getUrl(),
@@ -110,7 +110,7 @@ class ActivityPlugin extends Plugin
         // TRANS: Text for "stopped following" item in activity plugin.
         // TRANS: %1$s is a profile URL, %2$s is a profile name,
         // TRANS: %3$s is a profile URL, %4$s is a profile name.
-        $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'),
+        $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'),
                             $profile->getUrl(),
                             $profile->getBestName(),
                             $other->getUrl(),
@@ -155,7 +155,7 @@ class ActivityPlugin extends Plugin
         // TRANS: Text for "stopped liking" item in activity plugin.
         // TRANS: %1$s is a profile URL, %2$s is a profile name,
         // TRANS: %3$s is a notice URL, %4$s is an author name.
-        $rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'),
+        $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> stopped liking <a href="%3$s">%4$s\'s update</a>.'),
                             $profile->getUrl(),
                             $profile->getBestName(),
                             $notice->getUrl(),
@@ -183,7 +183,7 @@ class ActivityPlugin extends Plugin
                                         'uri' => $uri,
                                         'verb' => ActivityVerb::UNFAVORITE,
                                         'object_type' => (($notice->verb == ActivityVerb::POST) ?
-                                                         $notice->object_type : ActivityObject::ACTIVITY)));
+                                                         $notice->object_type : null)));
 
         return true;
     }
@@ -200,7 +200,7 @@ class ActivityPlugin extends Plugin
         // TRANS: Text for "joined group" item in activity plugin.
         // TRANS: %1$s is a profile URL, %2$s is a profile name,
         // TRANS: %3$s is a group URL, %4$s is a group name.
-        $rendered = sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'),
+        $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> joined the group <a href="%3$s">%4$s</a>.'),
                             $profile->getUrl(),
                             $profile->getBestName(),
                             $group->homeUrl(),
@@ -241,7 +241,7 @@ class ActivityPlugin extends Plugin
         // TRANS: Text for "left group" item in activity plugin.
         // TRANS: %1$s is a profile URL, %2$s is a profile name,
         // TRANS: %3$s is a group URL, %4$s is a group name.
-        $rendered = sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'),
+        $rendered = html_sprintf(_m('<a href="%1$s">%2$s</a> left the group <a href="%3$s">%4$s</a>.'),
                             $profile->getUrl(),
                             $profile->getBestName(),
                             $group->homeUrl(),
@@ -311,9 +311,10 @@ class ActivityPlugin extends Plugin
             // FIXME: do something here
             break;
         case ActivityVerb::JOIN:
-            $mem = Group_member::getKV('uri', $stored->uri);
-            if (!empty($mem)) {
+            $mem = Group_member::getKV('uri', $stored->getUri());
+            if ($mem instanceof Group_member) {
                 $group = $mem->getGroup();
+                $act->title = $stored->getTitle();
                 $act->objects = array(ActivityObject::fromGroup($group));
             }
             break;
@@ -322,9 +323,10 @@ class ActivityPlugin extends Plugin
             break;
         case ActivityVerb::FOLLOW:
             $sub = Subscription::getKV('uri', $stored->uri);
-            if (!empty($sub)) {
+            if ($sub instanceof Subscription) {
                 $profile = Profile::getKV('id', $sub->subscribed);
-                if (!empty($profile)) {
+                if ($profile instanceof Profile) {
+                    $act->title = $stored->getTitle();
                     $act->objects = array($profile->asActivityObject());
                 }
             }
@@ -337,12 +339,12 @@ class ActivityPlugin extends Plugin
         return true;
     }
 
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'Activity',
                             'version' => self::VERSION,
                             'author' => 'Evan Prodromou',
-                            'homepage' => 'http://status.net/wiki/Plugin:Activity',
+                            'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Activity',
                             'rawdescription' =>
                             // TRANS: Plugin description.
                             _m('Emits notices when social activities happen.'));