More cleanup.

This commit is contained in:
flash 2022-06-10 20:48:32 +02:00
parent 7d6b94294f
commit 34bfb49a38

View file

@ -2,7 +2,6 @@
namespace Misuzu\SharpChat;
use Misuzu\MszContext;
use Index\Http\HttpFx; // this should be replaced with an interface that implements the routes stuff
// Replace
use Misuzu\AuthToken;
@ -44,37 +43,20 @@ final class SharpChatRoutes {
$response->setHeader('Access-Control-Allow-Origin', '*');
$response->setHeader('Access-Control-Allow-Methods', 'GET');
$version = 1;//(int)$request->getParam('v', FILTER_SANITIZE_NUMBER_INT);
$raw = Emoticon::all();
$out = [];
if($version >= 2) {
foreach($raw as $emote) {
$strings = [];
foreach($raw as $emote) {
$strings = [];
foreach($emote->getStrings() as $string)
$strings[] = $string->emote_string;
foreach($emote->getStrings() as $string)
$strings[] = sprintf(':%s:', $string->emote_string);
$out[] = [
's' => $strings,
'u' => $emote->getUrl(),
'r' => $emote->getRank(),
];
}
} else {
foreach($raw as $emote) {
$strings = [];
foreach($emote->getStrings() as $string)
$strings[] = sprintf(':%s:', $string->emote_string);
$out[] = [
'Text' => $strings,
'Image' => $emote->getUrl(),
'Hierarchy' => $emote->getRank(),
];
}
$out[] = [
'Text' => $strings,
'Image' => $emote->getUrl(),
'Hierarchy' => $emote->getRank(),
];
}
return $out;