From 1a005d853fd483f336264342835405150f432cbd Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 18 Jul 2017 22:11:44 +0000 Subject: [PATCH] Widgets: Replace adding `balanceTags` on `widget_custom_html_content` filter in favor of just applying `widget_text` filters in the Custom HTML widget. Ensures that users who copy HTML from the Text widget in legacy mode over to the Custom HTML widget will continue to get all of the same filters applied, including tag balancing and shortcodes, if a plugin added support. Plugins still have the `widget_text_content` and `widget_custom_html_content` filters they can use to target the specific widget types. Amends [40893]. See #40951. Fixes #40907 for trunk. Built from https://develop.svn.wordpress.org/trunk@41086 git-svn-id: http://core.svn.wordpress.org/trunk@40926 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 2 -- wp-includes/version.php | 2 +- wp-includes/widgets/class-wp-widget-custom-html.php | 3 ++- wp-includes/widgets/class-wp-widget-text.php | 7 ++++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index ada9c53c3f..8f0237028d 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -170,8 +170,6 @@ add_filter( 'widget_text_content', 'wptexturize' ); add_filter( 'widget_text_content', 'convert_smilies', 20 ); add_filter( 'widget_text_content', 'wpautop' ); -add_filter( 'widget_custom_html_content', 'balanceTags' ); - add_filter( 'date_i18n', 'wp_maybe_decline_date' ); // RSS filters diff --git a/wp-includes/version.php b/wp-includes/version.php index 1ce3ba2ec4..c98eece8a4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41072'; +$wp_version = '4.9-alpha-41086'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets/class-wp-widget-custom-html.php b/wp-includes/widgets/class-wp-widget-custom-html.php index 2db50f4d22..5de618285f 100644 --- a/wp-includes/widgets/class-wp-widget-custom-html.php +++ b/wp-includes/widgets/class-wp-widget-custom-html.php @@ -61,7 +61,8 @@ class WP_Widget_Custom_HTML extends WP_Widget { /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); - $content = $instance['content']; + /** This filter is documented in wp-includes/widgets/class-wp-widget-text.php */ + $content = apply_filters( 'widget_text', $instance['content'], $instance, $this ); /** * Filters the content of the Custom HTML widget. diff --git a/wp-includes/widgets/class-wp-widget-text.php b/wp-includes/widgets/class-wp-widget-text.php index 69b7b91aea..2297d2bee2 100644 --- a/wp-includes/widgets/class-wp-widget-text.php +++ b/wp-includes/widgets/class-wp-widget-text.php @@ -213,10 +213,11 @@ class WP_Widget_Text extends WP_Widget { * * @since 2.3.0 * @since 4.4.0 Added the `$this` parameter. + * @since 4.8.1 The `$this` param may now be a `WP_Widget_Custom_HTML` object in addition to a `WP_Widget_Text` object. * - * @param string $text The widget content. - * @param array $instance Array of settings for the current widget. - * @param WP_Widget_Text $this Current Text widget instance. + * @param string $text The widget content. + * @param array $instance Array of settings for the current widget. + * @param WP_Widget_Text|WP_Widget_Custom_HTML $this Current Text widget instance. */ $text = apply_filters( 'widget_text', $text, $instance, $this );