Ticket #15489: garyc40-15489.patch
File garyc40-15489.patch, 9.3 KB (added by , 13 years ago) |
---|
-
wp-admin/admin-ajax.php
diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php index 5eb33e1..a2048dc 100644
function _wp_ajax_add_hierarchical_term() { 319 319 320 320 $id = isset($_POST['id'])? (int) $_POST['id'] : 0; 321 321 switch ( $action = $_POST['action'] ) : 322 case 'delete-post-list-item' : 323 $post = get_post( $id ); 324 if ( ! $post ) { 325 die( (string) time() ); 326 } 327 328 if ( ! current_user_can( 'delete_post', $post->ID ) ) { 329 die( '-1' ); 330 } 331 332 $post_type = $_POST['post_type']; 333 334 if ( ! empty( $_POST['trash'] ) ) { 335 check_ajax_referer( "trash-{$post_type}_{$post->ID}" ); 336 $status = get_post_status( $post->ID ); 337 if ( $status != 'trash' && ! wp_trash_post( $post->ID ) ) { 338 die( '0' ); 339 } 340 } elseif ( ! empty( $_POST['delete'] ) ) { 341 check_ajax_referer( "delete-{$post_type}_{$post->ID}" ); 342 if ( ! wp_delete_post( $post->ID ) ) { 343 die( '0' ); 344 } 345 } elseif ( ! empty( $_POST['untrash'] ) ) { 346 if ( ! wp_untrash_post( $post->ID ) ) { 347 die( '0' ); 348 } 349 } else { 350 die( '-1' ); 351 } 352 die( (string) time() ); 353 break; 322 354 case 'delete-comment' : // On success, die with time() instead of 1 323 355 if ( !$comment = get_comment( $id ) ) 324 356 die( (string) time() ); -
wp-admin/edit.php
diff --git wp-admin/edit.php wp-admin/edit.php index 5e0154f..fb1620a 100644
if ( $wp_list_table->has_items() ) 261 261 </div> 262 262 263 263 <?php 264 wp_post_trashnotice(); 264 265 include('./admin-footer.php'); -
wp-admin/includes/class-wp-posts-list-table.php
diff --git wp-admin/includes/class-wp-posts-list-table.php wp-admin/includes/class-wp-posts-list-table.php index 801fb96..2d8a1bf 100644
class WP_Posts_List_Table extends WP_List_Table { 75 75 76 76 parent::WP_List_Table( array( 77 77 'plural' => 'posts', 78 'singular' => 'post-list-item', 78 79 ) ); 79 80 } 80 81 … … class WP_Posts_List_Table extends WP_List_Table { 162 163 if ( !in_array( $status_name, $avail_post_stati ) ) 163 164 continue; 164 165 165 if ( empty( $num_posts->$status_name ) )166 if ( $status_name != 'trash' && empty( $num_posts->$status_name ) ) 166 167 continue; 167 168 168 169 if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] ) … … class WP_Posts_List_Table extends WP_List_Table { 544 545 } 545 546 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { 546 547 if ( 'trash' == $post->post_status ) 547 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";548 $actions['untrash'] = "<a class='delete:the-list:post-" . get_the_ID() . "::untrash=1' title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 548 549 elseif ( EMPTY_TRASH_DAYS ) 549 $actions['trash'] = "<a class=' submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";550 $actions['trash'] = "<a class='delete:the-list:post-" . get_the_ID() . "::trash=1 submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 550 551 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 551 $actions['delete'] = "<a class=' submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";552 $actions['delete'] = "<a class='delete:the-list:post-" . get_the_ID() . "::delete=1 submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 552 553 } 553 554 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { 554 555 if ( $can_edit_post ) -
wp-admin/includes/template.php
diff --git wp-admin/includes/template.php wp-admin/includes/template.php index 8a1e995..a3f05c3 100644
function get_inline_data($post) { 288 288 <div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div> 289 289 <div class="post_password">' . esc_html( $post->post_password ) . '</div>'; 290 290 291 if ( $post->post_status = 'trash' ) { 292 echo '<div class="_wp_trash_meta_status">' . get_post_meta( $post->ID, '_wp_trash_meta_status', true ) . '</div>'; 293 } 294 291 295 if ( $post_type_object->hierarchical ) 292 296 echo '<div class="post_parent">' . $post->post_parent . '</div>'; 293 297 … … function wp_comment_trashnotice() { 408 412 } 409 413 410 414 /** 415 * Output 'undo move to trash' text for posts 416 * 417 * @since 3.2.0 418 */ 419 function wp_post_trashnotice() { 420 ?> 421 <div class="hidden" id="trash-undo-holder"> 422 <div class="trash-undo-inside"><?php printf(__('%s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div> 423 </div> 424 <?php 425 } 426 427 /** 411 428 * {@internal Missing Short Description}} 412 429 * 413 430 * @since 1.2.0 -
wp-admin/js/inline-edit-post.dev.js
diff --git wp-admin/js/inline-edit-post.dev.js wp-admin/js/inline-edit-post.dev.js index 1a257c6..fecfbfb 100644
1 1 (function($) { 2 var inlineEditPost, postList; 3 4 postList = { 5 theList : {}, 6 postType : userSettings.typenow, 7 init : function() { 8 var t = this; 9 t.theList = $('#the-list').wpList({ 10 alt : '', 11 delBefore : t.delBefore, 12 delAfter : t.delAfter, 13 addColor : 'none' 14 }).bind('wpListDelEnd', function(e, s){ 15 var id = s.element.replace(/[^0-9]+/g, ''); 16 if (s.target.className.indexOf(':trash=1') != -1) 17 $('#undo-' + id).fadeIn(300, function(){}); 18 }); 19 }, 20 delBefore : function(settings, list) { 21 var cl = $(settings.target).attr('class'), el, colspan, undoRow, title, id; 22 settings.data.post_type = typenow; 23 if (cl.indexOf(':trash=1') != -1) { 24 id = cl.replace(/.*?post-([0-9]+).*/, '$1'); 25 el = $('#post-' + id); 26 el.find('.check-column :checkbox').attr('checked', ''); // Uncheck the row so as not to be affected by Bulk Edits. 27 note = $('#trash-undo-holder').html(); 28 colspan = el.children(':visible').length; 29 title = el.find('.post_title').text(); 30 undoRow = $('<tr id="undo-' + id + '" class="undo untrash" style="display:none;"><td colspan="' + colspan + '">' + note + '</td></tr>'). 31 insertBefore(el). 32 find('strong'). 33 text(title).end(). 34 find('.undo a'). 35 attr('href', 'post.php?action=untrash&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce). 36 attr('class', 'delete:the-list:post-' + id + '::untrash=1'). 37 click(function(){ 38 list.wpList.del(this); 39 $('#undo-' + id).css('backgroundColor', '#ceb').fadeOut(350, function(){ 40 $(this).remove(); 41 $('#post-' + id).css('backgroundColor', '').fadeIn(300, function(){}); 42 }); 43 return false; 44 }); 45 } 46 47 return settings; 48 }, 49 updateCount : function(counts) { 50 var index, el, count, url; 51 52 for (index in counts) { 53 el = $('.subsubsub .' + index + ' .count'); 54 count = el.text().replace(/[^0-9]+/g, '') * 1; 55 count += counts[index]; 56 el.text('(' + count + ')'); 57 } 58 }, 59 delAfter : function(r, settings) { 60 var counts = {}, 61 action = $(settings.target).parent(), 62 id = $(settings.target).attr('class').replace(/.*?post-([0-9]+).*/, '$1'), 63 tr = $('#post-' + id), 64 status = tr.find('._status').text(), 65 sticky = tr.find('.sticky').text(); 66 67 if (action.is('span.trash')) { 68 counts['all'] = -1; 69 counts['trash'] = 1; 70 counts[status] = -1; 71 if (sticky) { 72 counts['sticky'] = -1; 73 } 74 } else if (action.is('span.untrash')) { 75 counts['all'] = 1; 76 counts['trash'] = -1; 77 78 status = tr.find('._wp_trash_meta_status').text(); 79 80 if (status != 'trash') { 81 counts[status] = 1; 82 } 83 84 if (sticky) { 85 counts['sticky'] = 1; 86 } 87 } else if (action.is('span.delete')) { 88 counts['trash'] = -1; 89 } 90 91 postList.updateCount(counts); 92 93 return true; 94 } 95 }; 96 2 97 inlineEditPost = { 3 98 4 99 init : function(){ … … inlineEditPost = { 282 377 } 283 378 }; 284 379 285 $(document).ready(function(){inlineEditPost.init(); });380 $(document).ready(function(){inlineEditPost.init(); postList.init();}); 286 381 })(jQuery); -
wp-includes/script-loader.php
diff --git wp-includes/script-loader.php wp-includes/script-loader.php index 1d72dd5..d048167 100644
function wp_default_scripts( &$scripts ) { 387 387 $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' ); 388 388 $scripts->add_data( 'theme-preview', 'group', 1 ); 389 389 390 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20100707' );390 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest', 'wp-lists' ), '20100707' ); 391 391 $scripts->add_data( 'inline-edit-post', 'group', 1 ); 392 392 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 393 393 'error' => __('Error while saving the changes.'),