From 286a24b8cc3129581ae35fcbcc2aca8ab0a32474 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 12 Jun 2012 20:19:38 +0200 Subject: [PATCH] once again, with feeling --- .../serendipity_plugin_remoterss.php | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php index 56956670..56875ff9 100644 --- a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php +++ b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php @@ -565,6 +565,47 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } $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); + $tpl = $this->get_config('template'); + if (empty($tpl)) { + $tpl = 'plugin_remoterss.tpl'; + } + + // Template specifics go here + switch($tpl) { + case 'plugin_remoterss_nasaiotd.tpl': + $smarty_items['nasa_image'] = $c->getData('image'); + break; + } + $content = $this->parseTemplate($tpl); + } + + $this->debug('Caching Feed (' . strlen($content) . ' bytes)'); + $fp = @fopen($feedcache, 'w'); + if (trim($content) != '' && $fp) { + fwrite($fp, $content); + fclose($fp); + $this->debug('Feed cache written'); + } else { + $this->debug('Could not write (empty?) cache.'); + echo '
'; + if (trim($content) == '') { + $this->debug('Getting old feedcache'); + $content = @file_get_contents($feedcache); + } + } + $this->debug('RSS Plugin finished.'); + } elseif ($feedtype == 'atom') { $this->debug('URLCheck succeeded. Touching ' . $feedcache); // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. @@ -706,7 +747,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin { $content = @file_get_contents($feedcache); } } - $this->debug('RSS Plugin finished.'); + $this->debug('RSS Plugin (Atom) finished.'); } elseif ($feedtype == 'opml') { // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. @touch($feedcache);