2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2023-01-10 22:44:09 +00:00
|
|
|
|
|
|
|
namespace Shimmie2;
|
|
|
|
|
2021-03-14 23:43:50 +00:00
|
|
|
use MicroHTML\HTMLElement;
|
2022-10-27 16:21:46 +00:00
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
use function MicroHTML\INPUT;
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class FavoritesTheme extends Themelet
|
|
|
|
{
|
2024-01-20 14:10:59 +00:00
|
|
|
/**
|
|
|
|
* @param string[] $username_array
|
|
|
|
*/
|
2021-03-14 23:43:50 +00:00
|
|
|
public function display_people(array $username_array): void
|
2019-05-28 16:59:38 +00:00
|
|
|
{
|
|
|
|
global $page;
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$i_favorites = count($username_array);
|
|
|
|
$html = "$i_favorites people:";
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
reset($username_array); // rewind to first element in array.
|
2020-01-26 13:19:35 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
foreach ($username_array as $row) {
|
|
|
|
$username = html_escape($row);
|
|
|
|
$html .= "<br><a href='".make_link("user/$username")."'>$username</a>";
|
|
|
|
}
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block("Favorited By", $html, "left", 25));
|
|
|
|
}
|
2019-08-02 20:05:49 +00:00
|
|
|
|
2021-03-14 23:43:50 +00:00
|
|
|
public function get_help_html(): string
|
2019-08-02 20:05:49 +00:00
|
|
|
{
|
2020-10-26 15:15:51 +00:00
|
|
|
return '<p>Search for posts that have been favorited a certain number of times, or favorited by a particular individual.</p>
|
2019-08-02 20:05:49 +00:00
|
|
|
<div class="command_example">
|
2024-06-11 15:02:52 +00:00
|
|
|
<code>favorites=1</code>
|
2020-10-26 15:15:51 +00:00
|
|
|
<p>Returns posts that have been favorited once.</p>
|
2019-08-02 20:05:49 +00:00
|
|
|
</div>
|
|
|
|
<div class="command_example">
|
2024-06-11 15:02:52 +00:00
|
|
|
<code>favorites>0</code>
|
2020-10-26 15:15:51 +00:00
|
|
|
<p>Returns posts that have been favorited 1 or more times</p>
|
2019-08-02 20:05:49 +00:00
|
|
|
</div>
|
|
|
|
<p>Can use <, <=, >, >=, or =.</p>
|
|
|
|
<div class="command_example">
|
2024-06-11 15:02:52 +00:00
|
|
|
<code>favorited_by:username</code>
|
2020-10-26 15:15:51 +00:00
|
|
|
<p>Returns posts that have been favorited by "username". </p>
|
2019-08-02 20:05:49 +00:00
|
|
|
</div>
|
|
|
|
<div class="command_example">
|
2024-06-11 15:02:52 +00:00
|
|
|
<code>favorited_by_userno:123</code>
|
2020-10-26 15:15:51 +00:00
|
|
|
<p>Returns posts that have been favorited by user 123. </p>
|
2019-08-02 20:05:49 +00:00
|
|
|
</div>
|
|
|
|
';
|
|
|
|
}
|
2009-11-24 14:07:18 +00:00
|
|
|
}
|