mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
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: https://develop.svn.wordpress.org/trunk@23692 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user