- $action->element('link',array('rel'=>'alternate',
- 'type'=>'application/json+oembed',
- 'href'=>common_local_url(
- 'oembed',
- array(),
- array('format'=>'json','url'=>$action->notice->getUrl())),
- 'title'=>'oEmbed'),null);
- $action->element('link',array('rel'=>'alternate',
- 'type'=>'text/xml+oembed',
- 'href'=>common_local_url(
- 'oembed',
- array(),
- array('format'=>'xml','url'=>$action->notice->getUrl())),
- 'title'=>'oEmbed'),null);
+ try {
+ $action->element('link',array('rel'=>'alternate',
+ 'type'=>'application/json+oembed',
+ 'href'=>common_local_url(
+ 'oembed',
+ array(),
+ array('format'=>'json','url'=>$action->notice->getUrl())),
+ 'title'=>'oEmbed'),null);
+ $action->element('link',array('rel'=>'alternate',
+ 'type'=>'text/xml+oembed',
+ 'href'=>common_local_url(
+ 'oembed',
+ array(),
+ array('format'=>'xml','url'=>$action->notice->getUrl())),
+ 'title'=>'oEmbed'),null);
+ } catch (InvalidUrlException $e) {
+ // The notice is probably a share or similar, which don't
+ // have a representational URL of their own.
+ }