aboutsummaryrefslogtreecommitdiff
path: root/views/rss
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
committerSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
commite53d410129701ea1c9d19529afa493f11b5f5b70 (patch)
treed9963b24bf8932654b4a47e36602c75975e50dba /views/rss
parent377da25d2965c64941f83baae119fc970ec60982 (diff)
parent08a962c98e2923724f8013d6eaae89101243752a (diff)
downloadelgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.gz
elgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.bz2
Merge github.com:Elgg/Elgg
Conflicts: engine/lib/input.php
Diffstat (limited to 'views/rss')
-rw-r--r--views/rss/annotation/default.php34
-rw-r--r--views/rss/annotation/generic_comment.php33
-rw-r--r--views/rss/group/default.php54
-rw-r--r--views/rss/object/creator.php8
-rw-r--r--views/rss/object/default.php23
-rw-r--r--views/rss/object/georss.php10
-rw-r--r--views/rss/output/url.php2
-rw-r--r--views/rss/page/components/creator.php14
-rw-r--r--views/rss/page/components/georss.php15
-rw-r--r--views/rss/page/default.php45
-rw-r--r--views/rss/page/elements/comments.php13
-rw-r--r--views/rss/river/item.php27
-rw-r--r--views/rss/search/entity_list.php12
-rw-r--r--views/rss/user/default.php43
14 files changed, 178 insertions, 155 deletions
diff --git a/views/rss/annotation/default.php b/views/rss/annotation/default.php
deleted file mode 100644
index 98329f132..000000000
--- a/views/rss/annotation/default.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * Elgg RSS view for a generic comment
- *
- * @package Elgg
- * @subpackage Core
- */
-
-$entity = get_entity($vars['annotation']->entity_guid);
-
-$title = substr($vars['annotation']->value, 0, 32);
-if (strlen($vars['annotation']->value) > 32) {
- $title .= " ...";
-}
-
-$permalink = $entity->getURL();
-$pubdate = date('r', $entity->time_created);
-
-$creator = elgg_view('object/creator', array('entity' => $entity));
-$georss = elgg_view('object/georss', array('entity' => $entity));
-$extensions = elgg_view('extensions/item');
-
-$item = <<<__HTML
-<item>
- <guid isPermaLink='true'>$permalink#{$vars['annotation']->id}</guid>
- <pubDate>$pubdate</pubDate>
- <link>$permalink#{$vars['annotation']->id}</link>
- <title><![CDATA[$title]]></title>
- <description><![CDATA[{$vars['annotation']->value}]]></description>
- $creator$georss$extensions
-</item>
-__HTML;
-
-echo $item;
diff --git a/views/rss/annotation/generic_comment.php b/views/rss/annotation/generic_comment.php
new file mode 100644
index 000000000..de652fc8e
--- /dev/null
+++ b/views/rss/annotation/generic_comment.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Elgg RSS view for a generic_comment annotation
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$annotation = $vars['annotation'];
+
+$poster = $annotation->getOwnerEntity();
+$poster_name = htmlspecialchars($poster->name, ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $annotation->getTimeCreated());
+$permalink = $annotation->getURL();
+
+$title = elgg_echo('generic_comment:title', array($poster_name));
+
+$creator = elgg_view('page/components/creator', array('entity' => $annotation));
+$extensions = 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[{$vars['annotation']->value}]]></description>
+ $creator$extensions
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/group/default.php b/views/rss/group/default.php
index 4ffceba78..f57c7f82c 100644
--- a/views/rss/group/default.php
+++ b/views/rss/group/default.php
@@ -1,37 +1,37 @@
<?php
/**
- * Elgg default group view
+ * RSS group view
*
* @package Elgg
* @subpackage Core
*/
-?>
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+$title = htmlspecialchars($vars['entity']->name, ENT_NOQUOTES, 'UTF-8');
+if ($vars['entity']->description) {
+ $description = autop($vars['entity']->description);
+} elseif ($vars['entity']->briefdescription) {
+ $description = autop($vars['entity']->briefdescription);
+} else {
+ $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'><?php echo htmlspecialchars($vars['entity']->getURL()); ?></guid>
-<pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
-<link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link>
-<title><![CDATA[<?php echo (($vars['entity']->name)); ?>]]></title>
-<description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
-<?php
- $owner = $vars['entity']->getOwnerEntity();
- if ($owner) {
-?>
-<dc:creator><?php echo $owner->name; ?></dc:creator>
-<?php
- }
-?>
-<?php
- if (
- ($vars['entity'] instanceof Locatable) &&
- ($vars['entity']->getLongitude()) &&
- ($vars['entity']->getLatitude())
- ) {
- ?>
- <georss:point><?php echo $vars['entity']->getLatitude(); ?> <?php echo $vars['entity']->getLongitude(); ?></georss:point>
- <?php
- }
-?>
-<?php echo elgg_view('extensions/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/creator.php b/views/rss/object/creator.php
deleted file mode 100644
index 2bc6fd57d..000000000
--- a/views/rss/object/creator.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/**
- *
- */
-
-if ($owner = $vars['entity']->getOwnerEntity()) {
- echo "<dc:creator>{$owner->name}</dc:creator>";
-}
diff --git a/views/rss/object/default.php b/views/rss/object/default.php
index 29e5d4591..be8025953 100644
--- a/views/rss/object/default.php
+++ b/views/rss/object/default.php
@@ -1,6 +1,6 @@
<?php
/**
- * Elgg default object view
+ * RSS object view
*
* @package Elgg
* @subpackage Core
@@ -8,19 +8,18 @@
$title = $vars['entity']->title;
if (empty($title)) {
- $subtitle = strip_tags($vars['entity']->description);
- $title = substr($subtitle, 0, 32);
- if (strlen($subtitle) > 32) {
- $title .= ' ...';
- }
+ $title = strip_tags($vars['entity']->description);
+ $title = elgg_get_excerpt($title, 32);
}
-$permalink = htmlspecialchars($vars['entity']->getURL());
-$pubdate = date('r', $vars['entity']->time_created);
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
-$creator = elgg_view('object/creator', $vars);
-$georss = elgg_view('object/georss', $vars);
-$extension = elgg_view('extensions/item');
+$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>
@@ -28,7 +27,7 @@ $item = <<<__HTML
<pubDate>$pubdate</pubDate>
<link>$permalink</link>
<title><![CDATA[$title]]></title>
- <description><![CDATA[{$vars['entity']->description}]]></description>
+ <description><![CDATA[$description]]></description>
$creator$georss$extension
</item>
diff --git a/views/rss/object/georss.php b/views/rss/object/georss.php
deleted file mode 100644
index 8aa027519..000000000
--- a/views/rss/object/georss.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-/**
- *
- */
-
-if (($vars['entity'] instanceof Locatable) &&
- ($latitude = $vars['entity']->getLongitude()) && ($longitude = $vars['entity']->getLatitude())
-) {
- echo "<georss:point>$latitude $longitude</georss:point>";
-} \ No newline at end of file
diff --git a/views/rss/output/url.php b/views/rss/output/url.php
index e0b94bf8d..b0f4d9792 100644
--- a/views/rss/output/url.php
+++ b/views/rss/output/url.php
@@ -1,6 +1,6 @@
<?php
/**
- * RSS url view
+ * RSS url output view
*
*/
echo elgg_view('output/url', $vars, false, false, 'default');
diff --git a/views/rss/page/components/creator.php b/views/rss/page/components/creator.php
new file mode 100644
index 000000000..a14f1dbca
--- /dev/null
+++ b/views/rss/page/components/creator.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Creator view
+ *
+ * Implements Dublin Core creator
+ *
+ * @uses $vars['entity']
+ */
+
+$owner = $vars['entity']->getOwnerEntity();
+if ($owner) {
+ $owner_name = htmlspecialchars($owner->name, ENT_NOQUOTES, 'UTF-8');
+ echo "<dc:creator>$owner_name</dc:creator>";
+}
diff --git a/views/rss/page/components/georss.php b/views/rss/page/components/georss.php
new file mode 100644
index 000000000..d176b8cac
--- /dev/null
+++ b/views/rss/page/components/georss.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * GeoRSS view
+ *
+ * This implements GeoRSS-Simple
+ *
+ * @uses $vars['entity']
+ */
+
+$longitude = $vars['entity']->getLongitude();
+$latitude = $vars['entity']->getLatitude();
+
+if ($vars['entity'] instanceof Locatable && $longitude && $latitude) {
+ echo "<georss:point>$latitude $longitude</georss:point>";
+}
diff --git a/views/rss/page/default.php b/views/rss/page/default.php
index da6f69c41..c973e3fd0 100644
--- a/views/rss/page/default.php
+++ b/views/rss/page/default.php
@@ -2,18 +2,13 @@
/**
* Elgg RSS output pageshell
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
*
+ * @uses $vars['title'] The title of the RSS feed
+ * @uses $vars['body'] The items for the RSS feed as a string
+ * @uses $vars['descrption'] The description for the RSS feed
*/
-header("Content-Type: text/xml");
-
-// allow caching as required by stupid MS products for https feeds.
-header('Pragma: public', TRUE);
-
-echo "<?xml version='1.0'?>\n";
-
// Set title
if (empty($vars['title'])) {
$title = elgg_get_config('sitename');
@@ -22,20 +17,30 @@ if (empty($vars['title'])) {
}
// Remove RSS from URL
-$url = str_replace('?view=rss','', full_url());
-$url = str_replace('&view=rss','', $url);
+$url = str_replace('?view=rss', '', full_url());
+$url = str_replace('&view=rss', '', $url);
+$url = htmlspecialchars($url, ENT_NOQUOTES, 'UTF-8');
-?>
+$body = elgg_extract('body', $vars, '');
+$description = elgg_extract('description', $vars, '');
-<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" <?php echo elgg_view('extensions/xmlns'); ?> >
-<channel>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <link><?php echo htmlentities($url); ?></link>
- <?php echo elgg_view('extensions/channel'); ?>
- <?php
+$namespaces = elgg_view('extensions/xmlns');
+$extensions = elgg_view('extensions/channel');
- echo $vars['body'];
- ?>
+// allow caching as required by stupid MS products for https feeds.
+header('Pragma: public', true);
+header("Content-Type: text/xml");
+
+echo "<?xml version='1.0'?>";
+echo <<<END
+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" $namespaces>
+<channel>
+ <title><![CDATA[$title]]></title>
+ <link>$url</link>
+ <description><![CDATA[$description]]></description>
+ $extensions
+ $body
</channel>
</rss>
+END;
diff --git a/views/rss/page/elements/comments.php b/views/rss/page/elements/comments.php
new file mode 100644
index 000000000..9c655ffef
--- /dev/null
+++ b/views/rss/page/elements/comments.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * RSS comments view
+ *
+ * @uses $vars['entity']
+ */
+
+$options = array(
+ 'guid' => $vars['entity']->getGUID(),
+ 'annotation_name' => 'generic_comment',
+ 'order_by' => 'n_table.time_created desc',
+);
+echo elgg_list_annotations($options);
diff --git a/views/rss/river/item.php b/views/rss/river/item.php
index f84e6ccf0..fa2914eff 100644
--- a/views/rss/river/item.php
+++ b/views/rss/river/item.php
@@ -6,27 +6,30 @@
*/
$item = $vars['item'];
-$view = $item->getView();
-
$name = $item->getSubjectEntity()->name;
-$body = elgg_view($item->getView(), array('item' => $item), false, false, 'default');
-$body = "$name $body";
+$name = htmlspecialchars($name, ENT_NOQUOTES, 'UTF-8');
+$title = elgg_echo('river:update', array($name));
-$title = strip_tags($body);
$timestamp = date('r', $item->getPostedTime());
+$body = elgg_view('river/elements/summary', $vars, false, false, 'default');
+
$object = $item->getObjectEntity();
if ($object) {
$url = htmlspecialchars($object->getURL());
} else {
- $url = elgg_get_site_url() . 'activity';
+ $url = elgg_normalize_url('activity');
}
-?>
+$html = <<<__HTML
<item>
- <guid isPermaLink='true'><?php echo $url; ?></guid>
- <pubDate><?php echo $timestamp; ?></pubDate>
- <link><?php echo $url; ?></link>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <description><![CDATA[<?php echo ($body); ?>]]></description>
+ <guid>$item->id</guid>
+ <pubDate>$timestamp</pubDate>
+ <link>$url</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$body]]></description>
</item>
+
+__HTML;
+
+echo $html;
diff --git a/views/rss/search/entity_list.php b/views/rss/search/entity_list.php
deleted file mode 100644
index 1e44adf18..000000000
--- a/views/rss/search/entity_list.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * @package Elgg
- * @subpackage Core
- */
-
-$entities = $vars['entities'];
-if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- echo elgg_view_entity($entity);
- }
-} \ No newline at end of file
diff --git a/views/rss/user/default.php b/views/rss/user/default.php
index a8b9d073c..1c7bf75e7 100644
--- a/views/rss/user/default.php
+++ b/views/rss/user/default.php
@@ -1,29 +1,34 @@
<?php
/**
- * Elgg default user view
+ * RSS user view
*
* @package Elgg
* @subpackage Core
*/
-?>
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+$title = htmlspecialchars($vars['entity']->name, ENT_NOQUOTES, 'UTF-8');
+if ($vars['entity']->description) {
+ $description = autop($vars['entity']->description);
+} else {
+ $description = '';
+}
+
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
<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']->name)); ?>]]></title>
-<description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
-<?php
- if (
- ($vars['entity'] instanceof Locatable) &&
- ($vars['entity']->getLongitude()) &&
- ($vars['entity']->getLatitude())
- ) {
- ?>
- <georss:point><?php echo $vars['entity']->getLatitude(); ?> <?php echo $vars['entity']->getLongitude(); ?></georss:point>
- <?php
- }
-?>
-<?php echo elgg_view('extensions/item'); ?>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $georss$extension
</item>
+
+__HTML;
+
+echo $item;