source: trunk/Packages/Common/RSS.php

Last change on this file was 3, checked in by chronos, 8 years ago
  • Modified: Updated to work with PHP7. Old database class replaced by Common package.
  • Property svn:executable set to *
File size: 1.1 KB
Line 
1<?php
2
3class RSS
4{
5 var $Charset;
6 var $Title;
7 var $Link;
8 var $Description;
9 var $WebmasterEmail;
10 var $Items;
11
12 function __construct()
13 {
14 $this->Charset = 'utf8';
15 $this->Items = array();
16 }
17
18 function Generate()
19 {
20 $Result = '<?xml version="1.0" encoding="'.$this->Charset.'" ?>'."\n". //<?
21 '<rss version="2.0">'."\n".
22 " <channel>\n".
23 " <title>".$this->Title."</title>\n".
24 " <link>".$this->Link."</link>\n".
25 " <description>".$this->Description."</description>\n".
26 " <language>cs</language>\n".
27 " <webMaster>".$this->WebmasterEmail."</webMaster>\n".
28 " <pubDate>".date('r')."</pubDate>\n".
29 " <ttl>20</ttl>\n";
30 foreach($this->Items as $Item)
31 {
32 $Result .= " <item>\n".
33 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n".
34 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n".
35 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
36 ' <link>'.$Item['Link']."</link>\n".
37 " </item>\n";
38 }
39 $Result .= " </channel>\n".
40 "</rss>";
41 return($Result);
42 }
43}
Note: See TracBrowser for help on using the repository browser.