Skip to content

Commit

Permalink
Adding in Classes\GenerateRSS class and routes/controllers for the RS…
Browse files Browse the repository at this point in the history
…S content
  • Loading branch information
dragoonis committed Sep 17, 2012
1 parent 68f03f5 commit e58d60d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
41 changes: 41 additions & 0 deletions modules/BlogModule/Classes/GenerateRSS.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace BlogModule\Classes;

class GenerateRSS {

protected $cache = null;
protected $defaultTTL = 43200; // (86400 / 2)
protected $cacheKey = 'blog_rss_generate';
protected $blogPostStorage = null;

public function __construct($cache, $blogPostStorage)
{
$this->cache = $cache;
$this->blogPostStorage = $blogPostStorage;
}

/**
* Generate the RSS data
*
* @return array
*/
public function getRSSContent()
{

if ($this->cache->contains($this->cacheKey)) {
$rssData = $this->cache->fetch($this->cacheKey);
} else {

$rssData = array();

/* @todo - Generate RSS content */

$this->cache->save($this->cacheKey, $rssData, $this->defaultTTL);
}

return $rssData;

}

}
8 changes: 8 additions & 0 deletions modules/BlogModule/Controller/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public function tagviewAction()
return $this->indexAction($this->getRouteParam('tagID'));
}


public function getRSS()
{

}

protected function normalizePostTitleLink($title)
{
return strtolower(str_replace(' ', '-', $title));
Expand All @@ -145,5 +151,7 @@ protected function getBlogTagStorage() {
protected function getBlogPostTagStorage() {
return new \BlogModule\Storage\BlogPostTag($this->getService('datasource'));
}



}
5 changes: 4 additions & 1 deletion modules/BlogModule/resources/config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ BlogGetPopular:
BlogGetRecentComments:
pattern: /blog/get_recent_comments
defaults: { _controller: "BlogModule:Blog:getRecentComments"}


BlogGetPopular:
pattern: /blog/get_rss
defaults: { _controller: "BlogModule:Blog:getRSS"}

0 comments on commit e58d60d

Please sign in to comment.