* Added some default CSS styles, changed tpl from span to div
* Smarty security disabling for 1.7+ blogs only
This commit is contained in:
Grischa Brockhaus 2011-12-21 11:46:25 +01:00
parent 599d0f7c39
commit f25165fa5c
4 changed files with 34 additions and 13 deletions

View file

@ -1,3 +1,8 @@
Version 1.02 (brockhaus)
-----------------------
* Added default css entries, changed oebed containers from span to div.
* Smarty security disabling for 1.7+ blogs only.
Version 1.01 (brockhaus)
-----------------------
* Added "generic providers" embed.ly and oohembed.com.

View file

@ -21,9 +21,11 @@ class OEmbedTemplater {
if (version_compare($serendipity['version'], '1.7-alpha1')>=0) {
$serendipity['smarty']->disableSecurity();
}
/* in earlier versions this is not needed.
else {
$serendipity['smarty']->security = false;
}
*/
// be smarty 3 compat including the serendipity_smarty class wrappers ->fetch and ->display methods and remove changed parameter number 4
$content = @$serendipity['smarty']->fetch('file:'. $tfile);//, false

View file

@ -1,6 +1,6 @@
{* oembed.tpl last modified 2011-12-01 *}
{if $oembed.type=='rich'} {* =================================================== RICH *}
<span class="serendipity_oembed_rich">
<div class="serendipity_oembed_rich">
{if $oembed.provider_name=="Wikipedia"}
<blockquote>{$oembed.html}</blockquote>
{elseif $oembed.provider_name=="IMDB"} {* beautify noembed.com IMDB content *}
@ -10,21 +10,21 @@
{else}
{$oembed.html}
{/if}
</span>
</div>
{elseif $oembed.type=='video'} {* =================================================== VIDEO *}
<span class="serendipity_oembed_video">
<div class="serendipity_oembed_video">
{$oembed.html}
</span>
</div>
{elseif $oembed.type=='image'} {* =================================================== IMAGE *}
<span class="serendipity_oembed_photo">
<div class="serendipity_oembed_photo">
<a href="{$oembed.url}"><img src="{$oembed.thumbnail_url}""{if $oembed.title} title="{$oembed.title}" alt="{$oembed.title}"{/if}/></a>
</span>
</div>
{elseif $oembed.type=='photo'} {* =================================================== PHOTO *}
<span class="serendipity_oembed_photo">
<div class="serendipity_oembed_photo">
<img src="{$oembed.url}"{if $oembed.title} title="{$oembed.title}" alt="{$oembed.title}"{/if}/>
</span>
</div>
{elseif $oembed.type=='link'} {* =================================================== LINK *}
<span class="serendipity_oembed_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}
@ -33,9 +33,9 @@
<a href="{$oembedurl}" title="{$oembed.title}">{$oembed.author_name}</a>
{/if}
{if $oembed.provider_name=="Wikipedia"}</blockquote>{/if}
</span>
</div>
{else} {* Link type finishes *}
<span class="serendipity_oembed">
<div class="serendipity_oembed">
<a href="{$oembedurl}" target="_blank">{if $oembed.error}{$oembed.error}{else}{$oembedurl}{/if}</a>
</span>
</div>
{/if}

View file

@ -30,7 +30,7 @@ class serendipity_event_oembed extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_OEMBED_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Grischa Brockhaus');
$propbag->add('version', '1.01');
$propbag->add('version', '1.02');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@ -39,6 +39,7 @@ class serendipity_event_oembed extends serendipity_event
$propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES'));
$propbag->add('event_hooks', array(
'frontend_display' => true,
'css' => true,
));
$configuration = $configuration = array('info','maxwidth','maxheight','generic_service','embedly_apikey');
$configuration[] = 'supported'; // always last
@ -112,6 +113,19 @@ class serendipity_event_oembed extends serendipity_event
$this->update_entry($eventData, $simplePatterns, 'extended');
}
return true;
case 'css':
if (strpos($eventData, '.serendipity_oembed')) {
// class exists in CSS, so a user has customized it and we don't need default
// (doesn't work with templates like BP or 2k11 as the user css is loaded from a seperate file)
return true;
}
?>
.serendipity_oembed_rich, .serendipity_oembed_video, .serendipity_oembed_photo, .serendipity_oembed_link, .serendipity_oembed {
max-width: 100%;
height: auto;
}
<?php
return true;
}
}