From: garvinhicking Date: Thu, 13 Dec 2007 13:05:23 +0000 (+0000) Subject: templating for rss sidebar X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2d84c3425192ccaa7a1a020546591cac7d28d504;p=s9y.git templating for rss sidebar --- diff --git a/docs/NEWS b/docs/NEWS index 2f10b34..3d78c7a 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -5,7 +5,9 @@ Version 1.3 () * Add more verbose CSS classes to remote RSS sidebar plugin, also only encapsulate the first XML-Item as link. All following - items are only encapsulated in s. (garvinhicking) + items are only encapsulated in s. Also add possible + plugin_remoterss.tpl smarty output template to this + plugin. (garvinhicking) * Make browser compatibility plugin bail out for IE7. Thanks to Freudi from the forums. diff --git a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php index 4169e36..1aa4f58 100644 --- a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php +++ b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php @@ -263,7 +263,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin { 'smarty' => '2.6.7', 'php' => '4.1.0' )); - $propbag->add('configuration', array('number', 'use_rss_link', 'show_rss_element', 'escape_rss', 'displaydate', 'dateformat', 'sidebartitle', 'rssuri', 'charset', 'target', 'cachetime', 'feedtype', 'bulletimg', 'markup')); + $propbag->add('configuration', array('sidebartitle', 'feedtype', 'rssuri', 'show_rss_element', 'smarty', 'number', 'use_rss_link', 'escape_rss', 'displaydate', 'dateformat', 'charset', 'target', 'cachetime', 'bulletimg', 'markup')); $propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES')); } @@ -375,6 +375,12 @@ class serendipity_plugin_remoterss extends serendipity_plugin { $propbag->add('default', ''); break; + case 'smarty': + $propbag->add('type', 'boolean'); + $propbag->add('name', CATEGORY_PLUGIN_TEMPLATE); + $propbag->add('description', CATEGORY_PLUGIN_TEMPLATE_DESC); + $propbag->add('default', false); + break; case 'displaydate': $propbag->add('type', 'boolean'); @@ -452,6 +458,8 @@ class serendipity_plugin_remoterss extends serendipity_plugin { if (!$cachetime || !is_numeric($cachetime)) { $cachetime = 10800; // 3 hours in seconds } + + $smarty = serendipity_db_bool($this->get_config('smarty')); if (trim($rssuri)) { $feedcache = $serendipity['serendipityPath'] . 'templates_c/remoterss_cache_' . md5(preg_replace('@[^a-z0-9]*@i', '', $rssuri)) . '.dat'; @@ -475,12 +483,14 @@ class serendipity_plugin_remoterss extends serendipity_plugin { $escape_rss = serendipity_db_bool($this->get_config('escape_rss')); $i = 0; $content = ''; + $smarty_items = array(); while (($showAll || ($i < $number)) && ($item = $c->getNextItem())) { if (empty($item['title'])) { continue; } - echo ''; // end of rss_item + + if ($smarty) { + $smarty_items['items'][$i] = $item; + $smarty_items['items'][$i]['css_class'] = preg_replace('@[^a-z0-9]@imsU', '', $rss_element); + foreach($item AS $key => $val) { + $smarty_items['items'][$i]['decoded_' . str_replace(':', '_', $key)] = $this->decode($key); + } + } + $content .= ''; // end of rss_item ++$i; } + + if ($smarty) { + $smarty_items['use_rss_link'] = $use_rss_link; + $smarty_items['bulletimg'] = $bulletimg; + $smarty_items['escape_rss'] = $escape_rss; + $smarty_items['displaydate'] = $displaydate; + $smarty_items['dateformat'] = $dateformat; + $smarty_items['target'] = $target; + + $serendipity['smarty']->assign_by_ref('remoterss_items', $smarty_items); + $content = $this->parseTemplate('plugin_remoterss.tpl'); + } $this->debug('Caching Feed (' . strlen($content) . ' bytes)'); $fp = @fopen($feedcache, 'w'); diff --git a/templates/bulletproof/index.tpl b/templates/bulletproof/index.tpl index 109aeb9..710ec4a 100644 --- a/templates/bulletproof/index.tpl +++ b/templates/bulletproof/index.tpl @@ -58,6 +58,7 @@ {else} {serendipity_hookPlugin hook="frontend_header"} {/if} + {if $is_raw_mode != true}