Handle selfLink in ActivityObject

This commit is contained in:
Mikael Nordfeldth 2017-05-06 11:34:38 +02:00
parent 985f3b44b7
commit 7da925ca70

View File

@ -102,6 +102,7 @@ class ActivityObject
public $content; public $content;
public $owner; public $owner;
public $link; public $link;
public $selfLink; // think APP (Atom Publishing Protocol)
public $source; public $source;
public $avatarLinks = array(); public $avatarLinks = array();
public $geopoint; public $geopoint;
@ -263,6 +264,7 @@ class ActivityObject
$this->source = $this->_getSource($element); $this->source = $this->_getSource($element);
$this->link = ActivityUtils::getPermalink($element); $this->link = ActivityUtils::getPermalink($element);
$this->selfLink = ActivityUtils::getSelfLink($element);
$this->id = $this->_childContent($element, self::ID); $this->id = $this->_childContent($element, self::ID);
@ -651,6 +653,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)) { if(!empty($this->owner)) {
$owner = $this->owner->asActivityNoun(self::AUTHOR); $owner = $this->owner->asActivityNoun(self::AUTHOR);
$xo->raw($owner); $xo->raw($owner);