diff --git a/core/block.php b/core/block.php
index 815dbfd0..2fdaa091 100644
--- a/core/block.php
+++ b/core/block.php
@@ -32,7 +32,7 @@ class Block
/**
* How far down the section the block should appear, higher
* numbers appear lower. The scale is 0-100 by convention,
- * though any number or string will work.
+ * though any number will work.
*
* @var int
*/
diff --git a/core/util.php b/core/util.php
index 4e3c333b..b3c78264 100644
--- a/core/util.php
+++ b/core/util.php
@@ -711,6 +711,11 @@ function SHM_SIMPLE_FORM($target, ...$children)
return $form;
}
+function SHM_SUBMIT(string $text)
+{
+ return INPUT(["type"=>"submit", "value"=>$text]);
+}
+
function SHM_COMMAND_EXAMPLE(string $ex, string $desc)
{
return DIV(
diff --git a/ext/admin/theme.php b/ext/admin/theme.php
index 4864f088..679ac382 100644
--- a/ext/admin/theme.php
+++ b/ext/admin/theme.php
@@ -1,4 +1,5 @@
add_block(new Block("Misc Admin Tools", $html));
- $html = make_form(make_link("admin/set_tag_case"), "POST");
- $html .= "";
- $html .= "";
- $html .= "\n";
+ $html = (string)SHM_SIMPLE_FORM(
+ make_link("admin/set_tag_case"),
+ INPUT(["type"=>'text', "name"=>'tag', "placeholder"=>'Enter tag with correct case', "class"=>'autocomplete_tags', "autocomplete"=>'off']),
+ SHM_SUBMIT('Set Tag Case'),
+ );
$page->add_block(new Block("Set Tag Case", $html));
}
}
diff --git a/ext/approval/theme.php b/ext/approval/theme.php
index 8328f9ba..482df536 100644
--- a/ext/approval/theme.php
+++ b/ext/approval/theme.php
@@ -1,26 +1,27 @@
approved===true) {
- $html = "
- ".make_form(make_link('disapprove_image/'.$image->id), 'POST')."
-
-
-
- ";
+ $html = SHM_SIMPLE_FORM(
+ make_link('disapprove_image/'.$image->id),
+ INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image->id]),
+ SHM_SUBMIT("Disapprove")
+ );
} else {
- $html = "
- ".make_form(make_link('approve_image/'.$image->id), 'POST')."
-
-
-
- ";
+ $html = SHM_SIMPLE_FORM(
+ make_link('approve_image/'.$image->id),
+ INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image->id]),
+ SHM_SUBMIT("Approve")
+ );
}
- return $html;
+ return (string)$html;
}
@@ -30,11 +31,11 @@ class ApprovalTheme extends Themelet
approved:yes
Returns images that have been approved.
-
+
approved:no
Returns images that have not been approved.
-
+
';
}
@@ -49,10 +50,12 @@ class ApprovalTheme extends Themelet
{
global $page;
- $html = make_form(make_link("admin/approval"), "POST");
- $html .= " ";
- $html .= "";
- $html .= "\n";
+ $html = (string)SHM_SIMPLE_FORM(
+ make_link("admin/approval"),
+ BUTTON(["name"=>'approval_action', "value"=>'approve_all'], "Approve All Images"),
+ BR(),
+ BUTTON(["name"=>'approval_action', "value"=>'disapprove_all'], "Disapprove All Images"),
+ );
$page->add_block(new Block("Approval", $html));
}
}
diff --git a/ext/featured/theme.php b/ext/featured/theme.php
index 0f2b45ca..2981283a 100644
--- a/ext/featured/theme.php
+++ b/ext/featured/theme.php
@@ -1,4 +1,5 @@
get_auth_html()."
-
-
-
- ";
+ return (string)SHM_SIMPLE_FORM(
+ make_link("featured_image/set"),
+ INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]),
+ INPUT(["type"=>'submit', "value"=>'Feature This']),
+ );
}
public function build_featured_html(Image $image, ?string $query=null): string
diff --git a/ext/media/main.php b/ext/media/main.php
index b29b88a6..60d0bb4a 100644
--- a/ext/media/main.php
+++ b/ext/media/main.php
@@ -136,7 +136,6 @@ class Media extends Extension
}
}
-
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
{
global $user;
@@ -145,11 +144,9 @@ class Media extends Extension
}
}
-
public function onBulkActionBlockBuilding(BulkActionBlockBuildingEvent $event)
{
global $user;
-
if ($user->can(Permissions::RESCAN_MEDIA)) {
$event->add_action("bulk_media_rescan", "Scan Media Properties");
}
@@ -282,11 +279,9 @@ class Media extends Extension
}
}
-
public function onTagTermParse(TagTermParseEvent $event)
{
$matches = [];
-
if (preg_match(self::CONTENT_SEARCH_TERM_REGEX, strtolower($event->term), $matches) && $event->parse) {
$event->metatag = true;
}
@@ -466,7 +461,7 @@ class Media extends Extension
}
}
- public static function determine_ext(String $format): String
+ public static function determine_ext(string $format): string
{
$format = self::normalize_format($format);
switch ($format) {
@@ -599,8 +594,8 @@ class Media extends Extension
}
public static function image_resize_convert(
- String $input_path,
- String $input_type,
+ string $input_path,
+ string $input_type,
int $new_width,
int $new_height,
string $output_filename,
@@ -687,7 +682,7 @@ class Media extends Extension
* @throws InsufficientMemoryException if the estimated memory usage exceeds the memory limit.
*/
public static function image_resize_gd(
- String $image_filename,
+ string $image_filename,
array $info,
int $new_width,
int $new_height,
@@ -847,7 +842,7 @@ class Media extends Extension
* @param String $image_filename The path of the file to check.
* @return bool true if the file is an animated gif, false if it is not.
*/
- public static function is_animated_gif(String $image_filename): bool
+ public static function is_animated_gif(string $image_filename): bool
{
$is_anim_gif = 0;
if (($fh = @fopen($image_filename, 'rb'))) {
@@ -865,7 +860,7 @@ class Media extends Extension
}
- private static function compare_file_bytes(String $file_name, array $comparison): bool
+ private static function compare_file_bytes(string $file_name, array $comparison): bool
{
$size = filesize($file_name);
if ($size < count($comparison)) {
@@ -897,17 +892,17 @@ class Media extends Extension
}
}
- public static function is_animated_webp(String $image_filename): bool
+ public static function is_animated_webp(string $image_filename): bool
{
return self::compare_file_bytes($image_filename, self::WEBP_ANIMATION_HEADER);
}
- public static function is_lossless_webp(String $image_filename): bool
+ public static function is_lossless_webp(string $image_filename): bool
{
return self::compare_file_bytes($image_filename, self::WEBP_LOSSLESS_HEADER);
}
- public static function supports_alpha(string $format)
+ public static function supports_alpha(string $format): bool
{
return in_array(self::normalize_format($format), self::ALPHA_FORMATS);
}
diff --git a/ext/media/theme.php b/ext/media/theme.php
index d00d0d1d..05c25d8f 100644
--- a/ext/media/theme.php
+++ b/ext/media/theme.php
@@ -1,4 +1,11 @@
";
- $html .= "
Image Type
";
- $html .= "
";
- $html .= "\n";
+
+ $html = (string)SHM_SIMPLE_FORM(
+ make_link("admin/media_rescan"),
+ "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')))
+ )
+ );
$page->add_block(new Block("Media Tools", $html));
}
public function get_buttons_html(int $image_id): string
{
- return "
- ".make_form(make_link("media_rescan/"))."
-
-
-
- ";
+ return (string)SHM_SIMPLE_FORM(
+ make_link("media_rescan/"),
+ INPUT(["type"=>'hidden', "name"=>'image_id', "value"=>$image_id]),
+ SHM_SUBMIT('Scan Media Properties'),
+ );
}
public function get_help_html()
@@ -35,12 +46,12 @@ class MediaTheme extends Themelet
content:audio
Returns items that contain audio, including videos and audio files.
-
+
content:video
Returns items that contain video, including animated GIFs.
-
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.
+
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.