From 242a0c8078baaa7e6b04d48047ec0ad13ff220fa Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Sat, 12 Nov 2005 11:07:45 +0000 Subject: [PATCH] debug + strike --- docs/NEWS | 3 +++ .../serendipity_event_bbcode.php | 4 ++-- .../serendipity_plugin_remoterss.php | 23 ++++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index e4c7a18..a2f23bd 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.0 () ------------------------------------------------------------------------ + * Made remote RSS plugin be able to emit debug messages, enhance + bbcode plugin with new [strike] command, thanks to comdoxx! + * Fix wrong URL permalink detection when categories contain "." or "_" characters (garvinhicking) diff --git a/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php b/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php index 2fa0531..4c366c7 100644 --- a/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php +++ b/plugins/serendipity_event_bbcode/serendipity_event_bbcode.php @@ -21,7 +21,7 @@ class serendipity_event_bbcode extends serendipity_event $propbag->add('description', PLUGIN_EVENT_BBCODE_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Jez Hancock, Garvin Hicking'); - $propbag->add('version', '2.0'); + $propbag->add('version', '2.01'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -172,7 +172,7 @@ class serendipity_event_bbcode extends serendipity_event '/(? "\\1", '/(? "\\1", '/(? "
\\1
", - + '/(? "\\1", // [email] '/(? "\\1", '/(? "\\2", diff --git a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php index 08fe308..75c7fe5 100644 --- a/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php +++ b/plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php @@ -403,6 +403,18 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } } + function debug($msg) { + static $debug = false; + + if ($debug === false) { + return false; + } + + $fp = fopen('rss.log', 'a'); + fwrite($fp, '[' . date('Y-m-d H:i') . '] ' . $msg . "\n"); + fclose($fp); + } + function generate_content(&$title) { global $serendipity; @@ -435,13 +447,17 @@ class serendipity_plugin_remoterss extends serendipity_plugin { if (trim($rssuri)) { $feedcache = $serendipity['serendipityPath'] . 'templates_c/remoterss_cache_' . preg_replace('@[^a-z0-9]*@i', '', $rssuri) . '.dat'; if (!file_exists($feedcache) || filesize($feedcache) == 0 || filemtime($feedcache) < (time() - $cachetime)) { + $this->debug('Cachefile does not existing.'); if (!$this->urlcheck($rssuri)) { + $this->debug('URLCheck failed'); echo ''; } elseif ($feedtype == 'rss') { + $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. @touch($feedcache); require_once S9Y_PEAR_PATH . 'Onyx/RSS.php'; $c = &new Onyx_RSS($charset); + $this->debug('Running Onyx Parser'); $c->parse($rssuri); $this->encoding = $c->rss['encoding']; @@ -466,16 +482,21 @@ class serendipity_plugin_remoterss extends serendipity_plugin { ++$i; } + $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 == 'opml') { // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. @touch($feedcache); @@ -556,6 +577,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin { echo ''; } } else { + $this->debug('Got feed from cache ' . $feedcache); $content = file_get_contents($feedcache); } @@ -597,4 +619,3 @@ class serendipity_plugin_remoterss extends serendipity_plugin { } /* vim: set sts=4 ts=4 expandtab : */ -?> \ No newline at end of file -- 2.39.5