proxitok/app/Controllers/TrendingController.php
2022-02-16 15:20:35 +01:00

33 lines
901 B
PHP

<?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() {
$cursor = Misc::getCursor();
$api = Misc::api();
$feed = $api->getTrendingFeed($cursor);
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();
$feed = $api->getTrendingFeed();
if ($feed->meta->success) {
$feed = RSS::build('/trending', 'Trending', 'Tiktok trending', $feed->items);
// Setup headers
RSS::setHeaders('trending.rss');
echo $feed;
}
}
}