500 ) ); } // Decode the results $results = json_decode( $response['body'], true ); // Bail if there were no results or plan details returned if ( ! is_array( $results ) ) { return new WP_Error( 'failed_to_fetch_data', esc_html__( 'Unable to fetch the requested data.', 'jetpack' ), array( 'status' => 500 ) ); } return rest_ensure_response( array( 'code' => 'success', 'message' => esc_html__( 'Site features correctly received.', 'jetpack' ), 'data' => wp_remote_retrieve_body( $response ), ) ); } /** * Check that the current user has permissions to request information about this site. * * @since 5.1.0 * * @return bool */ public static function can_request() { return current_user_can( 'jetpack_manage_modules' ); } }