Changeset 23481
- Timestamp:
- 02/25/2013 02:32:22 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r23355 r23481 68 68 69 69 add_action( 'wp_ajax_nopriv_autosave', 'wp_ajax_nopriv_autosave', 1 ); 70 add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); 70 71 71 72 if ( is_user_logged_in() ) -
trunk/wp-admin/includes/ajax-actions.php
r23416 r23481 2082 2082 $response = array(); 2083 2083 2084 // screen id is the same as $current_screen->id and the JS global 'pagenow'2084 // screen_id is the same as $current_screen->id and the JS global 'pagenow' 2085 2085 if ( ! empty($_POST['screenid']) ) 2086 2086 $screen_id = sanitize_key($_POST['screenid']); 2087 2087 else 2088 2088 $screen_id = 'site'; 2089 2089 2090 2090 if ( ! empty($_POST['data']) ) { 2091 2091 $data = wp_unslash( (array) $_POST['data'] ); … … 2107 2107 $response['servertime'] = time(); 2108 2108 2109 // Change the interval, format: array( speed, ticks )2110 if ( isset($response['heartbeat_interval']) )2111 $response['heartbeat_interval'] = (array) $response['heartbeat_interval'];2112 2113 2109 wp_send_json($response); 2114 2110 } 2111 2112 function wp_ajax_nopriv_heartbeat() { 2113 $response = array(); 2114 2115 // screen_id is the same as $current_screen->id and the JS global 'pagenow' 2116 if ( ! empty($_POST['screenid']) ) 2117 $screen_id = sanitize_key($_POST['screenid']); 2118 else 2119 $screen_id = 'site'; 2120 2121 if ( ! empty($_POST['data']) ) { 2122 $data = wp_unslash( (array) $_POST['data'] ); 2123 $response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id ); 2124 } 2125 2126 $response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id ); 2127 2128 // Allow the transport to be replaced with long-polling easily 2129 do_action( 'heartbeat_nopriv_tick', $response, $screen_id ); 2130 2131 // send the current time acording to the server 2132 $response['servertime'] = time(); 2133 2134 wp_send_json($response); 2135 } 2136 -
trunk/wp-includes/general-template.php
r23401 r23481 2288 2288 */ 2289 2289 function wp_heartbeat_settings( $settings ) { 2290 $setting['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); 2290 if ( is_user_logged_in() ) 2291 $setting['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); 2292 2291 2293 return $setting; 2292 2294 } -
trunk/wp-includes/js/heartbeat.js
r23389 r23481 96 96 97 97 data.data = $.extend( {}, queue ); 98 $(document).trigger( 'heartbeat-send', [data.data] ); 98 99 99 100 data.interval = interval / 1000;
Note: See TracChangeset
for help on using the changeset viewer.