Added oEmbed discovery for attachments and notices

This commit is contained in:
Craig Andrews 2009-07-15 15:11:29 -04:00
parent e637e5a8a9
commit 6308539c1d
2 changed files with 36 additions and 0 deletions

View File

@ -98,6 +98,28 @@ class AttachmentAction extends Action
return $a->title(); return $a->title();
} }
function extraHead()
{
$this->element('link',array('rel'=>'alternate',
'type'=>'application/json+oembed',
'href'=>common_local_url(
'api',
array('apiaction'=>'laconica','method'=>'oembed.json'),
array('url'=>
common_local_url('attachment',
array('attachment' => $this->attachment->id)))),
'title'=>'oEmbed'),null);
$this->element('link',array('rel'=>'alternate',
'type'=>'text/xml+oembed',
'href'=>common_local_url(
'api',
array('apiaction'=>'laconica','method'=>'oembed.xml'),
array('url'=>
common_local_url('attachment',
array('attachment' => $this->attachment->id)))),
'title'=>'oEmbed'),null);
}
/** /**
* Handle input * Handle input
* *

View File

@ -275,6 +275,20 @@ class ShownoticeAction extends OwnerDesignAction
$this->element('meta', array('name' => 'microid', $this->element('meta', array('name' => 'microid',
'content' => $id->toString())); 'content' => $id->toString()));
} }
$this->element('link',array('rel'=>'alternate',
'type'=>'application/json+oembed',
'href'=>common_local_url(
'api',
array('apiaction'=>'laconica','method'=>'oembed.json'),
array('url'=>$this->notice->uri)),
'title'=>'oEmbed'),null);
$this->element('link',array('rel'=>'alternate',
'type'=>'text/xml+oembed',
'href'=>common_local_url(
'api',
array('apiaction'=>'laconica','method'=>'oembed.xml'),
array('url'=>$this->notice->uri)),
'title'=>'oEmbed'),null);
} }
} }