PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | libraries/adapter/rss/reader.php +42 -18 1.6.8 → 1.8.16 View file →
@@ -189,24 +189,38 @@
189 189 // authorization denied, do not go ahead
190 190 throw new Exception('Missing RSS authorization', 403);
191 191 }
192 192
193 - // read feed channels
194 - $feed = fetch_feed($this->channels);
193 + $feeds = [];
195 194
196 - if ($feed instanceof WP_Error)
195 + /**
196 + * Since WP 6.9 and SimplePie 1.9, multiple channels are no longer accepted.
197 + * We should rather instantiate a single object per feed and then merge them
198 + * together through SimplePie::merge_items().
199 + *
200 + * @since 10.1.67
201 + */
202 + foreach ($this->channels as $channel)
197 203 {
198 - // get SimplePie error
199 - $error = $feed->get_error_message();
204 + // read feed channels
205 + $feed = fetch_feed($channel);
200 206
201 - // extract first element as long as error is an array
202 - while (is_array($error))
207 + if ($feed instanceof WP_Error)
203 208 {
204 - $error = array_shift($error);
209 + // get SimplePie error
210 + $error = $feed->get_error_message();
211 +
212 + // extract first element as long as error is an array
213 + while (is_array($error))
214 + {
215 + $error = array_shift($error);
216 + }
217 +
218 + // something went wrong, propagate error
219 + throw new Exception($error, (int) $feed->get_error_code());
205 220 }
206 221
207 - // something went wrong, propagate error
208 - throw new Exception($error, (int) $feed->get_error_code());
222 + $feeds[] = $feed;
209 223 }
210 224
211 225 $list = array();
212 226
@@ -222,9 +236,10 @@
222 236 if ($strict || $ordering == 'asc')
223 237 {
224 238 // take all the items without limits because
225 239 // we need to check whether the feeds are visible
226 - $items = $feed->get_items();
240 + // $items = $feed->get_items();
241 + $items = \SimplePie\SimplePie::merge_items($feeds);
227 242
228 243 if ($ordering == 'asc')
229 244 {
230 245 // load items in reverse order from oldest to newest
@@ -233,22 +248,31 @@
233 248 }
234 249 else
235 250 {
236 251 // take the feeds according to the specified limits
237 - $items = $feed->get_items($start, $limit);
252 + // $items = $feed->get_items($start, $limit);
253 + $items = \SimplePie\SimplePie::merge_items($feeds, $start, $limit);
238 254 }
239 255
240 256 // iterate multi-feed property to scan all the supported feeds
241 257 foreach ($items as $data)
242 258 {
243 - // encapsulate feed data
244 - $feed = new JRssFeed($data, $this->plugin);
259 + try
260 + {
261 + // encapsulate feed data
262 + $feed = new JRssFeed($data, $this->plugin);
245 263
246 - // check if we should take only visible feeds
247 - if (!$strict || ($feed->isVisible() && $optinDate < $feed->date))
264 + // check if we should take only visible feeds
265 + if (!$strict || ($feed->isVisible() && $optinDate < $feed->date))
266 + {
267 + // take feed
268 + $list[] = $feed;
269 + }
270 + }
271 + catch (Throwable $error)
248 272 {
249 - // take feed
250 - $list[] = $feed;
273 + // an error has occurred while trying to initialize the feed
274 + continue;
251 275 }
252 276 }
253 277
254 278 if ($strict)