[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/rssbuilder/ -> class.RSS_V_091.inc.php (source)

   1  <?php
   2  require_once  'class.RSSBase.inc.php';
   3  /**
   4  * Class for creating an RSS-feed
   5  * @author Michael Wimmer <flaimo@gmail.com>
   6  * @category flaimo-php
   7  * @copyright Copyright © 2002-2008, Michael Wimmer
   8  * @license GNU General Public License v3
   9  * @link http://code.google.com/p/flaimo-php/
  10  * @package RSS
  11  * @version 2.2.1
  12  */
  13  class RSS_V_091 extends RSS_V_abstract {
  14      
  15  	function __construct(RSSBuilder &$rssdata) {
  16          parent::__construct($rssdata);
  17      } // end constructor
  18  
  19  	protected function generateXML() {
  20          parent::generateXML();
  21          $root = $this->xml->createElement('rss');
  22          $this->xml->appendChild($root);
  23          $root->setAttribute('version', '0.91');
  24      
  25          $channel = $this->xml->createElement('channel');
  26          $root->appendChild($channel);        
  27  
  28          if ($this->rssdata->getDCRights() != FALSE) {
  29              $copyright = $this->xml->createElement('copyright');
  30              $copyright->appendChild($this->xml->createTextNode($this->rssdata->getDCRights()));
  31              $channel->appendChild($copyright);            
  32          } // end if
  33          
  34          if ($this->rssdata->getDCDate() != FALSE) {
  35              $date = $this->xml->createTextNode(date('r', $this->rssdata->getDCDate()));
  36              $pub_date = $this->xml->createElement('pubDate');
  37              $lb_date = $this->xml->createElement('lastBuildDate');
  38              $pub_date->appendChild($date);
  39              $lb_date->appendChild($date->cloneNode());
  40              $channel->appendChild($pub_date);
  41              $channel->appendChild($lb_date);            
  42          } // end if
  43          
  44          if ($this->rssdata->getAbout() != FALSE) {
  45              $docs = $this->xml->createElement('docs');
  46              $link = $this->xml->createElement('link');
  47              $about_text = $this->xml->createTextNode($this->rssdata->getAbout());
  48              $docs->appendChild($about_text);
  49              $link->appendChild($about_text->cloneNode());
  50              $channel->appendChild($docs);    
  51              $channel->appendChild($link);
  52          } // end if
  53  
  54          if ($this->rssdata->getDescription() != FALSE) {
  55              $description = $this->xml->createElement('description');
  56              $description->appendChild($this->xml->createTextNode($this->rssdata->getDescription()));
  57              $channel->appendChild($description);            
  58          } // end if
  59  
  60          if ($this->rssdata->getTitle() != FALSE) {
  61              $title = $this->xml->createElement('title');
  62              $title->appendChild($this->xml->createTextNode($this->rssdata->getTitle()));
  63              $channel->appendChild($title);            
  64          } // end if
  65                  
  66          if ($this->rssdata->getImageLink() != FALSE) {
  67              $image = $this->xml->createElement('image');
  68              $channel->appendChild($image);    
  69              $image->appendChild($title->cloneNode(TRUE));    
  70              $url = $this->xml->createElement('url');
  71              $url->appendChild($this->xml->createTextNode($this->rssdata->getImageLink()));
  72              $image->appendChild($url);    
  73              $image->appendChild($link->cloneNode(TRUE));    
  74              $image->appendChild($description->cloneNode(TRUE));    
  75          } // end if
  76  
  77          if ($this->rssdata->getDCPublisher() != FALSE) {
  78              $managingEditor = $this->xml->createElement('managingEditor');
  79              $managingEditor->appendChild($this->xml->createTextNode($this->rssdata->getDCPublisher()));
  80              $channel->appendChild($managingEditor);            
  81          } // end if
  82  
  83          if ($this->rssdata->getDCCreator() != FALSE) {
  84              $webMaster = $this->xml->createElement('webMaster');
  85              $webMaster->appendChild($this->xml->createTextNode($this->rssdata->getDCCreator()));
  86              $channel->appendChild($webMaster);            
  87          } // end if
  88  
  89          if ($this->rssdata->getDCLanguage() != FALSE) {
  90              $language = $this->xml->createElement('language');
  91              $language->appendChild($this->xml->createTextNode($this->rssdata->getDCLanguage()));
  92              $channel->appendChild($language);            
  93          } // end if
  94          
  95          foreach ($this->rssdata->getRSSItemList() as $id => $rss_item) {
  96              $item = '$item_' . $id;
  97              $$item = $this->xml->createElement('item');
  98              $channel->appendChild($$item);
  99              
 100              $item_title = '$item_title_' . $id;
 101              $$item_title = $this->xml->createElement('title');
 102              $$item_title->appendChild($this->xml->createTextNode($rss_item->getTitle()));
 103              $$item->appendChild($$item_title);
 104              
 105              $item_link = '$item_link_' . $id;
 106              $$item_link = $this->xml->createElement('link');
 107              $$item_link->appendChild($this->xml->createTextNode($rss_item->getLink()));
 108              $$item->appendChild($$item_link);            
 109              
 110              $item_desc = '$item_desc_' . $id;
 111              $$item_desc = $this->xml->createElement('description');
 112              $$item_desc->appendChild($this->xml->createTextNode($rss_item->getDescription()));
 113              $$item->appendChild($$item_desc);    
 114          } // end foreach
 115      } // function    
 116  } // end class
 117  ?>


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7