forked from Cavemanon/cavepaintings
more tests, and make link to image work better
This commit is contained in:
@@ -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",
|
||||
"<fieldset>".
|
||||
"<legend><a href='http://en.wikipedia.org/wiki/Bbcode' target='_blank'>BBCode</a></legend>".
|
||||
$this->link_code("Text Link",$this->url($post_link, $text_link,"ubb"),"ubb_text-link").
|
||||
$this->link_code("Thumbnail Link",$this->url($post_link, $this->img($thumb_src,"ubb"),"ubb"),"ubb_thumb-link").
|
||||
$this->link_code("Inline Image", $this->img($image_src,"ubb"), "ubb_full-img").
|
||||
"</fieldset>".
|
||||
"
|
||||
<table><tr>
|
||||
|
||||
"<fieldset>".
|
||||
"<legend><a href='http://en.wikipedia.org/wiki/Html' target='_blank'>HTML</a></legend>".
|
||||
$this->link_code("Text Link", $this->url($post_link, $text_link,"html"), "html_text-link").
|
||||
$this->link_code("Thumbnail Link", $this->url($post_link,$this->img($thumb_src,"html"),"html"), "html_thumb-link").
|
||||
$this->link_code("Inline Image", $this->img($image_src,"html"), "html_full-image").
|
||||
"</fieldset>".
|
||||
<td><fieldset>
|
||||
<legend><a href='http://en.wikipedia.org/wiki/Bbcode' target='_blank'>BBCode</a></legend>
|
||||
<table>
|
||||
".
|
||||
$this->link_code("Link",$this->url($post_link, $text_link,"ubb"),"ubb_text-link").
|
||||
$this->link_code("Thumb",$this->url($post_link, $this->img($thumb_src,"ubb"),"ubb"),"ubb_thumb-link").
|
||||
$this->link_code("Image", $this->img($image_src,"ubb"), "ubb_full-img").
|
||||
"
|
||||
</table>
|
||||
</fieldset></td>
|
||||
|
||||
"<fieldset>".
|
||||
"<legend>Plain Text</legend>".
|
||||
$this->link_code("Post URL",$post_link,"text_post-link").
|
||||
$this->link_code("Thumbnail URL",$thumb_src,"text_thumb-url").
|
||||
$this->link_code("Image URL",$image_src,"text_image-src").
|
||||
"</fieldset>",
|
||||
<td><fieldset>
|
||||
<legend><a href='http://en.wikipedia.org/wiki/Html' target='_blank'>HTML</a></legend>
|
||||
<table>
|
||||
".
|
||||
$this->link_code("Link", $this->url($post_link, $text_link,"html"), "html_text-link").
|
||||
$this->link_code("Thumb", $this->url($post_link,$this->img($thumb_src,"html"),"html"), "html_thumb-link").
|
||||
$this->link_code("Image", $this->img($image_src,"html"), "html_full-image").
|
||||
"
|
||||
</table>
|
||||
</fieldset></td>
|
||||
|
||||
<td><fieldset>
|
||||
<legend>Plain Text</legend>
|
||||
<table>
|
||||
".
|
||||
$this->link_code("Link",$post_link,"text_post-link").
|
||||
$this->link_code("Thumb",$thumb_src,"text_thumb-url").
|
||||
$this->link_code("Image",$image_src,"text_image-src").
|
||||
"
|
||||
</table>
|
||||
</fieldset></td>
|
||||
|
||||
</tr></table>
|
||||
",
|
||||
"main",
|
||||
50));
|
||||
}
|
||||
|
||||
protected function url ($url,$content,$type) {
|
||||
if ($content == NULL) {$content=$url;}
|
||||
if ($content == NULL) {$content=$url;}
|
||||
|
||||
switch ($type) {
|
||||
case "html":
|
||||
@@ -62,9 +81,14 @@ class LinkImageTheme extends Themelet {
|
||||
return $text;
|
||||
}
|
||||
|
||||
protected function link_code($label,$content,$id=NULL) {
|
||||
return "<label for='".$id."' title='Click to select the textbox'>$label</label>\n".
|
||||
"<input type='text' readonly='readonly' id='".$id."' name='".$id."' value='".html_escape($content)."' onfocus='this.select();'></input>\n<br/>\n";
|
||||
protected function link_code($label,$content,$id=NULL) {
|
||||
return "
|
||||
<tr>
|
||||
<td><label for='".$id."' title='Click to select the textbox'>$label</label></td>
|
||||
<td><input type='text' readonly='readonly' id='".$id."' name='".$id."'
|
||||
value='".html_escape($content)."' onfocus='this.select();'></input></td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user