Changeset 23382 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 02/03/2013 07:03:27 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/ajax-actions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r23355 r23382 2075 2075 function wp_ajax_heartbeat() { 2076 2076 check_ajax_referer( 'heartbeat-nonce', '_nonce' ); 2077 $response = array( 'pagenow' => '' ); 2078 2079 if ( ! empty($_POST['pagenow']) ) 2080 $response['pagenow'] = sanitize_key($_POST['pagenow']); 2077 $response = array(); 2078 2079 // screenid is the same as $current_screen->id and the JS global 'pagenow' 2080 if ( ! empty($_POST['screenid']) ) 2081 $screen_id = sanitize_key($_POST['screenid']); 2082 else 2083 $screen_id = 'site'; 2081 2084 2082 2085 if ( ! empty($_POST['data']) ) { … … 2088 2091 // todo: separate filters: 'heartbeat_[action]' so we call different callbacks only when there is data for them, 2089 2092 // or all callbacks listen to one filter and run when there is something for them in $data? 2090 $response = apply_filters( 'heartbeat_received', $response, $data );2091 } 2092 2093 $response = apply_filters( 'heartbeat_send', $response );2093 $response = apply_filters( 'heartbeat_received', $response, $data, $screen_id ); 2094 } 2095 2096 $response = apply_filters( 'heartbeat_send', $response, $screen_id ); 2094 2097 2095 2098 // Allow the transport to be replaced with long-polling easily 2096 do_action( 'heartbeat_tick', $response ); 2097 2098 // always send the current time acording to the server 2099 $response['time'] = time(); 2099 do_action( 'heartbeat_tick', $response, $screen_id ); 2100 2101 // send the current time acording to the server 2102 $response['servertime'] = time(); 2103 2104 // Change the interval, format: array( speed, ticks ) 2105 if ( isset($response['heartbeat_interval']) ) 2106 $response['heartbeat_interval'] = (array) $response['heartbeat_interval']; 2100 2107 2101 2108 wp_send_json($response);
Note: See TracChangeset
for help on using the changeset viewer.