~chronoscz/estetistic/trunk

« back to all changes in this revision

Viewing changes to Packages/Common/RSS.php

  • Committer: chronos
  • Date: 2016-02-28 09:54:30 UTC
  • Revision ID: svn-v4:233a2d1c-c783-4dcf-9f2a-d37bcf656803:trunk:69
* Modified: Use object oriented approach for page drawing using Application class.
* Added: SQL updated will be automatic using UpdateTrace.php file.
* Added: Use generic setup page at URL /setup for SQL structure update.
* Modified: Update Common package to newer version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
class 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
 
}
 
1
<?php
 
2
 
 
3
class 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
}