2022-01-30 18:02:52 -05:00
|
|
|
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
|
|
|
|
use App\Helpers\Misc;
|
|
|
|
use App\Models\FeedTemplate;
|
|
|
|
use App\Helpers\ErrorHandler;
|
|
|
|
use App\Helpers\RSS;
|
|
|
|
|
|
|
|
class TrendingController {
|
|
|
|
static public function get() {
|
2022-02-16 09:20:35 -05:00
|
|
|
$cursor = Misc::getCursor();
|
2022-01-30 18:02:52 -05:00
|
|
|
$api = Misc::api();
|
2022-02-16 09:20:35 -05:00
|
|
|
$feed = $api->getTrendingFeed($cursor);
|
2022-01-30 18:02:52 -05:00
|
|
|
if ($feed->meta->success) {
|
|
|
|
$latte = Misc::latte();
|
|
|
|
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
|
|
|
|
} else {
|
|
|
|
ErrorHandler::show($feed->meta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static public function rss() {
|
|
|
|
$api = Misc::api();
|
2022-02-16 09:20:35 -05:00
|
|
|
$feed = $api->getTrendingFeed();
|
2022-01-30 18:02:52 -05:00
|
|
|
if ($feed->meta->success) {
|
|
|
|
$feed = RSS::build('/trending', 'Trending', 'Tiktok trending', $feed->items);
|
|
|
|
// Setup headers
|
|
|
|
RSS::setHeaders('trending.rss');
|
|
|
|
echo $feed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|