Index: commentrss.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/commentrss/commentrss.module,v
retrieving revision 1.12
diff -u -r1.12 commentrss.module
--- commentrss.module	18 Dec 2006 11:42:56 -0000	1.12
+++ commentrss.module	7 Jul 2007 23:46:28 -0000
@@ -53,7 +53,7 @@
 function commentrss_handler($type = NULL) {
   if ($type) {
     if (in_array($type, array('node', 'term', 'vocab', 'nodetype'))) {
-      if (call_user_func('commentrss_feed_' . $type)) {
+      if (call_user_func('commentrss_feed_'. $type)) {
         return;
       }
     }
@@ -119,62 +119,37 @@
   return FALSE;
 }
 
-// Provides a comment feed for a single node (also includes the node teaser
-// as the last item, even if there are too many comments which are not
-// included in the resulting RSS output)
+// Provides a comment feed for a single node
 function commentrss_feed_node() {
   global $base_url;
 
-  $nid = arg(2);
-  if (is_numeric($nid)) {
-    if (!($item = node_load($nid))) {
+  if (is_numeric(arg(2))) {
+    $node = node_load(arg(2));
+    if (!$node->nid) {
       return FALSE;
     }
 
-    $items = commentrss_format_items('n.nid', '', 'n.nid = %d AND', $nid);
-    $link = url("node/$nid", NULL, NULL, TRUE);
+    $items = commentrss_format_items('n.nid', '', 'n.nid = %d AND', $node->nid);
+    $link = url("node/$node->nid", NULL, NULL, TRUE);
 
-    // COPIED from node_feed() start
-    $item_length = variable_get('feed_item_length', 'teaser');
-    if ($item_length != 'title') {
-      $teaser = ($item_length == 'teaser') ? TRUE : FALSE;
-      if (node_hook($item, 'view')) {
-        node_invoke($item, 'view', $teaser, FALSE);
-      }
-      else {
-        $item = node_prepare($item, $teaser);
-      }
-      node_invoke_nodeapi($item, 'view', $teaser, FALSE);
-    }
-    switch ($item_length) {
-      case 'fulltext':
-        $item_text = $item->body;
-        break;
-      case 'teaser':
-        $item_text = $item->teaser;
-        if ($item->readmore) {
-          $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) .'</p>';
-        }
-        break;
-      case 'title':
-        $item_text = '';
-        break;
-    }
-    $extra = node_invoke_nodeapi($item, 'rss item');
-    $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' =>  date('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false'))));
+    $extra_defaults = array(
+      array('key' => 'pubDate', 'value' =>  date('r', $node->created)),
+      array('key' => 'dc:creator', 'value' => $node->name),
+      array('key' => 'guid', 'attributes' => array('isPermaLink' => 'false'),
+            'value' => $base_url .'/node/'. $node->nid)
+    );
+    $extra = node_invoke_nodeapi($node, 'rss item');
+    $extra = array_merge($extra, $extra_defaults);
     $namespaces = array();
     foreach ($extra as $element) {
       if ($element['namespace']) {
         $namespaces[] = $element['namespace'];
       }
     }
-    $items .= format_rss_item($item->title, $link, $item_text, $extra);
-    // COPIED from node_feed() end
-    
     $channel = array(
-      'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $item->title) .' - '. t('Comments'),
+      'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $node->title) .' - '. t('Comments'),
       'link'        => $link,
-      'description' => t('Comments for "@title"', array("@title" => $item->title)),
+      'description' => t('Comments for "@title"', array("@title" => $node->title)),
     );
     
     commentrss_format_feed($items, $channel, $namespaces);
@@ -211,7 +186,7 @@
   
   $channel_defaults = array(
     'version'     => '2.0',
-    'title'       => check_plain(variable_get('site_name', 'drupal')) . ' - ' . t('Comments'),
+    'title'       => check_plain(variable_get('site_name', 'drupal')) .' - '. t('Comments'),
     'link'        => $base_url,
     'description' => t('Comments'),
     'language'    => $locale
@@ -220,7 +195,7 @@
   $namespaces = array_merge(array('xmlns:dc="http://purl.org/dc/elements/1.1/"'), $namespaces);
   
   $output = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
-  $output .= '<rss version="'. $channel["version"] . '" xml:base="'. $base_url .'" ' . implode(' ', $namespaces) . ">\n";
+  $output .= '<rss version="'. $channel["version"] .'" xml:base="'. $base_url .'" '. implode(' ', $namespaces) . ">\n";
   $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']);
   $output .= "</rss>\n";
 
