| @@ 485-487 (lines=3) @@ | ||
| 482 | } |
|
| 483 | ||
| 484 | // Exit if no parameters were passed. |
|
| 485 | if ( ! is_array( $params ) ) { |
|
| 486 | return new WP_Error( 'missing_options', esc_html__( 'Missing options.', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 487 | } |
|
| 488 | ||
| 489 | // If $params was set via `get_body_params()` there may be some additional variables in the request that can |
|
| 490 | // cause validation to fail. This method verifies that each param was in fact updated and will throw a `some_updated` |
|
| @@ 1372-1381 (lines=10) @@ | ||
| 1369 | } |
|
| 1370 | ||
| 1371 | $verification_services_codes = get_option( 'verification_services_codes' ); |
|
| 1372 | if ( |
|
| 1373 | ! is_array( $verification_services_codes ) |
|
| 1374 | || empty( $verification_services_codes ) |
|
| 1375 | ) { |
|
| 1376 | return new WP_Error( |
|
| 1377 | 'empty', |
|
| 1378 | esc_html__( 'Site not verified with any service.', 'jetpack' ), |
|
| 1379 | array( 'status' => 404 ) |
|
| 1380 | ); |
|
| 1381 | } |
|
| 1382 | ||
| 1383 | $services = array(); |
|
| 1384 | foreach ( jetpack_verification_services() as $name => $service ) { |
|
| @@ 34-40 (lines=7) @@ | ||
| 31 | $results = json_decode( $response['body'], true ); |
|
| 32 | ||
| 33 | // Bail if there were no results or plan details returned |
|
| 34 | if ( ! is_array( $results ) ) { |
|
| 35 | return new WP_Error( |
|
| 36 | 'failed_to_fetch_data', |
|
| 37 | esc_html__( 'Unable to fetch the requested data.', 'jetpack' ), |
|
| 38 | array( 'status' => 500 ) |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | return rest_ensure_response( array( |
|
| 43 | 'code' => 'success', |
|
| @@ 742-744 (lines=3) @@ | ||
| 739 | $param = $request->get_params(); |
|
| 740 | ||
| 741 | // Exit if no parameters were passed. |
|
| 742 | if ( ! is_array( $param ) ) { |
|
| 743 | return new WP_Error( 'missing_setting', esc_html__( 'Missing setting.', 'jetpack' ), array( 'status' => 404 ) ); |
|
| 744 | } |
|
| 745 | ||
| 746 | // Get option name and value. |
|
| 747 | $option = key( $param ); |
|