diff --git a/app/Models/Feed.php b/app/Models/Feed.php index cc2196dac..89eb0a53c 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -356,49 +356,53 @@ class FreshRSS_Feed extends Minz_Model { $content = html_only_entity_decode($item->get_content()); - $elinks = array(); - foreach ($item->get_enclosures() as $enclosure) { - $elink = $enclosure->get_link(); - if ($elink != '' && empty($elinks[$elink])) { - $content .= '
'; - - if ($enclosure->get_title() != '') { - $content .= '

' . $enclosure->get_title() . '

'; - } + if ($item->get_enclosures() != null) { + $elinks = array(); + foreach ($item->get_enclosures() as $enclosure) { + $elink = $enclosure->get_link(); + if ($elink != '' && empty($elinks[$elink])) { + $content .= '
'; + + if ($enclosure->get_title() != '') { + $content .= '

' . $enclosure->get_title() . '

'; + } - $enclosureContent = ''; - $elinks[$elink] = true; - $mime = strtolower($enclosure->get_type()); - $medium = strtolower($enclosure->get_medium()); - if ($medium === 'image' || strpos($mime, 'image/') === 0) { - $enclosureContent .= '

'; - } elseif ($medium === 'audio' || strpos($mime, 'audio/') === 0) { - $enclosureContent .= '

💾

'; - } elseif ($medium === 'video' || strpos($mime, 'video/') === 0) { - $enclosureContent .= '

💾

'; - } elseif ($medium != '' || strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) { - $enclosureContent .= '

💾

'; - } else { - unset($elinks[$elink]); - } + $enclosureContent = ''; + $elinks[$elink] = true; + $mime = strtolower($enclosure->get_type()); + $medium = strtolower($enclosure->get_medium()); + if ($medium === 'image' || strpos($mime, 'image/') === 0) { + $enclosureContent .= '

'; + } elseif ($medium === 'audio' || strpos($mime, 'audio/') === 0) { + $enclosureContent .= '

💾

'; + } elseif ($medium === 'video' || strpos($mime, 'video/') === 0) { + $enclosureContent .= '

💾

'; + } elseif ($medium != '' || strpos($mime, 'application/') === 0 || strpos($mime, 'text/') === 0) { + $enclosureContent .= '

💾

'; + } else { + unset($elinks[$elink]); + } - $thumbnailContent = ''; - foreach ($enclosure->get_thumbnails() as $thumbnail) { - if (empty($elinks[$thumbnail])) { - $elinks[$thumbnail] = true; - $thumbnailContent .= '

'; + $thumbnailContent = ''; + if ($enclosure->get_thumbnails() != null) { + foreach ($enclosure->get_thumbnails() as $thumbnail) { + if (empty($elinks[$thumbnail])) { + $elinks[$thumbnail] = true; + $thumbnailContent .= '

'; + } + } } - } - $content .= $thumbnailContent; - $content .= $enclosureContent; + $content .= $thumbnailContent; + $content .= $enclosureContent; - if ($enclosure->get_description() != '') { - $content .= '
' . $enclosure->get_description() . '
'; + if ($enclosure->get_description() != '') { + $content .= '
' . $enclosure->get_description() . '
'; + } + $content .= "
\n"; } - $content .= "
\n"; } }