| @@ -10,8 +10,12 @@ | ||
| 10 | 10 | namespace Automattic\Jetpack\TOS; |
| 11 | 11 | |
| 12 | 12 | use Automattic\Jetpack\Connection\Client; |
| 13 | 13 | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 0 ); | |
| 16 | +} | |
| 17 | + | |
| 14 | 18 | /** |
| 15 | 19 | * Makes a request to the WP.com legal endpoint to mark the Terms of Service as accepted. |
| 16 | 20 | */ |
| 17 | 21 | function accept_tos() { |
| @@ -28,14 +32,13 @@ | ||
| 28 | 32 | ) |
| 29 | 33 | ); |
| 30 | 34 | |
| 31 | 35 | if ( is_wp_error( $response ) ) { |
| 32 | - wp_send_json_error( array( 'message' => __( 'Could not accept the Terms of Service. Please try again later.', 'jetpack' ) ) ); | |
| 33 | - wp_die(); | |
| 36 | + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int. | |
| 37 | + wp_send_json_error( array( 'message' => __( 'Could not accept the Terms of Service. Please try again later.', 'jetpack' ) ), null, JSON_UNESCAPED_SLASHES ); | |
| 34 | 38 | } |
| 35 | 39 | |
| 36 | - wp_send_json_success( $response ); | |
| 37 | - | |
| 38 | - wp_die(); | |
| 40 | + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- It takes null, but its phpdoc only says int. | |
| 41 | + wp_send_json_success( $response, null, JSON_UNESCAPED_SLASHES ); | |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | add_action( 'wp_ajax_jetpack_accept_tos', __NAMESPACE__ . '\accept_tos' ); |