Changeset 14 for Common/RSS.php


Ignore:
Timestamp:
Aug 3, 2021, 11:36:12 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Updated files to newer version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/RSS.php

    r12 r14  
    33class RSS
    44{
    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;
    1111
    1212  function __construct()
    1313  {
    14     $this->Charset = 'utf-8';
     14    $this->Charset = 'utf8';
     15    $this->Title = '';
     16    $this->Link = '';
     17    $this->Description = '';
     18    $this->WebmasterEmail = '';
    1519    $this->Items = array();
    1620  }
    1721
    18   function Generate()
     22  function Generate(): string
    1923  {
    20     Header('Content-Type: text/xml; charset=utf-8');
    2124    $Result = '<?xml version="1.0" encoding="'.$this->Charset.'" ?>'."\n". //<?
    22       '<rss version="2.0">'."\n".
    23       "  <channel>\n".
    24       "    <title>".$this->Title."</title>\n".
    25       "    <link>".$this->Link."</link>\n".
    26       "    <description>".$this->Description."</description>\n".
    27       "    <language>cs</language>\n".
    28       "    <webMaster>".$this->WebmasterEmail."</webMaster>\n".
    29       "    <pubDate>".date('r')."</pubDate>\n".
    30       "    <ttl>20</ttl>\n";
     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";
    3134    foreach ($this->Items as $Item)
    3235    {
     
    3437        '      <title>'.htmlspecialchars($Item['Title'])."</title>\n".
    3538        '      <description>'.htmlspecialchars($Item['Description'])."</description>\n".
    36         '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
    37         '      <link>'.$Item['Link']."</link>\n".
     39  '      <pubDate>'.date('r',$Item['Time'])."</pubDate>\n".
     40  '      <link>'.$Item['Link']."</link>\n".
    3841        "    </item>\n";
    3942    }
Note: See TracChangeset for help on using the changeset viewer.