Make WordPress Core


Ignore:
Timestamp:
10/21/2009 07:27:33 AM (17 years ago)
Author:
markjaquith
Message:

Save some clicks and optimize for the Upload, Set as thumbnail flow. props scribu. see #10928

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r12060 r12081  
    11021102 */
    11031103function get_media_item( $attachment_id, $args = null ) {
    1104         global $redir_tab;
    1105 
    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;
     1104        global $post_mime_types, $redir_tab;
     1105
    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;
     1110
     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 );
    11151114
    11161115        $toggle_on = __('Show');
    … …  
    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>";
    11461143        } else {
    11471144                $class = 'form-table';
    … …  
    12101207        if ( $delete )
    12111208                $delete = current_user_can('delete_post', $attachment_id) ? "<a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a>" : "";
    1212         if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
    1213                 $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
     1209        if ( 'image' == $type && get_post_image_id($_GET['post_id']) != $attachment_id )
     1210                $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
     1211
     1212        if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) )
     1213                $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n");
    12141214
    12151215        $hidden_fields = array();
Note: See TracChangeset for help on using the changeset viewer.