diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-02-01 14:09:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-02-01 14:09:31 +0000 |
commit | 7931c778d75cec00bd0d186da18c08e5dcf9a5c4 (patch) | |
tree | e6f833984fbe5909016351d7d6190a54031ecfab /modules/upload.module | |
parent | 171de5d46db2523bfd581a726979209efb608998 (diff) | |
download | brdo-7931c778d75cec00bd0d186da18c08e5dcf9a5c4.tar.gz brdo-7931c778d75cec00bd0d186da18c08e5dcf9a5c4.tar.bz2 |
- Patch #16513 by James (slightly modified): export categories and enclosures to RSS feeds (and made RSS feeds extensible).
NOTE: this needs to be documented.
Diffstat (limited to 'modules/upload.module')
-rw-r--r-- | modules/upload.module | 20 |
1 files changed, 18 insertions, 2 deletions
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 '<div class="attachments">'. form_group(t('Attachments'), $output) . '</div>'; + return '<div class="attachments">'. 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.')) .'</div>'; } function upload_load($node) { |