]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activitystreamjsondocument.php
define Reply::pkeyGet()
[quix0rs-gnu-social.git] / lib / activitystreamjsondocument.php
index 00029f85f913618355fa704f10a84eced027f8cb..097267f504e18ceca3be22213388eeb24ddb076a 100644 (file)
@@ -43,6 +43,7 @@ if (!defined('STATUSNET'))
  */
 class ActivityStreamJSONDocument
 {
+    const CONTENT_TYPE = 'application/stream+json; charset=utf-8';
 
     /* Top level array representing the document */
     protected $doc = array();
@@ -77,6 +78,7 @@ class ActivityStreamJSONDocument
      *
      * @param String $title the title
      */
+
     function setTitle($title)
     {
         $this->doc['title'] = $title;
@@ -91,7 +93,6 @@ class ActivityStreamJSONDocument
 
     function addItemsFromNotices($notices)
     {
-        common_debug("addItemsFromNotices");
         if (is_array($notices)) {
             foreach ($notices as $notice) {
                 $this->addItemFromNotice($notice);
@@ -113,9 +114,8 @@ class ActivityStreamJSONDocument
     {
         $cur = empty($this->cur) ? common_current_user() : $this->cur;
 
-        $act          = $notice->asActivity();
+        $act          = $notice->asActivity($cur);
         $act->extra[] = $notice->noticeInfo($cur);
-
         array_push($this->doc['items'], $act->asArray());
     }
 
@@ -128,7 +128,7 @@ class ActivityStreamJSONDocument
     function addLink($url = null, $rel = null, $mediaType = null)
     {
         $link = new ActivityStreamsLink($url, $rel, $mediaType);
-        $this->doc['link'][] = $link->asArray();
+        $this->doc['links'][] = $link->asArray();
     }
 
     /*
@@ -205,10 +205,10 @@ class ActivityStreamsLink
         }
 
         $this->linkDict = array(
-            'url'        => $url,
-            'rel'        => $rel,      // extension
-            'mediaType'  => $mediaType // extension
-       );
+            'url'   => $url,
+            'rel'   => $rel,      // extension
+            'type'  => $mediaType // extension
+        );
     }
 
     function asArray()