Public Member Functions | Data Fields

ilFeedWriter Class Reference
[Services/Feeds]

Feed writer class. More...

Inheritance diagram for ilFeedWriter:

Public Member Functions

 ilFeedWriter ()
 setEncoding ($a_enc)
 Set feed encoding.
 getEncoding ()
 setChannelAbout ($a_ab)
 Unique URI that defines the channel.
 getChannelAbout ()
 setChannelTitle ($a_title)
 Channel Title.
 getChannelTitle ()
 setChannelLink ($a_link)
 Channel Link URL to which an HTML rendering of the channel title will link.
 getChannelLink ()
 setChannelDescription ($a_desc)
 Channel Description.
 getChannelDescription ()
 addItem ($a_item)
 Add Item Item is an object of type ilFeedItem.
 getItems ()
 prepareStr ($a_str)
 getFeed ()
 get feed xml
 showFeed ()

Data Fields

 $encoding = "UTF-8"
 $ch_about = ""
 $ch_title = ""
 $ch_link = ""
 $ch_description = ""
 $items = array()

Detailed Description

Feed writer class.

how to make it "secure" alternative 1:

Author:
Alex Killing <alex.killing@gmx.de>
Version:
Id:
class.ilFeedWriter.php 14737 2007-09-18 08:11:41Z akill

Definition at line 44 of file class.ilFeedWriter.php.


Member Function Documentation

ilFeedWriter::addItem ( a_item  ) 

Add Item Item is an object of type ilFeedItem.

Definition at line 127 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
                $this->items[] = $a_item;
        }

Here is the caller graph for this function:

ilFeedWriter::getChannelAbout (  ) 

Definition at line 78 of file class.ilFeedWriter.php.

Referenced by getFeed().

        {
                return $this->ch_about;
        }

Here is the caller graph for this function:

ilFeedWriter::getChannelDescription (  ) 

Definition at line 118 of file class.ilFeedWriter.php.

Referenced by getFeed().

        {
                return $this->ch_desc;
        }

Here is the caller graph for this function:

ilFeedWriter::getChannelLink (  ) 

Definition at line 105 of file class.ilFeedWriter.php.

Referenced by getFeed().

        {
                return $this->ch_link;
        }

Here is the caller graph for this function:

ilFeedWriter::getChannelTitle (  ) 

Definition at line 91 of file class.ilFeedWriter.php.

Referenced by getFeed().

        {
                return $this->ch_title;
        }

Here is the caller graph for this function:

ilFeedWriter::getEncoding (  ) 

Definition at line 65 of file class.ilFeedWriter.php.

Referenced by getFeed().

        {
                return $this->encoding;
        }

Here is the caller graph for this function:

ilFeedWriter::getFeed (  ) 

get feed xml

Definition at line 148 of file class.ilFeedWriter.php.

References $d, getChannelAbout(), getChannelDescription(), getChannelLink(), getChannelTitle(), and getEncoding().

Referenced by showFeed().

        {
                include_once("classes/class.ilTemplate.php");
                $this->tpl = new ilTemplate("tpl.rss_2_0.xml", true, true, "Services/Feeds");
                
                $this->tpl->setVariable("XML", "xml");
                $this->tpl->setVariable("CONTENT_ENCODING", $this->getEncoding());
                $this->tpl->setVariable("CHANNEL_ABOUT", $this->getChannelAbout());
                $this->tpl->setVariable("CHANNEL_TITLE", $this->getChannelTitle());
                $this->tpl->setVariable("CHANNEL_LINK", $this->getChannelLink());
                $this->tpl->setVariable("CHANNEL_DESCRIPTION", $this->getChannelDescription());
                
                foreach($this->items as $item)
                {
                        $this->tpl->setCurrentBlock("rdf_seq");
                        $this->tpl->setVariable("RESOURCE", $item->getAbout());
                        $this->tpl->parseCurrentBlock();
                        
                        // Date
                        if ($item->getDate() != "")
                        {
                                $this->tpl->setCurrentBlock("date");
                                $d = $item->getDate();
                                $yyyy = substr($d, 0, 4);
                                $mm = substr($d, 5, 2);
                                $dd = substr($d, 8, 2);
                                $h = substr($d, 11, 2);
                                $m = substr($d, 14, 2);
                                $s = substr($d, 17, 2);
                                $this->tpl->setVariable("ITEM_DATE",
                                        date("r", mktime($h, $m, $s, $mm, $dd, $yyyy)));
                                $this->tpl->parseCurrentBlock();
                        }
                        
                        // Enclosure
                        if ($item->getEnclosureUrl() != "")
                        {
                                $this->tpl->setCurrentBlock("enclosure");
                                $this->tpl->setVariable("ENC_URL", $item->getEnclosureUrl());
                                $this->tpl->setVariable("ENC_LENGTH", $item->getEnclosureLength());
                                $this->tpl->setVariable("ENC_TYPE", $item->getEnclosureType());
                                $this->tpl->parseCurrentBlock();
                        }
                        
                        $this->tpl->setCurrentBlock("item");
                        $this->tpl->setVariable("ITEM_ABOUT", $item->getAbout());
                        $this->tpl->setVariable("ITEM_TITLE", $item->getTitle());
                        $this->tpl->setVariable("ITEM_DESCRIPTION", $item->getDescription());
                        $this->tpl->setVariable("ITEM_LINK", $item->getLink());
                        $this->tpl->parseCurrentBlock();
                        
                }
                
                $this->tpl->parseCurrentBlock();
                return $this->tpl->get();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilFeedWriter::getItems (  ) 

Definition at line 132 of file class.ilFeedWriter.php.

        {
                return $this->items;
        }

ilFeedWriter::ilFeedWriter (  ) 

Definition at line 53 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
        }

Here is the caller graph for this function:

ilFeedWriter::prepareStr ( a_str  ) 

Definition at line 137 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
                $a_str = str_replace("&", "&amp;", $a_str);
                $a_str = str_replace("<", "&lt;", $a_str);
                $a_str = str_replace(">", "&gt;", $a_str);
                return $a_str;
        }

Here is the caller graph for this function:

ilFeedWriter::setChannelAbout ( a_ab  ) 

Unique URI that defines the channel.

Definition at line 73 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
                $this->ch_about = $a_ab;
        }

Here is the caller graph for this function:

ilFeedWriter::setChannelDescription ( a_desc  ) 

Channel Description.

Definition at line 113 of file class.ilFeedWriter.php.

        {
                $this->ch_desc = $a_desc;
        }

ilFeedWriter::setChannelLink ( a_link  ) 

Channel Link URL to which an HTML rendering of the channel title will link.

Definition at line 100 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
                $this->ch_link = $a_link;
        }

Here is the caller graph for this function:

ilFeedWriter::setChannelTitle ( a_title  ) 

Channel Title.

Definition at line 86 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter::ilObjectFeedWriter(), and ilUserFeedWriter::ilUserFeedWriter().

        {
                $this->ch_title = $a_title;
        }

Here is the caller graph for this function:

ilFeedWriter::setEncoding ( a_enc  ) 

Set feed encoding.

Default is UTF-8.

Definition at line 60 of file class.ilFeedWriter.php.

        {
                $this->encoding = $a_enc;
        }

ilFeedWriter::showFeed (  ) 

Definition at line 205 of file class.ilFeedWriter.php.

References getFeed().

        {
                header("Content-Type: text/xml; charset=UTF-8;");
                echo $this->getFeed();
        }

Here is the call graph for this function:


Field Documentation

ilFeedWriter::$ch_about = ""

Definition at line 47 of file class.ilFeedWriter.php.

ilFeedWriter::$ch_description = ""

Definition at line 50 of file class.ilFeedWriter.php.

ilFeedWriter::$ch_link = ""

Definition at line 49 of file class.ilFeedWriter.php.

ilFeedWriter::$ch_title = ""

Definition at line 48 of file class.ilFeedWriter.php.

ilFeedWriter::$encoding = "UTF-8"

Definition at line 46 of file class.ilFeedWriter.php.

ilFeedWriter::$items = array()

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