WordPress.org

Make WordPress Core

Changeset 34260


Ignore:
Timestamp:
09/17/2015 05:54:56 AM (5 years ago)
Author:
wonderboymusic
Message:

Media: In wp_ajax_send_attachment_to_editor(), the fallback logic for $html should be tucked into an else statement so it isn't run needlessly and overwritten.

Props tychay.
Fixes #32072.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r34170 r34260  
    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
     
    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
Note: See TracChangeset for help on using the changeset viewer.