WordPress 4.5
[autoinstalls/wordpress.git] / wp-includes / widgets / class-wp-widget-text.php
index 96cf64290840f25c67d0440564efe04a4318b108..a8ec3d4fd81dff90fe6d5dd186780f2d75f74b5a 100644 (file)
@@ -23,9 +23,13 @@ class WP_Widget_Text extends WP_Widget {
         * @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 );
        }
 
        /**
@@ -80,10 +84,11 @@ class WP_Widget_Text extends WP_Widget {
        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;
        }