diff --git a/contrib/featured/test.php b/contrib/featured/test.php new file mode 100644 index 00000000..8f700695 --- /dev/null +++ b/contrib/featured/test.php @@ -0,0 +1,23 @@ +log_in_as_user(); + $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); + $this->log_out(); + + $this->get_page("post/view/$image_id"); + $this->click("Feature This"); + + $this->get_page("post/list"); + $this->assertText("Featured Image"); + + $this->log_in_as_admin(); + $this->delete_image($image_id); + $this->log_out(); + + # after deletion, there should be no feature + $this->get_page("post/list"); + $this->assertNoText("Featured Image"); + } +} +?> diff --git a/contrib/link_image/_style.css b/contrib/link_image/_style.css deleted file mode 100644 index 472620f6..00000000 --- a/contrib/link_image/_style.css +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file may not be distributed without its readme.txt -**/ - -/* * * Link to Image * * */ -#Link_to_Image { - /* allows borders to encompass the content; */ - overflow:hidden; -} - -#Link_to_Image fieldset { - width: 32%; - float:left; - min-width:25em; -} - -#Link_to_Image input, #Link_to_Image label { - display:block; - width:66%; - float:left; - margin-bottom:2.5px; -} - -#Link_to_Image label { - width:30%; - text-align:left; - padding-right:2%; - cursor:pointer; -} -#Link_to_Image input { - font-size:0.7em; - font-family:courier, fixed, monospace; -} - -#Link_to_Image br { - clear:both; -} - -#Link_to_Image label:hover { - border-bottom:1px dashed; -} \ No newline at end of file diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php index 21b5aef3..45255132 100644 --- a/contrib/link_image/main.php +++ b/contrib/link_image/main.php @@ -12,9 +12,6 @@ class LinkImage implements Extension { if(is_null($this->theme)) $this->theme = get_theme_object($this); if(($event instanceof DisplayingImageEvent)) { - $data_href = get_base_href(); - $page->add_header("",0); - $this->theme->links_block($page, $this->data($event->image)); } if($event instanceof SetupBuildingEvent) { @@ -28,17 +25,27 @@ class LinkImage implements Extension { '$title - $id ($ext $size $filesize)'); } } + + private function hostify($str) { + $str = str_replace(" ", "%20", $str); + if(strpos($str, "ttp://") > 0) { + return $str; + } + else { + return "http://" . $_SERVER["HTTP_HOST"] . $str; + } + } private function data($image) { global $config; $text_link = $image->parse_link_template($config->get_string("ext_link-img_text-link_format")); - $text_link = $text_link==" "? null : $text_link; // null blank setting so the url gets filled in on the text links. + $text_link = trim($text_link) == "" ? null : $text_link; // null blank setting so the url gets filled in on the text links. return array( - 'thumb_src' => $image->get_thumb_link(), - 'image_src' => $image->get_image_link(), - 'post_link' => $image->get_short_link(), - 'text_link' => $text_link); + 'thumb_src' => $this->hostify($image->get_thumb_link()), + 'image_src' => $this->hostify($image->get_image_link()), + 'post_link' => $this->hostify($_SERVER["REQUEST_URI"]), + 'text_link' => $text_link); } } add_event_listener(new LinkImage()); diff --git a/contrib/link_image/theme.php b/contrib/link_image/theme.php index cbc4186e..a447f6a7 100644 --- a/contrib/link_image/theme.php +++ b/contrib/link_image/theme.php @@ -4,36 +4,55 @@ class LinkImageTheme extends Themelet { $thumb_src = $data['thumb_src']; $image_src = $data['image_src']; $post_link = $data['post_link']; - $text_link = $data['text_link']; + $text_link = $data['text_link']; + $page->add_block( new Block( "Link to Image", - "
". + " +- "", + | + + | + + |