2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2020-01-26 23:12:48 +00:00
|
|
|
use function MicroHTML\INPUT;
|
|
|
|
use function MicroHTML\TABLE;
|
|
|
|
use function MicroHTML\TR;
|
|
|
|
use function MicroHTML\TH;
|
|
|
|
use function MicroHTML\TD;
|
|
|
|
use function MicroHTML\SELECT;
|
|
|
|
use function MicroHTML\OPTION;
|
2019-06-24 15:05:16 +00:00
|
|
|
|
|
|
|
class MediaTheme extends Themelet
|
|
|
|
{
|
2019-06-25 20:17:13 +00:00
|
|
|
public function display_form(array $types)
|
|
|
|
{
|
2019-10-02 10:23:57 +00:00
|
|
|
global $page;
|
2019-06-24 15:05:16 +00:00
|
|
|
|
2020-01-26 23:12:48 +00:00
|
|
|
$select = SELECT(["name"=>"media_rescan_type"]);
|
|
|
|
$select->appendChild(OPTION(["value"=>""], "All"));
|
2019-06-25 20:17:13 +00:00
|
|
|
foreach ($types as $type) {
|
2020-01-26 23:12:48 +00:00
|
|
|
$select->appendChild(OPTION(["value"=>$type["ext"]], "{$type["ext"]} ({$type["count"]})"));
|
2019-06-25 20:17:13 +00:00
|
|
|
}
|
2020-01-26 23:12:48 +00:00
|
|
|
|
|
|
|
$html = (string)SHM_SIMPLE_FORM(
|
2020-01-30 10:31:11 +00:00
|
|
|
"admin/media_rescan",
|
2020-01-26 23:12:48 +00:00
|
|
|
"Use this to force scanning for media properties.",
|
|
|
|
TABLE(
|
|
|
|
["class"=>"form"],
|
|
|
|
TR(TH("Image Type"), TD($select)),
|
|
|
|
TR(TD(["colspan"=>"2"], SHM_SUBMIT('Scan Media Information')))
|
|
|
|
)
|
|
|
|
);
|
2019-06-25 20:17:13 +00:00
|
|
|
$page->add_block(new Block("Media Tools", $html));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_buttons_html(int $image_id): string
|
|
|
|
{
|
2020-01-26 23:12:48 +00:00
|
|
|
return (string)SHM_SIMPLE_FORM(
|
2020-01-30 10:31:11 +00:00
|
|
|
"media_rescan/",
|
2020-01-26 23:12:48 +00:00
|
|
|
INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]),
|
|
|
|
SHM_SUBMIT('Scan Media Properties'),
|
|
|
|
);
|
2019-06-25 20:17:13 +00:00
|
|
|
}
|
2019-08-02 20:05:49 +00:00
|
|
|
|
|
|
|
public function get_help_html()
|
|
|
|
{
|
|
|
|
return '<p>Search for items based on the type of media.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>content:audio</pre>
|
|
|
|
<p>Returns items that contain audio, including videos and audio files.</p>
|
2020-01-26 23:12:48 +00:00
|
|
|
</div>
|
2019-08-02 20:05:49 +00:00
|
|
|
<div class="command_example">
|
|
|
|
<pre>content:video</pre>
|
|
|
|
<p>Returns items that contain video, including animated GIFs.</p>
|
|
|
|
</div>
|
2020-01-26 23:12:48 +00:00
|
|
|
<p>These search terms depend on the items being scanned for media content. Automatic scanning was implemented in mid-2019, so items uploaded before, or items uploaded on a system without ffmpeg, will require additional scanning before this will work.</p>
|
2019-08-02 20:05:49 +00:00
|
|
|
';
|
|
|
|
}
|
2019-06-24 15:05:16 +00:00
|
|
|
}
|