Page 1 of 1

RSS-Syndication additions

Posted: Thu Dec 18, 2008 12:26 am
by onli
Locally, I implemented three little additions to the rss-syndication-plugin:
1. Option to set a image at the top (like on Dirks Logbuch)
2. Option to rename the RSS x feed.
3. Option to rename the RSS comments.
Are you interested in a diff? Should this be against 1.4 beta 1 or 1.3.1?

Posted: Thu Dec 18, 2008 12:28 am
by Don Chambers
I suggest you post your diff to 1.4 beta 2 so it can be evaluated.

Posted: Thu Dec 18, 2008 1:14 am
by onli

Code: Select all

diff -Nur serendipity/include/plugin_internal.inc.php /var/www/include/plugin_internal.inc.php
--- serendipity/include/plugin_internal.inc.php	2008-11-06 15:11:13.000000000 +0100
+++ /var/www/include/plugin_internal.inc.php	2008-12-18 00:51:56.000000000 +0100
@@ -747,6 +747,9 @@
                                         'fb_title',
                                         'fb_alt',
                                         'fb_img',
+                                        'big_img',
+                                        'feed_name',
+                                        'comment_name',
                                        )
         );
         $propbag->add('groups',        array('FRONTEND_VIEWS'));
@@ -959,6 +962,27 @@
                 $propbag->add('description', SYNDICATION_PLUGIN_FEEDBURNERALT_DESC);
                 $propbag->add('default',     '');
                 break;
+            
+            case 'big_img':
+				$propbag->add('type',        'string');
+                $propbag->add('name',        SYNDICATION_PLUGIN_BIGIMG);
+                $propbag->add('description', SYNDICATION_PLUGIN_BIGIMG_DESC);
+                $propbag->add('default',     '');
+                break;
+
+			case 'feed_name':
+				$propbag->add('type',        'string');
+                $propbag->add('name',        SYNDICATION_PLUGIN_FEEDNAME);
+                $propbag->add('description', SYNDICATION_PLUGIN_FEEDNAME_DESC);
+                $propbag->add('default',     '');
+                break;
+
+			case 'comment_name':
+				$propbag->add('type',        'string');
+                $propbag->add('name',        SYNDICATION_PLUGIN_COMMENTNAME);
+                $propbag->add('description', SYNDICATION_PLUGIN_COMMENTNAME_DESC);
+                $propbag->add('default',     '');
+                break;
 
 
             default:
@@ -974,13 +998,27 @@
         $title = $this->get_config('title');
         $icon  = serendipity_getTemplateFile($this->get_config('iconURL', 'img/xml.gif'));
 
+		if ($this->get_config('feed_name') == '') {
+        	$FEED = 'feed';
+		}else{
+			$FEED = $this->get_config('feed_name');
+		}
+		if ($this->get_config('big_img') != '') {
+			$img = serendipity_getTemplateFile($this->get_config('big_img', 'img/xml.gif'));
+?>
+        <div style="padding-bottom: 2px;">
+            <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo $img; ?>" alt="XML" style="border: 0px" /></a>
+        </div>
+<?php
+        }
+        
    ?><ul><?php
 
         if (serendipity_db_bool($this->get_config('show_0.91', true))) {
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss', 'serendipityHTTPPath') ?>">RSS 0.91 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss', 'serendipityHTTPPath') ?>">RSS 0.91 <?php echo $FEED; ?></a>
         </li>
 <?php
         }
@@ -989,7 +1027,7 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss1', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss1', 'serendipityHTTPPath') ?>">RSS 1.0 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss1', 'serendipityHTTPPath') ?>">RSS 1.0 <?php echo $FEED; ?></a>
         </li>
 <?php
         }
@@ -998,7 +1036,7 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>">RSS 2.0 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/index.rss2', 'serendipityHTTPPath') ?>">RSS 2.0 <?php echo $FEED; ?></a>
         </li>
 <?php
         }
@@ -1007,7 +1045,7 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom03.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="ATOM/XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom03.xml', 'serendipityHTTPPath') ?>">ATOM 0.3 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom03.xml', 'serendipityHTTPPath') ?>">ATOM 0.3 <?php echo $FEED; ?></a>
         </li>
 <?php
         }
@@ -1016,7 +1054,7 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="ATOM/XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml', 'serendipityHTTPPath') ?>">ATOM 1.0 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml', 'serendipityHTTPPath') ?>">ATOM 1.0 <?php echo $FEED; ?></a>
         </li>
 <?php
         }
@@ -1025,7 +1063,12 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><span style="white-space: nowrap">RSS 2.0 <?php echo COMMENTS; ?></span></a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/comments.rss2', 'serendipityHTTPPath') ?>"><span style="white-space: nowrap">RSS 2.0 <?php 
+            if ($this->get_config('comment_name') == '') {
+        		echo COMMENTS;
+			}else{
+				echo $this->get_config('comment_name');
+			}  ?></span></a>
         </li>
 <?php
         }
@@ -1034,7 +1077,7 @@
 ?>
         <li>
             <a class="serendipity_xml_icon" href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/opml.xml', 'serendipityHTTPPath') ?>"><img src="<?php echo $icon; ?>" alt="XML" style="border: 0px" /></a>
-            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/opml.xml', 'serendipityHTTPPath') ?>">OPML 1.0 feed</a>
+            <a href="<?php echo serendipity_rewriteURL(PATH_FEEDS .'/opml.xml', 'serendipityHTTPPath') ?>">OPML 1.0 <?php echo $FEED; ?></a>
         </li>
 <?php
         }

 diff -Nur serendipity_lang_en.inc.php /var/www/lang/serendipity_lang_en.inc.ph
--- serendipity_lang_en.inc.php	2008-12-18 01:08:27.000000000 +0100
+++ /var/www/lang/serendipity_lang_en.inc.php	2008-12-18 01:08:55.000000000 +0100
@@ -243,6 +243,12 @@
 @define('SYNDICATION_PLUGIN_TTL_DESC', 'Amount of minutes after which your blog should not be cached any more by foreign sites/applications (empty: hidden) [RSS 2.0]');
 @define('SYNDICATION_PLUGIN_PUBDATE', 'Field "pubDate"');
 @define('SYNDICATION_PLUGIN_PUBDATE_DESC', 'Should the "pubDate"-field be embedded for a RSS-channel, to show the date of the latest entry?');
+@define('SYNDICATION_PLUGIN_BIGIMG', 'Big Image');
+@define('SYNDICATION_PLUGIN_BIGIMG_DESC', 'Display a (big) image at the top of the feeds in sidebar');
+@define('SYNDICATION_PLUGIN_FEEDNAME', 'Feed Name');
+@define('SYNDICATION_PLUGIN_FEEDNAME_DESC', 'Enter a custom name for the feeds');
+@define('SYNDICATION_PLUGIN_COMMENTNAME', 'Comment Name');
+@define('SYNDICATION_PLUGIN_COMMENTNAME_DESC', 'Enter a custom name for the comment feed');
 @define('CONTENT', 'Content');
 @define('TYPE', 'Type');
 @define('DRAFT', 'Draft');

diff -Nur utf-serendipity_lang_en.inc.php /var/www/lang/UTF-8/serendipity_lang_en.inc.php
--- utf-serendipity_lang_en.inc.php	2008-12-18 01:08:16.000000000 +0100
+++ /var/www/lang/UTF-8/serendipity_lang_en.inc.php	2008-12-18 01:08:52.000000000 +0100
@@ -243,6 +243,12 @@
 @define('SYNDICATION_PLUGIN_TTL_DESC', 'Amount of minutes after which your blog should not be cached any more by foreign sites/applications (empty: hidden) [RSS 2.0]');
 @define('SYNDICATION_PLUGIN_PUBDATE', 'Field "pubDate"');
 @define('SYNDICATION_PLUGIN_PUBDATE_DESC', 'Should the "pubDate"-field be embedded for a RSS-channel, to show the date of the latest entry?');
+@define('SYNDICATION_PLUGIN_BIGIMG', 'Big Image');
+@define('SYNDICATION_PLUGIN_BIGIMG_DESC', 'Display a (big) image at the top of the feeds in sidebar');
+@define('SYNDICATION_PLUGIN_FEEDNAME', 'Feed Name');
+@define('SYNDICATION_PLUGIN_FEEDNAME_DESC', 'Enter a custom name for the feeds');
+@define('SYNDICATION_PLUGIN_COMMENTNAME', 'Comment Name');
+@define('SYNDICATION_PLUGIN_COMMENTNAME_DESC', 'Enter a custom name for the comment feed');
 @define('CONTENT', 'Content');
 @define('TYPE', 'Type');
 @define('DRAFT', 'Draft');
Couldn't find a 1.4 beta 2 snapshot, but the blogentry states these files from 1.4 beta1 are equal.

Posted: Thu Dec 18, 2008 11:57 am
by garvinhicking
Hi!

I've committed your patch with a few changes, so that when the field is left empty or set to "none/empty/default" it will use the old variant, and the image on top is fetched with a full URL, not relative to the template directory for better understanding and less need to document how people need to enter paths.

You can fetch the snapshot from tomorrow to test things out. Many thanks for your contribution.

Regards,
Garvin