From f7b2bfae9778af2c99e0c7fe7b2634e0f4f0973f Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 16 Jan 2017 22:04:21 +0100 Subject: * mapping twitter items to universal objects --- providers/Provider.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'providers/Provider.php') diff --git a/providers/Provider.php b/providers/Provider.php index 02031ad..2e14d2b 100644 --- a/providers/Provider.php +++ b/providers/Provider.php @@ -24,16 +24,18 @@ abstract class Provider { abstract protected function _spamFilter($items); + abstract protected function _mapItems($content); + abstract protected function _sortContent($content); protected function _getItems() { $cacheFile = sprintf($this->_getCachePath(), $this->_feed); $this->_cacheTime = file_exists($cacheFile) ? filemtime($cacheFile) : 0; if ($this->_cacheTime > strtotime('-' . $this->_cacheTimeout)) { - return json_decode($this->_getCache($cacheFile)); + return unserialize($this->_getCache($cacheFile)); } else { $content = $this->_fetchItems(); - file_put_contents($cacheFile, json_encode($content)); + file_put_contents($cacheFile, serialize($content)); $this->_cacheTime = time(); return $content; } @@ -44,7 +46,7 @@ abstract class Provider { if (isset($this->_options['spamfilter'])) { $items = $this->_spamFilter($items); } - return $this->_sortContent($items); + return $this->_sortContent($this->_mapItems($items)); } public function cacheTime() { -- cgit v1.2.3