summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-02-07 14:16:27 +0000
committerDries Buytaert <dries@buytaert.net>2005-02-07 14:16:27 +0000
commit1970f1d2a8e76795d61ecff081a12cfd57e11708 (patch)
tree4e7cf51950fcd50590f0cfb0333c350a445c5806
parentde0a0b7a819006b15b727e632635287845a25c22 (diff)
downloadbrdo-1970f1d2a8e76795d61ecff081a12cfd57e11708.tar.gz
brdo-1970f1d2a8e76795d61ecff081a12cfd57e11708.tar.bz2
- Fixed warning in the feed generation (enclosures).
-rw-r--r--modules/upload.module26
-rw-r--r--modules/upload/upload.module26
2 files changed, 28 insertions, 24 deletions
diff --git a/modules/upload.module b/modules/upload.module
index 559b46d87..244270373 100644
--- a/modules/upload.module
+++ b/modules/upload.module
@@ -269,19 +269,21 @@ function upload_nodeapi(&$node, $op, $arg) {
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 ($node->files) {
+ $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)));
}
- }
- 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;
}
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 559b46d87..244270373 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -269,19 +269,21 @@ function upload_nodeapi(&$node, $op, $arg) {
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 ($node->files) {
+ $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)));
}
- }
- 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;
}