Make WordPress Core

Ticket #10928: use_as_thumbnail.diff

File use_as_thumbnail.diff, 1.7 KB (added by scribu, 15 years ago)
  • wp-admin/includes/media.php

     
    11011101 * @return string HTML form for attachment.
    11021102 */
    11031103function get_media_item( $attachment_id, $args = null ) {
    1104         global $redir_tab;
     1104        global $post_mime_types, $redir_tab;
    11051105
    1106         $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );
    1107         $args = wp_parse_args( $args, $default_args );
    1108         extract( $args, EXTR_SKIP );
    1109 
    1110         global $post_mime_types;
    11111106        if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
    11121107                $thumb_url = $thumb_url[0];
    11131108        else
    11141109                return false;
    11151110
     1111        $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );
     1112        $args = wp_parse_args( $args, $default_args );
     1113        extract( $args, EXTR_SKIP );
     1114
    11161115        $toggle_on = __('Show');
    11171116        $toggle_off = __('Hide');
    11181117
     
    11411140                $toggle_links = "
    11421141        <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
    11431142        <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
    1144         if ( 'image' == $type )
    1145                 $toggle_links .= "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"" . intval( $attachment_id ) . "\");return false;'>" . esc_html__( "Use for thumbnail" ) . "</a>";
     1143                if ( 'image' == $type && get_post_image_id($_GET['post_id']) != $attachment_id )
     1144                        $toggle_links .= "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
    11461145        } else {
    11471146                $class = 'form-table';
    11481147                $toggle_links = '';