[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

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

   1  <?php
   2  require_once  'interface.RSS.inc.php';
   3  require_once  'class.RSSBase.inc.php';
   4  /**
   5  * Class for creating an RSS-feed
   6  * @author Michael Wimmer <flaimo@gmail.com>
   7  * @category flaimo-php
   8  * @copyright Copyright © 2002-2008, Michael Wimmer
   9  * @license GNU General Public License v3
  10  * @link http://code.google.com/p/flaimo-php/
  11  * @package RSS
  12  * @version 2.2.1
  13  */
  14  abstract class RSS_V_abstract extends RSSBase implements RSS {
  15  
  16      protected $rssdata;
  17      protected $xml;
  18      protected $filename;
  19  
  20  	function __construct(RSSBuilder &$rssdata) {
  21          parent::__construct();
  22          $this->rssdata =& $rssdata;
  23      } // end constructor
  24  
  25      protected function &getRSSData() {
  26          return $this->rssdata;
  27      } // end function
  28  
  29  	protected function generateXML() {
  30          $this->xml = new DomDocument('1.0', $this->rssdata->getEncoding());
  31          $this->xml->appendChild($this->xml->createComment('RSS generated by Flaimo.com RSS Builder [' .  date('Y-m-d H:i:s')  .']'));
  32      } // end function
  33  
  34  	public function outputRSS($output = TRUE) {
  35          if (!isset($this->xml)) {
  36              $this->generateXML();
  37          } // end if
  38          header('content-type: text/xml;charset=' . $this->rssdata->getEncoding() . " \r\n");
  39          header('Content-Disposition: inline; filename=' . $this->rssdata->getFilename());
  40          echo $this->xml->saveXML();
  41      } // end function
  42  
  43  	public function saveRSS($path = '') {
  44          if (!isset($this->xml)) {
  45              $this->generateXML();
  46          } // end if
  47          $this->xml->save($path . $this->rssdata->getFilename());
  48          return (string) $path . $this->rssdata->getFilename();
  49      } // end function
  50  
  51  	public function getRSSOutput() {
  52          if (!isset($this->xml)) {
  53              $this->generateXML();
  54          } // end if
  55          return $this->xml->saveXML();
  56      } // function
  57  } // end class
  58  ?>


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