Changeset 42343 for trunk/src/wp-includes/widgets/class-wp-widget-text.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-text.php
r42185 r42343 31 31 */ 32 32 public function __construct() { 33 $widget_ops = array(34 'classname' => 'widget_text',35 'description' => __( 'Arbitrary text.' ),33 $widget_ops = array( 34 'classname' => 'widget_text', 35 'description' => __( 'Arbitrary text.' ), 36 36 'customize_selective_refresh' => true, 37 37 ); 38 38 $control_ops = array( 39 'width' => 400,39 'width' => 400, 40 40 'height' => 350, 41 41 ); … … 96 96 } 97 97 98 $wpautop = ! empty( $instance['filter'] );98 $wpautop = ! empty( $instance['filter'] ); 99 99 $has_line_breaks = ( false !== strpos( trim( $instance['text'] ), "\n" ) ); 100 100 … … 117 117 118 118 $doc = new DOMDocument(); 119 @$doc->loadHTML( sprintf( 120 '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>', 121 esc_attr( get_bloginfo( 'charset' ) ), 122 $instance['text'] 123 ) ); 119 @$doc->loadHTML( 120 sprintf( 121 '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>', 122 esc_attr( get_bloginfo( 'charset' ) ), 123 $instance['text'] 124 ) 125 ); 124 126 $body = $doc->getElementsByTagName( 'body' )->item( 0 ); 125 127 126 128 // See $allowedposttags. 127 129 $safe_elements_attributes = array( 128 'strong' => array(),129 'em' => array(),130 'b' => array(),131 'i' => array(),132 'u' => array(),133 's' => array(),134 'ul' => array(),135 'ol' => array(),136 'li' => array(),137 'hr' => array(),138 'abbr' => array(),130 'strong' => array(), 131 'em' => array(), 132 'b' => array(), 133 'i' => array(), 134 'u' => array(), 135 's' => array(), 136 'ul' => array(), 137 'ol' => array(), 138 'li' => array(), 139 'hr' => array(), 140 'abbr' => array(), 139 141 'acronym' => array(), 140 'code' => array(),141 'dfn' => array(),142 'a' => array(142 'code' => array(), 143 'dfn' => array(), 144 'a' => array( 143 145 'href' => true, 144 146 ), 145 'img' => array(147 'img' => array( 146 148 'src' => true, 147 149 'alt' => true, 148 150 ), 149 151 ); 150 $safe_empty_elements = array( 'img', 'hr', 'iframe' );152 $safe_empty_elements = array( 'img', 'hr', 'iframe' ); 151 153 152 154 foreach ( $body->getElementsByTagName( '*' ) as $element ) { … … 216 218 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 217 219 218 $text = ! empty( $instance['text'] ) ? $instance['text'] : '';220 $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; 219 221 $is_visual_text_widget = ( ! empty( $instance['visual'] ) && ! empty( $instance['filter'] ) ); 220 222 … … 234 236 * added to 'widget_text_content' then do_shortcode() will be manually called when in legacy mode as well. 235 237 */ 236 $widget_text_do_shortcode_priority = has_filter( 'widget_text', 'do_shortcode' );238 $widget_text_do_shortcode_priority = has_filter( 'widget_text', 'do_shortcode' ); 237 239 $should_suspend_legacy_shortcode_support = ( $is_visual_text_widget && false !== $widget_text_do_shortcode_priority ); 238 240 if ( $should_suspend_legacy_shortcode_support ) { … … 352 354 */ 353 355 public function update( $new_instance, $old_instance ) { 354 $new_instance = wp_parse_args( $new_instance, array( 355 'title' => '', 356 'text' => '', 357 'filter' => false, // For back-compat. 358 'visual' => null, // Must be explicitly defined. 359 ) ); 356 $new_instance = wp_parse_args( 357 $new_instance, array( 358 'title' => '', 359 'text' => '', 360 'filter' => false, // For back-compat. 361 'visual' => null, // Must be explicitly defined. 362 ) 363 ); 360 364 361 365 $instance = $old_instance; … … 418 422 array( 419 423 'title' => '', 420 'text' => '',424 'text' => '', 421 425 ) 422 426 );
Note: See TracChangeset
for help on using the changeset viewer.