OEmbed: Posterous Custom Provider delivers LinkEmbed if no video/image

was found.
This commit is contained in:
Grischa Brockhaus 2011-12-22 04:11:34 +01:00
parent 0860f97c66
commit 357168dc62
3 changed files with 25 additions and 16 deletions

View file

@ -26,11 +26,10 @@
{elseif $oembed.type=='link'} {* =================================================== LINK *}
<div class="serendipity_oembed_link">
{if $oembed.provider_name=="Wikipedia"}<blockquote>{/if}
{if $oembed.description}
{if $oembed.title}<strong>{$oembed.title}</strong><br/>{/if}
{if $oembed.description}{if $oembed.title}<strong>{$oembed.title}</strong><br/>{/if}
<p>{if $oembed.thumbnail_url}<img src="{$oembed.thumbnail_url}" align="left" style="padding-right: 1em"{if $oembed.title} alt="{$oembed.title}" title="{$oembed.title}"{/if}>{/if}{$oembed.description}{if $oembed.url} [<a href="{$oembed.url}" target="_blank">link</a>]{/if}</p>
{else}
<a href="{$oembedurl}" title="{$oembed.title}">{$oembed.author_name}</a>
<a href="{$oembedurl}" title="{$oembed.title}">{$oembed.author_name}: {$oembed.title}</a>
{/if}
{if $oembed.provider_name=="Wikipedia"}</blockquote>{/if}
</div>

View file

@ -12,7 +12,7 @@
*
* After implementing the provider you have to add it to the providers.xml like this:
* <provider>
* <name>Posterous (Imge and Video Posts)</name>
* <name>Posterous post.ly</name>
* <url>http://post.ly/*</url>
* <class>PostlyProvider</class>
* </provider>
@ -60,21 +60,31 @@ class PostlyProvider extends EmbedProvider {
$oembed->height=(string)$medium->height;
}
else {
return null;
$oembed = new LinkEmbed();
$oembed->type="link";
$oembed->html=(string)$post->body;
$oembed->description=(string)$post->body;
$oembed->url=(string)$post->link;
$oembed->thumbnail_url=(string)$post->authorpic;
}
$oembed->version='1.0';
$oembed->provider_name="Posterous";
$oembed->provider_url="http://posterous.com";
$oembed->resource_url=(string)$post->link;
$oembed->title = (string)$post->title;
//$oembed->html = $post->body;
$oembed->author_name = (string)$post->author;
$oembed->author_pic = (string)$post->authorpic; // normaly unsupported
return $oembed;
}
else {
return null;
$oembed = new LinkEmbed();
$oembed->type="link";
$oembed->html=(string)$post->body;
$oembed->description=(string)$post->body;
$oembed->url=(string)$post->link;
$oembed->thumbnail_url=(string)$post->authorpic;
}
$oembed->version='1.0';
$oembed->provider_name="Posterous";
$oembed->provider_url="http://posterous.com";
$oembed->resource_url=(string)$post->link;
$oembed->title = (string)$post->title;
//$oembed->html = $post->body;
$oembed->author_name = (string)$post->author;
$oembed->author_pic = (string)$post->authorpic; // normaly unsupported
return $oembed;
}
// === here comes the regular stuff for providers, what is very similar in any custom provider =========

View file

@ -122,7 +122,7 @@
<!-- custom providers =========================================== -->
<provider>
<name>Posterous (Imge and Video Posts)</name>
<name>Posterous post.ly</name>
<url>http://post.ly/*</url>
<class>PostlyProvider</class>
</provider>