0
@@ -67,7 +67,9 @@ class Blog extends CmsModuleBase
0
$this->register_module_plugin('blog');
0
- $this->register_route('/blog\/category\/(?P<category>[a-zA-Z\-_\ ]+)$/', array('action' => 'list_by_category'));
0
+ $this->register_route('/blog\/rss\.xml$/', array('action' => 'default', 'rss' => true, 'showtemplate' => false));
0
+ $this->register_route('/blog\/category\/(?P<category>[a-zA-Z\-_\ ]+)\.xml$/', array('action' => 'list_by_category', 'rss' => true, 'showtemplate' => false));
0
+ $this->register_route('/blog\/category\/(?P<category>[a-zA-Z\-_\ ]+)$/', array('action' => 'list_by_category'));
0
$this->register_route('/blog\/(?P<url>[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/.*?)$/', array('action' => 'detail'));
0
$this->register_route('/blog\/(?P<year>[0-9]{4})$/', array('action' => 'filter_list', 'month' => '-1', 'day' => '-1'));
0
$this->register_route('/blog\/(?P<year>[0-9]{4})\/(?P<month>[0-9]{2})$/', array('action' => 'filter_list', 'day' => '-1'));
0
@@ -78,6 +80,32 @@ class Blog extends CmsModuleBase
0
$this->add_xmlrpc_method('getPost', 'metaWeblog');
0
$this->add_xmlrpc_method('newPost', 'metaWeblog');
0
$this->add_xmlrpc_method('editPost', 'metaWeblog');
0
+ $this->add_temp_event_handler('Core', 'HeaderTagRender', 'handle_header_callback');
0
+ public function handle_header_callback($modulename, $eventname, &$params)
0
+ //We only add this link if another action hasn't done so already -- view by category does it's own thing, for example.
0
+ if (!$this->has_added_header_text())
0
+ $params['content'] .= '<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="' . $this->generate_rss_link() . '" />' . "\n";
0
+ protected function generate_rss_link($params = array(), $category = '')
0
+ $pretty_url = 'blog/rss.xml';
0
+ $pretty_url = 'blog/category/' . $category . '.xml';
0
+ if (!array_key_exists('category', $params))
0
+ $params['category'] = $category;
0
+ return $this->create_link('cntnt01', 'rss', $this->get_default_return_id(), '', $params, '', true, false, '', false, $pretty_url);
0
+ private function get_default_return_id()
0
+ return cmsms()->get('pageinfo')->return_id;
0
public function getRecentPosts($blog_id, $username, $password, $number_of_posts)
0
@@ -181,49 +209,71 @@ class Blog extends CmsModuleBase
0
public function get_default_summary_template()
0
return '{foreach from=$posts item=entry}
0
- <h3><a href="{$entry->url}">{$entry->title}</a></h3>
0
- {if $entry->author ne null}
0
- {mod_lang string=by} {$entry->author->full_name()}
0
+<h3><a href="{$entry->url}">{$entry->title}</a></h3>
0
+ {if $entry->author ne null}
0
+ {mod_lang string=by} {$entry->author->full_name()}
0
- {$entry->get_summary_for_frontend()}
0
+{$entry->get_summary_for_frontend()}
0
- {if $entry->has_more() eq true}
0
- <a href="{$entry->url}">{mod_lang string=hasmore} >></a>
0
+{if $entry->has_more() eq true}
0
+ <a href="{$entry->url}">{mod_lang string=hasmore} >></a>
0
public function get_default_detail_template()
0
return '{if $post ne null}
0
- <h3>{$post->title}</h3>
0
- {if $post->author ne null}
0
- {mod_lang string=by} {$post->author->full_name()}
0
+<h3>{$post->title}</h3>
0
+ {if $post->author ne null}
0
+ {mod_lang string=by} {$post->author->full_name()}
0
- {cms_module module="comments" module_name="blog" content_id=$post->id}
0
+{cms_module module="comments" module_name="blog" content_id=$post->id}
0
- {mod_lang string=postnotfound}
0
+{mod_lang string=postnotfound}
0
+ public function get_default_rss_template()
0
+ return '<?xml version="1.0"?>
0
+ <title>{$sitename|escape}</title>
0
+ <link>{root_url}</link>
0
+ {foreach from=$posts item=entry}
0
+ <title><![CDATA[{$entry->title}]]></title>
0
+ <link>{$entry->url}</link>
0
+ <guid>{$entry->url}</guid>
0
+ <pubDate>{$entry->post_date}</pubDate>
0
+ <category><![CDATA[]]></category>
0
+ <description><![CDATA[{$entry->get_summary_for_frontend()}]]></description>
Comments
No one has commented yet.