Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.420
diff -u -r1.420 common.inc
--- includes/common.inc 22 Jan 2005 11:15:24 -0000 1.420
+++ includes/common.inc 1 Feb 2005 00:52:45 -0000
@@ -689,7 +689,24 @@
$output .= ' '. drupal_specialchars(strip_tags($link)) ."\n";
$output .= ' '. drupal_specialchars($description) ."\n";
foreach ($args as $key => $value) {
- $output .= ' <'. $key .'>'. drupal_specialchars(strip_tags($value)) ."$key>\n";
+ if (is_array($value)) {
+ if ($value['key']) {
+ $output .= ' <'. $value['key'];
+ if (is_array($value['attributes'])) {
+ $output .= drupal_attributes($value['attributes']);
+ }
+
+ if ($value['value']) {
+ $output .= '>'. $value['value'] .''. $value['key'] .">\n";
+ }
+ else {
+ $output .= " />\n";
+ }
+ }
+ }
+ else {
+ $output .= ' <'. $key .'>'. drupal_specialchars(strip_tags($value)) ."$key>\n";
+ }
}
$output .= "\n";
Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.455
diff -u -r1.455 node.module
--- modules/node.module 31 Jan 2005 20:45:10 -0000 1.455
+++ modules/node.module 1 Feb 2005 00:52:46 -0000
@@ -1041,7 +1041,10 @@
// Allow modules to change $node->body before viewing.
node_invoke_nodeapi($item, 'view', false, false);
- $items .= format_rss_item($item->title, $link, $item->teaser, array('pubDate' => date('r', $item->changed)));
+ // Allow modules to add additional item fields
+ $extra = node_invoke_nodeapi($item, 'rss item');
+ $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->changed))));
+ $items .= format_rss_item($item->title, $link, $item->teaser, $extra);
}
$channel_defaults = array(
Index: modules/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.172
diff -u -r1.172 taxonomy.module
--- modules/taxonomy.module 29 Jan 2005 22:02:37 -0000 1.172
+++ modules/taxonomy.module 1 Feb 2005 00:52:46 -0000
@@ -885,6 +885,9 @@
case 'delete':
taxonomy_node_delete($node->nid);
break;
+ case 'rss item':
+ return taxonomy_rss_item($node);
+ break;
}
}
@@ -1012,6 +1015,20 @@
}
print theme('page', $output);
+}
+
+/**
+ * Provides category information for rss feeds
+ */
+function taxonomy_rss_item($node) {
+ $output = array();
+ $terms = taxonomy_node_get_terms($node->nid);
+ foreach ($terms as $term) {
+ $output[] = array('key' => 'category',
+ 'value' => $term->name,
+ 'attributes' => array('domain' => url('taxonomy/term/'.$term->tid, NULL, NULL, TRUE)));
+ }
+ return $output;
}
/**
Index: modules/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload.module,v
retrieving revision 1.22
diff -u -r1.22 upload.module
--- modules/upload.module 29 Jan 2005 22:02:37 -0000 1.22
+++ modules/upload.module 1 Feb 2005 00:52:46 -0000
@@ -265,6 +265,22 @@
break;
case 'search result':
return $node->files ? format_plural(count($node->files), '1 attachment', '%count attachments') : null;
+ case 'rss item':
+ $files = array();
+ foreach ($node->files as $file) {
+ if ($file->list) {
+ $files[] = $file;
+ }
+ }
+ if (count($files) > 0) {
+ // RSS only allows one enclosure per item
+ $file = array_shift($files);
+ return array(array('key' => 'enclosure',
+ 'attributes' => array('url' => file_create_url($file->filepath),
+ 'length' => $file->filesize,
+ 'type' => $file->filemime)));
+ }
+ break;
}
return $output;
@@ -332,7 +348,7 @@
}
if (count($node->files)) {
- $output = form_item('', theme('table', $header, $rows), t('Note: changes made to the attachments are not permanent until you save this post.'));
+ $output = form_item('', theme('table', $header, $rows), t('Note: changes made to the attachments are not permanent until you save this post. Also, only the first "listed" file will be included in rss feeds.'));
}
if (user_access('upload files')) {
$output .= form_file(t('Attach new file'), "upload", 40);