X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Factivitycontext.php;h=ff3bc9411d53baeaa48b9b8d007769382bafef44;hb=781075d4bc74296118bbf6f64565ab3aeb0a3a86;hp=2df7613f7d90385be94a481db18de4c29342ea0e;hpb=800b33590696e85480aa73c25261d80f1926e56d;p=quix0rs-gnu-social.git diff --git a/lib/activitycontext.php b/lib/activitycontext.php index 2df7613f7d..ff3bc9411d 100644 --- a/lib/activitycontext.php +++ b/lib/activitycontext.php @@ -51,10 +51,15 @@ class ActivityContext const POINT = 'point'; const ATTENTION = 'ostatus:attention'; + 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)) { @@ -70,16 +75,21 @@ 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); + // 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) { + $attention[] = $link->getAttribute(self::HREF); } } + $this->attention = array_unique($attention); } /**