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/filter/theme.php

30 lines
977 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Shimmie2;
use function MicroHTML\{META};
class FilterTheme extends Themelet
{
public function addFilterBox(): void
{
global $config, $page, $user, $user_config;
// If user is not able to set their own filters, use the default filters.
if ($user->can(Permissions::CHANGE_USER_SETTING)) {
$tags = $user_config->get_string("filter_tags");
} else {
$tags = $config->get_string("filter_tags");
}
$html = "<noscript>Post filtering requires JavaScript</noscript>
<ul id='filter-list' class='list-bulleted'></ul>
<a id='disable-all-filters' style='display: none;' href='#'>Disable all</a>
<a id='re-enable-all-filters' style='display: none;' href='#'>Re-enable all</a>
";
$page->add_html_header(META(['id' => 'filter-tags', 'tags' => $tags]));
$page->add_block(new Block("Filters", $html, "left", 10));
}
}