summaryrefslogtreecommitdiff
path: root/app/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'app/Libraries')
-rw-r--r--app/Libraries/Helper.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/Libraries/Helper.php b/app/Libraries/Helper.php
index 8164887..924c1db 100644
--- a/app/Libraries/Helper.php
+++ b/app/Libraries/Helper.php
@@ -2,6 +2,7 @@
namespace App\Libraries;
use App\Libraries\Helper;
use Carbon\Carbon;
+use Rumenx\Feed\FeedFactory;
class Helper {
public static function escapeLike($string){
@@ -37,7 +38,7 @@ class Helper {
break;
}
// create new feed
- $feed = \App::make("feed");
+ $feed = FeedFactory::create();
// multiple feeds are supported
// if you are using caching you should set different cache keys for your feeds
@@ -50,13 +51,13 @@ class Helper {
{
// set your feed's title, description, link, pubdate and language
- $feed->title = $feed_title;
- $feed->description = $feed_description;
- #$feed->logo = 'http://yoursite.tld/logo.jpg';
- $feed->link = url('feed/' . $title);
+ $feed->setTitle($feed_title);
+ $feed->setDescription($feed_description);
+ #$feed->setLogo('http://yoursite.tld/logo.jpg');
+ $feed->setLink(url('feed/' . $title));
$feed->setDateFormat('datetime'); // 'datetime', 'timestamp' or 'carbon'
- $feed->pubdate = $model[0]->created_at;
- $feed->lang = 'en';
+ $feed->setPubdate($model[0]->created_at);
+ $feed->setLang('en');
$feed->setShortening(false); // true or false
if ( "mastodon" == $title || "mastodon_test" == $title ) {
@@ -172,7 +173,10 @@ class Helper {
// first param is the feed format
// optional: second param is cache duration (value of 0 turns off caching)
// optional: you can set custom cache key with 3rd param as string
- return $feed->render('atom', $cache, 'feed_' . $title);
+ $xml = $feed->render('atom', $cache, 'feed_' . $title);
+ return response($xml, 200, [
+ 'Content-Type' => 'application/xml'
+ ]);
}
public static function first_sentence($content, $max_len = NULL) {