forked from Cavemanon/cavepaintings
Lots of linting again.
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
|
||||
class RandomImage extends Extension {
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $database, $page, $user;
|
||||
global $page;
|
||||
|
||||
if($event->page_matches("random_image")) {
|
||||
$action = '';
|
||||
if($event->count_args() == 1) {
|
||||
@@ -34,7 +35,7 @@ class RandomImage extends Extension {
|
||||
$search_terms = explode(' ', $event->get_arg(1));
|
||||
}
|
||||
else {
|
||||
# FIXME: throw exception
|
||||
throw new SCoreException("Error: too many arguments.");
|
||||
}
|
||||
$image = Image::by_random($search_terms);
|
||||
|
||||
|
@@ -5,23 +5,24 @@ class RandomImageTheme extends Themelet {
|
||||
$page->add_block(new Block("Random Image", $this->build_random_html($image), "left", 8));
|
||||
}
|
||||
|
||||
public function build_random_html(Image $image, $query=null) {
|
||||
global $config;
|
||||
$i_id = int_escape($image->id);
|
||||
$h_view_link = make_link("post/view/$i_id", $query);
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
public function build_random_html(Image $image, $query=null)
|
||||
{
|
||||
|
||||
return "
|
||||
<center><div>
|
||||
$i_id = int_escape($image->id);
|
||||
$h_view_link = make_link("post/view/$i_id", $query);
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
|
||||
<a href='$h_view_link' style='position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
||||
<img id='thumb_rand_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
||||
</a>
|
||||
return "
|
||||
<center><div>
|
||||
|
||||
</div></center>
|
||||
";
|
||||
<a href='$h_view_link' style='position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
||||
<img id='thumb_rand_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
||||
</a>
|
||||
|
||||
</div></center>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user