From: garvinhicking Date: Sun, 24 Jul 2005 11:38:00 +0000 (+0000) Subject: Let remoteRSS plugin fetch cache if it failed and not write empty caches. X-Git-Tag: 0.9~293 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f214cad0c71e74ab8424d8cd0a6ab90dc3fbdd62;p=s9y.git Let remoteRSS plugin fetch cache if it failed and not write empty caches. Thanks to Flo Solcher! --- diff --git a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php index 9717678..c30d82f 100644 --- a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php +++ b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php @@ -23,7 +23,7 @@ switch ($serendipity['lang']) { @define('PLUGIN_REMOTERSS_RSSTARGET_BLAHBLAH', 'Target des Links zu einem der angezeigten RSS-Einträge (Standard: _blank)'); @define('PLUGIN_REMOTERSS_NOURI', 'Kein RSS/OPML-Feed gewählt'); @define('PLUGIN_REMOTERSS_CACHETIME', 'Wann wird der Feed aktualisiert?'); - @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'Die Inhalte des fremden Feeds werden gecached. Sobald der Cache älter ist als X Minuten wird er aktualisiert (Standard: 3 Stunden)'); + @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'Die Inhalte des fremden Feeds werden gecached. Sobald der Cache älter ist als X Sekunden wird er aktualisiert (Standard: 3 Stunden)'); @define('PLUGIN_REMOTERSS_FEEDTYPE', 'Typ des Feeds'); @define('PLUGIN_REMOTERSS_FEEDTYPE_BLAHBLAH', 'Wählen Sie das Format des einzubindenden Feeds'); @define('PLUGIN_REMOTERSS_BULLETIMG', 'Bullet Image'); @@ -48,7 +48,7 @@ switch ($serendipity['lang']) { @define('PLUGIN_REMOTERSS_RSSTARGET', 'RSS/OPML linktarget'); @define('PLUGIN_REMOTERSS_RSSTARGET_BLAHBLAH', 'Target of the link to one of the displayed RSS items (Default: _blank)'); @define('PLUGIN_REMOTERSS_CACHETIME', 'When to update the feed?'); - @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'The contents of a feed are stored in a cache which will be updated as soon as its older than X minutes (Default: 3 hours)'); + @define('PLUGIN_REMOTERSS_CACHETIME_BLAHBLAH', 'The contents of a feed are stored in a cache which will be updated as soon as its older than X seconds (Default: 3 hours)'); @define('PLUGIN_REMOTERSS_FEEDTYPE', 'Feedtype'); @define('PLUGIN_REMOTERSS_FEEDTYPE_BLAHBLAH', 'Choose the format of the remote Feed'); @define('PLUGIN_REMOTERSS_BULLETIMG', 'Bullet Image'); @@ -292,7 +292,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin { $propbag->add('description', PLUGIN_REMOTERSS_BLAHBLAH); $propbag->add('stackable', true); $propbag->add('author', 'Udo Gerhards, Richard Thomas Harrison'); - $propbag->add('version', '1.2'); + $propbag->add('version', '1.3'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -461,11 +461,14 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } $fp = @fopen($feedcache, 'w'); - if ($fp) { + if (trim($content) != '' && $fp) { fwrite($fp, $content); fclose($fp); } else { echo '
'; + if (trim($content) == '') { + $content = @file_get_contents($feedcache); + } } } elseif ($feedtype == 'opml') { $opml = new s9y_remoterss_OPML(); @@ -528,13 +531,15 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } $fp = @fopen($feedcache, 'w'); - if ($fp) { + if (trim($content) != '' && $fp) { fwrite($fp, $content); fclose($fp); } else { echo '
'; + if (trim($content) == '') { + $content = @file_get_contents($feedcache); + } } - } else { echo ''; }