From 2b2018df3dd12875256cc20afb2ce081433d279a Mon Sep 17 00:00:00 2001 From: jiimka Date: Sat, 13 Jan 2018 20:40:38 +0200 Subject: [PATCH] Allow rss attributes customization --- Feed.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Feed.php b/Feed.php index b20c800..45e2bc1 100644 --- a/Feed.php +++ b/Feed.php @@ -18,14 +18,18 @@ class Feed extends DOMDocument /** @var DomElement $item */ private $item; - public function __construct() + public function __construct($rssAttributes = [], $encoding = 'utf-8') { parent::__construct(); $this->formatOutput = true; - $this->encoding = 'utf-8'; + $this->encoding = $encoding; $rssElement = $this->createElement('rss'); $rssElement->setAttribute('version', '2.0'); $rssElement->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom'); + foreach ($rssAttributes as $rssAttributeName => $rssAttributeValue) { + $rssElement->setAttribute($rssAttributeName, $rssAttributeValue); + } + $this->rss = $this->appendChild($rssElement); }