diff options
-rw-r--r-- | config/beer.json | bin | 0 -> 1035 bytes | |||
-rw-r--r-- | config/facebook.json | bin | 340 -> 339 bytes | |||
-rw-r--r-- | providers/Beer.php | 37 |
3 files changed, 37 insertions, 0 deletions
diff --git a/config/beer.json b/config/beer.json Binary files differnew file mode 100644 index 0000000..20b4923 --- /dev/null +++ b/config/beer.json diff --git a/config/facebook.json b/config/facebook.json Binary files differindex b9687d0..4668f09 100644 --- a/config/facebook.json +++ b/config/facebook.json diff --git a/providers/Beer.php b/providers/Beer.php new file mode 100644 index 0000000..b6f11a9 --- /dev/null +++ b/providers/Beer.php @@ -0,0 +1,37 @@ +<?php + +namespace Providers; + +require_once('Facebook.php'); + +class Beer extends \Providers\Facebook { + + protected $_feedGroup; + + public function __construct($feed, $options=[]) { + parent::__construct($feed, $options); + $this->_feedGroup = $feed; + $this->_groupConfig = json_decode(file_get_contents('../config/beer.json'), TRUE); + } + + protected function _getCachePath() { + return '../cache/beer.%s'; + } + + protected function _fetchItems() { + $data = []; + foreach ($this->_groupConfig[$this->_feedGroup] as $feed) { + $this->_feed = $feed; + $data = array_merge($data, parent::_fetchItems()); + } + return $data; + } + + protected function _sortContent($content) { + usort($content, function($c1, $c2) { return $c2->Time - $c1->Time; }); + return $content; + } + +} + +?> |