Version Description
- Remove the "From URL" tab since it isn't supported.
- Replace "Insert into Post" with "Insert into Widget" in thickbox.
Download this release
Release Info
| Developer | peterchester |
| Plugin | |
| Version | 3.0.8 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.7 to 3.0.8
- image-widget.php +53 -4
- readme.txt +9 -4
image-widget.php
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
/*
|
| 3 |
Plugin Name: Image Widget
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/image-widget/
|
| 5 |
-
Description:
|
| 6 |
Author: Shane and Peter, Inc.
|
| 7 |
-
Version: 3.0.
|
| 8 |
Author URI: http://www.shaneandpeter.com
|
| 9 |
*/
|
| 10 |
|
|
@@ -38,8 +38,10 @@ class SP_Image_Widget extends WP_Widget {
|
|
| 38 |
wp_enqueue_style( 'thickbox' );
|
| 39 |
wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
|
| 40 |
add_action( 'admin_head-widgets.php', array( $this, 'admin_head' ) );
|
| 41 |
-
} elseif ( 'media-upload.php' == $pagenow ) {
|
| 42 |
add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 7 );
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
}
|
| 45 |
|
|
@@ -77,6 +79,38 @@ class SP_Image_Widget extends WP_Widget {
|
|
| 77 |
}
|
| 78 |
}
|
| 79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
/**
|
| 82 |
* Filter image_end_to_editor results
|
|
@@ -95,7 +129,7 @@ class SP_Image_Widget extends WP_Widget {
|
|
| 95 |
// Normally, media uploader return an HTML string (in this case, typically a complete image tag surrounded by a caption).
|
| 96 |
// Don't change that; instead, send custom javascript variables back to opener.
|
| 97 |
// Check that this is for the widget. Shouldn't hurt anything if it runs, but let's do it needlessly.
|
| 98 |
-
if (
|
| 99 |
?>
|
| 100 |
<script type="text/javascript">
|
| 101 |
// send image variables back to opener
|
|
@@ -113,6 +147,21 @@ class SP_Image_Widget extends WP_Widget {
|
|
| 113 |
}
|
| 114 |
return $html;
|
| 115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
/**
|
| 118 |
* Widget frontend output
|
| 2 |
/*
|
| 3 |
Plugin Name: Image Widget
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/image-widget/
|
| 5 |
+
Description: Simple image widget that uses native Wordpress upload thickbox to add image widgets to your site.
|
| 6 |
Author: Shane and Peter, Inc.
|
| 7 |
+
Version: 3.0.8
|
| 8 |
Author URI: http://www.shaneandpeter.com
|
| 9 |
*/
|
| 10 |
|
| 38 |
wp_enqueue_style( 'thickbox' );
|
| 39 |
wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
|
| 40 |
add_action( 'admin_head-widgets.php', array( $this, 'admin_head' ) );
|
| 41 |
+
} elseif ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) {
|
| 42 |
add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 7 );
|
| 43 |
+
add_filter( 'gettext', array( $this, 'replace_text_in_thitckbox' ), 1, 3 );
|
| 44 |
+
add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) );
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
| 79 |
}
|
| 80 |
}
|
| 81 |
}
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Test context to see if the uploader is being used for the image widget or for other regular uploads
|
| 85 |
+
*
|
| 86 |
+
* @return void
|
| 87 |
+
* @author Shane & Peter, Inc. (Peter Chester)
|
| 88 |
+
*/
|
| 89 |
+
public function is_sp_widget_context() {
|
| 90 |
+
if ( strpos($_SERVER['HTTP_REFERER'],$this->id_base) !== false || strpos($_REQUEST['_wp_http_referer'],$this->id_base) !== false ) {
|
| 91 |
+
return true;
|
| 92 |
+
} else {
|
| 93 |
+
return false;
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Somewhat hacky way of replacing "Insert into Post" with "Insert into Widget"
|
| 99 |
+
*
|
| 100 |
+
* @param string $translated_text text that has already been translated (normally passed straight through)
|
| 101 |
+
* @param string $source_text text as it is in the code
|
| 102 |
+
* @param string $domain domain of the text
|
| 103 |
+
* @return void
|
| 104 |
+
* @author Shane & Peter, Inc. (Peter Chester)
|
| 105 |
+
*/
|
| 106 |
+
public function replace_text_in_thitckbox($translated_text, $source_text, $domain) {
|
| 107 |
+
if ( $this->is_sp_widget_context() ) {
|
| 108 |
+
if ('Insert into Post' == $source_text) {
|
| 109 |
+
return __('Insert Into Widget', 'sp_image_widget' );
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
return $translated_text;
|
| 113 |
+
}
|
| 114 |
|
| 115 |
/**
|
| 116 |
* Filter image_end_to_editor results
|
| 129 |
// Normally, media uploader return an HTML string (in this case, typically a complete image tag surrounded by a caption).
|
| 130 |
// Don't change that; instead, send custom javascript variables back to opener.
|
| 131 |
// Check that this is for the widget. Shouldn't hurt anything if it runs, but let's do it needlessly.
|
| 132 |
+
if ( $this->is_sp_widget_context() ) {
|
| 133 |
?>
|
| 134 |
<script type="text/javascript">
|
| 135 |
// send image variables back to opener
|
| 147 |
}
|
| 148 |
return $html;
|
| 149 |
}
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Remove from url tab until that functionality is added to widgets.
|
| 153 |
+
*
|
| 154 |
+
* @param array $tabs
|
| 155 |
+
* @return void
|
| 156 |
+
* @author Shane & Peter, Inc. (Peter Chester)
|
| 157 |
+
*/
|
| 158 |
+
public function media_upload_tabs($tabs) {
|
| 159 |
+
if ( $this->is_sp_widget_context() ) {
|
| 160 |
+
unset($tabs['type_url']);
|
| 161 |
+
return $tabs;
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
|
| 166 |
/**
|
| 167 |
* Widget frontend output
|
readme.txt
CHANGED
|
@@ -3,18 +3,18 @@ Contributors: Shane & Peter, Inc.
|
|
| 3 |
Donate link: http://www.shaneandpeter.com
|
| 4 |
Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
|
| 5 |
Requires at least: 2.8
|
| 6 |
-
Tested up to: 2.
|
| 7 |
-
Stable tag: 3.0.
|
| 8 |
|
| 9 |
== Description ==
|
| 10 |
|
| 11 |
-
Simple image widget
|
| 12 |
|
| 13 |
* MU Compatible
|
| 14 |
* Handles image resizing and alignment
|
| 15 |
* Link the image
|
| 16 |
* Title and Description
|
| 17 |
-
* Very
|
| 18 |
* Upload, link to external image, or select an image from your media collection using the built in thickbox browser.
|
| 19 |
|
| 20 |
== Installation ==
|
|
@@ -35,6 +35,11 @@ If you find any bugs or have any ideas, please mail us.
|
|
| 35 |
|
| 36 |
== Changelog ==
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
= 3.0.7 =
|
| 39 |
|
| 40 |
* Fix Dean's Fcuk editor conflict. (Thanks for the report Laurie L_T_G)
|
| 3 |
Donate link: http://www.shaneandpeter.com
|
| 4 |
Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
|
| 5 |
Requires at least: 2.8
|
| 6 |
+
Tested up to: 2.9
|
| 7 |
+
Stable tag: 3.0.8
|
| 8 |
|
| 9 |
== Description ==
|
| 10 |
|
| 11 |
+
Simple image widget that uses native Wordpress upload thickbox to add image widgets to your site.
|
| 12 |
|
| 13 |
* MU Compatible
|
| 14 |
* Handles image resizing and alignment
|
| 15 |
* Link the image
|
| 16 |
* Title and Description
|
| 17 |
+
* Very versatile. All fields are optional.
|
| 18 |
* Upload, link to external image, or select an image from your media collection using the built in thickbox browser.
|
| 19 |
|
| 20 |
== Installation ==
|
| 35 |
|
| 36 |
== Changelog ==
|
| 37 |
|
| 38 |
+
= 3.0.8 =
|
| 39 |
+
|
| 40 |
+
* Remove the "From URL" tab since it isn't supported.
|
| 41 |
+
* Replace "Insert into Post" with "Insert into Widget" in thickbox.
|
| 42 |
+
|
| 43 |
= 3.0.7 =
|
| 44 |
|
| 45 |
* Fix Dean's Fcuk editor conflict. (Thanks for the report Laurie L_T_G)
|
