aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/start.php3
-rw-r--r--mod/file/views/rss/file/enclosure.php16
-rw-r--r--mod/file/views/rss/object/file.php21
3 files changed, 19 insertions, 21 deletions
diff --git a/mod/file/start.php b/mod/file/start.php
index 843ae0794..9007fc9ba 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -22,6 +22,9 @@ function file_init() {
// Extend CSS
elgg_extend_view('css/elgg', 'file/css');
+ // add enclosure to rss item
+ elgg_extend_view('extensions/item', 'file/enclosure');
+
// extend group main page
elgg_extend_view('groups/tool_latest', 'file/group_module');
diff --git a/mod/file/views/rss/file/enclosure.php b/mod/file/views/rss/file/enclosure.php
new file mode 100644
index 000000000..600d287ef
--- /dev/null
+++ b/mod/file/views/rss/file/enclosure.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Link to download the file
+ *
+ * @uses $vars['entity']
+ */
+
+if (elgg_instanceof($vars['entity'], 'object', 'file')) {
+ $download_url = elgg_get_site_url() . 'mod/file/download.php?file_guid=' . $vars['entity']->getGUID();
+ $size = $vars['entity']->size();
+ $mime_type = $vars['entity']->getMimeType();
+ echo <<<END
+
+ <enclosure url="$download_url" length="$size" type="$mime_type" />";
+END;
+}
diff --git a/mod/file/views/rss/object/file.php b/mod/file/views/rss/object/file.php
deleted file mode 100644
index a0660d6c8..000000000
--- a/mod/file/views/rss/object/file.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-/**
- * Elgg RSS file object view
- *
- * @package ElggFile
- * @subpackage Core
- */
-$title = $vars['entity']->title;
-if (empty($title)) {
- $title = elgg_get_excerpt($vars['entity']->description, 32);
-}
-?>
-
-<item>
- <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
- <pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate>
- <link><?php echo $vars['entity']->getURL(); ?></link>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- <enclosure url="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
-</item>