From 7931c778d75cec00bd0d186da18c08e5dcf9a5c4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 1 Feb 2005 14:09:31 +0000 Subject: - Patch #16513 by James (slightly modified): export categories and enclosures to RSS feeds (and made RSS feeds extensible). NOTE: this needs to be documented. --- modules/upload.module | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'modules/upload.module') diff --git a/modules/upload.module b/modules/upload.module index 1a3348e65..c1fc08641 100644 --- a/modules/upload.module +++ b/modules/upload.module @@ -265,6 +265,22 @@ function upload_nodeapi(&$node, $op, $arg) { 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,14 +348,14 @@ function upload_form($node) { } 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 = theme('table', $header, $rows); } if (user_access('upload files')) { $output .= form_file(t('Attach new file'), "upload", 40); $output .= form_button(t('Attach'), 'fileop'); } - return '
'. form_group(t('Attachments'), $output) . '
'; + return '
'. form_group(t('Attachments'), $output, t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.')) .'
'; } function upload_load($node) { -- cgit v1.2.3