Ticket #34807: 34807.1.patch
File 34807.1.patch, 1.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/media.php
1206 1206 * @return string Converted content with 'srcset' and 'sizes' attributes added to images. 1207 1207 */ 1208 1208 function wp_make_content_images_responsive( $content ) { 1209 $images = get_media_embedded_in_content( $content, 'img' ); 1209 if ( ! preg_match_all( '/<img [^>]+>/', $content, $matches ) ) { 1210 return $content; 1211 } 1210 1212 1211 1213 $selected_images = $attachment_ids = array(); 1212 1214 1213 foreach( $ imagesas $image ) {1215 foreach( $matches[0] as $image ) { 1214 1216 if ( false === strpos( $image, ' srcset=' ) && preg_match( '/wp-image-([0-9]+)/i', $image, $class_id ) && 1215 1217 ( $attachment_id = absint( $class_id[1] ) ) ) { 1216 1218 … … 3506 3508 * Filter the embedded media types that are allowed to be returned from the content blob. 3507 3509 * 3508 3510 * @since 4.2.0 3509 * @since 4.4.0 Added 'img' to the allowed types.3510 3511 * 3511 3512 * @param array $allowed_media_types An array of allowed media types. Default media types are 3512 * 'audio', 'video', 'object', 'embed', 'iframe', and 'img'.3513 * 'audio', 'video', 'object', 'embed', and 'iframe'. 3513 3514 */ 3514 $allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' , 'img') );3515 $allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' ) ); 3515 3516 3516 3517 if ( ! empty( $types ) ) { 3517 3518 if ( ! is_array( $types ) ) {