Source for file rss.php

Documentation is available at rss.php

  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.sf.net //
  5. // //
  6. // This program is distributed in the hope that it will be useful, //
  7. // but WITHOUT ANY WARRANTY, without even the implied warranty of //
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
  9. // //
  10. // This product released under GNU General Public License v2 //
  11. ////////////////////////////////////////////////////////////////////////////////
  12.  
  13. define('RSS_GENERATOR', 'ReloadCMS ' . RCMS_VERSION_A . '.' . RCMS_VERSION_B . '.' . RCMS_VERSION_C . RCMS_VERSION_SUFFIX);
  14.  
  15. class rss_feed{
  16. var $title = '';
  17. var $url = '';
  18. var $description = '';
  19. var $encoding = '';
  20. var $language = '';
  21. var $copyright = '';
  22. var $generator = RSS_GENERATOR;
  23. var $items = array();
  24. function rss_feed($title, $url, $description, $encoding, $language, $copyright){
  25. $this->title = $title;
  26. $this->url = $url;
  27. $this->description = $description;
  28. $this->encoding = $encoding;
  29. $this->language = $language;
  30. $this->copyright = $copyright;
  31. }
  32. function addItem($title, $description, $link, $date, $category = ''){
  33. $this->items[] = array($title, $description, $link, $date, $category);
  34. }
  35. function showFeed(){
  36. echo "<?xml version=\"1.0\" encoding=\"{$this->encoding}\" ?>\r\n";
  37. echo "<rss version=\"2.0\">\n";
  38. echo "\t<channel>\n";
  39. echo "\t\t<title>{$this->title}</title>\n";
  40. echo "\t\t<link>{$this->url}</link>\n";
  41. echo "\t\t<description>{$this->description}</description>\n";
  42. echo "\t\t<language>{$this->language}</language>\n";
  43. echo "\t\t<copyright>{$this->copyright}</copyright>\n";
  44. echo "\t\t<lastBuildDate>" . date('r') . "</lastBuildDate>\n";
  45. echo "\t\t<generator>{$this->generator}</generator>\n";
  46. foreach ($this->items as $item){
  47. echo "\t\t<item>\n";
  48. echo "\t\t\t<title>{$item[0]}</title>\n";
  49. echo "\t\t\t<link>{$item[2]}</link>\n";
  50. echo "\t\t\t<description>{$item[1]}</description>\n";
  51. if(!empty($item[4])) echo "\t\t\t<category>{$item[4]}</category>\n";
  52. echo "\t\t\t<pubDate>" . date('r', $item[3]) . "</pubDate>\n";
  53. echo "\t\t</item>\n";
  54. }
  55. echo "\t</channel>\n";
  56. echo "</rss>\n";
  57. }
  58. }

Documentation generated on Fri, 08 Jun 2007 12:21:27 +0300 by phpDocumentor 1.3.0RC3