Make WordPress Core

Ticket #18708: 18708.6.patch

File 18708.6.patch, 5.0 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/css/media.dev.css

     
    193193        text-align: center;
    194194}
    195195
    196 #media-upload a.wp-post-thumbnail {
    197         margin: 0 20px;
    198 }
    199 
    200196#media-items a.delete {
    201197        display: block;
    202198        float: right;
  • wp-admin/includes/media.php

     
    2121                'library' => __('Media Library')
    2222        );
    2323
     24        if ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] )
     25                unset( $_default_tabs['type_url'] );
     26
    2427        return apply_filters('media_upload_tabs', $_default_tabs);
    2528}
    2629
     
    11561159                'extra_rows' => array(),
    11571160        );
    11581161
    1159         if ( $send )
     1162        if ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] )
     1163                $send = '';
     1164        elseif ( $send )
    11601165                $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
    11611166        if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
    11621167                if ( !EMPTY_TRASH_DAYS ) {
     
    11841189        if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
    11851190                && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
    11861191                $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
    1187                 $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
     1192                $primary = ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] ) ? 'button-primary' : '';
     1193                $thumbnail = "<input class='$primary' id='wp-post-thumbnail-$attachment_id' type='submit' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;' value='" . esc_attr__( "Use as featured image" ) . "' name='wp-post-thumbnail-$attachment_id' />";
    11881194        }
    11891195
    11901196        if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) )
     
    18351841
    18361842        $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
    18371843}
    1838 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
     1844if ( ! isset( $_REQUEST['context'] ) || 'featured' != $_REQUEST['context'] )
     1845        echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
    18391846unset($type_links);
    18401847?>
    18411848</ul>
  • wp-admin/includes/post.php

     
    11471147        if ( empty( $post_id ) )
    11481148                $post_id = $post_ID;
    11491149
    1150         $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post_id) );
     1150        $upload_iframe_src = get_upload_iframe_src( 'image', $post_id );
     1151        $upload_iframe_src = remove_query_arg( 'TB_iframe', $upload_iframe_src );
     1152        $upload_iframe_src = esc_url( add_query_arg( array( 'context' => 'featured', 'TB_iframe' => 1 ), $upload_iframe_src ) );
    11511153        $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    11521154        $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
    11531155
  • wp-admin/js/set-post-thumbnail.dev.js

     
    11function WPSetAsThumbnail(id, nonce){
    2         var $link = jQuery('a#wp-post-thumbnail-' + id);
     2        var $button = jQuery('input#wp-post-thumbnail-' + id);
    33
    4         $link.text( setPostThumbnailL10n.saving );
     4        $button.val( setPostThumbnailL10n.saving );
    55        jQuery.post(ajaxurl, {
    66                action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
    77        }, function(str){
    88                var win = window.dialogArguments || opener || parent || top;
    9                 $link.text( setPostThumbnailL10n.setThumbnail );
     9                $button.val( setPostThumbnailL10n.setThumbnail );
    1010                if ( str == '0' ) {
    1111                        alert( setPostThumbnailL10n.error );
    1212                } else {
    13                         jQuery('a.wp-post-thumbnail').show();
    14                         $link.text( setPostThumbnailL10n.done );
    15                         $link.fadeOut( 2000 );
     13                        jQuery('input.wp-post-thumbnail').show();
     14                        $button.val( setPostThumbnailL10n.done );
     15                        $button.fadeOut( 2000 );
    1616                        win.WPSetThumbnailID(id);
    1717                        win.WPSetThumbnailHTML(str);
     18                        if ( window.location.href.indexOf('featured') != -1 )
     19                                win.tb_remove();
    1820                }
    1921        }
    2022        );