From 6212acfc813781501177674baa3139ceef62f78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 15 Apr 2014 21:49:00 +0200 Subject: [fix] rss feed content type set to text/xml #636 --- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'inc/3rdparty/libraries/feedwriter') diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index df4c8b4b..79639c0c 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -89,18 +89,11 @@ define('JSONP', 3, true); */ public function genarateFeed() { - 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(); - } + 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'); + $this->printHead(); $this->printChannels(); $this->printItems(); -- cgit v1.2.3 From ef17914960191c6008fc70891544ae2182d70582 Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Apr 2014 09:39:50 +0200 Subject: Fix for #664 - Missing source url attribute in RSS feeds --- inc/3rdparty/libraries/feedwriter/FeedItem.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/3rdparty/libraries/feedwriter') diff --git a/inc/3rdparty/libraries/feedwriter/FeedItem.php b/inc/3rdparty/libraries/feedwriter/FeedItem.php index 3487423f..54a56f22 100644 --- a/inc/3rdparty/libraries/feedwriter/FeedItem.php +++ b/inc/3rdparty/libraries/feedwriter/FeedItem.php @@ -174,7 +174,8 @@ */ public function setSource($link) { - $this->setElement('source', $link); + $attributes = array('url'=>$link); + $this->setElement('source', "wallabag",$attributes); } /** -- cgit v1.2.3 From 827f5b42a667a9ac2ab68701c23885ae6e617907 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Thu, 24 Apr 2014 11:48:00 +0300 Subject: fix of rss headers problem --- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'inc/3rdparty/libraries/feedwriter') diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index 79639c0c..d708e99b 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -87,12 +87,25 @@ define('JSONP', 3, true); * @access public * @return void */ - public function genarateFeed() + public function genarateFeed($withHeaders = true) { - 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'); + 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'); + } elseif ($this->version == JSONP) { + header('Content-type: application/javascript; charset=UTF-8'); + } + } + + if ($this->version == JSON || $this->version == JSONP) { + $this->json = new stdClass(); + } + $this->printHead(); $this->printChannels(); -- cgit v1.2.3 From 3ec62cf95ab4436923d4c665fad7aef226cbb822 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Thu, 22 May 2014 17:16:38 +0300 Subject: update to 3.2 version of full-text-rss, issue #694 --- inc/3rdparty/libraries/feedwriter/FeedItem.php | 100 ++++++++++++----------- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 17 ++-- 2 files changed, 63 insertions(+), 54 deletions(-) mode change 100644 => 100755 inc/3rdparty/libraries/feedwriter/FeedItem.php (limited to 'inc/3rdparty/libraries/feedwriter') diff --git a/inc/3rdparty/libraries/feedwriter/FeedItem.php b/inc/3rdparty/libraries/feedwriter/FeedItem.php old mode 100644 new mode 100755 index 54a56f22..40786598 --- a/inc/3rdparty/libraries/feedwriter/FeedItem.php +++ b/inc/3rdparty/libraries/feedwriter/FeedItem.php @@ -1,7 +1,7 @@ version = $version; } /** * Set element (overwrites existing elements with $elementName) - * + * * @access public * @param srting The tag name of an element * @param srting The content of tag @@ -38,11 +38,11 @@ unset($this->elements[$elementName]); } $this->addElement($elementName, $content, $attributes); - } - + } + /** * Add an element to elements array - * + * * @access public * @param srting The tag name of an element * @param srting The content of tag @@ -61,11 +61,11 @@ $this->elements[$elementName][$i]['content'] = $content; $this->elements[$elementName][$i]['attributes'] = $attributes; } - + /** - * Set multiple feed elements from an array. + * Set multiple feed elements from an array. * Elements which have attributes cannot be added by this method - * + * * @access public * @param array array of elements in 'tagName' => 'tagContent' format. * @return void @@ -73,15 +73,15 @@ public function addElementArray($elementArray) { if(! is_array($elementArray)) return; - foreach ($elementArray as $elementName => $content) + foreach ($elementArray as $elementName => $content) { $this->addElement($elementName, $content); } } - + /** * Return the collection of elements in this feed item - * + * * @access public * @return array */ @@ -89,68 +89,74 @@ { return $this->elements; } - + // Wrapper functions ------------------------------------------------------ - + /** * Set the 'dscription' element of feed item - * + * * @access public * @param string The content of 'description' element * @return void */ - public function setDescription($description) + public function setDescription($description) { - $this->setElement('description', $description); + $tag = ($this->version == ATOM)? 'summary' : 'description'; + $this->setElement($tag, $description); } - + /** * @desc Set the 'title' element of feed item * @access public * @param string The content of 'title' element * @return void */ - public function setTitle($title) + public function setTitle($title) { - $this->setElement('title', $title); + $this->setElement('title', $title); } - + /** * Set the 'date' element of feed item - * + * * @access public * @param string The content of 'date' element * @return void */ - public function setDate($date) + public function setDate($date) { if(! is_numeric($date)) { $date = strtotime($date); } - - if($this->version == RSS2) + + if($this->version == ATOM) + { + $tag = 'updated'; + $value = date(DATE_ATOM, $date); + } + elseif($this->version == RSS2) { - $tag = 'pubDate'; - $value = date(DATE_RSS, $date); + $tag = 'pubDate'; + $value = date(DATE_RSS, $date); } - else + else { - $tag = 'dc:date'; - $value = date("Y-m-d", $date); + $tag = 'dc:date'; + $value = date("Y-m-d", $date); } - - $this->setElement($tag, $value); + + $this->setElement($tag, $value); } - + /** * Set the 'link' element of feed item - * + * * @access public * @param string The content of 'link' element * @return void */ - public function setLink($link) + public function setLink($link) { if($this->version == RSS2 || $this->version == RSS1) { @@ -161,27 +167,27 @@ { $this->setElement('link','',array('href'=>$link)); $this->setElement('id', FeedWriter::uuid($link,'urn:uuid:')); - } - + } + } /** * Set the 'source' element of feed item - * + * * @access public * @param string The content of 'source' element * @return void */ - public function setSource($link) + public function setSource($link) { $attributes = array('url'=>$link); $this->setElement('source', "wallabag",$attributes); } - + /** * Set the 'encloser' element of feed item * For RSS 2.0 only - * + * * @access public * @param string The url attribute of encloser tag * @param string The length attribute of encloser tag @@ -193,6 +199,6 @@ $attributes = array('url'=>$url, 'length'=>$length, 'type'=>$type); $this->setElement('enclosure','',$attributes); } - + } // end of class FeedItem ?> \ No newline at end of file diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index d708e99b..77755690 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -97,15 +97,12 @@ define('JSONP', 3, true); 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 ($this->version == JSON || $this->version == JSONP) { - $this->json = new stdClass(); - } - $this->printHead(); $this->printChannels(); @@ -116,6 +113,11 @@ define('JSONP', 3, true); } } + public function &getItems() + { + return $this->items; + } + /** * Create a new FeedItem. * @@ -199,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); } /** @@ -244,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) -- cgit v1.2.3 From 3dc8d84229ed0f3ccd40b44420ed6e818a6edea9 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Thu, 29 May 2014 16:35:00 +0300 Subject: fix of uninitialized object warning, issue #710 --- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'inc/3rdparty/libraries/feedwriter') diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index 77755690..aa064afb 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -97,13 +97,16 @@ define('JSONP', 3, true); 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 ($this->version == JSON || $this->version == JSONP) { + $this->json = new stdClass(); + } + + $this->printHead(); $this->printChannels(); $this->printItems(); @@ -202,7 +205,7 @@ define('JSONP', 3, true); public function setDescription($description) { $tag = ($this->version == ATOM)? 'subtitle' : 'description'; - $this->setChannelElement($tag, $desciption); + $this->setChannelElement($tag, $description); } /** -- cgit v1.2.3