]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activityobject.php
check for 'post' verb in microapps by default
[quix0rs-gnu-social.git] / lib / activityobject.php
index 444d098073a04500d8ddff0d5363a31d96e83fc9..7204980d40b8b505554935a2730370179eefec34 100644 (file)
@@ -68,6 +68,7 @@ class ActivityObject
     const PLACE     = 'http://activitystrea.ms/schema/1.0/place';
     const COMMENT   = 'http://activitystrea.ms/schema/1.0/comment';
     // ^^^^^^^^^^ tea!
+    const ACTIVITY = 'http://activitystrea.ms/schema/1.0/activity';
 
     // Atom elements we snarf
 
@@ -678,16 +679,19 @@ class ActivityObject
         $object = array();
 
         if (Event::handle('StartActivityObjectOutputJson', array($this, &$object))) {
-            // XXX: attachedObjects are added by Activity
+            // XXX: attachments are added by Activity
+
+            // author (Add object for author? Could be useful for repeats.)
+
+            // content (Add rendered version of the notice?)
 
             // displayName
             $object['displayName'] = $this->title;
 
-            // TODO: downstreamDuplicates
-
-            // embedCode (used for video)
+            // downstreamDuplicates
 
             // id
+            $object['id'] = $this->id;
             //
             // XXX: Should we use URL here? or a crazy tag URI?
             $object['id'] = $this->id;
@@ -698,7 +702,7 @@ class ActivityObject
                 // XXX: Not sure what the best avatar is to use for the
                 // author's "image". For now, I'm using the large size.
 
-                $avatarLarge      = null;
+                $imgLink          = null;
                 $avatarMediaLinks = array();
 
                 foreach ($this->avatarLinks as $a) {
@@ -723,7 +727,9 @@ class ActivityObject
                 $object['avatarLinks'] = $avatarMediaLinks; // extension
 
                 // image
-                $object['image']  = $imgLink->asArray();
+                if (!empty($imgLink)) {
+                    $object['image']  = $imgLink->asArray();
+                }
             }
 
             // objectType
@@ -733,9 +739,13 @@ class ActivityObject
             // @fixme this breaks extension URIs
             $object['type'] = substr($this->type, strrpos($this->type, '/') + 1);
 
+            // published (probably don't need. Might be useful for repeats.)
+
             // summary
             $object['summary'] = $this->summary;
 
+            // udpated (probably don't need this)
+
             // TODO: upstreamDuplicates
 
             // url (XXX: need to put the right thing here...)
@@ -750,8 +760,6 @@ class ActivityObject
                 $object[$objectName] = $props;
             }
 
-            // GeoJSON
-
             if (!empty($this->geopoint)) {
 
                 list($lat, $long) = explode(' ', $this->geopoint);
@@ -763,7 +771,7 @@ class ActivityObject
             }
 
             if (!empty($this->poco)) {
-                $object['contact'] = $this->poco->asArray();
+                $object['contact'] = array_filter($this->poco->asArray());
             }
             Event::handle('EndActivityObjectOutputJson', array($this, &$object));
         }