Make WordPress Core

Ticket #28038: 28038.diff

File 28038.diff, 1.1 KB (added by nacin, 10 years ago)
  • src/wp-includes/media.php

     
    25322532
    25332533        if ( current_user_can( 'edit_post', $attachment->ID ) ) {
    25342534                $response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
    2535                 $response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
    25362535                $response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
     2536
     2537                if ( 0 === strpos( $attachment->post_mime_type, 'image/' ) ) {
     2538                        static $image_editor_supports = array();
     2539                        if ( ! isset( $image_editor_supports[ $attachment->post_mime_type ] ) ) {
     2540                                $image_editor_supports[ $attachment->post_mime_type ] = wp_image_editor_supports( array( 'mime_type' => $attachment->post_mime_type ) );
     2541                        }
     2542
     2543                        if ( $image_editor_supports[ $attachment->post_mime_type ] ) {
     2544                                $response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
     2545                        }
     2546                }
    25372547        }
    25382548
    25392549        if ( current_user_can( 'delete_post', $attachment->ID ) )