Version Description
(2016-11-17) = * Enhanced integration with WPML and Page Builder * Added new action hooks (black_studio_tinymce_before_widget and black_studio_tinymce_after_widget)
Download this release
Release Info
Developer | marcochiesi |
Plugin | Black Studio TinyMCE Widget |
Version | 2.3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.12 to 2.3.0
- black-studio-tinymce-widget.php +2 -2
- includes/class-compatibility-plugins.php +56 -2
- includes/class-widget.php +2 -0
- readme.txt +9 -4
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.
|
7 |
Author: Black Studio
|
8 |
Author URI: http://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.
|
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.3.0
|
7 |
Author: Black Studio
|
8 |
Author URI: http://www.blackstudio.it
|
9 |
Requires at least: 3.1
|
35 |
* @var string
|
36 |
* @since 2.0.0
|
37 |
*/
|
38 |
+
public static $version = '2.3.0';
|
39 |
|
40 |
/**
|
41 |
* The single instance of the plugin class
|
includes/class-compatibility-plugins.php
CHANGED
@@ -74,10 +74,63 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Compatibility_Plugins' ) ) {
|
|
74 |
* @since 2.0.0
|
75 |
*/
|
76 |
public function wpml() {
|
|
|
|
|
77 |
add_filter( 'black_studio_tinymce_widget_update', array( $this, 'wpml_widget_update' ), 10, 2 );
|
78 |
add_filter( 'widget_text', array( $this, 'wpml_widget_text' ), 2, 3 );
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
/**
|
82 |
* Add widget text to WPML String translation
|
83 |
*
|
@@ -113,10 +166,11 @@ if ( ! class_exists( 'Black_Studio_TinyMCE_Compatibility_Plugins' ) ) {
|
|
113 |
* @since 2.0.0
|
114 |
*/
|
115 |
public function wpml_widget_text( $text, $instance = null, $widget = null ) {
|
116 |
-
if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
|
117 |
if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) {
|
118 |
if ( function_exists( 'icl_t' ) ) {
|
119 |
-
|
|
|
120 |
$text = icl_t( 'Widgets', 'widget body - ' . $widget->id_base . '-' . $widget->number, $text );
|
121 |
}
|
122 |
}
|
74 |
* @since 2.0.0
|
75 |
*/
|
76 |
public function wpml() {
|
77 |
+
add_action( 'black_studio_tinymce_before_widget', array( $this, 'wpml_widget_before' ), 10, 2 );
|
78 |
+
add_action( 'black_studio_tinymce_after_widget', array( $this, 'wpml_widget_after' ), 10, 2 );
|
79 |
add_filter( 'black_studio_tinymce_widget_update', array( $this, 'wpml_widget_update' ), 10, 2 );
|
80 |
add_filter( 'widget_text', array( $this, 'wpml_widget_text' ), 2, 3 );
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Disable WPML String translation native behavior
|
85 |
+
*
|
86 |
+
* @uses remove_filter()
|
87 |
+
*
|
88 |
+
* @param mixed[] $args
|
89 |
+
* @param mixed[] $instance
|
90 |
+
* @return void
|
91 |
+
* @since 2.3.0
|
92 |
+
*/
|
93 |
+
public function wpml_widget_before( $args, $instance ) {
|
94 |
+
if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
|
95 |
+
// Avoid native WPML string translation of widget titles
|
96 |
+
// For widgets inserted in pages built with Page Builder (SiteOrigin panels) and also when WPML Widgets is active
|
97 |
+
if ( false !== has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) ) {
|
98 |
+
if ( isset( $instance['panels_info'] ) || is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) ) {
|
99 |
+
remove_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
// Avoid native WPML string translation of widget texts (for all widgets)
|
103 |
+
// Black Studio TinyMCE Widget already supports WPML string translation, so this is needed to prevent duplicate translations
|
104 |
+
if ( false !== has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) ) {
|
105 |
+
remove_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Re-Enable WPML String translation native behavior
|
113 |
+
*
|
114 |
+
* @uses add_filter()
|
115 |
+
*
|
116 |
+
* @param mixed[] $args
|
117 |
+
* @param mixed[] $instance
|
118 |
+
* @return void
|
119 |
+
* @since 2.3.0
|
120 |
+
*/
|
121 |
+
public function wpml_widget_after( $args, $instance ) {
|
122 |
+
if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
|
123 |
+
if ( false === has_filter( 'widget_title', 'icl_sw_filters_widget_title' ) && function_exists( 'icl_sw_filters_widget_title' ) ) {
|
124 |
+
if ( isset( $instance['panels_info'] ) || is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) ) {
|
125 |
+
add_filter( 'widget_title', 'icl_sw_filters_widget_title', 0 );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
if ( false === has_filter( 'widget_text', 'icl_sw_filters_widget_text' ) && function_exists( 'icl_sw_filters_widget_text' ) ) {
|
129 |
+
add_filter( 'widget_text', 'icl_sw_filters_widget_text', 0 );
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
/**
|
135 |
* Add widget text to WPML String translation
|
136 |
*
|
166 |
* @since 2.0.0
|
167 |
*/
|
168 |
public function wpml_widget_text( $text, $instance = null, $widget = null ) {
|
169 |
+
if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) && ! is_plugin_active( 'wpml-widgets/wpml-widgets.php' ) ) {
|
170 |
if ( bstw()->check_widget( $widget ) && ! empty( $instance ) ) {
|
171 |
if ( function_exists( 'icl_t' ) ) {
|
172 |
+
// Avoid translation of Page Builder (SiteOrigin panels) widgets
|
173 |
+
if ( ! isset( $instance['panels_info'] ) ) {
|
174 |
$text = icl_t( 'Widgets', 'widget body - ' . $widget->id_base . '-' . $widget->number, $text );
|
175 |
}
|
176 |
}
|
includes/class-widget.php
CHANGED
@@ -48,6 +48,7 @@ if ( ! class_exists( 'WP_Widget_Black_Studio_TinyMCE' ) ) {
|
|
48 |
$after_widget = $args['after_widget'];
|
49 |
$before_title = $args['before_title'];
|
50 |
$after_title = $args['after_title'];
|
|
|
51 |
$before_text = apply_filters( 'black_studio_tinymce_before_text', '<div class="textwidget">', $instance );
|
52 |
$after_text = apply_filters( 'black_studio_tinymce_after_text', '</div>', $instance );
|
53 |
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
@@ -62,6 +63,7 @@ if ( ! class_exists( 'WP_Widget_Black_Studio_TinyMCE' ) ) {
|
|
62 |
$output .= $after_widget;
|
63 |
echo $output; // xss ok
|
64 |
}
|
|
|
65 |
}
|
66 |
|
67 |
/**
|
48 |
$after_widget = $args['after_widget'];
|
49 |
$before_title = $args['before_title'];
|
50 |
$after_title = $args['after_title'];
|
51 |
+
do_action( 'black_studio_tinymce_before_widget', $args, $instance );
|
52 |
$before_text = apply_filters( 'black_studio_tinymce_before_text', '<div class="textwidget">', $instance );
|
53 |
$after_text = apply_filters( 'black_studio_tinymce_after_text', '</div>', $instance );
|
54 |
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
|
63 |
$output .= $after_widget;
|
64 |
echo $output; // xss ok
|
65 |
}
|
66 |
+
do_action( 'black_studio_tinymce_after_widget', $args, $instance );
|
67 |
}
|
68 |
|
69 |
/**
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.blackstudio.it/en/wordpress-plugins/black-studio-tinymce
|
|
4 |
Tags: wysiwyg, widget, tinymce, editor, image, media, rich text, rich text editor, visual editor, wysiwyg editor, tinymce editor, widget editor, html editor, wysiwyg widget, html widget, editor widget, text widget, rich text widget, enhanced text widget, tinymce widget, visual widget, image widget, media widget
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -93,8 +93,9 @@ When dealing with a WordPress site URL change it is necessary to face the serial
|
|
93 |
|
94 |
= How to translate widgets using WPML =
|
95 |
|
96 |
-
|
97 |
-
|
|
|
98 |
|
99 |
= How to embed video and other contents =
|
100 |
|
@@ -180,6 +181,10 @@ Plugin's data is stored in serialized format inside a record in the `wp_options`
|
|
180 |
|
181 |
== Changelog ==
|
182 |
|
|
|
|
|
|
|
|
|
183 |
= 2.2.12 (2016-09-23) =
|
184 |
* Fixed issue with Page Builder's Live Editor
|
185 |
|
@@ -448,5 +453,5 @@ Plugin's data is stored in serialized format inside a record in the `wp_options`
|
|
448 |
|
449 |
== Upgrade Notice ==
|
450 |
|
451 |
-
= 2.
|
452 |
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: wysiwyg, widget, tinymce, editor, image, media, rich text, rich text editor, visual editor, wysiwyg editor, tinymce editor, widget editor, html editor, wysiwyg widget, html widget, editor widget, text widget, rich text widget, enhanced text widget, tinymce widget, visual widget, image widget, media widget
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 2.3.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
93 |
|
94 |
= How to translate widgets using WPML =
|
95 |
|
96 |
+
[WPML](https://wpml.org) is the leading commercial plugin for WordPress multi-language sites.
|
97 |
+
If you're using WPML, we recommend to install also the 3rd party [WPML Widgets](https://wordpress.org/plugins/wpml-widgets/) plugin, which will allow you to create widgets and assign them to specific languages, keeping the ability to work with the visual editor.
|
98 |
+
Alternatively you may use the WPML String Translation plugin, provided by the WPML team. In this case, you'll have to create the widgets in the widgets admin panel, using the Visual Editor provided by the Black Studio TinyMCE Widget plugin, and then go to WPML => String Translation and translate title and body of widgets. If you installed WPML after the creation of the widgets, just re-save them and they will appear on the String Translation list. Unfortunately the WPML String Translation interface has no Visual Editor, that's why we no longer recommend this method. If you were using WPML String Translation, we recommend to switch to WPML Widgets and remove the entries in WPML String Translation list after you moved them to be real widgets.
|
99 |
|
100 |
= How to embed video and other contents =
|
101 |
|
181 |
|
182 |
== Changelog ==
|
183 |
|
184 |
+
= 2.3.0 (2016-11-17) =
|
185 |
+
* Enhanced integration with WPML and Page Builder
|
186 |
+
* Added new action hooks (black_studio_tinymce_before_widget and black_studio_tinymce_after_widget)
|
187 |
+
|
188 |
= 2.2.12 (2016-09-23) =
|
189 |
* Fixed issue with Page Builder's Live Editor
|
190 |
|
453 |
|
454 |
== Upgrade Notice ==
|
455 |
|
456 |
+
= 2.3.0 =
|
457 |
Version 2.x is a major update. If you are upgrading from version 1.x please ensure to backup your database before upgrading.
|