Add Patreon link and latest Cachet blog posts to dashboard

This commit is contained in:
James Brooks
2016-05-31 19:12:23 +01:00
parent 0190813012
commit f53075ec4f
5 changed files with 50 additions and 13 deletions

View File

@@ -15,6 +15,11 @@ use GuzzleHttp\Client;
use Illuminate\Contracts\Cache\Repository;
use SimpleXmlElement;
/**
* This is the feed class.
*
* @author James Brooks <james@alt-three.com>
*/
class Feed
{
/**
@@ -60,9 +65,11 @@ class Feed
public function entries()
{
return $this->cache->remember('feeds', 2880, function () {
return new SimpleXmlElement((new Client())->get($this->url, [
$xml = simplexml_load_string((new Client())->get($this->url, [
'headers' => ['Accept' => 'application/rss+xml', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'],
])->getBody()->getContents());
])->getBody()->getContents(), null, LIBXML_NOCDATA);
return json_decode(json_encode($xml));
});
}
}