diff --git a/core/basethemelet.php b/core/basethemelet.php index 7e424942..11c9e2dc 100644 --- a/core/basethemelet.php +++ b/core/basethemelet.php @@ -6,7 +6,7 @@ namespace Shimmie2; use MicroHTML\HTMLElement; -use function MicroHTML\{A,B,BR,IMG,emptyHTML}; +use function MicroHTML\{A,B,BR,IMG,emptyHTML,joinHTML}; /** * Class BaseThemelet @@ -135,19 +135,6 @@ class BaseThemelet return $paginator; } - protected function implode(string|HTMLElement $glue, array $pieces): HTMLElement - { - $out = emptyHTML(); - $n = 0; - foreach ($pieces as $piece) { - if ($n++ > 0) { - $out->appendChild($glue); - } - $out->appendChild($piece); - } - return $out; - } - private function build_paginator(int $current_page, int $total_pages, string $base_url, ?string $query, bool $show_random): HTMLElement { $next = $current_page + 1; @@ -175,10 +162,10 @@ class BaseThemelet foreach (range($start, $end) as $i) { $pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, (string)$i); } - $pages_html = $this->implode(" | ", $pages); + $pages_html = joinHTML(" | ", $pages); return emptyHTML( - $this->implode(" | ", [ + joinHTML(" | ", [ $first_html, $prev_html, $random_html, diff --git a/themes/danbooru/themelet.class.php b/themes/danbooru/themelet.class.php index de10b659..96675fa2 100644 --- a/themes/danbooru/themelet.class.php +++ b/themes/danbooru/themelet.class.php @@ -6,7 +6,7 @@ namespace Shimmie2; use MicroHTML\HTMLElement; -use function MicroHTML\{A, B, DIV}; +use function MicroHTML\{A, B, DIV, joinHTML}; class Themelet extends BaseThemelet { @@ -54,7 +54,7 @@ class Themelet extends BaseThemelet foreach (range($start, $end) as $i) { $pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, (string)$i); } - $pages_html = $this->implode(" ", $pages); + $pages_html = joinHTML(" ", $pages); if ($first_html) { $pdots = "..."; @@ -68,6 +68,6 @@ class Themelet extends BaseThemelet $ndots = ""; } - return DIV(["id"=>'paginator'], $this->implode(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); + return DIV(["id"=>'paginator'], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); } } diff --git a/themes/danbooru2/themelet.class.php b/themes/danbooru2/themelet.class.php index 7ba357ba..c1f45c89 100644 --- a/themes/danbooru2/themelet.class.php +++ b/themes/danbooru2/themelet.class.php @@ -6,7 +6,7 @@ namespace Shimmie2; use MicroHTML\HTMLElement; -use function MicroHTML\{A,B,DIV}; +use function MicroHTML\{A,B,DIV,joinHTML}; class Themelet extends BaseThemelet { @@ -54,7 +54,7 @@ class Themelet extends BaseThemelet foreach (range($start, $end) as $i) { $pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, (string)$i); } - $pages_html = $this->implode(" ", $pages); + $pages_html = joinHTML(" ", $pages); if ($first_html) { $pdots = "..."; @@ -68,6 +68,6 @@ class Themelet extends BaseThemelet $ndots = ""; } - return DIV(["id"=>"paginator"], $this->implode(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); + return DIV(["id"=>"paginator"], joinHTML(" ", [$prev_html, $first_html, $pdots, $pages_html, $ndots, $last_html, $next_html])); } } diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index cd0aed79..336cefff 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -6,7 +6,7 @@ namespace Shimmie2; use MicroHTML\HTMLElement; -use function MicroHTML\{A,DIV,SPAN}; +use function MicroHTML\{A,DIV,SPAN,joinHTML}; /** * Class Themelet @@ -83,7 +83,7 @@ class Themelet extends BaseThemelet $prev_html, $random_html, "<< ", - $this->implode(" ", $pages), + joinHTML(" ", $pages), " >>", $next_html, $last_html