== Version 0.2.0 ==

* Changed the HTML generation to use a prototype theme engine. All HTML generation is now contained within {{{link_image.html.php}}}, which may be copied to the current theme folder and edited from there.

git-svn-id: file:///home/shish/svn/shimmie2/trunk@146 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
Artanis 2007-05-29 20:02:11 +00:00
parent 7d1e30413f
commit 53e5d9419a
3 changed files with 43 additions and 51 deletions

View file

@ -37,5 +37,5 @@
}
#link_to_image label:hover {
/*border-bottom:1px dashed;*/
border-bottom:1px dashed;
}

View file

@ -30,62 +30,46 @@ class LinkImage extends Extension {
}
}
private function get_html ($image) {
private function get_html($image) {
global $config;
$thumb_src = $image->get_thumb_link();
$image_src = $image->get_image_link();
$post_link = $image->get_short_link();
$text_link = $this->parse_link_template($config->get_string("ext_link-img_text-link_format"),$image);
$html = "<div id='link_to_image'>";
$html = "";
$html .= "<fieldset><legend><a href='http://en.wikipedia.org/wiki/Bbcode' target='_blank'>BBCode</a></legend>";
$html .= $this->link_code("Text Link", $this->ubb_url($post_link, $text_link), "ubb_text-link");
$html .= $this->link_code("Thumbnail Link", $this->ubb_url($post_link, $this->ubb_img($thumb_src)), "ubb_thumb-link");
$html .= $this->link_code("Inline Image", $this->ubb_img($image_src), "ubb_full-img");
$html .= "</fieldset>";
$html .= "<fieldset><legend><a href='http://en.wikipedia.org/wiki/Html' target='_blank'>HTML</a></legend>";
$html .= $this->link_code("Text Link", $this->html_url($post_link, $text_link), "html_text-link");
$html .= $this->link_code("Thumbnail Link", $this->html_url($post_link,$this->html_img($thumb_src)), "html_thumb-link");
$html .= $this->link_code("Inline Image", $this->html_img($image_src), "html_full-image");
$html .= "</fieldset>";
$html .= "<fieldset><legend>Plain Text</legend>";
$html .= $this->link_code("Post URL",$post_link,"text_post-link");
$html .= $this->link_code("Thumbnail URL",$thumb_src,"text_thumb-url");
$html .= $this->link_code("Image URL",$image_src,"text_image-src");
$html .= "</fieldset>";
$html .= "</div>";
if($this->get_HTML_PHP()) {
$html_gen = new LinkImageHTML($post_link, $image_src, $thumb_src, $text_link);
$html = $html_gen->getHTML();
}
return $html;
}
/* This function would do better generalized in the Extension class instead *
* of repeated in every extension. And probaly renamed, too... *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
private function get_HTML_PHP() {
global $config;
$theme = $config->get_string("theme");
private function ubb_url($link,$content) {
if ($content == NULL) { $content=$link; }
return "[url=".$link."]".$content."[/url]";
}
private function ubb_img($src) {
return "[img]".$src."[/img]";
}
private function html_url($link,$content) {
if ($content == NULL) { $content=$link; }
return "<a href=\"".$link."\">".$content."</a>";
}
private function html_img($src) {
return "<img src=\"".$src."\" />";
}
private function link_code($label,$content,$id=NULL) {
$control = "<label for='".$id."' title='Click to select the textbox'>$label</label>\n";
$control .= "<input type='text' readonly='readonly' id='".$id."' name='".$id."' value='".$content."' onfocus='this.select();'></input>\n";
$control .= "<br/>\n\n";
return $control;
if(file_exists("themes/$theme/link_image.html.php")) {
//$html .= "Using theme version";
include "themes/$theme/link_image.html.php";
} else if(file_exists("ext/link_image/link_image.html.php")) {
include "ext/link_image/link_image.html.php";
//$html .= "Using default generation in absense of themed generation.";
} else {
echo "<b>[Link to Image]<b> Error: <b>link_image.html.php</b> not found at either <b>ext/link_image/link_image.html.php</b> nor <b>themes/$theme/link_image.html.php</b>.<br/>".
"Please restore the default file to the former location, and copy it over to the latter if you wish to edit the html output of this extension.";
return false;
}
return true;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
private function parse_link_template($tmpl, $img) { //shamelessly copied from image.class.php
global $config;

View file

@ -25,14 +25,22 @@ To reset to the default, simply clear the current setting. Link to Image will th
To leave the setting blank for any reason, leave a space (' ') in it.
= Theming =
Link to Image now has a prototype theme engine built into it. All HTML generation has been moved to a seperate file.
To use this, copy link_image.html.php from {{{ext/link_image/}}} to {{{themes/$theme/}}}. You may then change the html output of Link to Image by editing this copy as it will be used in preference of the default.
= Install =
1. Copy the folder 'contrib/link_image' to 'ext'.
1. Copy the folder {{{contrib/link_image/}}} to {{{ext/}}}.
2. In the Config panel, make sure Base URL is set (you may as well set Data URL while you're there, if you haven't already.)
3. Make sure Image Link, Thumb Link, and Short Link all contain the full path ("http://" and onward,) either by using $base or plain text. Link to Image will not be able to retrieve the correct paths without these variables.
4. If you use .htaccess to make NiceURLs, make sure that a it allows access to the /ext/ folder, or else Link to Image will not be able to access ext/link_image/style.css.
* http://trac.shishnet.org/shimmie2/wiki/NiceURLs - Nice URLs
4. If you use .htaccess to make NiceURLs, make sure that a it allows access to the {{{ext/ folder}}}, or else Link to Image will not be able to access {{{ext/link_image/style.css}}}.
* http://trac.shishnet.org/shimmie2/wiki/NiceURLs - Nice URLs
* Recent changes to .htaccess (with its addition to the SVN) may make this step unnessasary.
= Change Log =
== Version 0.2.0 ==
* Changed the HTML generation to use a prototype theme engine. All HTML generation is now contained within {{{link_image.html.php}}}, which may be copied to the current theme folder and edited from there.
== Version 0.1.4 - 20071510 ==
* Style changes.
* Added output containing only the locations of the thumb, image and post.
@ -45,9 +53,9 @@ To leave the setting blank for any reason, leave a space (' ') in it.
* Created Readme.txt
* Merged 0.1.2 into 0.1.2b
* Removed uneeded documentation from main.php
* Rewrote the css to be unique. Previously used css I was wrote for elsewhere. Styled to reduce space consumption.
* Added code to insert the css import.
* Updated Nice URLs to allow access to the /ext/ folder. (Why is my stylesheet returning html instead of css?)
* Rewrote the css to be unique. Previously used CSS I wrote for elsewhere. Styled to reduce space consumption.
* Added code to insert the CSS import.
* Updated Nice URLs to allow access to the /ext/ folder. (Why is my stylesheet returning HTML instead of CSS?)
* First SVN update.
== Version 0.1.2b - 20070507 ==
@ -56,7 +64,7 @@ To leave the setting blank for any reason, leave a space (' ') in it.
* Updated to new extension format
* Created folder link_image in trunk/contrib
* Renamed link_image.ext.php to main.php and moved to /link_image/
* Created style.css { /* 404'd :|*/ }
* Created style.css {{{ /* 404'd :|*/ }}}.
* Documentation (different from mine.)
* Changed add_text_option() and added add_label() in SetupBuildingEvent because I was using an edited version of the function that shish didn't know about. It was a wonder that didn't throw massive errors.
* Published on SVN.