]> git.mjollnir.org Git - s9y.git/commitdiff
Tweak CSS output of rss sidebar plugin
authorgarvinhicking <garvinhicking>
Wed, 12 Dec 2007 10:37:41 +0000 (10:37 +0000)
committergarvinhicking <garvinhicking>
Wed, 12 Dec 2007 10:37:41 +0000 (10:37 +0000)
docs/NEWS
plugins/serendipity_plugin_remoterss/serendipity_plugin_remoterss.php

index f3e59e343020232c2bf165b1a574d207857dff58..2f10b340fddb64cdfea88e11e0a42aa89bd129fe 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 1.3 ()
 ------------------------------------------------------------------------
 
+    * Add more verbose CSS classes to remote RSS sidebar plugin, also
+      only encapsulate the first XML-Item as link. All following
+      items are only encapsulated in <span>s. (garvinhicking)
+
     * Make browser compatibility plugin bail out for IE7. Thanks to
       Freudi from the forums.
       
index 34b2f58aa70d4c62399838b1dd1cad2353336c8c..4169e36efb251828663c8deba3dd2423b8e71dd3 100644 (file)
@@ -379,7 +379,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
             case 'displaydate':
                 $propbag->add('type', 'boolean');
                 $propbag->add('name', PLUGIN_REMOTERSS_DISPLAYDATE);
-                $propbag->add('description', PLUGIN_REMOTERSS_BLAHBLAH);
+                $propbag->add('description', PLUGIN_REMOTERSS_DISPLAYDATE_BLAHBLAH);
                 $propbag->add('default', 'true');
                 break;
 
@@ -480,24 +480,41 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
                             continue;
                         }
 
+                        echo '<div class="rss_item">';
                         if ($use_rss_link) {
-                            $content .= '<a href="' . htmlspecialchars($this->decode($item['link'])) . '" ' . (!empty($target) ? 'target="'.$target.'"' : '') . '>';
+                            $content .= '<div class="rss_link"><a href="' . htmlspecialchars($this->decode($item['link'])) . '" ' . (!empty($target) ? 'target="'.$target.'"' : '') . '>';
                         }
 
                         if (!empty($bulletimg)) {
                             $content .= '<img src="' . $bulletimg . '" border="0" alt="*" /> ';
                         }
 
+                        $is_first = true;
                         foreach($rss_elements AS $rss_element) {
                             $rss_element = trim($rss_element);
+                            
+                            if (!$is_first) {
+                                $content .= '<span class="rss_' . preg_replace('@[^a-z0-9]@imsU', '', $rss_element) . '">';
+                            }
+
                             if ($escape_rss) {
                                 $content .= $this->decode($item[$rss_element]);
                             } else {
                                 $content .= htmlspecialchars($this->decode($item[$rss_element]));
                             }
+                            
+                            if (!$is_first) {
+                                $content .= '</span>';
+                            }
+
+                            if ($is_first && $use_rss_link) {
+                                $content .= '</a></div>'; // end of first linked element
+                            }
+                            $is_first = false;
                         }
 
-                        if ($use_rss_link) {
+                        if ($is_first && $use_rss_link) {
+                            // No XML element has been configured.
                             $content .= '</a>';
                         }
 
@@ -506,9 +523,10 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
                         if (!($item['timestamp'] == -1) AND ($displaydate == 'true')) {
                             $content .= '<div class="serendipitySideBarDate">'
                                       . htmlspecialchars(serendipity_formatTime($dateformat, $item['timestamp'], false))
-                                      . '</div><br />';
+                                      . '</div>';
 
                         }
+                        echo '</div>'; // end of rss_item
                         ++$i;
                     }