equal
deleted
inserted
replaced
3 * WordPress Ajax Process Execution |
3 * WordPress Ajax Process Execution |
4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 * @subpackage Administration |
6 * @subpackage Administration |
7 * |
7 * |
8 * @link https://codex.wordpress.org/AJAX_in_Plugins |
8 * @link https://developer.wordpress.org/plugins/javascript/ajax |
9 */ |
9 */ |
10 |
10 |
11 /** |
11 /** |
12 * Executing Ajax process. |
12 * Executing Ajax process. |
13 * |
13 * |
115 'parse-embed', |
115 'parse-embed', |
116 'set-attachment-thumbnail', |
116 'set-attachment-thumbnail', |
117 'parse-media-shortcode', |
117 'parse-media-shortcode', |
118 'destroy-sessions', |
118 'destroy-sessions', |
119 'install-plugin', |
119 'install-plugin', |
|
120 'activate-plugin', |
120 'update-plugin', |
121 'update-plugin', |
121 'crop-image', |
122 'crop-image', |
122 'generate-password', |
123 'generate-password', |
123 'save-wporg-username', |
124 'save-wporg-username', |
124 'delete-plugin', |
125 'delete-plugin', |
151 'health-check-dotorg-communication', |
152 'health-check-dotorg-communication', |
152 'health-check-is-in-debug-mode', |
153 'health-check-is-in-debug-mode', |
153 'health-check-background-updates', |
154 'health-check-background-updates', |
154 'health-check-loopback-requests', |
155 'health-check-loopback-requests', |
155 ); |
156 ); |
156 $core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated ); |
157 |
|
158 $core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated ); |
157 |
159 |
158 // Register core Ajax calls. |
160 // Register core Ajax calls. |
159 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) { |
161 if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) { |
160 add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
162 add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
161 } |
163 } |
165 } |
167 } |
166 |
168 |
167 add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' ); |
169 add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' ); |
168 |
170 |
169 add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
171 add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
|
172 |
|
173 // Register Plugin Dependencies Ajax calls. |
|
174 add_action( 'wp_ajax_check_plugin_dependencies', array( 'WP_Plugin_Dependencies', 'check_plugin_dependencies_during_ajax' ) ); |
170 |
175 |
171 $action = $_REQUEST['action']; |
176 $action = $_REQUEST['action']; |
172 |
177 |
173 if ( is_user_logged_in() ) { |
178 if ( is_user_logged_in() ) { |
174 // If no action is registered, return a Bad Request response. |
179 // If no action is registered, return a Bad Request response. |