]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activity.php
auth fix
[quix0rs-gnu-social.git] / lib / activity.php
index eb639a5dd30af29f88e849a24adbd1579009b245..c3a984a7b994f289995dccf521ee0e4eb8b83fda 100644 (file)
@@ -327,7 +327,7 @@ class Activity
         return null;
     }
 
-    function asString($namespace=false, $author=true)
+    function asString($namespace=false, $author=true, $source=false)
     {
         $xs = new XMLStringer(true);
 
@@ -348,8 +348,6 @@ class Activity
 
         if ($this->verb == ActivityVerb::POST && count($this->objects) == 1) {
 
-            common_debug('Using default object entry notation.');
-
             $obj = $this->objects[0];
 
             $xs->element('id', null, $obj->id);
@@ -480,7 +478,8 @@ class Activity
         
         foreach ($this->enclosures as $enclosure) {
             if (is_string($enclosure)) {
-                $xs->element('link', array('href' => $enclosure));
+                $xs->element('link', array('rel' => 'enclosure',
+                                           'href' => $enclosure));
             } else {
                 $attributes = array('rel' => 'enclosure',
                                     'href' => $enclosure->url,
@@ -489,13 +488,13 @@ class Activity
                 if ($enclosure->title) {
                     $attributes['title'] = $enclosure->title;
                 }
-                $xs->element('link', array('href' => $enclosure));
+                $xs->element('link', $attributes);
             }
         }
 
         // Info on the source feed
 
-        if (!empty($this->source)) {
+        if ($source && !empty($this->source)) {
             $xs->elementStart('source');
            
             $xs->element('id', null, $this->source->id);
@@ -550,7 +549,9 @@ class Activity
 
         $xs->elementEnd('entry');
 
-        return $xs->getString();
+        $str = $xs->getString();
+       
+        return $str;
     }
 
     private function _child($element, $tag, $namespace=self::SPEC)