aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-11-26 16:35:25 -0500
committerCash Costello <cash.costello@gmail.com>2011-11-26 16:35:25 -0500
commitca5a35607dfb277cecba120ce27eece7c59f270a (patch)
tree301e5b6fb94a2521f18ce926e69e659fe4e4fa54
parent22afb49f30fc9bcd6be84f734e89a9b644f2fb0f (diff)
downloadelgg-ca5a35607dfb277cecba120ce27eece7c59f270a.tar.gz
elgg-ca5a35607dfb277cecba120ce27eece7c59f270a.tar.bz2
fixed RSS feeds for Elgg 1.8
-rw-r--r--classes/TidypicsImage.php2
-rw-r--r--start.php6
-rw-r--r--views/rss/extensions/photos/xmlns.php9
-rw-r--r--views/rss/extensions/tidypics/channel.php1
-rw-r--r--views/rss/extensions/tidypics/xmlns.php1
-rw-r--r--views/rss/object/album.php64
-rw-r--r--views/rss/object/album/full.php16
-rw-r--r--views/rss/object/album/summary.php33
-rw-r--r--views/rss/object/file.php23
-rw-r--r--views/rss/object/image.php57
-rw-r--r--views/rss/tidypics/content_wrapper.php2
-rw-r--r--views/rss/tidypics/gallery.php16
12 files changed, 112 insertions, 118 deletions
diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php
index 926bc386b..a37e0dc38 100644
--- a/classes/TidypicsImage.php
+++ b/classes/TidypicsImage.php
@@ -68,7 +68,7 @@ class TidypicsImage extends ElggFile {
* @return string
*/
public function getSrcUrl($size = 'small') {
- return "photos/thumbnail/$this->guid/$size/";
+ return elgg_normalize_url("photos/thumbnail/$this->guid/$size/");
}
/**
diff --git a/start.php b/start.php
index f58e26e8c..817578607 100644
--- a/start.php
+++ b/start.php
@@ -51,11 +51,11 @@ function tidypics_init() {
elgg_register_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
elgg_register_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
+ // RSS extensions for embedded media
+ elgg_extend_view('extensions/xmlns', 'extensions/photos/xmlns');
+
/*
- // rss extensions
- elgg_extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
- elgg_extend_view('extensions/channel', 'extensions/tidypics/channel');
// register for menus
diff --git a/views/rss/extensions/photos/xmlns.php b/views/rss/extensions/photos/xmlns.php
new file mode 100644
index 000000000..67cf45133
--- /dev/null
+++ b/views/rss/extensions/photos/xmlns.php
@@ -0,0 +1,9 @@
+<?php
+/**
+ * Support media files by adding a namespace
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+?> xmlns:media="http://search.yahoo.com/mrss/" \ No newline at end of file
diff --git a/views/rss/extensions/tidypics/channel.php b/views/rss/extensions/tidypics/channel.php
deleted file mode 100644
index 8b620d15d..000000000
--- a/views/rss/extensions/tidypics/channel.php
+++ /dev/null
@@ -1 +0,0 @@
-<description /> \ No newline at end of file
diff --git a/views/rss/extensions/tidypics/xmlns.php b/views/rss/extensions/tidypics/xmlns.php
deleted file mode 100644
index cb9646dcb..000000000
--- a/views/rss/extensions/tidypics/xmlns.php
+++ /dev/null
@@ -1 +0,0 @@
- xmlns:media="http://search.yahoo.com/mrss/" \ No newline at end of file
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index 8df98cf7a..0c4606245 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -1,59 +1,15 @@
<?php
- /**
- * Tidypics Album RSS View
- */
+/**
+ * Album RSS view
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ */
-// for now catch the albums view and ignore it
-if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
-?>
- <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 $vars['entity']->title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- </item>
-<?php
-} else {
-
- $album = $vars['entity'];
-
- // use fullsize image
- $base_url_fullsize = $vars['url'] . 'pg/photos/download/';
-
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- // Set title
- $vars['title'] = $album->title;
- if (empty($vars['title'])) {
- $title = $vars['config']->sitename;
- } else if (empty($vars['config']->sitename)) {
- $title = $vars['title'];
- } else {
- $title = $vars['config']->sitename . ": " . $vars['title'];
- }
- $album_cover_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album_cover_guid . '&amp;size=thumb';
-?> <image>
- <url><?php echo $album_cover_url; ?></url>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <link><?php echo $album->getURL() . '?view=rss'; ?></link>
- </image>
-<?php
- }
-
- $limit = get_input('limit', 20);
-
- $images = elgg_get_entities(array(
- "type" => "object",
- "subtype" => "image",
- "container_guid" => $album->guid,
- "limit" => $limit,
- ));
-
-
- foreach ($images as $image) {
- echo elgg_view_entity($image);
- }
+$full_view = elgg_extract('full_view', $vars, false);
+if ($full_view) {
+ echo elgg_view('object/album/full', $vars);
+} else {
+ echo elgg_view('object/album/summary', $vars);
}
diff --git a/views/rss/object/album/full.php b/views/rss/object/album/full.php
new file mode 100644
index 000000000..8261e5ce0
--- /dev/null
+++ b/views/rss/object/album/full.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * List photos in an album for RSS
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ */
+
+$limit = (int)get_input('limit', 20);
+
+echo elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'container_guid' => $vars['entity']->getGUID(),
+ 'limit' => $limit,
+ 'full_view' => false,
+));
diff --git a/views/rss/object/album/summary.php b/views/rss/object/album/summary.php
new file mode 100644
index 000000000..b6dc8f003
--- /dev/null
+++ b/views/rss/object/album/summary.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Individual album summary view for RSS
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+
+$title = $vars['entity']->getTitle();
+$description = autop($vars['entity']->description);
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/object/file.php b/views/rss/object/file.php
deleted file mode 100644
index 1ede661ad..000000000
--- a/views/rss/object/file.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Tidypics RSS file object view - need to look into removing download link based on settings
- */
-
-$title = $vars['entity']->title;
-if (empty($title)) {
- $title = substr($vars['entity']->description,0,32);
- if (strlen($vars['entity']->description) > 32) {
- $title .= " ...";
- }
-}
-?>
-
- <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 $vars['url']; ?>pg/photos/download/<?php echo $vars['entity']->getGUID(); ?>/" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- </item>
diff --git a/views/rss/object/image.php b/views/rss/object/image.php
index b93592081..a59021bd1 100644
--- a/views/rss/object/image.php
+++ b/views/rss/object/image.php
@@ -1,19 +1,42 @@
<?php
+/**
+ * Individual image RSS view
+ *
+ * @uses $vars['entity'] TidypicsImage
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
-$title = $vars['entity']->title;
-$descr = $vars['entity']->description;
-$download = $vars['url'] . 'pg/photos/download/' . $vars['entity']->guid . '/inline/';
-$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
-?>
-
- <item>
- <title><?php echo $title; ?></title>
- <link><?php echo $base_url . $vars['entity']->guid . '&amp;size=large'; ?></link>
- <description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
- <pubDate><?php echo date("r", $vars['entity']->time_created); ?></pubDate>
- <guid isPermaLink="true"><?php echo $vars['entity']->getURL(); ?></guid>
- <media:content url="<?php echo $download; ?>" medium="image" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- <media:title><?php echo $title; ?></media:title>
- <media:description><?php echo htmlentities($descr); ?></media:description>
- <media:thumbnail url="<?php echo $base_url . $vars['entity']->guid . '&amp;size=thumb'; ?>"></media:thumbnail>
- </item> \ No newline at end of file
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+
+$title = $vars['entity']->getTitle();
+$description = autop($vars['entity']->description);
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$thumbnail_url = $vars['entity']->getSrcUrl('thumb');
+$download_url = $vars['entity']->getSrcUrl('large');
+
+$mime_type = $vars['entity']->getMimeType();
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
+ <media:content url="$download_url" medium="image" type="$mime_type" />
+ <media:title><![CDATA[$title]]></media:title>
+ <media:description><![CDATA[$description]]></media:description>
+ <media:thumbnail url="$thumbnail_url"></media:thumbnail>
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/tidypics/content_wrapper.php b/views/rss/tidypics/content_wrapper.php
deleted file mode 100644
index 0b16f2357..000000000
--- a/views/rss/tidypics/content_wrapper.php
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php
-echo $vars['content'];
diff --git a/views/rss/tidypics/gallery.php b/views/rss/tidypics/gallery.php
deleted file mode 100644
index 0e90a8c44..000000000
--- a/views/rss/tidypics/gallery.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Tidypics Listing RSS View
- */
-
-$context = $vars['context'];
-$entities = $vars['entities'];
-$count = $vars['count'];
-$baseurl = $vars['baseurl'];
-
-
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
-}