Simple Image Widget - Version 4.0.1

Version Description

  • Allow more HTML tags in the text field.
  • Updated customizer support and prevent cache poisoning.
  • Added French translation.
Download this release

Release Info

Developer bradyvercher
Plugin Icon 128x128 Simple Image Widget
Version 4.0.1
Comparing to
See all releases

Code changes from version 4.0.0 to 4.0.1

includes/class-simple-image-widget.php CHANGED
@@ -45,9 +45,8 @@ class Simple_Image_Widget extends WP_Widget {
45
  $widget_options = wp_parse_args(
46
  $widget_options,
47
  array(
48
- 'classname' => 'widget_simpleimage', // Legacy class name.
49
- 'description' => __( 'An image from your Media Library.', 'simple-image-widget' ),
50
- 'customizer_support' => true,
51
  )
52
  );
53
 
@@ -74,8 +73,7 @@ class Simple_Image_Widget extends WP_Widget {
74
  */
75
  public function widget( $args, $instance ) {
76
  $cache = (array) wp_cache_get( 'simple_image_widget', 'widget' );
77
-
78
- if ( isset( $cache[ $this->id ] ) ) {
79
  echo $cache[ $this->id ];
80
  return;
81
  }
@@ -113,8 +111,10 @@ class Simple_Image_Widget extends WP_Widget {
113
 
114
  echo $output;
115
 
116
- $cache[ $this->id ] = $output;
117
- wp_cache_set( 'simple_image_widget', array_filter( $cache ), 'widget' );
 
 
118
  }
119
 
120
  /**
@@ -375,13 +375,31 @@ class Simple_Image_Widget extends WP_Widget {
375
  $instance['link'] = esc_url_raw( $new_instance['link'] );
376
  $instance['link_text'] = wp_kses_data( $new_instance['link_text'] );
377
  $instance['new_window'] = isset( $new_instance['new_window'] );
378
- $instance['text'] = wp_kses_data( $new_instance['text'] );
379
 
380
  $this->flush_widget_cache();
381
 
382
  return $instance;
383
  }
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  /**
386
  * Get the various sizes of an image.
387
  *
@@ -455,6 +473,7 @@ class Simple_Image_Widget extends WP_Widget {
455
  $templates[] = $args['id'] . '_widget.php';
456
  }
457
  $templates[] = 'widget.php';
 
458
  /**
459
  * List of template names to look up to render output.
460
  *
45
  $widget_options = wp_parse_args(
46
  $widget_options,
47
  array(
48
+ 'classname' => 'widget_simpleimage', // Legacy class name.
49
+ 'description' => __( 'An image from your Media Library.', 'simple-image-widget' ),
 
50
  )
51
  );
52
 
73
  */
74
  public function widget( $args, $instance ) {
75
  $cache = (array) wp_cache_get( 'simple_image_widget', 'widget' );
76
+ if ( ! $this->is_preview() && isset( $cache[ $this->id ] ) ) {
 
77
  echo $cache[ $this->id ];
78
  return;
79
  }
111
 
112
  echo $output;
113
 
114
+ if ( ! $this->is_preview() ) {
115
+ $cache[ $this->id ] = $output;
116
+ wp_cache_set( 'simple_image_widget', array_filter( $cache ), 'widget' );
117
+ }
118
  }
119
 
120
  /**
375
  $instance['link'] = esc_url_raw( $new_instance['link'] );
376
  $instance['link_text'] = wp_kses_data( $new_instance['link_text'] );
377
  $instance['new_window'] = isset( $new_instance['new_window'] );
378
+ $instance['text'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['text'] ) ) );
379
 
380
  $this->flush_widget_cache();
381
 
382
  return $instance;
383
  }
384
 
385
+ /**
386
+ * Determine if the widget is being displayed in the customizer.
387
+ *
388
+ * @since 4.0.1
389
+ * @link https://core.trac.wordpress.org/ticket/27538
390
+ *
391
+ * @return bool
392
+ */
393
+ public function is_preview() {
394
+ global $wp_customize;
395
+
396
+ if ( method_exists( parent, 'is_preview' ) ) {
397
+ return parent::is_preview();
398
+ }
399
+
400
+ return ( isset( $wp_customize ) && $wp_customize->is_preview() ) ;
401
+ }
402
+
403
  /**
404
  * Get the various sizes of an image.
405
  *
473
  $templates[] = $args['id'] . '_widget.php';
474
  }
475
  $templates[] = 'widget.php';
476
+
477
  /**
478
  * List of template names to look up to render output.
479
  *
languages/simple-image-widget-fr_FR.mo ADDED
Binary file
languages/simple-image-widget-fr_FR.po ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 Simple Image Widget
2
+ # This file is distributed under the same license as the Simple Image Widget package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Simple Image Widget 3.0.4\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/simple-image-"
7
+ "widget\n"
8
+ "POT-Creation-Date: 2014-06-13 21:26:00+00:00\n"
9
+ "PO-Revision-Date: 2014-06-17 14:14+0100\n"
10
+ "Last-Translator: Alexandre Sadowski <hello@alexandresadowski.com>\n"
11
+ "Language-Team: LANGUAGE <LL@li.org>\n"
12
+ "Language: fr\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Generator: Poedit 1.6.5\n"
17
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
18
+
19
+ #: includes/class-simple-image-widget-legacy.php:108
20
+ msgid "These fields are here to maintain your data from an earlier version."
21
+ msgstr ""
22
+ "Ces champs sont là pour maintenir vos données à partir d'une version "
23
+ "antérieure."
24
+
25
+ #: includes/class-simple-image-widget-legacy.php:111
26
+ msgid ""
27
+ "Select an image, then clear these values, and they will disappear when you "
28
+ "save the widget."
29
+ msgstr ""
30
+ "Sélectionner une image, puis effacer ces valeurs, et elles disparaîtront "
31
+ "lorsque vous enregistrerez le widget."
32
+
33
+ #: includes/class-simple-image-widget-legacy.php:116
34
+ msgid "Image URL:"
35
+ msgstr "URL de l'image:"
36
+
37
+ #: includes/class-simple-image-widget-legacy.php:120
38
+ msgid "Alternate Text:"
39
+ msgstr "Texte alternative:"
40
+
41
+ #: includes/class-simple-image-widget-plugin.php:85
42
+ msgid "Choose an Attachment"
43
+ msgstr "Choisir un fichier"
44
+
45
+ #: includes/class-simple-image-widget-plugin.php:86
46
+ msgid "Update Attachment"
47
+ msgstr "Mettre à jour le fichier"
48
+
49
+ #: includes/class-simple-image-widget-plugin.php:87
50
+ #: includes/class-simple-image-widget-plugin.php:128
51
+ #: includes/class-simple-image-widget.php:412
52
+ msgid "Full Size"
53
+ msgstr "Taille entière"
54
+
55
+ #: includes/class-simple-image-widget-plugin.php:125
56
+ msgid "Thumbnail"
57
+ msgstr "Miniature"
58
+
59
+ #: includes/class-simple-image-widget-plugin.php:126
60
+ msgid "Medium"
61
+ msgstr "Moyenne"
62
+
63
+ #: includes/class-simple-image-widget-plugin.php:127
64
+ msgid "Large"
65
+ msgstr "Grande taille"
66
+
67
+ #: includes/class-simple-image-widget.php:43
68
+ msgid "Image"
69
+ msgstr "Image"
70
+
71
+ #: includes/class-simple-image-widget.php:49
72
+ msgid "An image from your Media Library."
73
+ msgstr "Une image de votre bibliothère de médias."
74
+
75
+ #: includes/class-simple-image-widget.php:235
76
+ msgid "Title:"
77
+ msgstr "Titre:"
78
+
79
+ #: includes/class-simple-image-widget.php:241
80
+ #: includes/class-simple-image-widget.php:251
81
+ msgid "Choose an Image"
82
+ msgstr "Sélectionner une image"
83
+
84
+ #: includes/class-simple-image-widget.php:242
85
+ msgid "Update Image"
86
+ msgstr "Mettre à jour l'image"
87
+
88
+ #: includes/class-simple-image-widget.php:263
89
+ msgid "Size:"
90
+ msgstr "Taille:"
91
+
92
+ #: includes/class-simple-image-widget.php:283
93
+ msgid "Link:"
94
+ msgstr "Lien:"
95
+
96
+ #: includes/class-simple-image-widget.php:289
97
+ msgid "Open in new window?"
98
+ msgstr "Ouvrir dans une nouvelle fenêtre?"
99
+
100
+ #: includes/class-simple-image-widget.php:298
101
+ msgid "Link Text:"
102
+ msgstr "Label du lien:"
103
+
104
+ #: includes/class-simple-image-widget.php:307
105
+ msgid "Text:"
106
+ msgstr "Texte:"
107
+
108
+ #. Plugin Name of the plugin/theme
109
+ msgid "Simple Image Widget"
110
+ msgstr "Simple Image Widget"
111
+
112
+ #. Plugin URI of the plugin/theme
113
+ msgid "https://wordpress.org/extend/plugins/simple-image-widget/"
114
+ msgstr "https://wordpress.org/extend/plugins/simple-image-widget/"
115
+
116
+ #. Description of the plugin/theme
117
+ msgid "A simple image widget utilizing the new WordPress media manager."
118
+ msgstr ""
119
+ "Un simple widget image utilisant le nouveau gestionnaire de médias de "
120
+ "WordPress."
121
+
122
+ #. Author of the plugin/theme
123
+ msgid "Blazer Six"
124
+ msgstr "Blazer Six"
125
+
126
+ #. Author URI of the plugin/theme
127
+ msgid "http://www.blazersix.com/"
128
+ msgstr "http://www.blazersix.com/"
129
+
130
+ #~ msgid "Display an image"
131
+ #~ msgstr "Afficher une image"
languages/simple-image-widget.pot CHANGED
@@ -1,59 +1,71 @@
1
- # Copyright (C) 2014 Simple Image Widget
2
- # This file is distributed under the same license as the Simple Image Widget package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Simple Image Widget 3.0.4\n"
6
  "Report-Msgid-Bugs-To: "
7
  "http://wordpress.org/support/plugin/simple-image-widget\n"
8
- "POT-Creation-Date: 2014-03-14 05:54:01+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
-
16
- #: includes/class-simple-image-widget-legacy.php:107
 
 
 
 
 
 
 
 
 
 
 
 
17
  msgid "These fields are here to maintain your data from an earlier version."
18
  msgstr ""
19
 
20
- #: includes/class-simple-image-widget-legacy.php:110
21
  msgid ""
22
  "Select an image, then clear these values, and they will disappear when you "
23
  "save the widget."
24
  msgstr ""
25
 
26
- #: includes/class-simple-image-widget-legacy.php:115
27
  msgid "Image URL:"
28
  msgstr ""
29
 
30
- #: includes/class-simple-image-widget-legacy.php:119
31
  msgid "Alternate Text:"
32
  msgstr ""
33
 
34
- #: includes/class-simple-image-widget-plugin.php:82
35
  msgid "Choose an Attachment"
36
  msgstr ""
37
 
38
- #: includes/class-simple-image-widget-plugin.php:83
39
  msgid "Update Attachment"
40
  msgstr ""
41
 
42
- #: includes/class-simple-image-widget-plugin.php:84
43
- #: includes/class-simple-image-widget-plugin.php:124
44
- #: includes/class-simple-image-widget.php:383
45
  msgid "Full Size"
46
  msgstr ""
47
 
48
- #: includes/class-simple-image-widget-plugin.php:121
49
  msgid "Thumbnail"
50
  msgstr ""
51
 
52
- #: includes/class-simple-image-widget-plugin.php:122
53
  msgid "Medium"
54
  msgstr ""
55
 
56
- #: includes/class-simple-image-widget-plugin.php:123
57
  msgid "Large"
58
  msgstr ""
59
 
@@ -61,40 +73,40 @@ msgstr ""
61
  msgid "Image"
62
  msgstr ""
63
 
64
- #: includes/class-simple-image-widget.php:47
65
- msgid "Display an image"
66
  msgstr ""
67
 
68
- #: includes/class-simple-image-widget.php:225
69
  msgid "Title:"
70
  msgstr ""
71
 
72
- #: includes/class-simple-image-widget.php:231
73
  #: includes/class-simple-image-widget.php:241
 
74
  msgid "Choose an Image"
75
  msgstr ""
76
 
77
- #: includes/class-simple-image-widget.php:232
78
  msgid "Update Image"
79
  msgstr ""
80
 
81
- #: includes/class-simple-image-widget.php:253
82
  msgid "Size:"
83
  msgstr ""
84
 
85
- #: includes/class-simple-image-widget.php:272
86
  msgid "Link:"
87
  msgstr ""
88
 
89
- #: includes/class-simple-image-widget.php:278
90
  msgid "Open in new window?"
91
  msgstr ""
92
 
93
- #: includes/class-simple-image-widget.php:287
94
  msgid "Link Text:"
95
  msgstr ""
96
 
97
- #: includes/class-simple-image-widget.php:296
98
  msgid "Text:"
99
  msgstr ""
100
 
1
+ # Copyright (C) 2014 Blazer Six
2
+ # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Simple Image Widget 4.0.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "http://wordpress.org/support/plugin/simple-image-widget\n"
8
+ "POT-Creation-Date: 2014-06-13 21:26:00+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: grunt-wp-i18n 0.4.5\n"
16
+ "Language: en\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "X-Poedit-Bookmarks: \n"
20
+ "X-Poedit-Country: United States\n"
21
+ "X-Poedit-KeywordsList: "
22
+ "__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;_nc:1,2;_x:1,"
23
+ "2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+ "X-Poedit-SourceCharset: utf-8\n"
26
+ "X-Textdomain-Support: yes\n"
27
+
28
+ #: includes/class-simple-image-widget-legacy.php:108
29
  msgid "These fields are here to maintain your data from an earlier version."
30
  msgstr ""
31
 
32
+ #: includes/class-simple-image-widget-legacy.php:111
33
  msgid ""
34
  "Select an image, then clear these values, and they will disappear when you "
35
  "save the widget."
36
  msgstr ""
37
 
38
+ #: includes/class-simple-image-widget-legacy.php:116
39
  msgid "Image URL:"
40
  msgstr ""
41
 
42
+ #: includes/class-simple-image-widget-legacy.php:120
43
  msgid "Alternate Text:"
44
  msgstr ""
45
 
46
+ #: includes/class-simple-image-widget-plugin.php:85
47
  msgid "Choose an Attachment"
48
  msgstr ""
49
 
50
+ #: includes/class-simple-image-widget-plugin.php:86
51
  msgid "Update Attachment"
52
  msgstr ""
53
 
54
+ #: includes/class-simple-image-widget-plugin.php:87
55
+ #: includes/class-simple-image-widget-plugin.php:128
56
+ #: includes/class-simple-image-widget.php:412
57
  msgid "Full Size"
58
  msgstr ""
59
 
60
+ #: includes/class-simple-image-widget-plugin.php:125
61
  msgid "Thumbnail"
62
  msgstr ""
63
 
64
+ #: includes/class-simple-image-widget-plugin.php:126
65
  msgid "Medium"
66
  msgstr ""
67
 
68
+ #: includes/class-simple-image-widget-plugin.php:127
69
  msgid "Large"
70
  msgstr ""
71
 
73
  msgid "Image"
74
  msgstr ""
75
 
76
+ #: includes/class-simple-image-widget.php:49
77
+ msgid "An image from your Media Library."
78
  msgstr ""
79
 
80
+ #: includes/class-simple-image-widget.php:235
81
  msgid "Title:"
82
  msgstr ""
83
 
 
84
  #: includes/class-simple-image-widget.php:241
85
+ #: includes/class-simple-image-widget.php:251
86
  msgid "Choose an Image"
87
  msgstr ""
88
 
89
+ #: includes/class-simple-image-widget.php:242
90
  msgid "Update Image"
91
  msgstr ""
92
 
93
+ #: includes/class-simple-image-widget.php:263
94
  msgid "Size:"
95
  msgstr ""
96
 
97
+ #: includes/class-simple-image-widget.php:283
98
  msgid "Link:"
99
  msgstr ""
100
 
101
+ #: includes/class-simple-image-widget.php:289
102
  msgid "Open in new window?"
103
  msgstr ""
104
 
105
+ #: includes/class-simple-image-widget.php:298
106
  msgid "Link Text:"
107
  msgstr ""
108
 
109
+ #: includes/class-simple-image-widget.php:307
110
  msgid "Text:"
111
  msgstr ""
112
 
readme.txt CHANGED
@@ -25,6 +25,10 @@ Blazer Six took over development and maintenance of Simple Image Widget with ver
25
  * [Follow @bradyvercher](https://twitter.com/bradyvercher)
26
  * [Hire Blazer Six](http://www.blazersix.com/)
27
 
 
 
 
 
28
  == Installation ==
29
 
30
  Install just like most other plugins. [Check out the codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins) if you have any questions.
@@ -71,6 +75,11 @@ The widget uses the core function `wp_get_attachment_image()` to display the ima
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
74
  = 4.0.0 =
75
  * New template system to make it easier to override the output.
76
  * Restructured to make it more intuitive for developers to extend the widget.
25
  * [Follow @bradyvercher](https://twitter.com/bradyvercher)
26
  * [Hire Blazer Six](http://www.blazersix.com/)
27
 
28
+ = Translation Credits =
29
+
30
+ * French (fr_FR) - Alexandre Sadowski [v4.0.1]
31
+
32
  == Installation ==
33
 
34
  Install just like most other plugins. [Check out the codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins) if you have any questions.
75
 
76
  == Changelog ==
77
 
78
+ = 4.0.1 =
79
+ * Allow more HTML tags in the text field.
80
+ * Updated customizer support and prevent cache poisoning.
81
+ * Added French translation.
82
+
83
  = 4.0.0 =
84
  * New template system to make it easier to override the output.
85
  * Restructured to make it more intuitive for developers to extend the widget.
simple-image-widget.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Simple Image Widget
12
  * Plugin URI: https://wordpress.org/extend/plugins/simple-image-widget/
13
  * Description: A simple image widget utilizing the new WordPress media manager.
14
- * Version: 4.0.0
15
  * Author: Blazer Six
16
  * Author URI: http://www.blazersix.com/
17
  * License: GPL-2.0+
11
  * Plugin Name: Simple Image Widget
12
  * Plugin URI: https://wordpress.org/extend/plugins/simple-image-widget/
13
  * Description: A simple image widget utilizing the new WordPress media manager.
14
+ * Version: 4.0.1
15
  * Author: Blazer Six
16
  * Author URI: http://www.blazersix.com/
17
  * License: GPL-2.0+