X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2F3rdparty%2Flibraries%2Ffeedwriter%2FFeedWriter.php;h=7775569033cc9e3c1acf81832f7c1b2dc36946dd;hb=87f01ea2e97715ac5df4ef7a6741cc26f3a5cd1b;hp=df4c8b4b7981253c841f1950066f4b6115e0b7a3;hpb=7a873ef1d76a26975185afcfd1669b5b024d85ec;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index df4c8b4b..77755690 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -87,20 +87,23 @@ define('JSONP', 3, true); * @access public * @return void */ - public function genarateFeed() + public function genarateFeed($withHeaders = true) { - if ($this->version == RSS2) { -// header('Content-type: text/xml; charset=UTF-8'); - // this line prevents Chrome 20 from prompting download - // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss -// header('X-content-type-options: nosniff'); - } elseif ($this->version == JSON) { -// header('Content-type: application/json; charset=UTF-8'); - $this->json = new stdClass(); - } elseif ($this->version == JSONP) { -// header('Content-type: application/javascript; charset=UTF-8'); - $this->json = new stdClass(); + if ($withHeaders) { + if ($this->version == RSS2) { + header('Content-type: text/xml; charset=UTF-8'); + // this line prevents Chrome 20 from prompting download + // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss + header('X-content-type-options: nosniff'); + } elseif ($this->version == JSON) { + header('Content-type: application/json; charset=UTF-8'); + $this->json = new stdClass(); + } elseif ($this->version == JSONP) { + header('Content-type: application/javascript; charset=UTF-8'); + $this->json = new stdClass(); + } } + $this->printHead(); $this->printChannels(); $this->printItems(); @@ -110,6 +113,11 @@ define('JSONP', 3, true); } } + public function &getItems() + { + return $this->items; + } + /** * Create a new FeedItem. * @@ -193,7 +201,8 @@ define('JSONP', 3, true); */ public function setDescription($description) { - $this->setChannelElement('description', $description); + $tag = ($this->version == ATOM)? 'subtitle' : 'description'; + $this->setChannelElement($tag, $desciption); } /** @@ -238,7 +247,7 @@ define('JSONP', 3, true); { $out = ''."\n"; if ($this->xsl) $out .= 'xsl).'"?>' . PHP_EOL; - $out .= '' . PHP_EOL; + $out .= '' . PHP_EOL; echo $out; } elseif ($this->version == JSON || $this->version == JSONP)