Merge set-post-thumbnail-handler.js with post.js, move Post Thumbnail meta-box to /includes/meta-boxes.php, see #10928

git-svn-id: http://svn.automattic.com/wordpress/trunk@12060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2009-10-19 20:23:35 +00:00
parent d3f3b6bed1
commit 76f6b9706e
9 changed files with 71 additions and 52 deletions

View File

@@ -114,26 +114,6 @@ function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel =
return $html;
}
function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
$content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
$thumbnail_html = wp_get_attachment_image($thumbnail_id, array( 266, 266 ) );
if ( !empty( $thumbnail_html ) ) {
$content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
}
}
return apply_filters( 'admin_post_thumbnail_html', $content );
}
function post_thumbnail_meta_box() {
global $post;
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
echo _wp_post_thumbnail_html( $thumbnail_id );
}
/**
* {@internal Missing Short Description}}
*

View File

@@ -807,3 +807,14 @@ function link_advanced_meta_box($link) {
</table>
<?php
}
/**
* Display post thumbnail meta box.
*
* @since 2.9.0
*/
function post_thumbnail_meta_box() {
global $post;
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
echo _wp_post_thumbnail_html( $thumbnail_id );
}

View File

@@ -1028,6 +1028,28 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
return $return;
}
/**
* 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_thumbnail_html( $thumbnail_id = NULL ) {
$content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
$thumbnail_html = wp_get_attachment_image($thumbnail_id, array( 266, 266 ) );
if ( !empty( $thumbnail_html ) ) {
$content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
}
}
return apply_filters( 'admin_post_thumbnail_html', $content );
}
/**
* Check to see if the post is currently being edited by another user.
*

View File

@@ -55,6 +55,12 @@ $_old_files = array(
'wp-admin/js/link-cat.js',
'wp-admin/js/forms.js',
'wp-admin/js/upload.js',
'wp-admin/js/set-post-thumbnail-handler.js',
'wp-admin/js/set-post-thumbnail-handler.dev.js',
'wp-admin/js/page.js',
'wp-admin/js/page.dev.js',
'wp-admin/js/slug.js',
'wp-admin/js/slug.dev.js',
'wp-admin/profile-update.php',
'wp-admin/templates.php',
'wp-includes/images/audio.png',