diff options
author | emkael <emkael@tlen.pl> | 2017-10-15 23:07:37 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-10-15 23:07:37 +0200 |
commit | 5da7c036422a8e5544da1da16e3ec7c5edb3c6a0 (patch) | |
tree | beb6c7d2b74b18fbde017d30c5bb2c8542258b75 | |
parent | c6ca59fcb238a2e408ccd20b31b75101e19a9242 (diff) |
* updates to RSS-to-RSS proxy
-rw-r--r-- | providers/Rss.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/providers/Rss.php b/providers/Rss.php index 6fdae6c..9f64088 100644 --- a/providers/Rss.php +++ b/providers/Rss.php @@ -7,8 +7,6 @@ require_once('Item.php'); class Rss extends \Providers\Provider { - protected $_cacheTimeout = '1 second'; - private $_feedUrl; private $_feedXml; @@ -61,7 +59,17 @@ class Rss extends \Providers\Provider { } public function title() { - return strval($this->_feedXml->title ?: $this->_feedXml->channel->title); + $cacheFile = sprintf($this->_getCachePath() . '.title', $this->_feed); + if (!file_exists($cacheFile)) { + $this->_fetchItems(); + } + if ($this->_feedXml) { + $title = strval($this->_feedXml->title ?: $this->_feedXml->channel->title); + file_put_contents($cacheFile, $title); + return $title; + } else { + return file_get_contents($cacheFile); + } } } |