proxitok/app/Controllers/TagController.php

33 lines
929 B
PHP
Raw Normal View History

2022-01-30 18:02:52 -05:00
<?php
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\RSS;
use App\Models\FeedTemplate;
class TagController {
static public function get(string $name) {
$cursor = Misc::getCursor();
$api = Misc::api();
2022-02-13 16:21:08 -05:00
$feed = $api->getHashtagFeed($name, $cursor);
2022-01-30 18:02:52 -05:00
if ($feed->meta->success) {
$latte = Misc::latte();
$latte->render(Misc::getView('tag'), new FeedTemplate('Tag', $feed));
} else {
ErrorHandler::show($feed->meta);
}
}
static public function rss(string $name) {
$api = Misc::api();
2022-02-13 16:21:08 -05:00
$feed = $api->getHashtagFeed($name);
2022-01-30 18:02:52 -05:00
if ($feed->meta->success) {
2022-02-13 16:21:08 -05:00
$feed = RSS::build("/tag/{$name}", "{$name} Tag", $feed->info->detail->desc, $feed->items);
2022-01-30 18:02:52 -05:00
// Setup headers
RSS::setHeaders('tag.rss');
echo $feed;
}
}
}