Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Logged out warnings, heartbeat: remove nopriv_autosave as it doubles …

…the functionality of the logged out warnings, move wp_ajax_nopriv_heartbeat() under No-privilege Ajax handlers in ajax-actions.php, see #23295, see #23216

git-svn-id: http://core.svn.wordpress.org/trunk@23692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit d46102d2589409b7574c1662f4daf7e94001e773 1 parent 5398ac4
Andrew Ozz authored
Showing with 20 additions and 37 deletions.
  1. +0 −1  wp-admin/admin-ajax.php
  2. +20 −36 wp-admin/includes/ajax-actions.php
View
1  wp-admin/admin-ajax.php
@@ -66,7 +66,6 @@
if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) )
add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
-add_action( 'wp_ajax_nopriv_autosave', 'wp_ajax_nopriv_autosave', 1 );
add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
if ( is_user_logged_in() )
View
56 wp-admin/includes/ajax-actions.php
@@ -9,20 +9,29 @@
/*
* No-privilege Ajax handlers.
*/
+function wp_ajax_nopriv_heartbeat() {
+ $response = array();
-function wp_ajax_nopriv_autosave() {
- $id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
+ // screen_id is the same as $current_screen->id and the JS global 'pagenow'
+ if ( ! empty($_POST['screenid']) )
+ $screen_id = sanitize_key($_POST['screenid']);
+ else
+ $screen_id = 'site';
- if ( ! $id )
- wp_die( -1 );
+ if ( ! empty($_POST['data']) ) {
+ $data = wp_unslash( (array) $_POST['data'] );
+ $response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
+ }
- $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() );
- $x = new WP_Ajax_Response( array(
- 'what' => 'autosave',
- 'id' => $id,
- 'data' => $message
- ) );
- $x->send();
+ $response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );
+
+ // Allow the transport to be replaced with long-polling easily
+ do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
+
+ // send the current time according to the server
+ $response['servertime'] = time();
+
+ wp_send_json($response);
}
/*
@@ -2098,31 +2107,6 @@ function wp_ajax_heartbeat() {
wp_send_json($response);
}
-function wp_ajax_nopriv_heartbeat() {
- $response = array();
-
- // screen_id is the same as $current_screen->id and the JS global 'pagenow'
- if ( ! empty($_POST['screenid']) )
- $screen_id = sanitize_key($_POST['screenid']);
- else
- $screen_id = 'site';
-
- if ( ! empty($_POST['data']) ) {
- $data = wp_unslash( (array) $_POST['data'] );
- $response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
- }
-
- $response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );
-
- // Allow the transport to be replaced with long-polling easily
- do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
-
- // send the current time acording to the server
- $response['servertime'] = time();
-
- wp_send_json($response);
-}
-
function wp_ajax_revisions_data() {
check_ajax_referer( 'revisions-ajax-nonce', 'nonce' );
Please sign in to comment.
Something went wrong with that request. Please try again.