forked from Cavemanon/cavepaintings
PSR-2. I'm not a huge fan, but ugly consistency beats no consistency...
This commit is contained in:
@@ -1,43 +1,48 @@
|
||||
<?php
|
||||
|
||||
class RandomListTheme extends Themelet {
|
||||
protected $search_terms;
|
||||
class RandomListTheme extends Themelet
|
||||
{
|
||||
protected $search_terms;
|
||||
|
||||
/**
|
||||
* #param string[] $search_terms
|
||||
*/
|
||||
public function set_page(array $search_terms) {
|
||||
$this->search_terms = $search_terms;
|
||||
}
|
||||
/**
|
||||
* #param string[] $search_terms
|
||||
*/
|
||||
public function set_page(array $search_terms)
|
||||
{
|
||||
$this->search_terms = $search_terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* #param Image[] $images
|
||||
*/
|
||||
public function display_page(Page $page, array $images) {
|
||||
$page->title = "Random Images";
|
||||
/**
|
||||
* #param Image[] $images
|
||||
*/
|
||||
public function display_page(Page $page, array $images)
|
||||
{
|
||||
$page->title = "Random Images";
|
||||
|
||||
$html = "<b>Refresh the page to view more images</b>";
|
||||
if (count($images)) {
|
||||
$html .= "<div class='shm-image-list'>";
|
||||
$html = "<b>Refresh the page to view more images</b>";
|
||||
if (count($images)) {
|
||||
$html .= "<div class='shm-image-list'>";
|
||||
|
||||
foreach ($images as $image)
|
||||
$html .= $this->build_thumb_html($image);
|
||||
foreach ($images as $image) {
|
||||
$html .= $this->build_thumb_html($image);
|
||||
}
|
||||
|
||||
$html .= "</div>";
|
||||
} else {
|
||||
$html .= "<br/><br/>No images were found to match the search criteria";
|
||||
}
|
||||
$html .= "</div>";
|
||||
} else {
|
||||
$html .= "<br/><br/>No images were found to match the search criteria";
|
||||
}
|
||||
|
||||
$page->add_block(new Block("Random Images", $html));
|
||||
$page->add_block(new Block("Random Images", $html));
|
||||
|
||||
$nav = $this->build_navigation($this->search_terms);
|
||||
$page->add_block(new Block("Navigation", $nav, "left", 0));
|
||||
}
|
||||
$nav = $this->build_navigation($this->search_terms);
|
||||
$page->add_block(new Block("Navigation", $nav, "left", 0));
|
||||
}
|
||||
|
||||
protected function build_navigation(array $search_terms): string {
|
||||
$h_search_string = html_escape(Tag::implode($search_terms));
|
||||
$h_search_link = make_link("random");
|
||||
$h_search = "
|
||||
protected function build_navigation(array $search_terms): string
|
||||
{
|
||||
$h_search_string = html_escape(Tag::implode($search_terms));
|
||||
$h_search_link = make_link("random");
|
||||
$h_search = "
|
||||
<p><form action='$h_search_link' method='GET'>
|
||||
<input type='search' name='search' value='$h_search_string' placeholder='Search random list' class='autocomplete_tags' autocomplete='off' />
|
||||
<input type='hidden' name='q' value='/random'>
|
||||
@@ -45,7 +50,6 @@ class RandomListTheme extends Themelet {
|
||||
</form>
|
||||
";
|
||||
|
||||
return $h_search;
|
||||
}
|
||||
return $h_search;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user