Make WordPress Core

Ticket #32072: 32072.diff

File 32072.diff, 1.6 KB (added by wonderboymusic, 10 years ago)
  • src/wp-admin/includes/ajax-actions.php

     
    24912491                }
    24922492        }
    24932493
    2494         $rel = $url = '';
    2495         $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
    2496         if ( ! empty( $attachment['url'] ) ) {
    2497                 $url = $attachment['url'];
    2498                 if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
    2499                         $rel = ' rel="attachment wp-att-' . $id . '"';
    2500                 $html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
     2494        $rel = '';
     2495        $url = empty( $attachment['url'] ) ? '' : $attachment['url'];
     2496        if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url ) {
     2497                $rel = ' rel="attachment wp-att-' . $id . '"';
    25012498        }
    25022499
    25032500        remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
     
    25142511                }
    25152512
    25162513                $title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
    2517                 $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt );
     2514                $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt );
    25182515        } elseif ( wp_attachment_is( 'video', $post ) || wp_attachment_is( 'audio', $post )  ) {
    25192516                $html = stripslashes_deep( $_POST['html'] );
     2517        } else {
     2518                $html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
     2519                if ( ! empty( $url ) ) {
     2520                        $html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
     2521                }
    25202522        }
    25212523
    25222524        /** This filter is documented in wp-admin/includes/media.php */