Changeset 24273 for trunk/wp-admin/includes/misc.php
- Timestamp:
- 05/16/2013 03:47:09 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/misc.php
r24209 r24273 624 624 } 625 625 626 $response['wp-refresh-post-lock'] = $send; 627 } 628 629 return $response; 630 } 631 add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 ); 632 633 /** 634 * Check nonce expiration on the New/Edit Post screen and refresh if needed 635 * 636 * @since 3.6 637 */ 638 function wp_refresh_post_nonces( $response, $data, $screen_id ) { 639 if ( 'post' == $screen_id && array_key_exists( 'wp-refresh-post-nonces', $data ) ) { 640 $received = $data['wp-refresh-post-nonces']; 641 642 if ( ! $post_id = absint( $received['post_id'] ) ) 643 return $response; 644 645 if ( ! current_user_can('edit_post', $post_id) ) 646 return $response; 647 626 648 if ( ! empty( $received['post_nonce'] ) && 2 === wp_verify_nonce( $received['post_nonce'], 'update-post_' . $post_id ) ) { 627 $ send['update_nonces'] = array(649 $response['wp-refresh-post-nonces'] = array( 628 650 'replace-autosavenonce' => wp_create_nonce('autosave'), 629 651 'replace-getpermalinknonce' => wp_create_nonce('getpermalink'), … … 634 656 ); 635 657 } 636 637 $response['wp-refresh-post-lock'] = $send;638 658 } 639 659 640 660 return $response; 641 661 } 642 add_filter( 'heartbeat_received', 'wp_refresh_post_ lock', 10, 3 );662 add_filter( 'heartbeat_received', 'wp_refresh_post_nonces', 10, 3 ); 643 663 644 664 /**
Note: See TracChangeset
for help on using the changeset viewer.