FeedWriter\Feed::__construct PHP Method

__construct() protected method

If no version is given, a feed in RSS 2.0 format will be generated.
protected __construct ( string $version = Feed::RSS2 )
$version string the version constant (RSS1/RSS2/ATOM).
    protected function __construct($version = Feed::RSS2)
    {
        $this->version = $version;
        // Setting default encoding
        $this->encoding = 'utf-8';
        // Setting default value for essential channel element
        $this->setTitle($version . ' Feed');
        // Add some default XML namespaces
        $this->namespaces['content'] = 'http://purl.org/rss/1.0/modules/content/';
        $this->namespaces['wfw'] = 'http://wellformedweb.org/CommentAPI/';
        $this->namespaces['atom'] = 'http://www.w3.org/2005/Atom';
        $this->namespaces['rdf'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
        $this->namespaces['rss1'] = 'http://purl.org/rss/1.0/';
        $this->namespaces['dc'] = 'http://purl.org/dc/elements/1.1/';
        $this->namespaces['sy'] = 'http://purl.org/rss/1.0/modules/syndication/';
        // Tag names to encode in CDATA
        $this->addCDATAEncoding(array('description', 'content:encoded', 'summary'));
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __construct()
 {
     parent::__construct(Feed::ATOM);
 }