Image Widget - Version 3.1.4

Version Description

  • Added support for ALT tags. If no alt tag is entered the title is used.
Download this release

Release Info

Developer peterchester
Plugin Icon 128x128 Image Widget
Version 3.1.4
Comparing to
See all releases

Code changes from version 3.1.3 to 3.1.4

image-widget.js CHANGED
@@ -22,7 +22,10 @@ function send_to_editor(h) {
22
  jQuery( '#widget-'+self.IW_instance+'-title' ).val(self.IW_title);
23
 
24
  // set caption in widget
25
- jQuery( '#widget-'+self.IW_instance+'-description' ).val(self.IW_alt);
 
 
 
26
 
27
  // set link in widget
28
  jQuery( '#widget-'+self.IW_instance+'-link' ).val(self.IW_url);
22
  jQuery( '#widget-'+self.IW_instance+'-title' ).val(self.IW_title);
23
 
24
  // set caption in widget
25
+ jQuery( '#widget-'+self.IW_instance+'-description' ).val(self.IW_caption);
26
+
27
+ // set alt text in widget
28
+ jQuery( '#widget-'+self.IW_instance+'-alt' ).val(self.IW_alt);
29
 
30
  // set link in widget
31
  jQuery( '#widget-'+self.IW_instance+'-link' ).val(self.IW_url);
image-widget.php CHANGED
@@ -4,7 +4,7 @@ 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.1.3
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
@@ -42,7 +42,7 @@ class SP_Image_Widget extends WP_Widget {
42
  wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
43
  add_action( 'admin_head-widgets.php', array( $this, 'admin_head' ) );
44
  } elseif ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) {
45
- add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 7 );
46
  add_filter( 'gettext', array( $this, 'replace_text_in_thitckbox' ), 1, 3 );
47
  add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) );
48
  }
@@ -135,11 +135,12 @@ class SP_Image_Widget extends WP_Widget {
135
  * @return string javascript array of attachment url and id or just the url
136
  * @author Shane & Peter, Inc. (Peter Chester)
137
  */
138
- function image_send_to_editor( $html, $id, $alt, $title, $align, $url, $size ) {
139
  // Normally, media uploader return an HTML string (in this case, typically a complete image tag surrounded by a caption).
140
  // Don't change that; instead, send custom javascript variables back to opener.
141
  // Check that this is for the widget. Shouldn't hurt anything if it runs, but let's do it needlessly.
142
  if ( $this->is_sp_widget_context() ) {
 
143
  ?>
144
  <script type="text/javascript">
145
  // send image variables back to opener
@@ -147,6 +148,7 @@ class SP_Image_Widget extends WP_Widget {
147
  win.IW_html = '<?php echo addslashes($html) ?>';
148
  win.IW_img_id = '<?php echo $id ?>';
149
  win.IW_alt = '<?php echo addslashes($alt) ?>';
 
150
  win.IW_title = '<?php echo addslashes($title) ?>';
151
  win.IW_align = '<?php echo $align ?>';
152
  win.IW_url = '<?php echo $url ?>';
@@ -191,7 +193,7 @@ class SP_Image_Widget extends WP_Widget {
191
  echo '<a class="'.$this->widget_options['classname'].'-image-link" href="'.$instance['link'].'" target="'.$instance['linktarget'].'">';
192
  }
193
  if ($instance['imageurl']) {
194
- echo "<img src=\"{$instance['imageurl']}\" alt=\"{$instance['title']}\" style=\"";
195
  if (!empty($instance['width']) && is_numeric($instance['width'])) {
196
  echo "max-width: {$instance['width']}px;";
197
  }
@@ -202,6 +204,11 @@ class SP_Image_Widget extends WP_Widget {
202
  if (!empty($instance['align']) && $instance['align'] != 'none') {
203
  echo " class=\"align{$instance['align']}\"";
204
  }
 
 
 
 
 
205
  echo " />";
206
  }
207
 
@@ -241,6 +248,7 @@ class SP_Image_Widget extends WP_Widget {
241
  $instance['width'] = $new_instance['width'];
242
  $instance['height'] = $new_instance['height'];
243
  $instance['align'] = $new_instance['align'];
 
244
 
245
  return $instance;
246
  }
@@ -263,7 +271,8 @@ class SP_Image_Widget extends WP_Widget {
263
  'height' => '',
264
  'image' => '',
265
  'imageurl' => '',
266
- 'align' => ''
 
267
  ) );
268
  ?>
269
 
@@ -321,6 +330,8 @@ class SP_Image_Widget extends WP_Widget {
321
  <option value="right"<?php selected( $instance['align'], 'right' ); ?>><?php _e('right', $this->pluginDomain); ?></option>
322
  </select></p>
323
 
 
 
324
  <?php
325
  }
326
 
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.1.4
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
42
  wp_enqueue_script( $control_ops['id_base'], WP_PLUGIN_URL.'/image-widget/image-widget.js',array('thickbox'), false, true );
43
  add_action( 'admin_head-widgets.php', array( $this, 'admin_head' ) );
44
  } elseif ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) {
45
+ add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 8 );
46
  add_filter( 'gettext', array( $this, 'replace_text_in_thitckbox' ), 1, 3 );
47
  add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) );
48
  }
135
  * @return string javascript array of attachment url and id or just the url
136
  * @author Shane & Peter, Inc. (Peter Chester)
137
  */
138
+ function image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
139
  // Normally, media uploader return an HTML string (in this case, typically a complete image tag surrounded by a caption).
140
  // Don't change that; instead, send custom javascript variables back to opener.
141
  // Check that this is for the widget. Shouldn't hurt anything if it runs, but let's do it needlessly.
142
  if ( $this->is_sp_widget_context() ) {
143
+ if ($alt=='') $alt = $title;
144
  ?>
145
  <script type="text/javascript">
146
  // send image variables back to opener
148
  win.IW_html = '<?php echo addslashes($html) ?>';
149
  win.IW_img_id = '<?php echo $id ?>';
150
  win.IW_alt = '<?php echo addslashes($alt) ?>';
151
+ win.IW_caption = '<?php echo addslashes($caption) ?>';
152
  win.IW_title = '<?php echo addslashes($title) ?>';
153
  win.IW_align = '<?php echo $align ?>';
154
  win.IW_url = '<?php echo $url ?>';
193
  echo '<a class="'.$this->widget_options['classname'].'-image-link" href="'.$instance['link'].'" target="'.$instance['linktarget'].'">';
194
  }
195
  if ($instance['imageurl']) {
196
+ echo "<img src=\"{$instance['imageurl']}\" style=\"";
197
  if (!empty($instance['width']) && is_numeric($instance['width'])) {
198
  echo "max-width: {$instance['width']}px;";
199
  }
204
  if (!empty($instance['align']) && $instance['align'] != 'none') {
205
  echo " class=\"align{$instance['align']}\"";
206
  }
207
+ if (!empty($instance['alt'])) {
208
+ echo " alt=\"{$instance['alt']}\"";
209
+ } else {
210
+ echo " alt=\"{$instance['title']}\"";
211
+ }
212
  echo " />";
213
  }
214
 
248
  $instance['width'] = $new_instance['width'];
249
  $instance['height'] = $new_instance['height'];
250
  $instance['align'] = $new_instance['align'];
251
+ $instance['alt'] = $new_instance['alt'];
252
 
253
  return $instance;
254
  }
271
  'height' => '',
272
  'image' => '',
273
  'imageurl' => '',
274
+ 'align' => '',
275
+ 'alt' => ''
276
  ) );
277
  ?>
278
 
330
  <option value="right"<?php selected( $instance['align'], 'right' ); ?>><?php _e('right', $this->pluginDomain); ?></option>
331
  </select></p>
332
 
333
+ <p><label for="<?php echo $this->get_field_id('alt'); ?>"><?php _e('Alternate Text:', $this->pluginDomain); ?></label>
334
+ <input id="<?php echo $this->get_field_id('alt'); ?>" name="<?php echo $this->get_field_name('alt'); ?>" type="text" value="<?php echo esc_attr(strip_tags($instance['alt'])); ?>" /></p>
335
  <?php
336
  }
337
 
lang/SP_Image_Widget-de_DE.mo CHANGED
Binary file
lang/SP_Image_Widget-de_DE.po CHANGED
@@ -1,4 +1,4 @@
1
- # Translation of the Image Widget 3.1.3 WordPress plugin.
2
  # This file is distributed under the same license as the the Image Widget package.
3
  # Rüdiger Weiß <ruediger@mac.com>, 2010.
4
  #
@@ -91,3 +91,6 @@ msgstr "zentriert"
91
  msgid "right"
92
  msgstr "rechts"
93
 
 
 
 
1
+ # Translation of the Image Widget 3.1.4 WordPress plugin.
2
  # This file is distributed under the same license as the the Image Widget package.
3
  # Rüdiger Weiß <ruediger@mac.com>, 2010.
4
  #
91
  msgid "right"
92
  msgstr "rechts"
93
 
94
+ #: image-widget.php:331
95
+ msgid "Alternate Text:"
96
+ msgstr "Alternativer Text"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 2.8
6
  Tested up to: 2.9.1.1
7
- Stable tag: 3.1.3
8
 
9
  == Description ==
10
 
@@ -16,10 +16,11 @@ Simple image widget that uses native Wordpress upload thickbox to add image widg
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
  This plugin is actively supported and we will do our best to help you. In return we simply as 3 things:
21
 
22
- 1. Help Out. If you see a question on the forum you can help with or have a great idea and want to code it up and submit a patch, that would be just plain awesome and we will shower your with praise. Might even be a good way to get to know us and lead to some paid work if you freelance.
23
  1. Donate - if this is generating enough revenue to support our time it makes all the difference in the world
24
  https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
25
 
@@ -43,6 +44,10 @@ Please visit the forum for questions or comments: http://wordpress.org/tags/imag
43
 
44
  == Changelog ==
45
 
 
 
 
 
46
  = 3.1.3 =
47
 
48
  * Added German language support (Thank you Rüdiger Weiß!!!)
4
  Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 2.8
6
  Tested up to: 2.9.1.1
7
+ Stable tag: 3.1.4
8
 
9
  == Description ==
10
 
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
+ * Language Support for German (feel free to contribute other languages)
20
 
21
  This plugin is actively supported and we will do our best to help you. In return we simply as 3 things:
22
 
23
+ 1. Help Out. If you see a question on the forum you can help with or have a great idea and want to code it up and submit a patch, that would be just plain awesome and we will shower your with praise. Might even be a good way to get to know us and lead to some paid work if you freelance. Also, we are happy to post translations if you provide them.
24
  1. Donate - if this is generating enough revenue to support our time it makes all the difference in the world
25
  https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
26
 
44
 
45
  == Changelog ==
46
 
47
+ = 3.1.4 =
48
+
49
+ * Added support for ALT tags. If no alt tag is entered the title is used.
50
+
51
  = 3.1.3 =
52
 
53
  * Added German language support (Thank you Rüdiger Weiß!!!)