Ticket #18708: 18708.6.patch
File 18708.6.patch, 5.0 KB (added by , 12 years ago) |
---|
-
wp-admin/css/media.dev.css
193 193 text-align: center; 194 194 } 195 195 196 #media-upload a.wp-post-thumbnail {197 margin: 0 20px;198 }199 200 196 #media-items a.delete { 201 197 display: block; 202 198 float: right; -
wp-admin/includes/media.php
21 21 'library' => __('Media Library') 22 22 ); 23 23 24 if ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] ) 25 unset( $_default_tabs['type_url'] ); 26 24 27 return apply_filters('media_upload_tabs', $_default_tabs); 25 28 } 26 29 … … 1156 1159 'extra_rows' => array(), 1157 1160 ); 1158 1161 1159 if ( $send ) 1162 if ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] ) 1163 $send = ''; 1164 elseif ( $send ) 1160 1165 $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false ); 1161 1166 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1162 1167 if ( !EMPTY_TRASH_DAYS ) { … … 1184 1189 if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) 1185 1190 && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) { 1186 1191 $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" ); 1187 $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>"; 1192 $primary = ( isset( $_REQUEST['context'] ) && 'featured' == $_REQUEST['context'] ) ? 'button-primary' : ''; 1193 $thumbnail = "<input class='$primary' id='wp-post-thumbnail-$attachment_id' type='submit' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;' value='" . esc_attr__( "Use as featured image" ) . "' name='wp-post-thumbnail-$attachment_id' />"; 1188 1194 } 1189 1195 1190 1196 if ( ( $send || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) … … 1835 1841 1836 1842 $type_links[] = "<li><a href='" . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>'; 1837 1843 } 1838 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>'; 1844 if ( ! isset( $_REQUEST['context'] ) || 'featured' != $_REQUEST['context'] ) 1845 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>'; 1839 1846 unset($type_links); 1840 1847 ?> 1841 1848 </ul> -
wp-admin/includes/post.php
1147 1147 if ( empty( $post_id ) ) 1148 1148 $post_id = $post_ID; 1149 1149 1150 $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post_id) ); 1150 $upload_iframe_src = get_upload_iframe_src( 'image', $post_id ); 1151 $upload_iframe_src = remove_query_arg( 'TB_iframe', $upload_iframe_src ); 1152 $upload_iframe_src = esc_url( add_query_arg( array( 'context' => 'featured', 'TB_iframe' => 1 ), $upload_iframe_src ) ); 1151 1153 $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>'; 1152 1154 $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) ); 1153 1155 -
wp-admin/js/set-post-thumbnail.dev.js
1 1 function WPSetAsThumbnail(id, nonce){ 2 var $ link = jQuery('a#wp-post-thumbnail-' + id);2 var $button = jQuery('input#wp-post-thumbnail-' + id); 3 3 4 $ link.text( setPostThumbnailL10n.saving );4 $button.val( setPostThumbnailL10n.saving ); 5 5 jQuery.post(ajaxurl, { 6 6 action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie) 7 7 }, function(str){ 8 8 var win = window.dialogArguments || opener || parent || top; 9 $ link.text( setPostThumbnailL10n.setThumbnail );9 $button.val( setPostThumbnailL10n.setThumbnail ); 10 10 if ( str == '0' ) { 11 11 alert( setPostThumbnailL10n.error ); 12 12 } else { 13 jQuery(' a.wp-post-thumbnail').show();14 $ link.text( setPostThumbnailL10n.done );15 $ link.fadeOut( 2000 );13 jQuery('input.wp-post-thumbnail').show(); 14 $button.val( setPostThumbnailL10n.done ); 15 $button.fadeOut( 2000 ); 16 16 win.WPSetThumbnailID(id); 17 17 win.WPSetThumbnailHTML(str); 18 if ( window.location.href.indexOf('featured') != -1 ) 19 win.tb_remove(); 18 20 } 19 21 } 20 22 );