Public Member Functions | Data Fields

Feed Class Reference

Public Member Functions

 generate_feed ()
 generate_feed_xml ()

Data Fields

 $title = ''
 $feedurl = ''
 $description = ''
 $pubdate = ''
 $items = array()

Detailed Description

This class represents an RSS/Atom feed, containing the necessary header details and feed items

Author:
Ivan Lucas, Paul heaney

Definition at line 26 of file export.inc.php.


Member Function Documentation

generate_feed (  ) 

Generates and displays the RSS feed as well as setting the header type

Author:
Paul Heaney

Definition at line 39 of file export.inc.php.

References generate_feed_xml().

    {
        header("Content-Type: application/xml");
        echo $this->generate_feed_xml();
    } 

generate_feed_xml (  ) 

Generates the RSS XML

Author:
Paul Heaney
Returns:
string The XML string for the feed

Definition at line 51 of file export.inc.php.

References $_SESSION, $application_version_string, $CONFIG, $lang, global, items, and pubdate.

Referenced by generate_feed().

    {
        global $CONFIG, $application_version_string;

        if (!empty($_SESSION['lang'])) $lang = $_SESSION['lang'];
        else $lang = $CONFIG['default_i18n'];
    
        $xml = "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">";
        $xml .= "<channel><title>{$this->title}</title>\n";
        $xml .= "<link>".application_url()."</link>\n";
        $xml .= "<atom:link href=\"{$this->feedurl}\" rel=\"self\" type=\"application/rss+xml\" />\n";
        $xml .= "<description>{$this->description}</description>\n";
        $xml .= "<language>{$lang}</language>\n";
        $xml .= "<pubDate>".date('r', $this->pubdate)."</pubDate>\n";
        $xml .= "<lastBuildDate>".date('r', $this->pubdate)."</lastBuildDate>\n";
        $xml .= "<docs>http://blogs.law.harvard.edu/tech/rss</docs>";
        $xml .= "<generator>{$CONFIG['application_name']} {$application_version_string}</generator>\n";
        $xml .= "<webMaster>".user_email($CONFIG['support_manager'])." (Support Manager)</webMaster>\n";
    
    
        if (is_array($this->items))
        {
            foreach ($this->items AS $item)
            {
                $xml .= $item->generateItem();
            }
        }

        $xml .= "</channel></rss>\n";
        return $xml;
    }


Field Documentation

$description = ''

Definition at line 30 of file export.inc.php.

$feedurl = ''

Definition at line 29 of file export.inc.php.

$items = array()

Definition at line 33 of file export.inc.php.

$pubdate = ''

Definition at line 31 of file export.inc.php.

$title = ''

Definition at line 28 of file export.inc.php.


The documentation for this class was generated from the following file:

For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo

© 2008-2011 Support Incident Tracker

Tsohost Logo