Ticket #24458: 24458.4.diff
File 24458.4.diff, 1.1 KB (added by , 12 years ago) |
---|
-
wp-includes/media.php
2509 2509 2510 2510 $matched_html = $matches[0]; 2511 2511 2512 // Look for attributes.2513 if ( ! preg_match _all( '#(src|class)=([\'"])(.+?)\2#is', $matched_html, $matches ) || empty( $matches ) )2512 // Look for the class attribute. 2513 if ( ! preg_match( '#class=([\'"])(.+?)\1#is', $matched_html, $matches ) || empty( $matches ) ) 2514 2514 return $attachment_id; 2515 2515 2516 $attr = array(); 2517 foreach ( $matches[1] as $key => $attribute_name ) 2518 $attr[ $attribute_name ] = $matches[3][ $key ]; 2519 2520 if ( ! empty( $attr['class'] ) && false !== strpos( $attr['class'], 'wp-image-' ) ) 2521 if ( preg_match( '#wp-image-([0-9]+)#i', $attr['class'], $matches ) ) 2516 $classes = $matches[2]; 2517 if ( ! empty( $classes ) && false !== strpos( $classes, 'wp-image-' ) ) 2518 if ( preg_match( '#wp-image-([0-9]+)#i', $classes, $matches ) ) 2522 2519 $attachment_id = absint( $matches[1] ); 2523 2520 2524 if ( ! $attachment_id && ! empty( $attr['src'] ) )2525 $attachment_id = attachment_url_to_postid( $attr['src'] );2526 2527 2521 return $attachment_id; 2528 2522 }