default.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Elgg RSS output pageshell
  4. *
  5. * @package Elgg.Core
  6. *
  7. * @uses $vars['title'] The title of the RSS feed
  8. * @uses $vars['body'] The items for the RSS feed as a string
  9. * @uses $vars['descrption'] The description for the RSS feed
  10. */
  11. // Set title
  12. if (empty($vars['title'])) {
  13. $title = elgg_get_config('sitename');
  14. } else {
  15. $title = elgg_get_config('sitename') . ": " . $vars['title'];
  16. }
  17. // Remove RSS from URL
  18. $rssurl = current_page_url();
  19. $url = elgg_http_remove_url_query_element($rssurl, 'view');
  20. $rssurl = htmlspecialchars($url, ENT_NOQUOTES, 'UTF-8');
  21. $url = htmlspecialchars($url, ENT_NOQUOTES, 'UTF-8');
  22. $body = elgg_extract('body', $vars, '');
  23. $description = elgg_extract('description', $vars, '');
  24. $namespaces = elgg_view('extensions/xmlns');
  25. $extensions = elgg_view('extensions/channel');
  26. // allow caching as required by stupid MS products for https feeds.
  27. header('Pragma: public');
  28. header("Content-Type: text/xml;charset=utf-8");
  29. echo "<?xml version='1.0'?>";
  30. echo <<<END
  31. <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" $namespaces>
  32. <channel>
  33. <title><![CDATA[$title]]></title>
  34. <link>$url</link>
  35. <atom:link href="$rssurl" rel="self" type="application/rss+xml" />
  36. <description><![CDATA[$description]]></description>
  37. $extensions
  38. $body
  39. </channel>
  40. </rss>
  41. END;