]> git.mjollnir.org Git - s9y.git/commitdiff
debug + strike
authorgarvinhicking <garvinhicking>
Sat, 12 Nov 2005 11:07:45 +0000 (11:07 +0000)
committergarvinhicking <garvinhicking>
Sat, 12 Nov 2005 11:07:45 +0000 (11:07 +0000)
docs/NEWS
plugins/serendipity_event_bbcode/serendipity_event_bbcode.php
plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php

index e4c7a18be20fa40190039bbaaebe52fcb82d28f4..a2f23bdb81ae08df7b4e96a5928a7f314d0dfd3d 100644 (file)
--- 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)
 
index 2fa0531203d62394dc9bf8cad053220ad52b6690..4c366c78e7640298a5b7b043ab4a1ba81eccc3ff 100644 (file)
@@ -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
               '/(?<!\\\\)\[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>",
index 08fe308945bbba26640709750a65089f7220fae3..75c7fe5f08d92428c2a097b33ffc615e88340d48 100644 (file)
@@ -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 '<!-- 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'];
 
@@ -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 '<!-- 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);
@@ -556,6 +577,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
                     echo '<!-- no valid feedtype -->';
                 }
             } 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