Make feeds work with simplified template fallback

Since default is no longer queried if not set specifically, the new
default template 2k11 needs to carry the feed template and the banner
image. See http://board.s9y.org/viewtopic.php?f=3&t=20801 and
8affa1126a
This commit is contained in:
onli 2016-07-27 10:35:03 +02:00
parent d31c8960f8
commit 3179ed7d57
8 changed files with 271 additions and 5 deletions

View File

@ -240,15 +240,11 @@ if ($_GET['type'] == 'content' &&
$metadata['showMail'] = serendipity_db_bool(serendipity_get_config_var('show_mail', $metadata['showMail']));
$file_version = preg_replace('@[^0-9a-z\.-_]@i', '', $version);
$metadata['template_file'] = serendipity_getTemplateFile('feed_' . $file_version . '.tpl', 'serendipityPath');
$metadata['template_file'] = 'feed_' . $file_version . '.tpl';
serendipity_smarty_init();
serendipity_plugin_api::hook_event('frontend_rss', $metadata);
if (!$metadata['template_file'] || $metadata['template_file'] == 'feed_' . $file_version . '.tpl') {
die("Invalid RSS version specified or RSS-template file not found\n");
}
$self_url = ($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . serendipity_specialchars($_SERVER['REQUEST_URI']);
if (!is_array($entries)) {
$entries = array();

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<rss version="0.91" {$namespace_display_dat}>
<channel>
<title>{$metadata.title}</title>
<link>{$metadata.link}</link>
<description>{$metadata.description}</description>
<language>{$metadata.language}</language>
{$metadata.additional_fields.image}
{foreach from=$entries item="entry"}
<item>
<title>{$entry.feed_title}</title>
<link>{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}</link>
{if !empty($entry.body)}
<description>
{$entry.feed_body|@escape} {$entry.feed_ext|@escape}
</description>
{/if}
</item>
{/foreach}
</channel>
</rss>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF {$namespace_display_dat}
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns="http://my.netscape.com/rdf/simple/0.9/">
<channel>
<title>{$metadata.title}</title>
<link>{$metadata.link}</link>
<description>{$metadata.description}</description>
<dc:language>{$metadata.language}</dc:language>
{if $metadata.showMail}
<admin:errorReportsTo rdf:resource="mailto:{$metadata.email}" />
{/if}
{$metadata.additional_fields.image_rss10_channel}
<items>
<rdf:Seq>
{foreach from=$entries item="entry"}
<rdf:li resource="{serendipity_rss_getguid entry=$entry is_comments=$is_comments}" />
{/foreach}
</rdf:Seq>
</items>
</channel>
{$metadata.additional_fields.image_rss10_rdf}
{$once_display_dat}
{foreach from=$entries item="entry"}
<item rdf:about="{$entry.feed_guid}">
<title>{$entry.feed_title}</title>
<link>{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}</link>
{if !empty($entry.body)}
<description>
{$entry.feed_body|@escape} {$entry.feed_ext|@escape}
</description>
{/if}
<dc:publisher>{$entry.feed_blogTitle}</dc:publisher>
<dc:creator>{$entry.feed_email} ({$entry.feed_author})</dc:creator>
<dc:subject>
{foreach from=$entry.categories item="cat"}{$cat.feed_category_name}, {/foreach}</dc:subject>
<dc:date>{$entry.feed_timestamp}</dc:date>
<wfw:comment>{$serendipityBaseURL}wfwcomment.php?cid={$entry.feed_id}</wfw:comment>
{if !$is_comments}
<slash:comments>{$entry.comments}</slash:comments>
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&amp;type=comments&amp;cid={$entry.feed_id}</wfw:commentRss>
{/if}
{$entry.per_entry_display_dat}
</item>
{/foreach}
</rdf:RDF>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
{$namespace_display_dat}>
<channel>
{$channel_display_dat}
<title>{$metadata.title}</title>
<link>{$metadata.link}</link>
<description>{$metadata.description}</description>
<dc:language>{$metadata.language}</dc:language>
{if $metadata.showMail}
<admin:errorReportsTo rdf:resource="mailto:{$metadata.email}" />
{/if}
<generator>Serendipity {$serendipityVersion} - http://www.s9y.org/</generator>
{$metadata.additional_fields.channel}
{$metadata.additional_fields.image}
{foreach from=$entries item="entry"}
<item>
<title>{$entry.feed_title}</title>
<link>{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}</link>
{foreach from=$entry.categories item="cat"}
<category>{$cat.feed_category_name}</category>
{/foreach}
<comments>{$entry.feed_entryLink}#comments</comments>
<wfw:comment>{$serendipityBaseURL}wfwcomment.php?cid={$entry.feed_id}</wfw:comment>
{if !$is_comments}
<slash:comments>{$entry.comments}</slash:comments>
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&amp;type=comments&amp;cid={$entry.feed_id}</wfw:commentRss>
{/if}
<author>{$entry.feed_email} ({$entry.feed_author})</author>
{if !empty($entry.body)}
<content:encoded>
{$entry.feed_body|@escape} {$entry.feed_ext|@escape}
</content:encoded>
{/if}
<pubDate>{$entry.feed_timestamp_r}</pubDate>
<guid isPermaLink="false">{$entry.feed_guid}</guid>
{$entry.per_entry_display_dat}
</item>
{/foreach}
</channel>
</rss>

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<feed version="0.3" {$namespace_display_dat}
xmlns="http://purl.org/atom/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
{$channel_display_dat}
<link href="{$serendipityBaseURL}rss.php?version=atom0.3" rel="service.feed" title="{$metadata.title}" type="application/x.atom+xml" />
<link href="{$serendipityBaseURL}" rel="alternate" title="{$metadata.title}" type="text/html" />
<link href="{$serendipityBaseURL}rss.php?version=2.0" rel="alternate" title="{$metadata.title}" type="application/rss+xml" />
<link rel="stylesheet" href="{serendipity_getFile file='atom.css'}" type="text/css" />
<title mode="escaped" type="text/html">{$metadata.title}</title>
<tagline mode="escaped" type="text/html">{$metadata.description}</tagline>
<id>{$metadata.link}</id>
<modified>{$last_modified}</modified>
<generator url="http://www.s9y.org/" version="{$serendipityVersion}">Serendipity {$serendipityVersion} - http://www.s9y.org/</generator>
<dc:language>{$metadata.language}</dc:language>
{if $metadata.showMail}
<admin:errorReportsTo rdf:resource="mailto:{$metadata.email}" />
{/if}
<info mode="xml" type="text/html">
<div xmlns="http://www.w3.org/1999/xhtml">You are viewing an ATOM formatted XML site feed. Usually this file is inteded to be viewed in an aggregator or syndication software. If you want to know more about ATOM, please visist <a href="http://atomenabled.org/">Atomenabled.org</a></div>
</info>
{foreach from=$entries item="entry"}
<entry>
<link href="{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}" rel="alternate" title="{$entry.feed_title}" type="text/html" />
<author>
<name>{$entry.feed_author}</name>
{if $entry.feed_email != 'nospam@example.com'}<email>{$entry.feed_email}</email>{/if}
</author>
<issued>{$entry.feed_timestamp}</issued>
<created>{$entry.feed_timestamp}</created>
<modified>{$entry.feed_last_modified}</modified>
<wfw:comment>{$serendipityBaseURL}wfwcomment.php?cid={$entry.feed_id}</wfw:comment>
{if !$is_comments}
<slash:comments>{$entry.comments}</slash:comments>
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&amp;type=comments&amp;cid={$entry.feed_id}</wfw:commentRss>
{/if}
<id>{$entry.feed_guid}</id>
<title mode="escaped" type="text/html">{$entry.feed_title}</title>
{if !empty($entry.body)}
<content type="application/xhtml+xml" xml:base="{$serendipityBaseURL}">
<div xmlns="http://www.w3.org/1999/xhtml">
{$entry.feed_body} {$entry.feed_ext}
</div>
</content>
{/if}
{$entry.per_entry_display_dat}
</entry>
{/foreach}
</feed>

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8" ?>
<feed {$namespace_display_dat}
xmlns="http://www.w3.org/2005/Atom"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
{$channel_display_dat}
<link href="{$self_url}" rel="self" title="{$metadata.title}" type="application/atom+xml" />
<link href="{$serendipityBaseURL}" rel="alternate" title="{$metadata.title}" type="text/html" />
<link href="{$serendipityBaseURL}rss.php?version=2.0" rel="alternate" title="{$metadata.title}" type="application/rss+xml" />
<link rel="stylesheet" href="{serendipity_getFile file='atom.css'}" type="text/css" />
<title type="html">{$metadata.title}</title>
<subtitle type="html">{$metadata.description}</subtitle>
{$metadata.additional_fields.image_atom10}
<id>{$metadata.link}</id>
<updated>{$last_modified}</updated>
<generator uri="http://www.s9y.org/" version="{$serendipityVersion}">Serendipity {$serendipityVersion} - http://www.s9y.org/</generator>
<dc:language>{$metadata.language}</dc:language>
{if $metadata.showMail}
<admin:errorReportsTo rdf:resource="mailto:{$metadata.email}" />
{/if}
{foreach from=$entries item="entry"}
<entry>
<link href="{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}" rel="alternate" title="{$entry.feed_title}" />
<author>
<name>{$entry.feed_author}</name>
{if $entry.feed_email != 'nospam@example.com'}<email>{$entry.feed_email}</email>{/if}
</author>
<published>{$entry.feed_timestamp}</published>
<updated>{$entry.feed_last_modified}</updated>
<wfw:comment>{$serendipityBaseURL}wfwcomment.php?cid={$entry.feed_id}</wfw:comment>
{if !$is_comments}
<slash:comments>{$entry.comments}</slash:comments>
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&amp;type=comments&amp;cid={$entry.feed_id}</wfw:commentRss>
{/if}
{foreach from=$entry.categories item="cat"}
<category scheme="{$cat.categoryURL}" label="{$cat.feed_category_name}" term="{$cat.feed_category_name}" />
{/foreach}
<id>{$entry.feed_guid}</id>
<title type="html">{$entry.feed_title}</title>
{if !empty($entry.body)}
<content type="html">
<![CDATA[{$entry.feed_body} {$entry.feed_ext}]]>
</content>
{/if}
{$entry.per_entry_display_dat}
</entry>
{/foreach}
</feed>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<opml version="{$metadata.version}" {$namespace_display_dat}>
<head>
<title>{$metadata.title}</title>
<dateModified>{$last_modified}</dateModified>
<ownerName>Serendipity {$serendipityVersion} - http://www.s9y.org/</ownerName>
</head>
<body>
{foreach from=$entries item="entry"}
<outline text="{$entry.feed_title}" type="url" htmlUrl="{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}" urlHTTP="{$entry.feed_entryLink}{if $is_comments}#c{$entry.commentid}{/if}" />
{/foreach}
</body>
</opml>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB