diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-05-29 18:54:06 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2014-05-29 18:54:06 +0200 |
commit | a9f5e572dde4f986a498d2fbe92a38a1b22f9595 (patch) | |
tree | 80b5bfc9836ae92cc4929a4d72ae0b2730e568bc /inc/3rdparty/libraries/feedwriter/FeedWriter.php | |
parent | 96834a47b09985e1c82b82857fc108f20e8b8f2b (diff) | |
parent | 8038b38802769031e050c753fc0a388a2276629e (diff) | |
download | wallabag-a9f5e572dde4f986a498d2fbe92a38a1b22f9595.tar.gz wallabag-a9f5e572dde4f986a498d2fbe92a38a1b22f9595.tar.zst wallabag-a9f5e572dde4f986a498d2fbe92a38a1b22f9595.zip |
Merge pull request #712 from wallabag/dev1.7.0
1.7, call me "Premium version"
Diffstat (limited to 'inc/3rdparty/libraries/feedwriter/FeedWriter.php')
-rwxr-xr-x | inc/3rdparty/libraries/feedwriter/FeedWriter.php | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index df4c8b4b..aa064afb 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php | |||
@@ -87,20 +87,26 @@ define('JSONP', 3, true); | |||
87 | * @access public | 87 | * @access public |
88 | * @return void | 88 | * @return void |
89 | */ | 89 | */ |
90 | public function genarateFeed() | 90 | public function genarateFeed($withHeaders = true) |
91 | { | 91 | { |
92 | if ($this->version == RSS2) { | 92 | if ($withHeaders) { |
93 | // header('Content-type: text/xml; charset=UTF-8'); | 93 | if ($this->version == RSS2) { |
94 | // this line prevents Chrome 20 from prompting download | 94 | header('Content-type: text/xml; charset=UTF-8'); |
95 | // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss | 95 | // this line prevents Chrome 20 from prompting download |
96 | // header('X-content-type-options: nosniff'); | 96 | // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss |
97 | } elseif ($this->version == JSON) { | 97 | header('X-content-type-options: nosniff'); |
98 | // header('Content-type: application/json; charset=UTF-8'); | 98 | } elseif ($this->version == JSON) { |
99 | $this->json = new stdClass(); | 99 | header('Content-type: application/json; charset=UTF-8'); |
100 | } elseif ($this->version == JSONP) { | 100 | } elseif ($this->version == JSONP) { |
101 | // header('Content-type: application/javascript; charset=UTF-8'); | 101 | header('Content-type: application/javascript; charset=UTF-8'); |
102 | $this->json = new stdClass(); | 102 | } |
103 | } | 103 | } |
104 | |||
105 | if ($this->version == JSON || $this->version == JSONP) { | ||
106 | $this->json = new stdClass(); | ||
107 | } | ||
108 | |||
109 | |||
104 | $this->printHead(); | 110 | $this->printHead(); |
105 | $this->printChannels(); | 111 | $this->printChannels(); |
106 | $this->printItems(); | 112 | $this->printItems(); |
@@ -110,6 +116,11 @@ define('JSONP', 3, true); | |||
110 | } | 116 | } |
111 | } | 117 | } |
112 | 118 | ||
119 | public function &getItems() | ||
120 | { | ||
121 | return $this->items; | ||
122 | } | ||
123 | |||
113 | /** | 124 | /** |
114 | * Create a new FeedItem. | 125 | * Create a new FeedItem. |
115 | * | 126 | * |
@@ -193,7 +204,8 @@ define('JSONP', 3, true); | |||
193 | */ | 204 | */ |
194 | public function setDescription($description) | 205 | public function setDescription($description) |
195 | { | 206 | { |
196 | $this->setChannelElement('description', $description); | 207 | $tag = ($this->version == ATOM)? 'subtitle' : 'description'; |
208 | $this->setChannelElement($tag, $description); | ||
197 | } | 209 | } |
198 | 210 | ||
199 | /** | 211 | /** |
@@ -238,7 +250,7 @@ define('JSONP', 3, true); | |||
238 | { | 250 | { |
239 | $out = '<?xml version="1.0" encoding="utf-8"?>'."\n"; | 251 | $out = '<?xml version="1.0" encoding="utf-8"?>'."\n"; |
240 | if ($this->xsl) $out .= '<?xml-stylesheet type="text/xsl" href="'.htmlspecialchars($this->xsl).'"?>' . PHP_EOL; | 252 | if ($this->xsl) $out .= '<?xml-stylesheet type="text/xsl" href="'.htmlspecialchars($this->xsl).'"?>' . PHP_EOL; |
241 | $out .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">' . PHP_EOL; | 253 | $out .= '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">' . PHP_EOL; |
242 | echo $out; | 254 | echo $out; |
243 | } | 255 | } |
244 | elseif ($this->version == JSON || $this->version == JSONP) | 256 | elseif ($this->version == JSON || $this->version == JSONP) |