Make WordPress Core

Ticket #18708: 18708.2.patch

File 18708.2.patch, 2.4 KB (added by SergeyBiryukov, 13 years ago)
  • wp-admin/includes/media.php

     
    400400        return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='{$id}-add_{$type}' class='thickbox add_$type' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
    401401}
    402402
    403 function get_upload_iframe_src($type) {
     403function get_upload_iframe_src($type, $close_on_save = false) {
    404404        global $post_ID, $temp_ID;
    405405        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
    406406        $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, admin_url('media-upload.php') );
    407407
    408408        if ( 'media' != $type )
    409409                $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
     410        if ( $close_on_save )
     411                $upload_iframe_src = add_query_arg('close-on-save', true, $upload_iframe_src);
    410412        $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src);
    411413
    412414        return add_query_arg('TB_iframe', true, $upload_iframe_src);
  • wp-admin/includes/post.php

     
    11861186 */
    11871187function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
    11881188        global $content_width, $_wp_additional_image_sizes, $post_ID;
    1189         $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1189        $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image', true) ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    11901190        $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
    11911191
    11921192        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
  • wp-admin/js/set-post-thumbnail.dev.js

     
    1515                        $link.fadeOut( 2000 );
    1616                        win.WPSetThumbnailID(id);
    1717                        win.WPSetThumbnailHTML(str);
     18                        if ( window.location.href.indexOf('close-on-save') != -1 )
     19                                win.tb_remove();
    1820                }
    1921        }
    2022        );