From bcc5a4c29ec9178d7515c8b29d186f31bac4065b Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 16 Jan 2017 18:06:09 +0100 Subject: * cosmetic changes to the feed standard layout --- providers/Provider.php | 6 +++++- providers/Twitter.php | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'providers') diff --git a/providers/Provider.php b/providers/Provider.php index 0c3f344..02031ad 100644 --- a/providers/Provider.php +++ b/providers/Provider.php @@ -24,6 +24,8 @@ abstract class Provider { abstract protected function _spamFilter($items); + abstract protected function _sortContent($content); + protected function _getItems() { $cacheFile = sprintf($this->_getCachePath(), $this->_feed); $this->_cacheTime = file_exists($cacheFile) ? filemtime($cacheFile) : 0; @@ -42,13 +44,15 @@ abstract class Provider { if (isset($this->_options['spamfilter'])) { $items = $this->_spamFilter($items); } - return $items; + return $this->_sortContent($items); } public function cacheTime() { return $this->_cacheTime; } + abstract public function title(); + } ?> diff --git a/providers/Twitter.php b/providers/Twitter.php index 868bb28..e9b98e1 100644 --- a/providers/Twitter.php +++ b/providers/Twitter.php @@ -97,7 +97,6 @@ class Twitter extends \Providers\Provider { } } } - usort($filteredContent, function($c1, $c2) { return strcmp($c1->id_str, $c2->id_str); }); $content = $filteredContent; if ($spamHashes) { foreach ($spamHashes as $hash) { @@ -112,6 +111,15 @@ class Twitter extends \Providers\Provider { return $content; } + protected function _sortContent($content) { + usort($content, function($c1, $c2) { return strcmp($c2->id_str, $c1->id_str); }); + return $content; + } + + public function title() { + return sprintf("%s's timeline", $this->_feed); + } + } ?> -- cgit v1.2.3