url = $url; $this->cache = Cache::getLazyCache(); } public function showDescription($bool) { $this->showDescription = $bool; } public function showContent($bool) { $this->showContent = $bool; } public function setCountPosts($count) { $this->count = $count; } public function get() { $cacheId = 'RSS_' . md5($this->url); $output = $this->cache->fetch($cacheId); if (!$output) { try { $content = Http::fetchRemoteFile($this->url, null, 0, 15); $rss = @simplexml_load_string($content); if ($rss === false) { throw new \Exception("Failed to parse XML."); } } catch (\Exception $e) { throw new \Exception("Error while importing feed: {$e->getMessage()}\n"); } $output = '
'; $this->cache->save($cacheId, $output, 60 * 60 * 24); } return $output; } private function addTargetBlankAndNoReferrerToLinks($content) { return str_replace('