]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activity.php
throw an error that looks like mysql errors.. :-S
[quix0rs-gnu-social.git] / lib / activity.php
index 7926d05697e667998d27d0ea89d823dff0861a3e..2cb80f9e1a26bba80f94c19822b41f4db67fc0b1 100644 (file)
@@ -1048,6 +1048,7 @@ class Activity
     public $id;      // ID of the activity
     public $title;   // title of the activity
     public $categories = array(); // list of AtomCategory objects
+    public $enclosures = array(); // list of enclosure URL references
 
     /**
      * Turns a regular old Atom <entry> into a magical activity
@@ -1063,6 +1064,18 @@ class Activity
         }
 
         $this->entry = $entry;
+
+        // @fixme Don't send in a DOMDocument
+        if ($feed instanceof DOMDocument) {
+            common_log(
+                LOG_WARNING,
+                'Activity::__construct() - '
+                . 'DOMDocument passed in for feed by mistake. '
+                . "Expecting a 'feed' DOMElement."
+            );
+            $feed = $feed->getElementsByTagName('feed')->item(0);
+        }
+
         $this->feed  = $feed;
 
         $pubEl = $this->_child($entry, self::PUBLISHED, self::ATOM);
@@ -1144,6 +1157,10 @@ class Activity
                 $this->categories[] = new AtomCategory($catEl);
             }
         }
+
+        foreach (ActivityUtils::getLinks($entry, 'enclosure') as $link) {
+            $this->enclosures[] = $link->getAttribute('href');
+        }
     }
 
     /**