From: Mikael Nordfeldth Date: Sun, 4 Oct 2015 12:46:45 +0000 (+0200) Subject: Add an event to get plugin discovery hints from XRD X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=684b9419a037109f7a6f169ef3eba81e968733ed;p=quix0rs-gnu-social.git Add an event to get plugin discovery hints from XRD --- diff --git a/plugins/OStatus/lib/discoveryhints.php b/plugins/OStatus/lib/discoveryhints.php index 27c32b483c..4df7690038 100644 --- a/plugins/OStatus/lib/discoveryhints.php +++ b/plugins/OStatus/lib/discoveryhints.php @@ -24,28 +24,31 @@ class DiscoveryHints { { $hints = array(); - foreach ($xrd->links as $link) { - switch ($link->rel) { - case WebFingerResource_Profile::PROFILEPAGE: - $hints['profileurl'] = $link->href; - break; - case Salmon::REL_SALMON: - case Salmon::NS_MENTIONS: // XXX: deprecated, remove in the future - case Salmon::NS_REPLIES: // XXX: deprecated, remove in the future - $hints['salmon'] = $link->href; - break; - case Discovery::UPDATESFROM: - if (empty($link->type) || $link->type == 'application/atom+xml') { - $hints['feedurl'] = $link->href; + if (Event::handle('StartDiscoveryHintsFromXRD', array($xrd, &$hints))) { + foreach ($xrd->links as $link) { + switch ($link->rel) { + case WebFingerResource_Profile::PROFILEPAGE: + $hints['profileurl'] = $link->href; + break; + case Salmon::REL_SALMON: + case Salmon::NS_MENTIONS: // XXX: deprecated, remove in the future + case Salmon::NS_REPLIES: // XXX: deprecated, remove in the future + $hints['salmon'] = $link->href; + break; + case Discovery::UPDATESFROM: + if (empty($link->type) || $link->type == 'application/atom+xml') { + $hints['feedurl'] = $link->href; + } + break; + case Discovery::HCARD: + case Discovery::MF2_HCARD: + $hints['hcard'] = $link->href; + break; + default: + break; } - break; - case Discovery::HCARD: - case Discovery::MF2_HCARD: - $hints['hcard'] = $link->href; - break; - default: - break; } + Event::handle('EndDiscoveryHintsFromXRD', array($xrd, &$hints)); } return $hints;