Changeset 33468 for trunk/src/wp-admin/includes/ajax-actions.php
- Timestamp:
- 07/28/2015 10:06:52 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r33432 r33468 2572 2572 */ 2573 2573 function wp_ajax_heartbeat() { 2574 if ( empty( $_POST['_nonce'] ) ) 2575 wp_send_json_error(); 2576 2577 $response = array(); 2578 2579 if ( false === wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ) ) { 2580 // User is logged in but nonces have expired. 2581 $response['nonces_expired'] = true; 2582 wp_send_json($response); 2583 } 2574 if ( empty( $_POST['_nonce'] ) ) { 2575 wp_send_json_error(); 2576 } 2577 2578 $response = $data = array(); 2579 $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); 2584 2580 2585 2581 // screen_id is the same as $current_screen->id and the JS global 'pagenow'. 2586 if ( ! empty( $_POST['screen_id']) )2582 if ( ! empty( $_POST['screen_id'] ) ) { 2587 2583 $screen_id = sanitize_key($_POST['screen_id']); 2588 else2584 } else { 2589 2585 $screen_id = 'front'; 2590 2591 if ( ! empty($_POST['data']) ) { 2586 } 2587 2588 if ( ! empty( $_POST['data'] ) ) { 2592 2589 $data = wp_unslash( (array) $_POST['data'] ); 2593 2590 } 2591 2592 if ( 1 !== $nonce_state ) { 2593 $response = apply_filters( 'wp_refresh_nonces', $response, $data, $screen_id ); 2594 2595 if ( false === $nonce_state ) { 2596 // User is logged in but nonces have expired. 2597 $response['nonces_expired'] = true; 2598 wp_send_json( $response ); 2599 } 2600 } 2601 2602 if ( ! empty( $data ) ) { 2594 2603 /** 2595 2604 * Filter the Heartbeat response received. … … 2629 2638 $response['server_time'] = time(); 2630 2639 2631 wp_send_json( $response);2640 wp_send_json( $response ); 2632 2641 } 2633 2642
Note: See TracChangeset
for help on using the changeset viewer.