Image Widget - Version 3.2.7

Version Description

  • Update javascript to work with the new version of WordPress (thanks Matt Wiebe!!! @mattwiebe)
  • Added Japanese translation courtesy of Takayuki Miyauchi (@miya0001)
Download this release

Release Info

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

Code changes from version 3.2.5 to 3.2.7

image-widget.js CHANGED
@@ -1,105 +1,108 @@
1
- function set_active_widget(instance_id) {
2
- self.IW_instance = instance_id;
3
- }
4
-
5
- function image_widget_send_to_editor(h) {
6
- // ignore content returned from media uploader and use variables passed to window instead
7
-
8
- // store attachment id in hidden field
9
- jQuery( '#widget-'+self.IW_instance+'-image' ).val( self.IW_img_id );
10
-
11
- // display attachment preview
12
- jQuery( '#display-widget-'+self.IW_instance+'-image' ).html( self.IW_html );
13
-
14
- // change width & height fields in widget to match image
15
- jQuery( '#widget-'+self.IW_instance+'-width' ).val(jQuery( '#display-widget-'+self.IW_instance+'-image img').attr('width'));
16
- jQuery( '#widget-'+self.IW_instance+'-height' ).val(jQuery( '#display-widget-'+self.IW_instance+'-image img').attr('height'));
17
-
18
- // set alignment in widget
19
- jQuery( '#widget-'+self.IW_instance+'-align' ).val(self.IW_align);
20
-
21
- // set title in widget
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);
32
-
33
- // close thickbox
34
- tb_remove();
35
-
36
- // change button text
37
- jQuery('#add_image-widget-'+self.IW_instance+'-image').html(jQuery('#add_image-widget-'+self.IW_instance+'-image').html().replace(/Add Image/g, 'Change Image'));
38
- }
39
-
40
- function changeImgWidth(instance) {
41
- var width = jQuery( '#widget-'+instance+'-width' ).val();
42
- var height = Math.round(width / imgRatio(instance));
43
- changeImgSize(instance,width,height);
44
- }
45
-
46
- function changeImgHeight(instance) {
47
- var height = jQuery( '#widget-'+instance+'-height' ).val();
48
- var width = Math.round(height * imgRatio(instance));
49
- changeImgSize(instance,width,height);
50
- }
51
-
52
- function imgRatio(instance) {
53
- var width_old = jQuery( '#display-widget-'+instance+'-image img').attr('width');
54
- var height_old = jQuery( '#display-widget-'+instance+'-image img').attr('height');
55
- var ratio = width_old / height_old;
56
- return ratio;
57
- }
58
-
59
- function changeImgSize(instance,width,height) {
60
- if (isNaN(width) || width < 1) {
61
- jQuery( '#widget-'+instance+'-width' ).val('');
62
- width = 'none';
63
- } else {
64
- jQuery( '#widget-'+instance+'-width' ).val(width);
65
- width = width + 'px';
66
  }
67
- jQuery( '#display-widget-'+instance+'-image img' ).css({
68
- 'width':width
69
- });
70
 
71
- if (isNaN(height) || height < 1) {
72
- jQuery( '#widget-'+instance+'-height' ).val('');
73
- height = 'none';
74
- } else {
75
- jQuery( '#widget-'+instance+'-height' ).val(height);
76
- height = height + 'px';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
- jQuery( '#display-widget-'+instance+'-image img' ).css({
79
- 'height':height
80
- });
81
- }
82
-
83
- function changeImgAlign(instance) {
84
- var align = jQuery( '#widget-'+instance+'-align' ).val();
85
- jQuery( '#display-widget-'+instance+'-image img' ).attr(
86
- 'class', (align == 'none' ? '' : 'align'+align)
87
- );
88
- }
89
-
90
- jQuery(document).ready(function() {
91
- jQuery("body").click(function(event) {
92
- if (jQuery(event.target).is('a.thickbox-image-widget')) {
93
- window.send_to_editor = window.image_widget_send_to_editor;
94
- tb_show("Add an Image", event.target.href, false);
 
 
 
 
 
 
 
 
 
 
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  });
97
- // Modify thickbox link to fit window. Adapted from wp-admin\js\media-upload.dev.js.
98
- jQuery('a.thickbox-image-widget').each( function() {
99
- var href = jQuery(this).attr('href'), width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
100
- if ( ! href ) return;
101
- href = href.replace(/&width=[0-9]+/g, '');
102
- href = href.replace(/&height=[0-9]+/g, '');
103
- jQuery(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
104
- });
105
- });
1
+ (function($){
2
+
3
+ window.set_active_widget = function(instance_id) {
4
+ self.IW_instance = instance_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  }
 
 
 
6
 
7
+ function image_widget_send_to_editor(h) {
8
+ // ignore content returned from media uploader and use variables passed to window instead
9
+
10
+ // store attachment id in hidden field
11
+ $( '#widget-'+self.IW_instance+'-image' ).val( self.IW_img_id );
12
+
13
+ // display attachment preview
14
+ $( '#display-widget-'+self.IW_instance+'-image' ).html( self.IW_html );
15
+
16
+ // change width & height fields in widget to match image
17
+ $( '#widget-'+self.IW_instance+'-width' ).val($( '#display-widget-'+self.IW_instance+'-image img').attr('width'));
18
+ $( '#widget-'+self.IW_instance+'-height' ).val($( '#display-widget-'+self.IW_instance+'-image img').attr('height'));
19
+
20
+ // set alignment in widget
21
+ $( '#widget-'+self.IW_instance+'-align' ).val(self.IW_align);
22
+
23
+ // set title in widget
24
+ $( '#widget-'+self.IW_instance+'-title' ).val(self.IW_title);
25
+
26
+ // set caption in widget
27
+ $( '#widget-'+self.IW_instance+'-description' ).val(self.IW_caption);
28
+
29
+ // set alt text in widget
30
+ $( '#widget-'+self.IW_instance+'-alt' ).val(self.IW_alt);
31
+
32
+ // set link in widget
33
+ $( '#widget-'+self.IW_instance+'-link' ).val(self.IW_url);
34
+
35
+ // close thickbox
36
+ tb_remove();
37
+
38
+ // change button text
39
+ $('#add_image-widget-'+self.IW_instance+'-image').html($('#add_image-widget-'+self.IW_instance+'-image').html().replace(/Add Image/g, 'Change Image'));
40
  }
41
+
42
+ function changeImgWidth(instance) {
43
+ var width = $( '#widget-'+instance+'-width' ).val();
44
+ var height = Math.round(width / imgRatio(instance));
45
+ changeImgSize(instance,width,height);
46
+ }
47
+
48
+ function changeImgHeight(instance) {
49
+ var height = $( '#widget-'+instance+'-height' ).val();
50
+ var width = Math.round(height * imgRatio(instance));
51
+ changeImgSize(instance,width,height);
52
+ }
53
+
54
+ function imgRatio(instance) {
55
+ var width_old = $( '#display-widget-'+instance+'-image img').attr('width');
56
+ var height_old = $( '#display-widget-'+instance+'-image img').attr('height');
57
+ var ratio = width_old / height_old;
58
+ return ratio;
59
+ }
60
+
61
+ function changeImgSize(instance,width,height) {
62
+ if (isNaN(width) || width < 1) {
63
+ $( '#widget-'+instance+'-width' ).val('');
64
+ width = 'none';
65
+ } else {
66
+ $( '#widget-'+instance+'-width' ).val(width);
67
+ width = width + 'px';
68
  }
69
+ $( '#display-widget-'+instance+'-image img' ).css({
70
+ 'width':width
71
+ });
72
+
73
+ if (isNaN(height) || height < 1) {
74
+ $( '#widget-'+instance+'-height' ).val('');
75
+ height = 'none';
76
+ } else {
77
+ $( '#widget-'+instance+'-height' ).val(height);
78
+ height = height + 'px';
79
+ }
80
+ $( '#display-widget-'+instance+'-image img' ).css({
81
+ 'height':height
82
+ });
83
+ }
84
+
85
+ function changeImgAlign(instance) {
86
+ var align = $( '#widget-'+instance+'-align' ).val();
87
+ $( '#display-widget-'+instance+'-image img' ).attr(
88
+ 'class', (align == 'none' ? '' : 'align'+align)
89
+ );
90
+ }
91
+
92
+ $(document).ready(function() {
93
+ $("#widgets-right").delegate('a.thickbox-image-widget', 'click', function(event) {
94
+ event.preventDefault();
95
+ window.send_to_editor = image_widget_send_to_editor;
96
+ tb_show("Add an Image", event.target.href, false);
97
+ });
98
+ // Modify thickbox link to fit window. Adapted from wp-admin\js\media-upload.dev.js.
99
+ $('a.thickbox-image-widget').each( function() {
100
+ var href = $(this).attr('href'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
101
+ if ( ! href ) return;
102
+ href = href.replace(/&width=[0-9]+/g, '');
103
+ href = href.replace(/&height=[0-9]+/g, '');
104
+ $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
105
+ });
106
  });
107
+
108
+ })(jQuery);
 
 
 
 
 
 
 
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.2.5
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
@@ -221,6 +221,9 @@ class SP_Image_Widget extends WP_Widget {
221
  $instance['link'] = $new_instance['link'];
222
  $instance['image'] = $new_instance['image'];
223
  $instance['imageurl'] = $this->get_image_url($new_instance['image'],$new_instance['width'],$new_instance['height']); // image resizing not working right now
 
 
 
224
  $instance['linktarget'] = $new_instance['linktarget'];
225
  $instance['width'] = $new_instance['width'];
226
  $instance['height'] = $new_instance['height'];
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.2.7
8
  Author URI: http://www.shaneandpeter.com
9
  */
10
 
221
  $instance['link'] = $new_instance['link'];
222
  $instance['image'] = $new_instance['image'];
223
  $instance['imageurl'] = $this->get_image_url($new_instance['image'],$new_instance['width'],$new_instance['height']); // image resizing not working right now
224
+ if( $_SERVER["HTTPS"] == "on" ) {
225
+ $instance['imageurl'] = str_replace('http://', 'https://', $instance['imageurl']);
226
+ }
227
  $instance['linktarget'] = $new_instance['linktarget'];
228
  $instance['width'] = $new_instance['width'];
229
  $instance['height'] = $new_instance['height'];
lang/SP_Image_Widget-ja.mo ADDED
Binary file
lang/SP_Image_Widget-ja.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
+ # Rüdiger Weiß <ruediger@mac.com>, 2010.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Image Widget 3.1.3\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "POT-Creation-Date: 2011-06-21 00:00+0000\n"
10
+ "PO-Revision-Date: 2011-06-21 00:00+0000\n"
11
+ "Last-Translator: Takayuki Miyauchi <miya@theta.ne.jp>\n"
12
+ "Language-Team: Rüdiger Weiß <ruediger@mac.com>\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Poedit-Language: Japanese\n"
17
+ "X-Poedit-Country: Japan\n"
18
+ "X-Poedit-SourceCharset: iso-8859-1\n"
19
+ "X-Poedit-KeywordsList: __;_e\n"
20
+ "X-Poedit-Basepath: .\n"
21
+
22
+ #: image-widget.php:33
23
+ msgid "Showcase a single image with a Title, URL, and a Description"
24
+ msgstr "単一の画像を表示します。"
25
+
26
+ #: image-widget.php:35
27
+ msgid "Image Widget"
28
+ msgstr "画像ウィジェット"
29
+
30
+ #: image-widget.php:114
31
+ msgid "Insert Into Widget"
32
+ msgstr "ウィジェットに挿入"
33
+
34
+ #: image-widget.php:265
35
+ msgid "Title:"
36
+ msgstr "タイトル:"
37
+
38
+ #: image-widget.php:268
39
+ msgid "Image:"
40
+ msgstr "画像:"
41
+
42
+ #: image-widget.php:272
43
+ msgid "Change Image"
44
+ msgstr "画像を変更"
45
+
46
+ #: image-widget.php:272
47
+ msgid "Add Image"
48
+ msgstr "画像を追加"
49
+
50
+ #: image-widget.php:295
51
+ msgid "Caption:"
52
+ msgstr "見出し:"
53
+
54
+ #: image-widget.php:298
55
+ msgid "Link:"
56
+ msgstr "リンク:"
57
+
58
+ #: image-widget.php:301
59
+ msgid "Stay in Window"
60
+ msgstr "同じウインドウ"
61
+
62
+ #: image-widget.php:302
63
+ msgid "Open New Window"
64
+ msgstr "新しいウインドウ"
65
+
66
+ #: image-widget.php:305
67
+ msgid "Width:"
68
+ msgstr "幅:"
69
+
70
+ #: image-widget.php:308
71
+ msgid "Height:"
72
+ msgstr "高さ:"
73
+
74
+ #: image-widget.php:311
75
+ msgid "Align:"
76
+ msgstr "配置:"
77
+
78
+ #: image-widget.php:313
79
+ msgid "none"
80
+ msgstr "なし"
81
+
82
+ #: image-widget.php:314
83
+ msgid "left"
84
+ msgstr "左"
85
+
86
+ #: image-widget.php:315
87
+ msgid "center"
88
+ msgstr "中央"
89
+
90
+ #: image-widget.php:316
91
+ msgid "right"
92
+ msgstr "右"
93
+
94
+ #: image-widget.php:331
95
+ msgid "Alternate Text:"
96
+ msgstr "代替テキスト:"
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: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 3.2.5
8
 
9
  == Description ==
10
 
@@ -18,6 +18,7 @@ Simple image widget that uses native Wordpress upload thickbox to add image widg
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, Portuguese, Swedish and French (feel free to contribute other languages)
20
  * Supports override of template so that you can override the template for your theme!
 
21
 
22
  This plugin is actively supported and we will do our best to help you. In return we simply as 3 things:
23
 
@@ -67,6 +68,15 @@ function my_template_filter($template) {
67
 
68
  == Changelog ==
69
 
 
 
 
 
 
 
 
 
 
70
  = 3.2.5 =
71
 
72
  * Added Swedish translation courtesy of Tomas Lindhoff (@Tomas)
@@ -205,8 +215,4 @@ Thank you @smurkas, @squigie and @laurie!!! Special thanks to Cameron Clark fro
205
 
206
  = Where do I go to file a bug or ask a question? =
207
 
208
- Please visit the forum for questions or comments: http://wordpress.org/tags/image-widget/
209
-
210
- == Upgrade Notice ==
211
-
212
- This upgrade should have no impact on existing installs.
4
  Tags: widget, image, ad, banner, simple, upload, sidebar, admin, thickbox, resize
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 3.2.7
8
 
9
  == Description ==
10
 
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, Portuguese, Swedish and French (feel free to contribute other languages)
20
  * Supports override of template so that you can override the template for your theme!
21
+ * Supports HTTPS
22
 
23
  This plugin is actively supported and we will do our best to help you. In return we simply as 3 things:
24
 
68
 
69
  == Changelog ==
70
 
71
+ = 3.2.7 =
72
+
73
+ * Update javascript to work with the new version of WordPress (thanks Matt Wiebe!!! @mattwiebe)
74
+ * Added Japanese translation courtesy of Takayuki Miyauchi (@miya0001)
75
+
76
+ = 3.2.6 =
77
+
78
+ * Add HTTPS support courtesy of David Paul Ellenwood (DPE@SGS)
79
+
80
  = 3.2.5 =
81
 
82
  * Added Swedish translation courtesy of Tomas Lindhoff (@Tomas)
215
 
216
  = Where do I go to file a bug or ask a question? =
217
 
218
+ Please visit the forum for questions or comments: http://wordpress.org/tags/image-widget/