summaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-01-29 20:28:12 +0100
committeremkael <emkael@tlen.pl>2017-01-29 20:28:12 +0100
commitaa365cb876d24a8de7956028fb54eab5687f85e1 (patch)
tree5f41c8f8d29c31b65ed73943fa455d3e2009000e /providers
parent9a9c04512e5dcb77c7fe5d850e3f2a0250cc160e (diff)
* Facebook aggregate provider for beer-related pages
Diffstat (limited to 'providers')
-rw-r--r--providers/Beer.php37
1 files changed, 37 insertions, 0 deletions
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;
+ }
+
+}
+
+?>