WordPress.org

Make WordPress Core

Ticket #19257: 19257.patch

File 19257.patch, 7.7 KB (added by johnbillion, 4 years ago)
  • wp-admin/edit-form-advanced.php

     
    122122        add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 
    123123 
    124124if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) ) 
    125                 add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low'); 
     125        add_meta_box('postimagediv', $post_type_object->labels->featured_image, 'post_thumbnail_meta_box', null, 'side', 'low'); 
    126126 
    127127if ( post_type_supports($post_type, 'excerpt') ) 
    128128        add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); 
  • wp-admin/includes/media.php

     
    11621162                $calling_post_id = $post->post_parent; 
    11631163        if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) 
    11641164                && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { 
     1165                $calling_post = get_post( $calling_post_id ); 
     1166                $calling_post_type_object = get_post_type_object( $calling_post->post_type ); 
    11651167                $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); 
    1166                 $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>"; 
     1168                $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html( $calling_post_type_object->labels->use_featured_image ) . "</a>"; 
    11671169        } 
    11681170 
    11691171        if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) 
     
    12471249 * @since 2.5.0 
    12481250 */ 
    12491251function media_upload_header() { 
     1252        $post_id = intval($_REQUEST['post_id']); 
     1253        if ( !empty( $post_id ) ) 
     1254                $post_type = get_post_type( $post_id ); 
     1255        else 
     1256                $post_type = ''; 
    12501257        ?> 
    1251         <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script> 
     1258        <script type="text/javascript">post_id = <?php echo $post_id; ?>;post_type = '<?php echo $post_type; ?>';</script> 
    12521259        <div id="media-upload-header"> 
    12531260        <?php the_media_upload_tabs(); ?> 
    12541261        </div> 
  • wp-admin/includes/post.php

     
    11441144 */ 
    11451145function _wp_post_thumbnail_html( $thumbnail_id = NULL ) { 
    11461146        global $content_width, $_wp_additional_image_sizes, $post_ID; 
    1147         $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>'; 
    1148         $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' )); 
     1147        $post = get_post( $post_ID ); 
     1148        $post_type_object = get_post_type_object( $post->post_type ); 
     1149        $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr( $post_type_object->labels->set_featured_image ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>'; 
     1150        $content = sprintf($set_thumbnail_link, esc_html( $post_type_object->labels->set_featured_image )); 
    11491151 
    11501152        if ( $thumbnail_id && get_post( $thumbnail_id ) ) { 
    11511153                $old_content_width = $content_width; 
     
    11571159                if ( !empty( $thumbnail_html ) ) { 
    11581160                        $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ID" ); 
    11591161                        $content = sprintf($set_thumbnail_link, $thumbnail_html); 
    1160                         $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>'; 
     1162                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>'; 
    11611163                } 
    11621164                $content_width = $old_content_width; 
    11631165        } 
  • wp-admin/js/set-post-thumbnail.dev.js

     
    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                setThumbnail = 'setThumbnail_' + post_type; 
     10                $link.text( setPostThumbnailL10n[setThumbnail] ); 
    1011                if ( str == '0' ) { 
    1112                        alert( setPostThumbnailL10n.error ); 
    1213                } else { 
  • wp-includes/post.php

     
    11921192                'not_found' => array( __('No posts found.'), __('No pages found.') ), 
    11931193                'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), 
    11941194                'parent_item_colon' => array( null, __('Parent Page:') ), 
    1195                 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ) 
     1195                'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), 
     1196                'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ), 
     1197                'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ), 
     1198                'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ), 
     1199                'use_featured_image' => array( __( 'Use as featured image' ), __( 'Use as featured image' ) ) 
    11961200        ); 
    11971201        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; 
    11981202        return _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults ); 
  • wp-includes/script-loader.php

     
    379379                        'error' => __( 'Could not load the preview image. Please reload the page and try again.' ) 
    380380                )); 
    381381 
    382                 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20100518', 1 ); 
    383                 $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array( 
    384                         'setThumbnail' => __( 'Use as featured image' ), 
     382                $setPostThumbnailL10n = array( 
     383                        'setThumbnail' => __( 'Use as featured image' ), // Back compat 
    385384                        'saving' => __( 'Saving...' ), 
    386385                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ), 
    387386                        'done' => __( 'Done' ) 
    388                 ) ); 
     387                ); 
    389388 
     389                foreach ( get_post_types( null, 'objects' ) as $post_type_object ) { 
     390                        if ( isset( $post_type_object->labels->use_featured_image ) ) 
     391                                $setPostThumbnailL10n["setThumbnail_{$post_type_object->name}"] = $post_type_object->labels->use_featured_image; 
     392                } 
     393 
     394                $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20100518', 1 ); 
     395                $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', $setPostThumbnailL10n ); 
     396 
    390397                // Navigation Menus 
    391398                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array('jquery-ui-sortable'), '20111115' ); 
    392399                $scripts->localize( 'nav-menu', 'navMenuL10n', array(