Make WordPress Core

Ticket #24458: 24458.4.diff

File 24458.4.diff, 1.1 KB (added by kovshenin, 12 years ago)
  • wp-includes/media.php

     
    25092509
    25102510        $matched_html = $matches[0];
    25112511
    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 ) )
    25142514                return $attachment_id;
    25152515
    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 ) )
    25222519                        $attachment_id = absint( $matches[1] );
    25232520
    2524         if ( ! $attachment_id && ! empty( $attr['src'] ) )
    2525                 $attachment_id = attachment_url_to_postid( $attr['src'] );
    2526 
    25272521        return $attachment_id;
    25282522}