From bf264bb66d4d48dab3379b8d502389484e9914b7 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 10 Dec 2009 06:14:36 +0000 Subject: [PATCH] Post/Page Image was too generic a name. Post/Page Thumbnail is more clear, even if you can create very large thumbnail images if you so choose. git-svn-id: http://svn.automattic.com/wordpress/trunk@12351 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 4 +- wp-admin/edit-form-advanced.php | 4 +- wp-admin/edit-page-form.php | 4 +- wp-admin/includes/image.php | 2 +- wp-admin/includes/media.php | 4 +- wp-admin/includes/meta-boxes.php | 6 +- wp-admin/includes/post.php | 14 ++--- wp-includes/default-filters.php | 6 +- wp-includes/media.php | 26 ++++----- wp-includes/post-image-template.php | 76 ------------------------- wp-includes/post-thumbnail-template.php | 76 +++++++++++++++++++++++++ wp-includes/script-loader.php | 2 +- wp-includes/theme.php | 5 +- wp-settings.php | 2 +- 14 files changed, 114 insertions(+), 117 deletions(-) delete mode 100644 wp-includes/post-image-template.php create mode 100644 wp-includes/post-thumbnail-template.php diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index d0cd5e317..783e052fd 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -1410,14 +1410,14 @@ case 'set-post-thumbnail': if ( $thumbnail_id == '-1' ) { delete_post_meta( $post_id, '_thumbnail_id' ); - die( _wp_post_image_html() ); + die( _wp_post_thumbnail_html() ); } if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ); if ( !empty( $thumbnail_html ) ) { update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id ); - die( _wp_post_image_html( $thumbnail_id ) ); + die( _wp_post_thumbnail_html( $thumbnail_id ) ); } } die( '0' ); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 99fb4010d..085fabca3 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -98,8 +98,8 @@ foreach ( get_object_taxonomies('post') as $tax_name ) { } add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core'); -if ( current_theme_supports( 'post-images', 'post' ) ) - add_meta_box('postimagediv', __('Post Image'), 'post_image_meta_box', 'post', 'side', 'low'); +if ( current_theme_supports( 'post-thumbnails', 'post' ) ) + add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low'); add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core'); add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core'); diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 7bea6a7e1..79420164f 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -80,8 +80,8 @@ add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'pag add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core'); add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core'); add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core'); -if ( current_theme_supports( 'post-images', 'page' ) ) - add_meta_box('postimagediv', __('Page Image'), 'post_image_meta_box', 'page', 'side', 'low'); +if ( current_theme_supports( 'post-thumbnails', 'page' ) ) + add_meta_box('postimagediv', __('Page Image'), 'post_thumbnail_meta_box', 'page', 'side', 'low'); $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM if ( $post->post_author && !in_array($post->post_author, $authors) ) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 0b5e58456..903bd5fe1 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -75,7 +75,7 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_ } /** - * Generate post image attachment meta data. + * Generate post thumbnail attachment meta data. * * @since 2.1.0 * diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 8577f93e4..e6277f174 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1239,8 +1239,8 @@ function get_media_item( $attachment_id, $args = null ) { } $thumbnail = ''; - if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-images', get_post_type($_GET['post_id']) ) && get_post_image_id($_GET['post_id']) != $attachment_id ) - $thumbnail = "" . esc_html__( "Use as post image" ) . ""; + if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-thumbnails', get_post_type($_GET['post_id']) ) && get_post_thumbnail_id($_GET['post_id']) != $attachment_id ) + $thumbnail = "" . esc_html__( "Use as thumbnail" ) . ""; if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) ) $form_fields['buttons'] = array('tr' => "\t\t$send $thumbnail $delete\n"); diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 17fc4fd10..d5e9cb7e8 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -815,12 +815,12 @@ function link_advanced_meta_box($link) { } /** - * Display post image meta box. + * Display post thumbnail meta box. * * @since 2.9.0 */ -function post_image_meta_box() { +function post_thumbnail_meta_box() { global $post; $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); - echo _wp_post_image_html( $thumbnail_id ); + echo _wp_post_thumbnail_html( $thumbnail_id ); } diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 225c64600..9dba35d94 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1062,32 +1062,32 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { } /** - * Output HTML for the post image meta-box. + * Output HTML for the post thumbnail meta-box. * * @since 2.9.0 * * @param int $thumbnail_id ID of the attachment used for thumbnail * @return string html */ -function _wp_post_image_html( $thumbnail_id = NULL ) { +function _wp_post_thumbnail_html( $thumbnail_id = NULL ) { global $content_width, $_wp_additional_image_sizes; - $content = '

' . esc_html__( 'Set image' ) . '

'; + $content = '

' . esc_html__( 'Set thumbnail' ) . '

'; if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $old_content_width = $content_width; $content_width = 266; - if ( !isset( $_wp_additional_image_sizes['post-image'] ) ) + if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) ) $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) ); else - $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-image' ); + $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' ); if ( !empty( $thumbnail_html ) ) { $content = '' . $thumbnail_html . ''; - $content .= '

' . esc_html__( 'Remove image' ) . '

'; + $content .= '

' . esc_html__( 'Remove thumbnail' ) . '

'; } $content_width = $old_content_width; } - return apply_filters( 'admin_post_image_html', $content ); + return apply_filters( 'admin_post_thumbnail_html', $content ); } /** diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 5f6a32deb..668f389de 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -213,9 +213,9 @@ add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' ); add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); -// Post Image CSS class filtering -add_action( 'begin_fetch_post_image_html', '_wp_post_image_class_filter_add' ); -add_action( 'end_fetch_post_image_html', '_wp_post_image_class_filter_remove' ); +// Post Thumbnail CSS class filtering +add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); +add_action( 'end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove' ); // Redirect Old Slugs add_action( 'template_redirect', 'wp_old_slug_redirect' ); diff --git a/wp-includes/media.php b/wp-includes/media.php index cb96bf7ea..84533d2ca 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -183,10 +183,10 @@ function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE ) { } /** - * Registers an image size for the post image + * Registers an image size for the post thumbnail */ -function set_post_image_size( $width = 0, $height = 0, $crop = FALSE ) { - add_image_size( 'post-image', $width, $height, $crop ); +function set_post_thumbnail_size( $width = 0, $height = 0, $crop = FALSE ) { + add_image_size( 'post-thumbnail', $width, $height, $crop ); } /** @@ -578,38 +578,38 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa } /** - * Adds a 'wp-post-image' class to post image thumbnails - * Uses the begin_fetch_post_image_html and end_fetch_post_image_html action hooks to - * dynamically add/remove itself so as to only filter post image thumbnails + * Adds a 'wp-post-image' class to post thumbnail thumbnails + * Uses the begin_fetch_post_thumbnail_html and end_fetch_post_thumbnail_html action hooks to + * dynamically add/remove itself so as to only filter post thumbnail thumbnails * * @author Mark Jaquith * @since 2.9.0 * @param array $attr Attributes including src, class, alt, title * @return array */ -function _wp_post_image_class_filter( $attr ) { +function _wp_post_thumbnail_class_filter( $attr ) { $attr['class'] .= ' wp-post-image'; return $attr; } /** - * Adds _wp_post_image_class_filter to the wp_get_attachment_image_attributes filter + * Adds _wp_post_thumbnail_class_filter to the wp_get_attachment_image_attributes filter * * @author Mark Jaquith * @since 2.9.0 */ -function _wp_post_image_class_filter_add( $attr ) { - add_filter( 'wp_get_attachment_image_attributes', '_wp_post_image_class_filter' ); +function _wp_post_thumbnail_class_filter_add( $attr ) { + add_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' ); } /** - * Removes _wp_post_image_class_filter from the wp_get_attachment_image_attributes filter + * Removes _wp_post_thumbnail_class_filter from the wp_get_attachment_image_attributes filter * * @author Mark Jaquith * @since 2.9.0 */ -function _wp_post_image_class_filter_remove( $attr ) { - remove_filter( 'wp_get_attachment_image_attributes', '_wp_post_image_class_filter' ); +function _wp_post_thumbnail_class_filter_remove( $attr ) { + remove_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' ); } add_shortcode('wp_caption', 'img_caption_shortcode'); diff --git a/wp-includes/post-image-template.php b/wp-includes/post-image-template.php deleted file mode 100644 index 1a6b30e7a..000000000 --- a/wp-includes/post-image-template.php +++ /dev/null @@ -1,76 +0,0 @@ - \ No newline at end of file diff --git a/wp-includes/post-thumbnail-template.php b/wp-includes/post-thumbnail-template.php new file mode 100644 index 000000000..baf1bce62 --- /dev/null +++ b/wp-includes/post-thumbnail-template.php @@ -0,0 +1,76 @@ + \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index dcbd462d7..580913db1 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091021' ); $scripts->add_data( 'set-post-thumbnail', 'group', 1 ); $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array( - 'setThumbnail' => __( 'Use as post image' ), + 'setThumbnail' => __( 'Use as thumbnail' ), 'saving' => __( 'Saving...' ), 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ) ) ); diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 463047bcc..a2639103a 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1321,9 +1321,6 @@ function add_custom_image_header($header_callback, $admin_header_callback) { function add_theme_support( $feature ) { global $_wp_theme_features; - if ( 'post-thumbnails' == $feature ) // This was changed during 2.9 beta. I'll be nice and not break things. - $feature = 'post-images'; - if ( func_num_args() == 1 ) $_wp_theme_features[$feature] = true; else @@ -1353,7 +1350,7 @@ function current_theme_supports( $feature ) { // @todo Allow pluggable arg checking switch ( $feature ) { - case 'post-images': + case 'post-thumbnails': // post-thumbnails can be registered for only certain content/post types by passing // an array of types to add_theme_support(). If no array was passed, then // any type is accepted diff --git a/wp-settings.php b/wp-settings.php index 4fea749f8..01557408a 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -692,7 +692,7 @@ if ( file_exists(TEMPLATEPATH . '/functions.php') ) include(TEMPLATEPATH . '/functions.php'); // Load in support for template functions which the theme supports -require_if_theme_supports( 'post-images', ABSPATH . WPINC . '/post-image-template.php' ); +require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); /** * Runs just before PHP shuts down execution.