WordPress.org

Make WordPress Core

Ticket #12792: 12792.diff

File 12792.diff, 6.1 KB (added by scribu, 12 years ago)
  • wp-includes/js/thickbox/thickbox.js

     
    2323
    2424//add thickbox to href & area elements that have a class of .thickbox
    2525function tb_init(domChunk){
    26         jQuery(domChunk).click(function(){
     26        jQuery(domChunk).live('click', function(){
    2727        var t = this.title || this.name || null;
    2828        var a = this.href || this.alt;
    2929        var g = this.rel || false;
  • wp-includes/script-loader.php

     
    167167        $scripts->add( 'jquery-autocomplete', "/wp-includes/js/jquery/autocomplete$suffix.js", array('jquery'), '1.1' );
    168168        $scripts->add_data( 'jquery-autocomplete', 'group', 1 );
    169169
    170         $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20100108');
     170        $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20104104');
    171171        $scripts->add_data( 'thickbox', 'group', 1 );
    172172        $scripts->localize( 'thickbox', 'thickboxL10n', array(
    173173                        'next' => __('Next >'),
  • wp-admin/includes/post.php

     
    11431143 */
    11441144function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
    11451145        global $content_width, $_wp_additional_image_sizes;
    1146         $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set featured image' ) . '</a></p>';
    11471146
     1147        $set_thumbnail_link = '<p class="hide-if-no-js"><a href="' . get_upload_iframe_src('image') . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1148        $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
     1149
    11481150        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
    11491151                $old_content_width = $content_width;
    11501152                $content_width = 266;
     
    11531155                else
    11541156                        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
    11551157                if ( !empty( $thumbnail_html ) ) {
    1156                         $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
     1158                        $content = sprintf($set_thumbnail_link, $thumbnail_html);
    11571159                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
    11581160                }
    11591161                $content_width = $old_content_width;
  • wp-admin/includes/media.php

     
    351351 * @since unknown
    352352 */
    353353function media_buttons() {
    354         global $post_ID, $temp_ID;
    355         $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
    356         $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
    357         $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
    358         $media_title = __('Add Media');
    359         $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
    360         $image_title = __('Add an Image');
    361         $video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&amp;type=video");
    362         $video_title = __('Add Video');
    363         $audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&amp;type=audio");
    364         $audio_title = __('Add Audio');
    365 
    366354        $do_image = $do_audio = $do_video = true;
    367355        if ( is_multisite() ) {
    368356                $media_buttons = get_site_option( 'mu_media_buttons' );
     
    376364        $out = '';
    377365
    378366        if ( $do_image )
    379                 $out .= "<a href='{$image_upload_iframe_src}&amp;TB_iframe=true' id='add_image' class='thickbox' title='$image_title' onclick='return false;'><img src='" . esc_url( admin_url( 'images/media-button-image.gif' ) ) . "' alt='$image_title' /></a>";
     367                $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif', 'image');
    380368        if ( $do_video )
    381                 $out .= "<a href='{$video_upload_iframe_src}&amp;TB_iframe=true' id='add_video' class='thickbox' title='$video_title' onclick='return false;'><img src='" . esc_url( admin_url( 'images/media-button-video.gif' ) ) . "' alt='$video_title' /></a>";
     369                $out .= _media_button(__('Add Video'), 'images/media-button-video.gif', 'video');
    382370        if ( $do_audio )
    383                 $out .= "<a href='{$audio_upload_iframe_src}&amp;TB_iframe=true' id='add_audio' class='thickbox' title='$audio_title' onclick='return false;'><img src='" . esc_url( admin_url( 'images/media-button-music.gif' ) ) . "' alt='$audio_title' /></a>";
    384         $out .= "<a href='{$media_upload_iframe_src}&amp;TB_iframe=true' id='add_media' class='thickbox' title='$media_title' onclick='return false;'><img src='" . esc_url( admin_url( 'images/media-button-other.gif' ) ) . "' alt='$media_title' /></a>";
     371                $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif', 'audio');
    385372
     373        $out .= _media_button(__('Add Media'), 'images/media-button-other.gif', 'media');
     374
     375        $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
     376
    386377        printf($context, $out);
    387378}
    388379add_action( 'media_buttons', 'media_buttons' );
    389380
     381function _media_button($title, $icon, $type) {
     382        return "<a href='" . get_upload_iframe_src($type) . "' id='add_$type' class='thickbox' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' /></a>";
     383}
     384
     385function get_upload_iframe_src($type) {
     386        global $post_ID, $temp_ID;
     387        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
     388        $upload_iframe_src = add_query_arg('post_id', $uploading_iframe_ID, 'media-upload.php');
     389
     390        if ( 'media' != $type )
     391                $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
     392        $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src);
     393
     394        return add_query_arg('TB_iframe', true, $upload_iframe_src);
     395}
     396
    390397/**
    391398 * {@internal Missing Short Description}}
    392399 *