Changeset 41779 for trunk/src/wp-includes/widgets/class-wp-widget-text.php
- Timestamp:
- 10/06/2017 12:38:57 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-text.php
r41577 r41779 291 291 } 292 292 293 $text = preg_replace_callback( '#<[^>]*>#', array( $this, 'inject_video_max_width_style' ), $text ); 294 293 295 ?> 294 296 <div class="textwidget"><?php echo $text; ?></div> 295 297 <?php 296 298 echo $args['after_widget']; 299 } 300 301 /** 302 * Inject max-width and remove height for videos too constrained to fit inside sidebars on frontend. 303 * 304 * @since 4.9.0 305 * 306 * @see WP_Widget_Media_Video::inject_video_max_width_style() 307 * @param array $matches Pattern matches from preg_replace_callback. 308 * @return string HTML Output. 309 */ 310 public function inject_video_max_width_style( $matches ) { 311 $html = $matches[0]; 312 $html = preg_replace( '/\sheight="\d+"/', '', $html ); 313 $html = preg_replace( '/\swidth="\d+"/', '', $html ); 314 $html = preg_replace( '/(?<=width:)\s*\d+px(?=;?)/', '100%', $html ); 315 return $html; 297 316 } 298 317
Note: See TracChangeset
for help on using the changeset viewer.