_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php 1 location
|
@@ 31-37 (lines=7) @@
|
| 28 |
|
$response = Client::wpcom_json_api_request_as_blog( $request, '1.1' ); |
| 29 |
|
|
| 30 |
|
// Bail if there was an error or malformed response. |
| 31 |
|
if ( is_wp_error( $response ) || ! is_array( $response ) || ! isset( $response['body'] ) ) { |
| 32 |
|
return new WP_Error( |
| 33 |
|
'failed_to_fetch_data', |
| 34 |
|
esc_html__( 'Unable to fetch the requested data.', 'jetpack' ), |
| 35 |
|
array( 'status' => 500 ) |
| 36 |
|
); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
// Decode the results. |
| 40 |
|
$results = json_decode( $response['body'], true ); |
_inc/lib/class.core-rest-api-endpoints.php 1 location
|
@@ 2511-2513 (lines=3) @@
|
| 2508 |
|
* @return bool|WP_Error |
| 2509 |
|
*/ |
| 2510 |
|
public static function validate_services( $value, $request, $param ) { |
| 2511 |
|
if ( ! is_array( $value ) || ! isset( $value['visible'] ) || ! isset( $value['hidden'] ) ) { |
| 2512 |
|
return new WP_Error( 'invalid_param', sprintf( esc_html__( '%s must be an array with visible and hidden items.', 'jetpack' ), $param ) ); |
| 2513 |
|
} |
| 2514 |
|
|
| 2515 |
|
// Allow to clear everything. |
| 2516 |
|
if ( empty( $value['visible'] ) && empty( $value['hidden'] ) ) { |
_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 1 location
|
@@ 228-237 (lines=10) @@
|
| 225 |
|
*/ |
| 226 |
|
public static function activate_modules( $request ) { |
| 227 |
|
|
| 228 |
|
if ( |
| 229 |
|
! isset( $request['modules'] ) |
| 230 |
|
|| ! is_array( $request['modules'] ) |
| 231 |
|
) { |
| 232 |
|
return new WP_Error( |
| 233 |
|
'not_found', |
| 234 |
|
esc_html__( 'The requested Jetpack module was not found.', 'jetpack' ), |
| 235 |
|
array( 'status' => 404 ) |
| 236 |
|
); |
| 237 |
|
} |
| 238 |
|
|
| 239 |
|
$activated = array(); |
| 240 |
|
$failed = array(); |