Ticket #49588: 49588.patch
File 49588.patch, 2.3 KB (added by , 5 years ago) |
---|
-
src/wp-includes/widgets/class-wp-widget-custom-html.php
164 164 $post = $original_post; 165 165 remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) ); 166 166 167 // Inject the Text widget's container class name alongside this widget's class name for theme styling compatibility. 168 $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text ', $args['before_widget'] ); 167 $args = apply_filters( 'widget_custom_html_args', $args ); 169 168 169 // Inject the Text widget's container class names alongside this widget's class name for theme styling compatibility. 170 $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text textwidget custom-html-widget ', $args['before_widget'], 1 ); 171 170 172 echo $args['before_widget']; 171 173 if ( ! empty( $title ) ) { 172 174 echo $args['before_title'] . $title . $args['after_title']; 173 175 } 174 echo '<div class="textwidget custom-html-widget">'; // The textwidget class is for theme styling compatibility.175 176 echo $content; 176 echo '</div>';177 177 echo $args['after_widget']; 178 178 } 179 179 -
tests/phpunit/tests/widgets/custom-html-widget.php
112 112 $this->assertNotEmpty( $this->widget_custom_html_content_args ); 113 113 $this->assertNotEmpty( $this->widget_text_args ); 114 114 $this->assertContains( '[filter:widget_text][filter:widget_custom_html_content]', $output ); 115 $this->assertContains( '<section id="custom_html-5" class="widget_text widget widget_custom_html">', $output ); 116 $this->assertContains( '<div class="textwidget custom-html-widget">', $output ); 115 $this->assertContains( '<section id="custom_html-5" class="widget_text textwidget custom-html-widget widget widget_custom_html">', $output ); 117 116 $this->assertNotContains( '<p>', $output ); 118 117 $this->assertNotContains( '<br>', $output ); 119 118 $this->assertNotContains( '</u>', $output );