From 1ad6acf37ca70eec7f394f26e244c15ce309d8a0 Mon Sep 17 00:00:00 2001 From: discomrade <83621080+discomrade@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:20:50 +0000 Subject: [PATCH] [themes] add search link to rating --- themes/danbooru/view.theme.php | 9 +++++---- themes/danbooru2/view.theme.php | 12 +++++------- themes/lite/view.theme.php | 9 +++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/themes/danbooru/view.theme.php b/themes/danbooru/view.theme.php index eed15aea..96fd7da5 100644 --- a/themes/danbooru/view.theme.php +++ b/themes/danbooru/view.theme.php @@ -53,11 +53,12 @@ class CustomViewPostTheme extends ViewPostTheme } if (Extension::is_enabled(RatingsInfo::KEY)) { - if ($image['rating'] === null || $image['rating'] == "?") { - $image['rating'] = "?"; + $rating = $image['rating']; + if ($rating === null) { + $rating = "?"; } - $h_rating = Ratings::rating_to_human($image['rating']); - $html .= "
Rating: $h_rating"; + $h_rating = Ratings::rating_to_human($rating); + $html .= "
Rating: $h_rating"; } return $html; diff --git a/themes/danbooru2/view.theme.php b/themes/danbooru2/view.theme.php index 3720f907..f81b0a0e 100644 --- a/themes/danbooru2/view.theme.php +++ b/themes/danbooru2/view.theme.php @@ -54,14 +54,12 @@ class CustomViewPostTheme extends ViewPostTheme } if (Extension::is_enabled(RatingsInfo::KEY)) { - if ($image['rating'] === null || $image['rating'] == "?") { - $image['rating'] = "?"; - } - // @phpstan-ignore-next-line - ??? - if (Extension::is_enabled(RatingsInfo::KEY)) { - $h_rating = Ratings::rating_to_human($image['rating']); - $html .= "
Rating: $h_rating"; + $rating = $image['rating']; + if ($rating === null) { + $rating = "?"; } + $h_rating = Ratings::rating_to_human($rating); + $html .= "
Rating: $h_rating"; } return $html; diff --git a/themes/lite/view.theme.php b/themes/lite/view.theme.php index 467477ea..5194fd99 100644 --- a/themes/lite/view.theme.php +++ b/themes/lite/view.theme.php @@ -58,11 +58,12 @@ class CustomViewPostTheme extends ViewPostTheme } if (Extension::is_enabled(RatingsInfo::KEY)) { - if ($image['rating'] === null || $image['rating'] == "?") { - $image['rating'] = "?"; + $rating = $image['rating']; + if ($rating === null) { + $rating = "?"; } - $h_rating = Ratings::rating_to_human($image['rating']); - $html .= "
Rating: $h_rating"; + $h_rating = Ratings::rating_to_human($rating); + $html .= "
Rating: $h_rating"; } return $html;