wp/wp-admin/admin-ajax.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   138 	'health-check-is-in-debug-mode',
   138 	'health-check-is-in-debug-mode',
   139 	'health-check-background-updates',
   139 	'health-check-background-updates',
   140 	'health-check-loopback-requests',
   140 	'health-check-loopback-requests',
   141 	'health-check-get-sizes',
   141 	'health-check-get-sizes',
   142 	'toggle-auto-updates',
   142 	'toggle-auto-updates',
       
   143 	'send-password-reset',
   143 );
   144 );
   144 
   145 
   145 // Deprecated.
   146 // Deprecated.
   146 $core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-save-post', 'press-this-add-category' );
   147 $core_actions_post_deprecated = array(
       
   148 	'wp-fullscreen-save-post',
       
   149 	'press-this-save-post',
       
   150 	'press-this-add-category',
       
   151 	'health-check-dotorg-communication',
       
   152 	'health-check-is-in-debug-mode',
       
   153 	'health-check-background-updates',
       
   154 	'health-check-loopback-requests',
       
   155 );
   147 $core_actions_post            = array_merge( $core_actions_post, $core_actions_post_deprecated );
   156 $core_actions_post            = array_merge( $core_actions_post, $core_actions_post_deprecated );
   148 
   157 
   149 // Register core Ajax calls.
   158 // Register core Ajax calls.
   150 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
   159 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) {
   151 	add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
   160 	add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
   152 }
   161 }
   153 
   162 
   154 if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
   163 if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) {
   155 	add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
   164 	add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
   156 }
   165 }
       
   166 
       
   167 add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
   157 
   168 
   158 add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
   169 add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
   159 
   170 
   160 $action = ( isset( $_REQUEST['action'] ) ) ? $_REQUEST['action'] : '';
   171 $action = ( isset( $_REQUEST['action'] ) ) ? $_REQUEST['action'] : '';
   161 
   172