X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivityobject.php;h=677a48197fd9e0e6ff10ee0a14b4e532109c8f7c;hb=1c40e7c139af98e4fe9c73093da4183ad8d9e234;hp=0a358ccabbe1c4ceb34199b7f0badc80485a64b3;hpb=073e3a1572d0cd5934c6578f4245c39e8376351f;p=quix0rs-gnu-social.git diff --git a/lib/activityobject.php b/lib/activityobject.php index 0a358ccabb..677a48197f 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -100,6 +100,13 @@ class ActivityObject public $poco; public $displayName; + // @todo move this stuff to it's own PHOTO activity object + const MEDIA_DESCRIPTION = 'description'; + + public $thumbnail; + public $largerImage; + public $description; + /** * Constructor * @@ -150,6 +157,19 @@ class ActivityObject $this->poco = new PoCo($element); } + + if ($this->type == self::PHOTO) { + + $this->thumbnail = ActivityUtils::getLink($element, 'preview'); + $this->largerImage = ActivityUtils::getLink($element, 'enclosure'); + + $this->description = ActivityUtils::childContent( + $element, + ActivityObject::MEDIA_DESCRIPTION, + Activity::MEDIA + ); + + } } private function _fromAuthor($element) @@ -157,10 +177,7 @@ class ActivityObject $this->type = self::PERSON; // XXX: is this fair? $this->title = $this->_childContent($element, self::NAME); - $id = $this->_childContent($element, self::URI); - if (ActivityUtils::validateUri($id)) { - $this->id = $id; - } + $this->id = $this->_childContent($element, self::URI); if (empty($this->id)) { $email = $this->_childContent($element, self::EMAIL); @@ -173,15 +190,6 @@ class ActivityObject private function _fromAtomEntry($element) { - if ($element->localName == 'actor') { - // Old-fashioned ... - // First pull anything from , then we'll add on top. - $author = ActivityUtils::child($element->parentNode, 'author'); - if ($author) { - $this->_fromAuthor($author); - } - } - $this->type = $this->_childContent($element, Activity::OBJECTTYPE, Activity::SPEC); @@ -189,11 +197,6 @@ class ActivityObject $this->type = ActivityObject::NOTE; } - $id = $this->_childContent($element, self::ID); - if (ActivityUtils::validateUri($id)) { - $this->id = $id; - } - $this->summary = ActivityUtils::childHtmlContent($element, self::SUMMARY); $this->content = ActivityUtils::getContent($element); @@ -206,6 +209,12 @@ class ActivityObject $this->source = $this->_getSource($element); $this->link = ActivityUtils::getPermalink($element); + + $this->id = $this->_childContent($element, self::ID); + + if (empty($this->id) && !empty($this->link)) { // fallback if there's no ID + $this->id = $this->link; + } } // @fixme rationalize with Activity::_fromRssItem()