Make WordPress Core

Ticket #19257: 19257-2.patch

File 19257-2.patch, 9.5 KB (added by mordauk, 10 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    208208        add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
    209209
    210210if ( $thumbnail_support && current_user_can( 'upload_files' ) )
    211         add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
     211        add_meta_box('postimagediv', $post_type_object->labels->featured_image, 'post_thumbnail_meta_box', null, 'side', 'low');
    212212
    213213if ( post_type_supports($post_type, 'excerpt') )
    214214        add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
     
    366366        }
    367367
    368368        if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
    369                 $publish_box .= '<li>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</li>';
     369                $publish_box .= '<li>' . sprintf( __('<strong>%s</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.'), $post_type_object->labels->featured_image ) . '</li>';
    370370        }
    371371
    372372        $publish_box .= '</ul>';
  • src/wp-admin/includes/media.php

     
    14881488        }
    14891489        if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
    14901490                && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
     1491               
     1492                $calling_post = get_post( $calling_post_id );
     1493                $calling_post_type_object = get_post_type_object( $calling_post->post_type );
     1494
    14911495                $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
    1492                 $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>";
     1496                $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>";
    14931497        }
    14941498
    14951499        if ( ( $r['send'] || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) {
     
    17241728 * @since 2.5.0
    17251729 */
    17261730function media_upload_header() {
     1731
    17271732        $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    1728         echo '<script type="text/javascript">post_id = ' . $post_id . ";</script>\n";
     1733
     1734        if ( ! empty( $post_id ) ) {
     1735                $post_type = get_post_type( $post_id );
     1736        } else {
     1737                $post_type = '';
     1738        }
     1739
     1740        echo '<script type="text/javascript">post_id = ' . $post_id . ';post_type = ' . $post_type . ';</script>';
    17291741        if ( empty( $_GET['chromeless'] ) ) {
    17301742                echo '<div id="media-upload-header">';
    17311743                the_media_upload_tabs();
  • src/wp-admin/includes/post.php

     
    13451345function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
    13461346        global $content_width, $_wp_additional_image_sizes;
    13471347
    1348         $post = get_post( $post );
    1349 
     1348        $post = get_post( $post );
     1349        $post_type_object = get_post_type_object( $post->post_type );
     1350        $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr( $post_type_object->labels->set_featured_image ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    13501351        $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
    1351         $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>';
    1352         $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
    13531352
     1353        $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html( $post_type_object->labels->set_featured_image ) );
     1354
    13541355        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
    13551356                $old_content_width = $content_width;
    13561357                $content_width = 266;
     
    13611362                if ( !empty( $thumbnail_html ) ) {
    13621363                        $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
    13631364                        $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
    1364                         $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>';
     1365                        $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>';
    13651366                }
    13661367                $content_width = $old_content_width;
    13671368        }
  • src/wp-admin/js/set-post-thumbnail.js

     
    99                action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
    1010        }, function(str){
    1111                var win = window.dialogArguments || opener || parent || top;
    12                 $link.text( setPostThumbnailL10n.setThumbnail );
     12                setThumbnail = 'setThumbnail_' + post_type;
     13                $link.text( setPostThumbnailL10n[setThumbnail] );
    1314                if ( str == '0' ) {
    1415                        alert( setPostThumbnailL10n.error );
    1516                } else {
  • src/wp-includes/media.php

     
    29912991
    29922992        $hier = $post && is_post_type_hierarchical( $post->post_type );
    29932993
     2994        $post_type_object = get_post_type_object( $post->post_type );
     2995
    29942996        $strings = array(
    29952997                // Generic
    29962998                'url'         => __( 'URL' ),
     
    30493051                'insertFromUrlTitle' => __( 'Insert from URL' ),
    30503052
    30513053                // Featured Images
    3052                 'setFeaturedImageTitle' => __( 'Set Featured Image' ),
    3053                 'setFeaturedImage'    => __( 'Set featured image' ),
     3054                'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
     3055                'setFeaturedImage'    => $post_type_object->labels->set_featured_image,
    30543056
    30553057                // Gallery
    30563058                'createGalleryTitle' => __( 'Create Gallery' ),
  • src/wp-includes/post.php

     
    16391639                'not_found' => array( __('No posts found.'), __('No pages found.') ),
    16401640                'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
    16411641                'parent_item_colon' => array( null, __('Parent Page:') ),
    1642                 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) )
     1642                'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
     1643                'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ),
     1644                'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ),
     1645                'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ),
     1646                'use_featured_image' => array( __( 'Use as featured image' ), __( 'Use as featured image' ) )
    16431647        );
    16441648        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    16451649
  • src/wp-includes/script-loader.php

     
    570570                        'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
    571571                ));
    572572
    573                 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    574                 did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    575                         'setThumbnail' => __( 'Use as featured image' ),
     573                $setPostThumbnailL10n = array(
     574                        'setThumbnail' => __( 'Use as featured image' ), // Back compat
    576575                        'saving' => __( 'Saving...' ),
    577576                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    578577                        'done' => __( 'Done' )
    579                 ) );
     578                );
    580579
     580                foreach ( get_post_types( null, 'objects' ) as $post_type_object ) {
     581                        if ( isset( $post_type_object->labels->use_featured_image ) ) {
     582                                $setPostThumbnailL10n["setThumbnail_{$post_type_object->name}"] = $post_type_object->labels->use_featured_image;
     583                        }
     584                }
     585                $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
     586                did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', $setPostThumbnailL10n );
     587
     588
    581589                // Navigation Menus
    582590                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox' ) );
    583591                did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(