PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | _inc/lib/core-api/class.jetpack-core-api-site-endpoints.php +6 -5 13.2.4 → 16.3-a.1 View file →
@@ -5,8 +5,9 @@
5 5 * @package automattic/jetpack
6 6 */
7 7
8 8 use Automattic\Jetpack\Connection\Client;
9 +use Automattic\Jetpack\Publicize\Publicize;
9 10 use Automattic\Jetpack\Stats\WPCOM_Stats;
10 11
11 12 /**
12 13 * This is the endpoint class for `/site` endpoints.
@@ -60,16 +61,16 @@
60 61 );
61 62 }
62 63
63 64 /**
64 - * Returns the result of `/sites/%s/purchases` endpoint call.
65 + * Returns the result of `/upgrades` endpoint call.
65 66 *
66 67 * @return array of site purchases.
67 68 */
68 69 public static function get_purchases() {
69 70 // Make the API request.
70 - $request = sprintf( '/sites/%d/purchases', Jetpack_Options::get_option( 'id' ) );
71 - $response = Client::wpcom_json_api_request_as_blog( $request, '1.1' );
71 + $request = sprintf( '/upgrades?site=%d', Jetpack_Options::get_option( 'id' ) );
72 + $response = Client::wpcom_json_api_request_as_blog( $request, '1.2' );
72 73
73 74 // Bail if there was an error or malformed response.
74 75 if ( is_wp_error( $response ) || ! is_array( $response ) || ! isset( $response['body'] ) ) {
75 76 return self::get_failed_fetch_error();
@@ -252,9 +253,9 @@
252 253 }
253 254 }
254 255
255 256 // Number of active Publicize connections.
256 - if ( Jetpack::is_module_active( 'publicize' ) && class_exists( 'Publicize' ) ) {
257 + if ( Jetpack::is_module_active( 'publicize' ) && class_exists( Publicize::class ) ) {
257 258 $publicize = new Publicize();
258 259 $connections = $publicize->get_all_connections();
259 260
260 261 $number_of_connections = 0;
@@ -294,9 +295,9 @@
294 295 return rest_ensure_response(
295 296 array(
296 297 'code' => 'success',
297 298 'message' => esc_html__( 'Site benefits correctly received.', 'jetpack' ),
298 - 'data' => wp_json_encode( $benefits ),
299 + 'data' => wp_json_encode( $benefits, JSON_UNESCAPED_SLASHES ),
299 300 )
300 301 );
301 302 }
302 303 }