<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<rss version="2.0"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>{{ htmlspecialchars($channelTitle) }}</title>
    <link>{{ $channelLink }}</link>
    <description>{{ htmlspecialchars($channelDescription) }}</description>
    <language>en-us</language>
    <lastBuildDate>{{ $buildDate }}</lastBuildDate>
    <atom:link href="{{ $feedUrl }}" rel="self" type="application/rss+xml" />
    @foreach ($items as $item)
    <item>
        <title><![CDATA[{{ $item['title'] }}]]></title>
        <link>{{ $item['link'] }}</link>
        <guid isPermaLink="true">{{ $item['guid'] }}</guid>
        @if (!empty($item['pubDate']))
        <pubDate>{{ $item['pubDate'] }}</pubDate>
        @endif
        @if (!empty($item['author']))
        <dc:creator><![CDATA[{{ $item['author'] }}]]></dc:creator>
        @endif
        @if (!empty($item['category']))
        <category><![CDATA[{{ $item['category'] }}]]></category>
        @endif
        <description><![CDATA[{!! $item['description'] !!}]]></description>
        @if (!empty($item['enclosure']))
        <enclosure url="{{ $item['enclosure']['url'] }}"
                   length="{{ $item['enclosure']['length'] }}"
                   type="{{ $item['enclosure']['type'] }}" />
        @endif
        @if (!empty($item['enclosure']))
        <media:content url="{{ $item['enclosure']['url'] }}" medium="image" />
        @endif
    </item>
    @endforeach
</channel>
</rss>
