}
}
+ function onEndWebFingerNoticeLinks(XML_XRD $xrd, Notice $target)
+ {
+ $author = $target->getProfile();
+ $salmon_url = common_local_url('usersalmon', array('id' => $author->id));
+ $xrd->links[] = new XML_XRD_Element_Link(Salmon::REL_SALMON, $salmon_url);
+ return true;
+ }
+
function onEndWebFingerProfileLinks(XML_XRD $xrd, Profile $target)
{
$xrd->links[] = new XML_XRD_Element_Link(Discovery::UPDATESFROM,
- $profile: Profile object for which we want a WebFinger ID
- &$acct: String reference where reconstructed ID is stored
-StartWebFingerProfileLinks: About to set links for the resource descriptor of a profile
+StartWebFingerNoticeLinks: About to set links for the resource descriptor of a Notice
+- $xrd: XML_XRD object being shown
+- $target: Notice being shown
+
+EndWebFingerNoticeLinks: Done with links for the resource descriptor of a Notice
+- $xrd: XML_XRD object being shown
+- $target: Notice being shown
+
+StartWebFingerProfileLinks: About to set links for the resource descriptor of a Profile
- $xrd: XML_XRD object being shown
- $target: Profile being shown
-EndWebFingerProfileLinks: Done with links for the resource descriptor of a profile
+EndWebFingerProfileLinks: Done with links for the resource descriptor of a Profile
- $xrd: XML_XRD object being shown
- $target: Profile being shown
abstract class WebFingerResource
{
- const PROFILEPAGE = 'http://webfinger.net/rel/profile-page';
-
protected $identities = array();
protected $object = null;
return $aliases;
}
- public function updateXRD(XML_XRD $xrd) {
- $xrd->links[] = new XML_XRD_Element_Link(WebFingerResource::PROFILEPAGE,
- $this->object->getUrl(), 'text/html');
- }
+ abstract public function updateXRD(XML_XRD $xrd);
}
public function updateXRD(XML_XRD $xrd)
{
- parent::updateXRD($xrd);
+ if (Event::handle('StartWebFingerNoticeLinks', array($xrd, $this->object))) {
+ $xrd->links[] = new XML_XRD_Element_Link('alternate',
+ common_local_url('ApiStatusesShow',
+ array('id'=>$this->object->id,
+ 'format'=>'atom')),
+ 'application/atom+xml');
- // TODO: Add atom and json representation links here
- // TODO: Add Salmon/callback links and stuff here
+ $xrd->links[] = new XML_XRD_Element_Link('alternate',
+ common_local_url('ApiStatusesShow',
+ array('id'=>$this->object->id,
+ 'format'=>'json')),
+ 'application/json');
+ Event::handle('EndWebFingerNoticeLinks', array($xrd, $this->object));
+ }
}
}
class WebFingerResource_Profile extends WebFingerResource
{
+ const PROFILEPAGE = 'http://webfinger.net/rel/profile-page';
+
public function __construct(Profile $object)
{
// The type argument above verifies that it's our class
{
if (Event::handle('StartWebFingerProfileLinks', array($xrd, $this->object))) {
- parent::updateXRD($xrd);
+ $xrd->links[] = new XML_XRD_Element_Link(self::PROFILEPAGE,
+ $this->object->getUrl(), 'text/html');
// XFN
$xrd->links[] = new XML_XRD_Element_Link('http://gmpg.org/xfn/11',