Image Widget - Version 3.3.5

Version Description

  • Fix filtered media library inserts thanks to @miraclemaker as well as @oxyc, @BjornW and innumerable others in the support forum (http://wordpress.org/support/topic/plugin-image-widget-add-image-upload-an-image-select-insert-into-widget-no-image-is-shown)
  • Adjusted HTTPS/SSL handling so that it's only applied in the view. ( thanks @TheFluffyDoneky and @aerobrent )
  • Added a filter for the image url: 'image_widget_image_url'
  • Add Dutch language translation ( thank you Carsten Alsemgeest - presis.nl )
  • Rename all language files to lowercase image_widget to match the localization string.
Download this release

Release Info

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

Code changes from version 3.3.4 to 3.3.5

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: Modern Tribe, Inc.
7
- Version: 3.3.4
8
  Author URI: http://tri.be
9
  */
10
 
@@ -24,7 +24,7 @@ add_action('widgets_init', 'tribe_load_image_widget');
24
  class Tribe_Image_Widget extends WP_Widget {
25
 
26
  /**
27
- * SP Image Widget constructor
28
  *
29
  * @author Modern Tribe, Inc. (Peter Chester)
30
  */
@@ -48,6 +48,7 @@ class Tribe_Image_Widget extends WP_Widget {
48
  add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 8 );
49
  add_filter( 'gettext', array( $this, 'replace_text_in_thickbox' ), 1, 3 );
50
  add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) );
 
51
  }
52
  $this->fix_async_upload_image();
53
  }
@@ -194,9 +195,11 @@ class Tribe_Image_Widget extends WP_Widget {
194
  function widget( $args, $instance ) {
195
  extract( $args );
196
  extract( $instance );
197
- $title = apply_filters( 'widget_title', empty( $title ) ? '' : $title );
198
-
199
- include( $this->getTemplateHierarchy( 'widget' ) );
 
 
200
  }
201
 
202
  /**
@@ -220,9 +223,6 @@ class Tribe_Image_Widget extends WP_Widget {
220
  $instance['link'] = $new_instance['link'];
221
  $instance['image'] = $new_instance['image'];
222
  $instance['imageurl'] = $this->get_image_url($new_instance['image'],$new_instance['width'],$new_instance['height']); // image resizing not working right now
223
- if( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ) {
224
- $instance['imageurl'] = str_replace('http://', 'https://', $instance['imageurl']);
225
- }
226
  $instance['linktarget'] = $new_instance['linktarget'];
227
  $instance['width'] = $new_instance['width'];
228
  $instance['height'] = $new_instance['height'];
@@ -272,6 +272,22 @@ class Tribe_Image_Widget extends WP_Widget {
272
  <?php
273
  }
274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  /**
276
  * Loads theme files in appropriate hierarchy: 1) child theme,
277
  * 2) parent template, 3) plugin resources. will look in the 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: Modern Tribe, Inc.
7
+ Version: 3.3.5
8
  Author URI: http://tri.be
9
  */
10
 
24
  class Tribe_Image_Widget extends WP_Widget {
25
 
26
  /**
27
+ * Tribe Image Widget constructor
28
  *
29
  * @author Modern Tribe, Inc. (Peter Chester)
30
  */
48
  add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 8 );
49
  add_filter( 'gettext', array( $this, 'replace_text_in_thickbox' ), 1, 3 );
50
  add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) );
51
+ add_filter( 'image_widget_image_url', array( $this, 'https_cleanup' ) );
52
  }
53
  $this->fix_async_upload_image();
54
  }
195
  function widget( $args, $instance ) {
196
  extract( $args );
197
  extract( $instance );
198
+ if ( !empty( $imageurl ) ) {
199
+ $title = apply_filters( 'widget_title', empty( $title ) ? '' : $title );
200
+ $imageurl = apply_filters( 'image_widget_image_url', $imageurl, $args, $instance );
201
+ include( $this->getTemplateHierarchy( 'widget' ) );
202
+ }
203
  }
204
 
205
  /**
223
  $instance['link'] = $new_instance['link'];
224
  $instance['image'] = $new_instance['image'];
225
  $instance['imageurl'] = $this->get_image_url($new_instance['image'],$new_instance['width'],$new_instance['height']); // image resizing not working right now
 
 
 
226
  $instance['linktarget'] = $new_instance['linktarget'];
227
  $instance['width'] = $new_instance['width'];
228
  $instance['height'] = $new_instance['height'];
272
  <?php
273
  }
274
 
275
+ /**
276
+ * Adjust the image url on output to account for SSL.
277
+ *
278
+ * @param string $imageurl
279
+ * @return string $imageurl
280
+ * @author Modern Tribe, Inc. (Peter Chester)
281
+ */
282
+ function https_cleanup( $imageurl = '' ) {
283
+ if( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ) {
284
+ $imageurl = str_replace('http://', 'https://', $imageurl);
285
+ } else {
286
+ $imageurl = str_replace('https://', 'http://', $imageurl);
287
+ }
288
+ return $imageurl;
289
+ }
290
+
291
  /**
292
  * Loads theme files in appropriate hierarchy: 1) child theme,
293
  * 2) parent template, 3) plugin resources. will look in the image-widget/
lang/{Image_Widget-de_DE.mo → image_widget-de_DE.mo} RENAMED
File without changes
lang/{Image_Widget-de_DE.po → image_widget-de_DE.po} RENAMED
File without changes
lang/{Image_Widget-fr_FR.mo → image_widget-fr_FR.mo} RENAMED
File without changes
lang/{Image_Widget-fr_FR.po → image_widget-fr_FR.po} RENAMED
File without changes
lang/{Image_Widget-ja.mo → image_widget-ja.mo} RENAMED
File without changes
lang/{Image_Widget-ja.po → image_widget-ja.po} RENAMED
File without changes
lang/image_widget-nl_NL.mo ADDED
Binary file
lang/image_widget-nl_NL.po ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Image Widget 3.1.3\n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2010-01-30 14:15+0100\n"
9
+ "PO-Revision-Date: 2012-06-06 10:49+0100\n"
10
+ "Last-Translator: Presis <contact@presis.nl>\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Poedit-Language: Dutch\n"
15
+ "X-Poedit-Country: DUTCH\n"
16
+ "X-Poedit-SourceCharset: iso-8859-1\n"
17
+ "X-Poedit-KeywordsList: __;_e\n"
18
+ "X-Poedit-Basepath: .\n"
19
+ "Language-Team: \n"
20
+
21
+ #: image-widget.php:33
22
+ msgid "Showcase a single image with a Title, URL, and a Description"
23
+ msgstr "Toon een afbeelding met een Titel, URL en een Omschrijving"
24
+
25
+ #: image-widget.php:35
26
+ msgid "Image Widget"
27
+ msgstr "Afbeelding"
28
+
29
+ #: image-widget.php:114
30
+ msgid "Insert Into Widget"
31
+ msgstr "In Widget invoegen"
32
+
33
+ #: image-widget.php:265
34
+ msgid "Title:"
35
+ msgstr "Titel:"
36
+
37
+ #: image-widget.php:268
38
+ msgid "Image:"
39
+ msgstr "Afbeelding:"
40
+
41
+ #: image-widget.php:272
42
+ msgid "Change Image"
43
+ msgstr "Afbeelding wijzigen"
44
+
45
+ #: image-widget.php:272
46
+ msgid "Add Image"
47
+ msgstr "Afbeelding kiezen"
48
+
49
+ #: image-widget.php:295
50
+ msgid "Caption:"
51
+ msgstr "Onderschrift:"
52
+
53
+ #: image-widget.php:298
54
+ msgid "Link:"
55
+ msgstr "Link:"
56
+
57
+ #: image-widget.php:301
58
+ msgid "Stay in Window"
59
+ msgstr "open in zelfde venster"
60
+
61
+ #: image-widget.php:302
62
+ msgid "Open New Window"
63
+ msgstr "open in nieuw venster"
64
+
65
+ #: image-widget.php:305
66
+ msgid "Width:"
67
+ msgstr "Breedte:"
68
+
69
+ #: image-widget.php:308
70
+ msgid "Height:"
71
+ msgstr "Hoogte:"
72
+
73
+ #: image-widget.php:311
74
+ msgid "Align:"
75
+ msgstr "Uitlijning:"
76
+
77
+ #: image-widget.php:313
78
+ msgid "none"
79
+ msgstr "geen"
80
+
81
+ #: image-widget.php:314
82
+ msgid "left"
83
+ msgstr "links"
84
+
85
+ #: image-widget.php:315
86
+ msgid "center"
87
+ msgstr "midden"
88
+
89
+ #: image-widget.php:316
90
+ msgid "right"
91
+ msgstr "rechts"
92
+
93
+ #: image-widget.php:331
94
+ msgid "Alternate Text:"
95
+ msgstr "Alternatieve tekst:"
96
+
lang/{Image_Widget-pl_PL.mo → image_widget-pl_PL.mo} RENAMED
File without changes
lang/{Image_Widget-pl_PL.po → image_widget-pl_PL.po} RENAMED
File without changes
lang/{Image_Widget-pt_BR.mo → image_widget-pt_BR.mo} RENAMED
File without changes
lang/{Image_Widget-pt_BR.po → image_widget-pt_BR.po} RENAMED
File without changes
lang/{Image_Widget-ro_RO.mo → image_widget-ro_RO.mo} RENAMED
File without changes
lang/{Image_Widget-ro_RO.po → image_widget-ro_RO.po} RENAMED
File without changes
lang/{Image_Widget-sv_SE.mo → image_widget-sv_SE.mo} RENAMED
File without changes
lang/{Image_Widget-sv_SE.po → image_widget-sv_SE.po} RENAMED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Image Widget ===
2
- Contributors: ModernTribe, peterchester, mattwiebe, Produced by Modern Tribe, Inc.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
4
- Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 3.0
6
- Tested up to: 3.3.1
7
- Stable tag: 3.3.4
8
 
9
  == Description ==
10
 
@@ -17,10 +17,11 @@ Simple image widget that uses native Wordpress upload thickbox to add image widg
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
  * Supports override of template so that you can override the template for your theme!
20
- * Supports HTTPS
21
 
22
  Supported Languages (feel free to contribute other languages):
23
 
 
24
  * French
25
  * German
26
  * Japanese
@@ -72,6 +73,14 @@ function my_template_filter($template) {
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
75
  = 3.3.4 =
76
 
77
  * Fix javascript bugs in the widget admin UI. ( thanks for filing this @joo-joo )
1
  === Image Widget ===
2
+ Contributors: ModernTribe, peterchester, mattwiebe
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6
4
+ Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize, french, german, japanese, portuguese, romanian, swedish, dutch, ssl, https
5
  Requires at least: 3.0
6
+ Tested up to: 3.4.1
7
+ Stable tag: 3.3.5
8
 
9
  == Description ==
10
 
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
  * Supports override of template so that you can override the template for your theme!
20
+ * Supports HTTPS/SSL image urls
21
 
22
  Supported Languages (feel free to contribute other languages):
23
 
24
+ * Dutch
25
  * French
26
  * German
27
  * Japanese
73
 
74
  == Changelog ==
75
 
76
+ = 3.3.5 =
77
+
78
+ * Fix filtered media library inserts thanks to @miraclemaker as well as @oxyc, @BjornW and innumerable others in the support forum (http://wordpress.org/support/topic/plugin-image-widget-add-image-upload-an-image-select-insert-into-widget-no-image-is-shown)
79
+ * Adjusted HTTPS/SSL handling so that it's only applied in the view. ( thanks @TheFluffyDoneky and @aerobrent )
80
+ * Added a filter for the image url: 'image_widget_image_url'
81
+ * Add Dutch language translation ( thank you Carsten Alsemgeest - presis.nl )
82
+ * Rename all language files to lowercase image_widget to match the localization string.
83
+
84
  = 3.3.4 =
85
 
86
  * Fix javascript bugs in the widget admin UI. ( thanks for filing this @joo-joo )
resources/js/image-widget-upload-fixer.js CHANGED
@@ -18,6 +18,35 @@ jQuery(document).ready(function() {
18
  }
19
  return true;
20
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  });
22
 
23
 
18
  }
19
  return true;
20
  });
21
+
22
+ //also update the filter form with a new hidden field
23
+ //is the filter form present on the page?
24
+ if (jQuery("form#filter").length>0) {
25
+
26
+ //code for retrieving GET vars (we want the value of widget_id)
27
+ var widget_id = '';
28
+ document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
29
+ function decode(s) {
30
+ return decodeURIComponent(s.split("+").join(" "));
31
+ }
32
+
33
+ var key = decode(arguments[1]);
34
+ if (key == 'widget_id') {
35
+ widget_id = decode(arguments[2]);
36
+ }
37
+ });
38
+
39
+ if (widget_id.length > 0) {//do we have a value?
40
+
41
+ //insert hidden field into form
42
+ jQuery('form#filter').append(
43
+ jQuery('<input/>')
44
+ .attr('type', 'hidden')
45
+ .attr('name', 'widget_id')
46
+ .val(widget_id)
47
+ );
48
+ }
49
+ }
50
  });
51
 
52
 
views/widget.php CHANGED
@@ -10,7 +10,7 @@ if ( !defined('ABSPATH') )
10
 
11
  echo $before_widget;
12
  if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
13
- if ( !empty( $image ) ) {
14
  if ( $link ) {
15
  echo '<a class="'.$this->widget_options['classname'].'-image-link" href="'.esc_url($link).'" target="'.esc_attr($linktarget).'">';
16
  }
@@ -32,7 +32,7 @@ if ( !empty( $image ) ) {
32
  echo " alt=\"{$alt}\"";
33
  } else {
34
  $title = esc_attr($title);
35
- echo " alt=\"{$title}\"";
36
  }
37
  echo " />";
38
  }
@@ -42,7 +42,7 @@ if ( !empty( $image ) ) {
42
  if ( !empty( $description ) ) {
43
  $text = apply_filters( 'widget_text', $description, $args, $instance );
44
  echo '<div class="'.$this->widget_options['classname'].'-description" >';
45
- echo wpautop( $text );
46
  echo "</div>";
47
  }
48
  echo $after_widget;
10
 
11
  echo $before_widget;
12
  if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
13
+ if ( !empty( $imageurl ) ) {
14
  if ( $link ) {
15
  echo '<a class="'.$this->widget_options['classname'].'-image-link" href="'.esc_url($link).'" target="'.esc_attr($linktarget).'">';
16
  }
32
  echo " alt=\"{$alt}\"";
33
  } else {
34
  $title = esc_attr($title);
35
+ echo " alt=\"{$title}\"";
36
  }
37
  echo " />";
38
  }
42
  if ( !empty( $description ) ) {
43
  $text = apply_filters( 'widget_text', $description, $args, $instance );
44
  echo '<div class="'.$this->widget_options['classname'].'-description" >';
45
+ echo wpautop( $text );
46
  echo "</div>";
47
  }
48
  echo $after_widget;