Changeset 23692 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 03/13/2013 11:54:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r23683 r23692 10 10 * No-privilege Ajax handlers. 11 11 */ 12 13 function wp_ajax_nopriv_autosave() { 14 $id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; 15 16 if ( ! $id ) 17 wp_die( -1 ); 18 19 $message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="_blank">Please log in again.</a>'), wp_login_url() ); 20 $x = new WP_Ajax_Response( array( 21 'what' => 'autosave', 22 'id' => $id, 23 'data' => $message 24 ) ); 25 $x->send(); 12 function wp_ajax_nopriv_heartbeat() { 13 $response = array(); 14 15 // screen_id is the same as $current_screen->id and the JS global 'pagenow' 16 if ( ! empty($_POST['screenid']) ) 17 $screen_id = sanitize_key($_POST['screenid']); 18 else 19 $screen_id = 'site'; 20 21 if ( ! empty($_POST['data']) ) { 22 $data = wp_unslash( (array) $_POST['data'] ); 23 $response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id ); 24 } 25 26 $response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id ); 27 28 // Allow the transport to be replaced with long-polling easily 29 do_action( 'heartbeat_nopriv_tick', $response, $screen_id ); 30 31 // send the current time according to the server 32 $response['servertime'] = time(); 33 34 wp_send_json($response); 26 35 } 27 36 … … 2099 2108 } 2100 2109 2101 function wp_ajax_nopriv_heartbeat() {2102 $response = array();2103 2104 // screen_id is the same as $current_screen->id and the JS global 'pagenow'2105 if ( ! empty($_POST['screenid']) )2106 $screen_id = sanitize_key($_POST['screenid']);2107 else2108 $screen_id = 'site';2109 2110 if ( ! empty($_POST['data']) ) {2111 $data = wp_unslash( (array) $_POST['data'] );2112 $response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );2113 }2114 2115 $response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );2116 2117 // Allow the transport to be replaced with long-polling easily2118 do_action( 'heartbeat_nopriv_tick', $response, $screen_id );2119 2120 // send the current time acording to the server2121 $response['servertime'] = time();2122 2123 wp_send_json($response);2124 }2125 2126 2110 function wp_ajax_revisions_data() { 2127 2111 check_ajax_referer( 'revisions-ajax-nonce', 'nonce' );
Note: See TracChangeset
for help on using the changeset viewer.