Black Studio TinyMCE Widget - Version 2.6.1

Version Description

(2017-12-13) = * Fixed bug related to WPML String Translation filters

Download this release

Release Info

Developer marcochiesi
Plugin Icon 128x128 Black Studio TinyMCE Widget
Version 2.6.1
Comparing to
See all releases

Code changes from version 2.6.0 to 2.6.1

black-studio-tinymce-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Black Studio TinyMCE Widget
4
  Plugin URI: https://wordpress.org/plugins/black-studio-tinymce-widget/
5
  Description: Adds a new "Visual Editor" widget type based on the native WordPress TinyMCE editor.
6
- Version: 2.6.0
7
  Author: Black Studio
8
  Author URI: https://www.blackstudio.it
9
  Requires at least: 3.1
@@ -35,7 +35,7 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Plugin' ) ) {
35
  * @var string
36
  * @since 2.0.0
37
  */
38
- public static $version = '2.6.0';
39
 
40
  /**
41
  * The single instance of the plugin class
3
  Plugin Name: Black Studio TinyMCE Widget
4
  Plugin URI: https://wordpress.org/plugins/black-studio-tinymce-widget/
5
  Description: Adds a new "Visual Editor" widget type based on the native WordPress TinyMCE editor.
6
+ Version: 2.6.1
7
  Author: Black Studio
8
  Author URI: https://www.blackstudio.it
9
  Requires at least: 3.1
35
  * @var string
36
  * @since 2.0.0
37
  */
38
+ public static $version = '2.6.1';
39
 
40
  /**
41
  * The single instance of the plugin class
includes/class-compatibility-plugins.php CHANGED
@@ -24,6 +24,22 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Compatibility_Plugins' ) ) {
24
  */
25
  protected static $_instance = null;
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  /**
28
  * Return the single class instance
29
  *
@@ -126,16 +142,20 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Compatibility_Plugins' ) ) {
126
  public function wpml_widget_before( $args, $instance ) {
127
  if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
128
  // Avoid native WPML string translation of widget titles
129
- // For widgets inserted in pages built with Page Builder (SiteOrigin panels) and also when WPML Widgets is active
 
130
  if ( false !== has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) ) {
131
  if ( isset( $instance['panels_info'] ) || isset( $instance['wp_page_widget'] ) || is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) || version_compare( $this->wpml_get_version(), '3.8.0' ) >= 0 ) {
132
  remove_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
 
133
  }
134
  }
135
  // Avoid native WPML string translation of widget texts (for all widgets)
136
- // Black Studio TinyMCE Widget already supports WPML string translation, so this is needed to prevent duplicate translations
 
137
  if ( false !== has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) ) {
138
  remove_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
 
139
  }
140
  }
141
 
@@ -153,13 +173,19 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Compatibility_Plugins' ) ) {
153
  */
154
  public function wpml_widget_after( $args, $instance ) {
155
  if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
156
- if ( false === has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) && function_exists( 'icl_sw_filters_widget_title' ) ) {
157
- if ( isset( $instance['panels_info'] ) || isset( $instance['wp_page_widget'] ) || is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) || version_compare( $this->wpml_get_version(), '3.8.0' ) >= 0 ) {
 
158
  add_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
 
159
  }
160
  }
161
- if ( false === has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) && function_exists( 'icl_sw_filters_widget_text' ) || version_compare( $this->wpml_get_version(), '3.8.0' ) >= 0 ) {
162
- add_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
 
 
 
 
163
  }
164
  }
165
  }
24
  */
25
  protected static $_instance = null;
26
 
27
+ /**
28
+ * Flag to keep track of removed WPML filter on widget title
29
+ *
30
+ * @var boolean
31
+ * @since 2.6.1
32
+ */
33
+ private $wpml_removed_widget_title_filter = false;
34
+
35
+ /**
36
+ * Flag to keep track of removed WPML filter on widget text
37
+ *
38
+ * @var boolean
39
+ * @since 2.6.1
40
+ */
41
+ private $wpml_removed_widget_text_filter = false;
42
+
43
  /**
44
  * Return the single class instance
45
  *
142
  public function wpml_widget_before( $args, $instance ) {
143
  if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
144
  // Avoid native WPML string translation of widget titles
145
+ // for widgets inserted in pages built with Page Builder (SiteOrigin panels)
146
+ // and also when WPML Widgets is active and for WPML versions from 3.8.0 on
147
  if ( false !== has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) ) {
148
  if ( isset( $instance['panels_info'] ) || isset( $instance['wp_page_widget'] ) || is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) || version_compare( $this->wpml_get_version(), '3.8.0' ) >= 0 ) {
149
  remove_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
150
+ $this->wpml_removed_widget_title_filter = true;
151
  }
152
  }
153
  // Avoid native WPML string translation of widget texts (for all widgets)
154
+ // Note: Black Studio TinyMCE Widget already supports WPML string translation,
155
+ // so this is needed to prevent duplicate translations
156
  if ( false !== has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) ) {
157
  remove_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
158
+ $this->wpml_removed_widget_text_filter = true;
159
  }
160
  }
161
 
173
  */
174
  public function wpml_widget_after( $args, $instance ) {
175
  if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
176
+ // Restore widget title's native WPML string translation filter if it was removed
177
+ if ( $this->wpml_removed_widget_title_filter ) {
178
+ if ( false === has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) && function_exists( 'icl_sw_filters_widget_title' ) ) {
179
  add_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
180
+ $this->wpml_removed_widget_title_filter = false;
181
  }
182
  }
183
+ // Restore widget text's native WPML string translation filter if it was removed
184
+ if ( $this->wpml_removed_widget_text_filter ) {
185
+ if ( false === has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) && function_exists( 'icl_sw_filters_widget_text' ) ) {
186
+ add_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
187
+ $this->wpml_removed_widget_text_filter = false;
188
+ }
189
  }
190
  }
191
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.blackstudio.it/en/wordpress-plugins/black-studio-tinymc
4
  Tags: widget, visual, editor, wysiwyg, html, text, tinymce, image, media, gallery, embed, wpml
5
  Requires at least: 3.1
6
  Tested up to: 4.9
7
- Stable tag: 2.6.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl.html
10
 
@@ -189,6 +189,9 @@ DELETE FROM wp_usermeta WHERE meta_key LIKE '_bstw%';
189
 
190
  == Changelog ==
191
 
 
 
 
192
  = 2.6.0 (2017-11-17) =
193
  * Compatibility update for WPML 3.8
194
  * Added filter `black_studio_tinymce_widget_additional_fields`
@@ -494,5 +497,6 @@ DELETE FROM wp_usermeta WHERE meta_key LIKE '_bstw%';
494
 
495
  == Upgrade Notice ==
496
 
497
- = 2.6.0 =
498
- Version 2.x is a major update. If you are upgrading from version 1.x please ensure to backup your database before upgrading.
 
4
  Tags: widget, visual, editor, wysiwyg, html, text, tinymce, image, media, gallery, embed, wpml
5
  Requires at least: 3.1
6
  Tested up to: 4.9
7
+ Stable tag: 2.6.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl.html
10
 
189
 
190
  == Changelog ==
191
 
192
+ = 2.6.1 (2017-12-13) =
193
+ * Fixed bug related to WPML String Translation filters
194
+
195
  = 2.6.0 (2017-11-17) =
196
  * Compatibility update for WPML 3.8
197
  * Added filter `black_studio_tinymce_widget_additional_fields`
497
 
498
  == Upgrade Notice ==
499
 
500
+ = 2.6.1 =
501
+ If you're using WPML, double check our FAQ, as version 2.6 introduced some changes regarding widgets translations.
502
+ Important: Always ensure to backup your database before upgrading.