From 66f4a8b0078e133f3f4e292ae7cc234655d8d041 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Fri, 1 Dec 2017 10:09:15 -0800 Subject: [PATCH] check for "type" property on alternates --- lib/XRay/Feeds.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/XRay/Feeds.php b/lib/XRay/Feeds.php index c388629..d34f0b9 100644 --- a/lib/XRay/Feeds.php +++ b/lib/XRay/Feeds.php @@ -69,23 +69,25 @@ class Feeds { $mf2 = \mf2\Parse($body, $result['url']); if(isset($mf2['alternates'])) { foreach($mf2['alternates'] as $alt) { - if(strpos($alt['type'], 'application/json') !== false) { - $feeds[] = [ - 'url' => $alt['url'], - 'type' => 'jsonfeed' - ]; - } - if(strpos($alt['type'], 'application/atom+xml') !== false) { - $feeds[] = [ - 'url' => $alt['url'], - 'type' => 'atom' - ]; - } - if(strpos($alt['type'], 'application/rss+xml') !== false) { - $feeds[] = [ - 'url' => $alt['url'], - 'type' => 'rss' - ]; + if(isset($alt['type'])) { + if(strpos($alt['type'], 'application/json') !== false) { + $feeds[] = [ + 'url' => $alt['url'], + 'type' => 'jsonfeed' + ]; + } + if(strpos($alt['type'], 'application/atom+xml') !== false) { + $feeds[] = [ + 'url' => $alt['url'], + 'type' => 'atom' + ]; + } + if(strpos($alt['type'], 'application/rss+xml') !== false) { + $feeds[] = [ + 'url' => $alt['url'], + 'type' => 'rss' + ]; + } } } }