Add an event to get plugin discovery hints from XRD

This commit is contained in:
Mikael Nordfeldth 2015-10-04 14:46:45 +02:00
parent 2aed59a02a
commit 684b9419a0

View File

@ -24,28 +24,31 @@ class DiscoveryHints {
{ {
$hints = array(); $hints = array();
foreach ($xrd->links as $link) { if (Event::handle('StartDiscoveryHintsFromXRD', array($xrd, &$hints))) {
switch ($link->rel) { foreach ($xrd->links as $link) {
case WebFingerResource_Profile::PROFILEPAGE: switch ($link->rel) {
$hints['profileurl'] = $link->href; case WebFingerResource_Profile::PROFILEPAGE:
break; $hints['profileurl'] = $link->href;
case Salmon::REL_SALMON: break;
case Salmon::NS_MENTIONS: // XXX: deprecated, remove in the future case Salmon::REL_SALMON:
case Salmon::NS_REPLIES: // XXX: deprecated, remove in the future case Salmon::NS_MENTIONS: // XXX: deprecated, remove in the future
$hints['salmon'] = $link->href; case Salmon::NS_REPLIES: // XXX: deprecated, remove in the future
break; $hints['salmon'] = $link->href;
case Discovery::UPDATESFROM: break;
if (empty($link->type) || $link->type == 'application/atom+xml') { case Discovery::UPDATESFROM:
$hints['feedurl'] = $link->href; 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; return $hints;