Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[themes] more consistent naming #1338

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/themelet.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ private function get_common(): Themelet
return self::$common;
}

public function build_thumb_html(Image $image): HTMLElement
public function build_thumb(Image $image): HTMLElement
{
$c = self::get_common();
assert(is_a($c, CommonElementsTheme::class));
return $c->build_thumb_html($image);
return $c->build_thumb($image);
}

public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false): void
Expand Down
2 changes: 1 addition & 1 deletion ext/artists/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public function show_artist(array $artist, array $aliases, array $members, array
//we show the images for the artist
$artist_images = "";
foreach ($images as $image) {
$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);

$artist_images .= '<span class="thumb">'.
'<a href="$image_link">'.$thumb_html.'</a>'.
Expand Down
2 changes: 1 addition & 1 deletion ext/comment/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function display_comment_list(array $images, int $page_number, int $total
$image = $pair[0];
$comments = $pair[1];

$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);
$comment_html = "";

$comment_count = count($comments);
Expand Down
2 changes: 1 addition & 1 deletion ext/common_elements/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CommonElementsTheme extends Themelet
* Generic thumbnail code; returns HTML rather than adding
* a block since thumbs tend to go inside blocks...
*/
public function build_thumb_html(Image $image): HTMLElement
public function build_thumb(Image $image): HTMLElement
{
global $config;

Expand Down
2 changes: 1 addition & 1 deletion ext/image_view_counter/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function view_popular(array $images): void
global $page, $config;
$pop_images = "";
foreach ($images as $image) {
$pop_images .= $this->build_thumb_html($image) . "\n";
$pop_images .= $this->build_thumb($image) . "\n";
}

$page->set_title($config->get_string(SetupConfig::TITLE));
Expand Down
2 changes: 1 addition & 1 deletion ext/index/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function build_table(array $images, ?string $query): HTMLElement
$h_query = html_escape($query);
$table = "<div class='shm-image-list' data-query='$h_query'>";
foreach ($images as $image) {
$table .= $this->build_thumb_html($image);
$table .= $this->build_thumb($image);
}
$table .= "</div>";
return rawHTML($table);
Expand Down
4 changes: 2 additions & 2 deletions ext/notes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function display_note_list(array $images, int $pageNumber, int $totalPage
global $page;
$pool_images = '';
foreach ($images as $image) {
$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);

$pool_images .= '<span class="thumb">'.
' <a href="$image_link">'.$thumb_html.'</a>'.
Expand All @@ -101,7 +101,7 @@ public function display_note_requests(array $images, int $pageNumber, int $total

$pool_images = '';
foreach ($images as $image) {
$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);
$pool_images .= '<span class="thumb">'.
' <a href="$image_link">'.$thumb_html.'</a>'.
'</span>';
Expand Down
2 changes: 1 addition & 1 deletion ext/numeric_score/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function view_popular(array $images, string $totaldate, string $current,

$pop_images = "";
foreach ($images as $image) {
$pop_images .= $this->build_thumb_html($image)."\n";
$pop_images .= $this->build_thumb($image)."\n";
}

$b_dte = make_link("popular_by_$name", date($fmt, \Safe\strtotime("-1 $name", \Safe\strtotime($totaldate))));
Expand Down
8 changes: 4 additions & 4 deletions ext/pools/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function view_pool(Pool $pool, array $images, int $pageNumber, int $total

$image_list = DIV(["class" => "shm-image-list"]);
foreach ($images as $image) {
$image_list->appendChild($this->build_thumb_html($image));
$image_list->appendChild($this->build_thumb($image));
}

$page->add_block(new Block("Viewing Posts", $image_list, "main", 30));
Expand Down Expand Up @@ -249,7 +249,7 @@ function confirm_action() {
$image_list = DIV(["class" => "shm-image-list"]);
foreach ($images as $image) {
$image_list->appendChild(
SPAN(["class" => "thumb"], $this->build_thumb_html($image), BR(), INPUT(["type" => "checkbox", "name" => "check[]", "value" => $image->id])),
SPAN(["class" => "thumb"], $this->build_thumb($image), BR(), INPUT(["type" => "checkbox", "name" => "check[]", "value" => $image->id])),
);
}
$form->appendChild($image_list);
Expand Down Expand Up @@ -280,7 +280,7 @@ public function edit_order(Page $page, Pool $pool, array $images): void
foreach ($images as $i => $image) {
$image_list->appendChild(SPAN(
["class" => "thumb"],
$this->build_thumb_html($image),
$this->build_thumb($image),
INPUT(["type" => "number", "name" => "order_{$image->id}", "value" => $image['image_order'], "style" => "max-width: 50px;"]),
));
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public function edit_pool(Page $page, Pool $pool, array $images): void
foreach ($images as $image) {
$image_list->appendChild(SPAN(
["class" => "thumb"],
$this->build_thumb_html($image),
$this->build_thumb($image),
INPUT(["type" => "checkbox", "name" => "check[]", "value" => $image->id])
));
}
Expand Down
2 changes: 1 addition & 1 deletion ext/random_image/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function onPageRequest(PageRequestEvent $event): void
} elseif ($action === "widget") {
$page->set_mode(PageMode::DATA);
$page->set_mime(MimeType::HTML);
$page->set_data($this->theme->build_thumb_html($image));
$page->set_data($this->theme->build_thumb($image));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/random_list/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function display_page(Page $page, array $images): void
$html .= "<div class='shm-image-list'>";

foreach ($images as $image) {
$html .= $this->build_thumb_html($image);
$html .= $this->build_thumb($image);
}

$html .= "</div>";
Expand Down
2 changes: 1 addition & 1 deletion ext/regen_thumb/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function display_results(Page $page, Image $image): void
$page->set_title("Thumbnail Regenerated");
$page->add_html_header(META(['http-equiv' => 'cache-control', 'content' => 'no-cache']));
$page->add_block(new NavBlock());
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
$page->add_block(new Block("Thumbnail", $this->build_thumb($image)));
}

public function bulk_html(): string
Expand Down
6 changes: 3 additions & 3 deletions ext/relationships/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ private function get_parent_thumbnail_html(Image $image): HTMLElement
$parent_id = $image['parent_id'];
$parent_image = Image::by_id_ex($parent_id);

return $this->build_thumb_html($parent_image);
return $this->build_thumb($parent_image);
}

private function get_child_thumbnail_html(Image $image): HTMLElement
{
return $this->build_thumb_html($image);
return $this->build_thumb($image);
}

private function get_sibling_thumbnail_html(Image $image): string
Expand All @@ -116,7 +116,7 @@ private function get_sibling_thumbnail_html(Image $image): string
$html = "";

foreach ($siblings as $sibling) {
$html .= $this->build_thumb_html($sibling);
$html .= $this->build_thumb($sibling);
}

return $html;
Expand Down
2 changes: 1 addition & 1 deletion ext/replace_file/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function display_replace_page(Page $page, int $image_id): void
$max_kb = to_shorthand_int($max_size);

$image = Image::by_id_ex($image_id);
$thumbnail = $this->build_thumb_html($image);
$thumbnail = $this->build_thumb($image);

$form = SHM_FORM("replace/".$image_id, multipart: true);
$form->appendChild(emptyHTML(
Expand Down
2 changes: 1 addition & 1 deletion ext/report_image/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function display_reported_images(Page $page, array $reports): void
foreach ($reports as $report) {
$image = $report['image'];
$h_reason = format_text($report['reason']);
$image_link = $this->build_thumb_html($image);
$image_link = $this->build_thumb($image);

$reporter_name = html_escape($report['reporter_name']);
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
Expand Down
2 changes: 1 addition & 1 deletion ext/rss_images/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private function thumb(Image $image): string
$posted = date(DATE_RSS, \Safe\strtotime($image->posted));
$content = html_escape(
"<div>" .
"<p>" . $this->theme->build_thumb_html($image) . "</p>" .
"<p>" . $this->theme->build_thumb($image) . "</p>" .
"</div>"
);

Expand Down
2 changes: 1 addition & 1 deletion themes/danbooru/comment.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function display_comment_list(array $images, int $page_number, int $total
$image = $pair[0];
$comments = $pair[1];

$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);

$s = "&nbsp;&nbsp;&nbsp;";
$un = $image->get_owner()->name;
Expand Down
2 changes: 1 addition & 1 deletion themes/danbooru/index.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function build_table(array $images, ?string $query): HTMLElement
$h_query = html_escape($query);
$table = "<div class='shm-image-list' data-query='$h_query'>";
foreach ($images as $image) {
$table .= $this->build_thumb_html($image) . "\n";
$table .= $this->build_thumb($image) . "\n";
}
$table .= "</div>";
return rawHTML($table);
Expand Down
2 changes: 1 addition & 1 deletion themes/danbooru2/comment.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function display_comment_list(array $images, int $page_number, int $total
$image = $pair[0];
$comments = $pair[1];

$thumb_html = $this->build_thumb_html($image);
$thumb_html = $this->build_thumb($image);

$s = "&nbsp;&nbsp;&nbsp;";
$un = $image->get_owner()->name;
Expand Down
2 changes: 1 addition & 1 deletion themes/danbooru2/index.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function build_table(array $images, ?string $query): HTMLElement
$h_query = html_escape($query);
$table = "<div class='shm-image-list' data-query='$h_query'>";
foreach ($images as $image) {
$table .= $this->build_thumb_html($image) . "\n";
$table .= $this->build_thumb($image) . "\n";
}
$table .= "</div>";
return rawHTML($table);
Expand Down
2 changes: 1 addition & 1 deletion themes/futaba/comment.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function display_comment_list(array $images, int $page_number, int $total
$html .= "File: <a href=\"".make_link("post/view/{$image->id}")."\">$h_filename</a> - ($h_filesize, {$w}x{$h}) - ";
$html .= html_escape($image->get_tag_list());
$html .= "<div style='text-align: left'>";
$html .= "<div style='float: left;'>" . $this->build_thumb_html($image) . "</div>";
$html .= "<div style='float: left;'>" . $this->build_thumb($image) . "</div>";
$html .= "<div class='commentset'>$comment_html</div>";
$html .= "</div>";

Expand Down