]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activityobject.php
Faster NodeInfo stats
[quix0rs-gnu-social.git] / lib / activityobject.php
index fc62e5f46cad6e67aa799f19ac48b47b65d6a3b1..597792ffdeb2528852dd7a8e76b21c6928b01e51 100644 (file)
@@ -28,9 +28,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 require_once(INSTALLDIR.'/lib/activitystreamjsondocument.php');
 
@@ -271,6 +269,22 @@ class ActivityObject
         if (empty($this->id) && !empty($this->link)) { // fallback if there's no ID
             $this->id = $this->link;
         }
+
+        $els = $element->childNodes;
+        $out = array();
+
+        for ($i = 0; $i < $els->length; $i++) {
+            $link = $els->item($i);
+            if ($link->localName == ActivityUtils::LINK && $link->namespaceURI == ActivityUtils::ATOM) {
+                $attrs = array();
+                foreach ($link->attributes as $attrName=>$attrNode) {
+                    $attrs[$attrName] = $attrNode->nodeValue;
+                }
+                $this->extra[] = [$link->localName,
+                                    $attrs,
+                                    $link->nodeValue];
+            }
+        }
     }
 
     // @todo FIXME: rationalize with Activity::_fromRssItem()
@@ -493,7 +507,7 @@ class ActivityObject
 
             $object->type = self::mimeTypeToObjectType($file->mimetype);
             $object->id   = TagURI::mint(sprintf("file:%d", $file->id));
-            $object->link = common_local_url('attachment', array('attachment' => $file->id));
+            $object->link = $file->getAttachmentUrl();
 
             if ($file->title) {
                 $object->title = $file->title;