diff options
-rw-r--r-- | views/rss/object/default.php | 61 | ||||
-rw-r--r-- | views/rss/page_shells/default.php (renamed from views/rss/pageshells/pageshell.php) | 0 | ||||
-rw-r--r-- | views/rss/river/item/list.php | 50 |
3 files changed, 55 insertions, 56 deletions
diff --git a/views/rss/object/default.php b/views/rss/object/default.php index 5d11599dc..7b1ab10bc 100644 --- a/views/rss/object/default.php +++ b/views/rss/object/default.php @@ -11,38 +11,43 @@ $title = $vars['entity']->title; if (empty($title)) { $subtitle = strip_tags($vars['entity']->description); - $title = substr($subtitle,0,32); + $title = substr($subtitle, 0, 32); if (strlen($subtitle) > 32) { - $title .= " ..."; + $title .= ' ...'; } } -?> +$permalink = htmlspecialchars($vars['entity']->getURL()); +$pubdate = date('r', $vars['entity']->time_created); +$creator = ''; +if ($owner = $vars['entity']->getOwnerEntity()) { + $creator = "<dc:creator>{$owner->name}</dc:creator>"; +} + +$georss = ''; +if ( + ($vars['entity'] instanceof Locatable) && + ($vars['entity']->getLongitude()) && + ($vars['entity']->getLatitude()) +) { + $latitude = $vars['entity']->getLatitude(); + $longitude = $vars['entity']->getLongitude(); + $georss = "<georss:point>$latitude $longitude</georss:point>"; +} + +$extension = elgg_view('extensions/item'); + +$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 $title; ?>]]></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[{$vars['entity']->description}]]></description> + $creator$georss$extension </item> + +__HTML; + +echo $item; diff --git a/views/rss/pageshells/pageshell.php b/views/rss/page_shells/default.php index c62ac4aac..c62ac4aac 100644 --- a/views/rss/pageshells/pageshell.php +++ b/views/rss/page_shells/default.php diff --git a/views/rss/river/item/list.php b/views/rss/river/item/list.php index 5ac43c544..8047c24bf 100644 --- a/views/rss/river/item/list.php +++ b/views/rss/river/item/list.php @@ -6,39 +6,33 @@ * @link http://elgg.org/ */ -if (isset($vars['items']) && is_array($vars['items'])) { - - $i = 0; - if (!empty($vars['items'])) { - foreach($vars['items'] as $item) { - - // echo elgg_view_river_item($item); - if (elgg_view_exists($item->view,'default')) { - $body = elgg_view($item->view,array('item' => $item),false,false,'default'); - $time = date("r",$item->posted); - if ($entity = get_entity($item->object_guid)) { - $url = htmlspecialchars($entity->getURL()); - } else { - $url = $vars['url']; - } - $title = strip_tags($body); - - ?> - <item> - <guid isPermaLink='true'><?php echo $url; ?></guid> - <pubDate><?php echo $time; ?></pubDate> - <link><?php echo $url; ?></link> - <title><![CDATA[<?php echo $title; ?>]]></title> - <description><![CDATA[<?php echo (autop($body)); ?>]]></description> - </item> - <?php - +if (isset($vars['items']) && is_array($vars['items']) && !empty($vars['items'])) { + foreach($vars['items'] as $item) { + if (elgg_view_exists($item->view)) { + $body = elgg_view($item->view, array('item' => $item)); + $time = date('r', $item->posted); + if ($entity = get_entity($item->object_guid)) { + $url = htmlspecialchars($entity->getURL()); + } else { + $url = $vars['url']; } + $title = strip_tags($body); + + echo <<<__HTML +<item> + <guid isPermaLink="true">$url</guid> + <pubDate>$time</pubDate> + <title><![CDATA[$title]]></title> + <link>$url</link> + <description><![CDATA[$body]]></description> +</item> +__HTML; + $i++; if ($i >= $vars['limit']) { break; } } } -}
\ No newline at end of file +} |