summaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-01-31 12:41:23 +0100
committeremkael <emkael@tlen.pl>2019-01-31 19:41:45 +0100
commita9aae4076e0068eaa3dd74b3577f0e528b3104a5 (patch)
treec88e13657dcf6cf31143bfc06c36045b51f4043b /providers
parent43b9e57aa7ec901150e60dd026cfab2ee227c45a (diff)
Deprecating FB API, motherfuckers
Diffstat (limited to 'providers')
-rw-r--r--providers/Facebook.php76
1 files changed, 0 insertions, 76 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php
deleted file mode 100644
index 013781b..0000000
--- a/providers/Facebook.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace Providers;
-
-require_once('Provider.php');
-require_once('Item.php');
-require_once('../lib/facebook-graph-sdk/src/Facebook/autoload.php');
-
-class Facebook extends \Providers\Provider {
-
- protected $_cacheTimeout = '5 minutes';
- private $_api;
- private $_config;
-
- public function __construct($feed, $options=[]) {
- parent::__construct($feed, $options);
- $this->_config = json_decode(file_get_contents('../config/facebook.json'), TRUE);
- $this->_api = new \Facebook\Facebook($this->_config);
- }
-
- protected function _getCachePath() {
- return '../cache/facebook.%s';
- }
-
- protected function _fetchItems() {
- $request = new \Facebook\FacebookRequest(
- $this->_api->getApp(),
- $this->_config['user_token'],
- 'GET',
- sprintf('/%s/posts', $this->_feed)
- );
- $data = $this->_api->getClient()->sendRequest($request)->getDecodedBody()['data'];
- return $data;
- }
-
- protected function _spamFilter($items) {
- return $items;
- }
-
- protected function _mapItems($content) {
- return array_map(
- function($i) {
- $item = new Item();
- $item->ID = $i['id'];
- $item->Title = str_replace(
- "\n", ' ',
- isset($i['story']) ? $i['story'] : (
- isset($i['message']) ? $i['message'] : $i['id']
- )
- );
- $item->Link = sprintf(
- 'https://facebook.com/%s',
- $i['id']
- );
- $item->Text = nl2br(
- isset($i['message']) ? $i['message'] : (
- isset($i['story']) ? $i['story'] : $i['id']
- )
- );
- $item->Time = strtotime($i['created_time']);
- return $item;
- }, $content
- );
- }
-
- protected function _sortContent($content) {
- return $content;
- }
-
- public function title() {
- return sprintf("%s's Facebook page posts", $this->_feed);
- }
-
-}
-
-?>