Fix RSS syntax according W3C recommendations
1. Add atom schema 2. Sanitize international characters in URL acording RFC3987 3. Ignore locale in date
This commit is contained in:
parent
9a7668587a
commit
c742cb1ab1
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<<?php
|
||||
|
||||
class pluginRSS extends Plugin {
|
||||
|
||||
@ -54,10 +54,11 @@ class pluginRSS extends Plugin {
|
||||
);
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
$xml .= '<rss version="2.0">';
|
||||
$xml .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
|
||||
$xml .= '<channel>';
|
||||
$xml .= '<atom:link href="'.DOMAIN_BASE.'rss.xml" rel="self" type="application/rss+xml" />';
|
||||
$xml .= '<title>'.$site->title().'</title>';
|
||||
$xml .= '<link>'.$site->url().'</link>';
|
||||
$xml .= '<link>'.preg_replace_callback("/[^\x20-\x7f]/", function($match) { return urlencode($match[0]); },$site->url()).'</link>';
|
||||
$xml .= '<description>'.$site->description().'</description>';
|
||||
$xml .= '<lastBuildDate>'.date(DATE_RSS).'</lastBuildDate>';
|
||||
|
||||
@ -68,7 +69,7 @@ class pluginRSS extends Plugin {
|
||||
$page = new Page($pageKey);
|
||||
$xml .= '<item>';
|
||||
$xml .= '<title>'.$page->title().'</title>';
|
||||
$xml .= '<link>'.$page->permalink().'</link>';
|
||||
$xml .= "<link>".preg_replace_callback('/[^\x20-\x7f]/',function($match){return urlencode($match[0]);},$page->permalink())."</link>";
|
||||
$xml .= '<description>'.Sanitize::html($page->contentBreak()).'</description>';
|
||||
$xml .= '<pubDate>'.date('r',strtotime($page->getValue('dateRaw'))).'</pubDate>';
|
||||
$xml .= '<guid isPermaLink="false">'.$page->uuid().'</guid>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user