X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivityobject.php;h=597792ffdeb2528852dd7a8e76b21c6928b01e51;hb=586fb5a5175d7a10f5f78dd026434e48202e5451;hp=ca6390b725331704f878d152367f1a3fb8c0cead;hpb=6a95a0cecbe810c35610972f75a1dcfe9e0c44b5;p=quix0rs-gnu-social.git diff --git a/lib/activityobject.php b/lib/activityobject.php index ca6390b725..597792ffde 100644 --- a/lib/activityobject.php +++ b/lib/activityobject.php @@ -28,9 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } require_once(INSTALLDIR.'/lib/activitystreamjsondocument.php'); @@ -102,6 +100,7 @@ class ActivityObject public $content; public $owner; public $link; + public $selfLink; // think APP (Atom Publishing Protocol) public $source; public $avatarLinks = array(); public $geopoint; @@ -263,12 +262,29 @@ class ActivityObject $this->source = $this->_getSource($element); $this->link = ActivityUtils::getPermalink($element); + $this->selfLink = ActivityUtils::getSelfLink($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; } + + $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() @@ -651,6 +667,18 @@ class ActivityObject ); } + if (!empty($this->selfLink)) { + $xo->element( + 'link', + array( + 'rel' => 'self', + 'type' => 'application/atom+xml', + 'href' => $this->selfLink + ), + null + ); + } + if(!empty($this->owner)) { $owner = $this->owner->asActivityNoun(self::AUTHOR); $xo->raw($owner);