X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivitycontext.php;h=fd0dfe06c1b7bfef81f9e82a322dc689d23f31be;hb=3b19b63babc538d7dece46fa818049c92a3eae3f;hp=5afbb7fd28b75b4bc36315a74f1e3cecd3b3f944;hpb=f9a4728fcc5d93a019bc72f44c836fa51c2e8ea7;p=quix0rs-gnu-social.git diff --git a/lib/activitycontext.php b/lib/activitycontext.php index 5afbb7fd28..fd0dfe06c1 100644 --- a/lib/activitycontext.php +++ b/lib/activitycontext.php @@ -39,6 +39,8 @@ class ActivityContext public $location; public $attention = array(); public $conversation; + public $forwardID; // deprecated, use ActivityVerb::SHARE instead + public $forwardUrl; // deprecated, use ActivityVerb::SHARE instead const THR = 'http://purl.org/syndication/thread/1.0'; const GEORSS = 'http://www.georss.org/georss'; @@ -54,8 +56,12 @@ class ActivityContext const MENTIONED = 'mentioned'; const CONVERSATION = 'ostatus:conversation'; - function __construct($element) + function __construct($element = null) { + if (empty($element)) { + return; + } + $replyToEl = ActivityUtils::child($element, self::INREPLYTO, self::THR); if (!empty($replyToEl)) { @@ -71,8 +77,8 @@ class ActivityContext $links = $element->getElementsByTagNameNS(ActivityUtils::ATOM, ActivityUtils::LINK); + $attention = array(); for ($i = 0; $i < $links->length; $i++) { - $link = $links->item($i); $linkRel = $link->getAttribute(ActivityUtils::REL); @@ -80,11 +86,12 @@ class ActivityContext // XXX: Deprecate this in favour of "mentioned" from Salmon spec // http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html#SALR if ($linkRel == self::ATTENTION) { - $this->attention[] = $link->getAttribute(self::HREF); + $attention[] = $link->getAttribute(self::HREF); } elseif ($linkRel == self::MENTIONED) { - $this->attention[] = $link->getAttribute(self::HREF); + $attention[] = $link->getAttribute(self::HREF); } } + $this->attention = array_unique($attention); } /**