This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/emoticons_list/theme.php
Shish f84bcaec01 microhtml for everything in <head>
I wanted to ensure that all pages (even the downtime page, terms page, home page, etc) had the appropriate `data-` attributes on `<body>` (because those are required for certain javascript, eg autocomplete, to work). One thing led to another and now everything in `head` is microhtml'ed
2024-06-21 18:52:05 +01:00

35 lines
808 B
PHP

<?php
declare(strict_types=1);
namespace Shimmie2;
use function MicroHTML\TITLE;
class EmoticonListTheme extends Themelet
{
/**
* @param string[] $list
*/
public function display_emotes(array $list): void
{
global $page;
$data_href = get_base_href();
$body = "<table><tr>";
$n = 1;
foreach ($list as $item) {
$name = pathinfo($item, PATHINFO_FILENAME);
$body .= "<td><img alt='$name' src='$data_href/$item'> :$name:</td>";
if ($n++ % 3 == 0) {
$body .= "</tr><tr>";
}
}
$body .= "</tr></table>";
$page->set_mode(PageMode::DATA);
$page->set_data((string)$page->html_html(
TITLE("Emoticon list"),
$body
));
}
}