Changeset 14 for Common/RSS.php
- Timestamp:
- Aug 3, 2021, 11:36:12 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/RSS.php
r12 r14 3 3 class RSS 4 4 { 5 var$Charset;6 var$Title;7 var$Link;8 var$Description;9 var$WebmasterEmail;10 var$Items;5 public string $Charset; 6 public string $Title; 7 public string $Link; 8 public string $Description; 9 public string $WebmasterEmail; 10 public array $Items; 11 11 12 12 function __construct() 13 13 { 14 $this->Charset = 'utf-8'; 14 $this->Charset = 'utf8'; 15 $this->Title = ''; 16 $this->Link = ''; 17 $this->Description = ''; 18 $this->WebmasterEmail = ''; 15 19 $this->Items = array(); 16 20 } 17 21 18 function Generate() 22 function Generate(): string 19 23 { 20 Header('Content-Type: text/xml; charset=utf-8');21 24 $Result = '<?xml version="1.0" encoding="'.$this->Charset.'" ?>'."\n". //<? 22 23 24 25 26 27 28 29 30 25 '<rss version="2.0">'."\n". 26 " <channel>\n". 27 " <title>".$this->Title."</title>\n". 28 " <link>".$this->Link."</link>\n". 29 " <description>".$this->Description."</description>\n". 30 " <language>cs</language>\n". 31 " <webMaster>".$this->WebmasterEmail."</webMaster>\n". 32 " <pubDate>".date('r')."</pubDate>\n". 33 " <ttl>20</ttl>\n"; 31 34 foreach ($this->Items as $Item) 32 35 { … … 34 37 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n". 35 38 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n". 36 37 39 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n". 40 ' <link>'.$Item['Link']."</link>\n". 38 41 " </item>\n"; 39 42 }
Note:
See TracChangeset
for help on using the changeset viewer.