Browse Source

check for "type" property on alternates

pull/49/head v1.4.6
Aaron Parecki 6 years ago
parent
commit
66f4a8b007
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 19 additions and 17 deletions
  1. +19
    -17
      lib/XRay/Feeds.php

+ 19
- 17
lib/XRay/Feeds.php View File

@ -69,23 +69,25 @@ class Feeds {
$mf2 = \mf2\Parse($body, $result['url']); $mf2 = \mf2\Parse($body, $result['url']);
if(isset($mf2['alternates'])) { if(isset($mf2['alternates'])) {
foreach($mf2['alternates'] as $alt) { 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'
];
}
} }
} }
} }

Loading…
Cancel
Save