insanelyBlog/includes/rss.php

28 lines
969 B
PHP

<?php
header("Content-Type: application/xml");
echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
?>
<rss version="2.0">
<channel>
<title><?=$_set['title']?></title>
<link><?=$_set['url']?></link>
<description><?=$_set['description']?></description>
<language>hu-hu</language>
<?php
$blog = new blog();
while ($data = $blog->entries())
{
$image = preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images);
echo " <item>\n"
." <title>".htmlspecialchars($data['entryTitle'])."</title>\n"
." <pubDate>".show_date($data['entryPublished'])."</pubDate>\n"
." <link>".$_set['url'].get_entry_link($data['entrySlug'])."</link>\n"
." <description>".strip_tags(nl2br(explode('[[MORE]]', $data['entryContent'])[0]))."</description>\n"
.($image ? " <media:thumbnail url='".$_set['url'].$images[1]."' />\n" : null)
." </item>\n";
}
?>
</channel>
</rss>