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)
$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',
'/(?<!\\\\)\[i(?::\w+)?\](.*?)\[\/i(?::\w+)?\]/si' => "<span style=\"font-style:italic\">\\1</span>",
'/(?<!\\\\)\[u(?::\w+)?\](.*?)\[\/u(?::\w+)?\]/si' => "<span style=\"text-decoration:underline\">\\1</span>",
'/(?<!\\\\)\[center(?::\w+)?\](.*?)\[\/center(?::\w+)?\]/si' => "<div style=\"text-align:center\">\\1</div>",
-
+ '/(?<!\\\\)\[strike(?::\w+)?\](.*?)\[\/strike(?::\w+)?\]/si' => "<span style=\"text-decoration:line-through\">\\1</span>",
// [email]
'/(?<!\\\\)\[email(?::\w+)?\]' . $pattern_mail . '\[\/email(?::\w+)?\]/si' => "<a href=\"mailto:\\1\" class=\"bb-email\">\\1</a>",
'/(?<!\\\\)\[email(?::\w+)?=' . $pattern_mail . '\](.*?)\[\/email(?::\w+)?\]/si' => "<a href=\"mailto:\\1\" class=\"bb-email\">\\2</a>",
}
}
+ 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;
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 '<!-- No valid URL! -->';
} 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'];
++$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 '<!-- Cache failed to ' . $feedcache . ' in ' . getcwd() . ' --><br />';
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);
echo '<!-- no valid feedtype -->';
}
} else {
+ $this->debug('Got feed from cache ' . $feedcache);
$content = file_get_contents($feedcache);
}
}
/* vim: set sts=4 ts=4 expandtab : */
-?>
\ No newline at end of file