equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 /** |
2 /** |
3 * Error Protection API: WP_Recovery_Mode class |
3 * Error Protection API: WP_Recovery_Mode class |
4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 * @since 5.2.0 |
6 * @since 5.2.0 |
7 */ |
7 */ |
8 |
8 |
9 /** |
9 /** |
10 * Core class used to implement Recovery Mode. |
10 * Core class used to implement Recovery Mode. |
11 * |
11 * |
237 if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) { |
237 if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) { |
238 return; |
238 return; |
239 } |
239 } |
240 |
240 |
241 if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], self::EXIT_ACTION ) ) { |
241 if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], self::EXIT_ACTION ) ) { |
242 wp_die( __( 'Exit recovery mode link expired.' ) ); |
242 wp_die( __( 'Exit recovery mode link expired.' ), 403 ); |
243 } |
243 } |
244 |
244 |
245 if ( ! $this->exit_recovery_mode() ) { |
245 if ( ! $this->exit_recovery_mode() ) { |
246 wp_die( __( 'Failed to exit recovery mode. Please try again later.' ) ); |
246 wp_die( __( 'Failed to exit recovery mode. Please try again later.' ) ); |
247 } |
247 } |
270 $validated = $this->cookie_service->validate_cookie(); |
270 $validated = $this->cookie_service->validate_cookie(); |
271 |
271 |
272 if ( is_wp_error( $validated ) ) { |
272 if ( is_wp_error( $validated ) ) { |
273 $this->cookie_service->clear_cookie(); |
273 $this->cookie_service->clear_cookie(); |
274 |
274 |
275 wp_die( $validated, '' ); |
275 $validated->add_data( array( 'status' => 403 ) ); |
|
276 wp_die( $validated ); |
276 } |
277 } |
277 |
278 |
278 $session_id = $this->cookie_service->get_session_id_from_cookie(); |
279 $session_id = $this->cookie_service->get_session_id_from_cookie(); |
279 if ( is_wp_error( $session_id ) ) { |
280 if ( is_wp_error( $session_id ) ) { |
280 $this->cookie_service->clear_cookie(); |
281 $this->cookie_service->clear_cookie(); |
281 |
282 |
282 wp_die( $session_id, '' ); |
283 $session_id->add_data( array( 'status' => 403 ) ); |
|
284 wp_die( $session_id ); |
283 } |
285 } |
284 |
286 |
285 $this->is_active = true; |
287 $this->is_active = true; |
286 $this->session_id = $session_id; |
288 $this->session_id = $session_id; |
287 } |
289 } |
335 * |
337 * |
336 * @since 5.2.0 |
338 * @since 5.2.0 |
337 * |
339 * |
338 * @global array $wp_theme_directories |
340 * @global array $wp_theme_directories |
339 * |
341 * |
340 * @param array $error Error that was triggered. |
342 * @param array $error Error that was triggered. |
341 * |
|
342 * @return array|false { |
343 * @return array|false { |
343 * @type string $slug The extension slug. This is the plugin or theme's directory. |
344 * Extension details. |
344 * @type string $type The extension type. Either 'plugin' or 'theme'. |
345 * |
|
346 * @type string $slug The extension slug. This is the plugin or theme's directory. |
|
347 * @type string $type The extension type. Either 'plugin' or 'theme'. |
345 * } |
348 * } |
346 */ |
349 */ |
347 protected function get_extension_for_error( $error ) { |
350 protected function get_extension_for_error( $error ) { |
348 global $wp_theme_directories; |
351 global $wp_theme_directories; |
349 |
352 |