Improved image enclosure as per RSS 2, and improved description removing tags

This commit is contained in:
angerangel 2024-02-13 18:10:15 +01:00 committed by GitHub
parent d586fce4f2
commit 2941138358
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,8 +75,10 @@ class pluginRSS extends Plugin {
$xml .= '<item>';
$xml .= '<title>'.$page->title().'</title>';
$xml .= '<link>'.$this->encodeURL($page->permalink()).'</link>';
$xml .= '<image>'.$page->coverImage(true).'</image>';
$xml .= '<description>'.Sanitize::html($page->contentBreak()).'</description>';
$imagepath = parse_url($page->coverImage(true), PHP_URL_PATH);
$imagepath = $_SERVER['DOCUMENT_ROOT'] . $imagepath;
$xml .= '<enclosure url="'.$page->coverImage(true). '" length="'.filesize($imagepath) .'" type="'.mime_content_type($imagepath) .'" />';
$xml .= '<description>'. strip_tags( $page->contentBreak() ) .'</description>';
$xml .= '<pubDate>'.date(DATE_RSS,strtotime($page->getValue('dateRaw'))).'</pubDate>';
$xml .= '<guid isPermaLink="false">'.$page->uuid().'</guid>';
$xml .= '</item>';