Changeset 23355
- Timestamp:
- 01/29/2013 06:15:25 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r22967 r23355 57 57 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 58 58 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', 59 'send-attachment-to-editor', 'save-attachment-order', 59 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 60 60 ); 61 61 -
trunk/wp-admin/includes/ajax-actions.php
r23293 r23355 2072 2072 wp_send_json_success( $html ); 2073 2073 } 2074 2075 function wp_ajax_heartbeat() { 2076 check_ajax_referer( 'heartbeat-nonce', '_nonce' ); 2077 $response = array( 'pagenow' => '' ); 2078 2079 if ( ! empty($_POST['pagenow']) ) 2080 $response['pagenow'] = sanitize_key($_POST['pagenow']); 2081 2082 if ( ! empty($_POST['data']) ) { 2083 $data = (array) $_POST['data']; 2084 // todo: how much to sanitize and preset and what to leave to be accessed from $data or $_POST..? 2085 $user = wp_get_current_user(); 2086 $data['user_id'] = $user->exists() ? $user->ID : 0; 2087 2088 // todo: separate filters: 'heartbeat_[action]' so we call different callbacks only when there is data for them, 2089 // 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 ); 2094 2095 // 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(); 2100 2101 wp_send_json($response); 2102 } -
trunk/wp-includes/default-filters.php
r23329 r23355 291 291 add_filter( 'default_option_embed_autourls', '__return_true' ); 292 292 293 // Default settings for heartbeat 294 add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' ); 295 293 296 unset($filter, $action); -
trunk/wp-includes/general-template.php
r22634 r23355 2285 2285 return $result; 2286 2286 } 2287 2288 /** 2289 * Default settings for heartbeat 2290 * 2291 * Outputs the nonce used in the heartbeat XHR 2292 * 2293 * @since 3.6.0 2294 * 2295 * @param array $settings 2296 * @return array $settings 2297 */ 2298 function wp_heartbeat_settings( $settings ) { 2299 $setting['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); 2300 return $setting; 2301 } -
trunk/wp-includes/script-loader.php
r23339 r23355 108 108 109 109 $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), false, 1 ); 110 111 $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 ); 112 did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings', 113 apply_filters( 'heartbeat_settings', array() ) 114 ); 110 115 111 116 $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 ); … … 372 377 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 ); 373 378 374 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox' ), false, 1 );379 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'heartbeat'), false, 1 ); 375 380 did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array( 376 381 'ok' => __('OK'),
Note: See TracChangeset
for help on using the changeset viewer.