Image to Post - random list

This commit is contained in:
Matthew Barbour 2020-10-26 10:18:13 -05:00
parent f497094482
commit 456176ac11
3 changed files with 9 additions and 9 deletions

View file

@ -9,8 +9,8 @@ class RandomListInfo extends ExtensionInfo
public $url = "http://www.drudexsoftware.com"; public $url = "http://www.drudexsoftware.com";
public $authors = ["Drudex Software"=>"support@drudexsoftware.com"]; public $authors = ["Drudex Software"=>"support@drudexsoftware.com"];
public $license = self::LICENSE_GPLV2; public $license = self::LICENSE_GPLV2;
public $description = "Allows displaying a page with random images"; public $description = "Allows displaying a page with random posts";
public $documentation = public $documentation =
"Random image list can be accessed through www.yoursite.com/random "Random post list can be accessed through www.yoursite.com/random
It is recommended that you create a link to this page so users know it exists."; It is recommended that you create a link to this page so users know it exists.";
} }

View file

@ -35,7 +35,7 @@ class RandomList extends Extension
$images_per_page = $config->get_int("random_images_list_count", 12); $images_per_page = $config->get_int("random_images_list_count", 12);
$random_images = []; $random_images = [];
// generate random images // generate random posts
for ($i = 0; $i < $images_per_page; $i++) { for ($i = 0; $i < $images_per_page; $i++) {
$random_image = Image::by_random($search_terms); $random_image = Image::by_random($search_terms);
if (!$random_image) { if (!$random_image) {
@ -57,12 +57,12 @@ class RandomList extends Extension
public function onSetupBuilding(SetupBuildingEvent $event) public function onSetupBuilding(SetupBuildingEvent $event)
{ {
$sb = new SetupBlock("Random Images List"); $sb = new SetupBlock("Random Posts List");
// custom headers // custom headers
$sb->add_int_option( $sb->add_int_option(
"random_images_list_count", "random_images_list_count",
"Amount of Random images to display " "Amount of Random posts to display "
); );
$event->panel->add_block($sb); $event->panel->add_block($sb);

View file

@ -17,9 +17,9 @@ class RandomListTheme extends Themelet
*/ */
public function display_page(Page $page, array $images) public function display_page(Page $page, array $images)
{ {
$page->title = "Random Images"; $page->title = "Random Posts";
$html = "<b>Refresh the page to view more images</b>"; $html = "<b>Refresh the page to view more posts</b>";
if (count($images)) { if (count($images)) {
$html .= "<div class='shm-image-list'>"; $html .= "<div class='shm-image-list'>";
@ -29,10 +29,10 @@ class RandomListTheme extends Themelet
$html .= "</div>"; $html .= "</div>";
} else { } else {
$html .= "<br/><br/>No images were found to match the search criteria"; $html .= "<br/><br/>No posts were found to match the search criteria";
} }
$page->add_block(new Block("Random Images", $html)); $page->add_block(new Block("Random Posts", $html));
$nav = $this->build_navigation($this->search_terms); $nav = $this->build_navigation($this->search_terms);
$page->add_block(new Block("Navigation", $nav, "left", 0)); $page->add_block(new Block("Navigation", $nav, "left", 0));