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

44 lines
1.2 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
2020-06-02 23:08:24 +00:00
use function MicroHTML\INPUT;
class PrivateImageTheme extends Themelet
{
public function get_image_admin_html(Image $image): string
2020-06-02 23:08:24 +00:00
{
2023-11-11 21:49:12 +00:00
if ($image->private === false) {
2020-06-02 23:08:24 +00:00
$html = SHM_SIMPLE_FORM(
'privatize_image/'.$image->id,
2023-11-11 21:49:12 +00:00
INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image->id]),
2020-06-02 23:08:24 +00:00
SHM_SUBMIT("Make Private")
);
} else {
$html = SHM_SIMPLE_FORM(
'publicize_image/'.$image->id,
2023-11-11 21:49:12 +00:00
INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image->id]),
2020-06-02 23:08:24 +00:00
SHM_SUBMIT("Make Public")
);
}
return (string)$html;
}
public function get_help_html(): string
2020-06-02 23:08:24 +00:00
{
2020-10-26 15:17:47 +00:00
return '<p>Search for posts that are private/public.</p>
2020-06-02 23:08:24 +00:00
<div class="command_example">
<pre>private:yes</pre>
2020-10-26 15:17:47 +00:00
<p>Returns posts that are private, restricted to yourself if you are not an admin.</p>
2020-06-02 23:08:24 +00:00
</div>
<div class="command_example">
<pre>private:no</pre>
2020-10-26 15:17:47 +00:00
<p>Returns posts that are public.</p>
2020-06-02 23:08:24 +00:00
</div>
';
}
}