* @access public
*/
public function __construct() {
- $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
- $control_ops = array('width' => 400, 'height' => 350);
- parent::__construct('text', __('Text'), $widget_ops, $control_ops);
+ $widget_ops = array(
+ 'classname' => 'widget_text',
+ 'description' => __( 'Arbitrary text or HTML.' ),
+ 'customize_selective_refresh' => true,
+ );
+ $control_ops = array( 'width' => 400, 'height' => 350 );
+ parent::__construct( 'text', __( 'Text' ), $widget_ops, $control_ops );
}
/**
$widget_text = ! empty( $instance['text'] ) ? $instance['text'] : '';
/**
- * Filter the content of the Text widget.
+ * Filters the content of the Text widget.
*
* @since 2.3.0
* @since 4.4.0 Added the `$this` parameter.
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = sanitize_text_field( $new_instance['title'] );
- if ( current_user_can('unfiltered_html') )
- $instance['text'] = $new_instance['text'];
- else
- $instance['text'] = wp_kses_post( stripslashes( $new_instance['text'] ) );
+ if ( current_user_can( 'unfiltered_html' ) ) {
+ $instance['text'] = $new_instance['text'];
+ } else {
+ $instance['text'] = wp_kses_post( $new_instance['text'] );
+ }
$instance['filter'] = ! empty( $new_instance['filter'] );
return $instance;
}