1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<?php
/**
* Jetpack Client
*
* Deprecated methods for Jetpack to act as client with wpcom, provided for back-compatibility.
*
* @category Connection
* @package automattic/jetpack-compat
*/
use Automattic\Jetpack\Connection\Client;
/**
* Class Jetpack_Client
*
* @deprecated Use Automattic\Jetpack\Connection\Client
*/
class Jetpack_Client {
/**
* Jetpack API version.
*
* @deprecated use Automattic\Jetpack\Connection\Client::WPCOM_JSON_API_VERSION
*/
const WPCOM_JSON_API_VERSION = '1.1';
/**
* Perform remote request.
*
* @deprecated use Automattic\Jetpack\Connection\Client::remote_request
*
* @param array $args Arguments.
* @param null $body Request body.
*
* @return array|WP_Error
*/
public static function remote_request( $args, $body = null ) {
_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
return Client::remote_request( $args, $body );
}
/**
* Request to wpcom using the blog id.
*
* @deprecated use Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog
*
* @param string $path Endpoint path.
* @param string $version Endpoint version.
* @param array $args Arguments.
* @param null $body Request body.
* @param string $base_api_path Endpoint base prefix.
*
* @return Array|WP_Error
*/
public static function wpcom_json_api_request_as_blog(
$path,
$version = self::WPCOM_JSON_API_VERSION,
$args = array(),
$body = null,
$base_api_path = 'rest'
) {
_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
return Client::wpcom_json_api_request_as_blog( $path, $version, $args, $body, $base_api_path );
}
/**
* Wrapper for wp_remote_request(). Turns off SSL verification for certain SSL errors.
* This is suboptimal, but many, many, many hosts have misconfigured SSL.
*
* @deprecated use Automattic\Jetpack\Connection\Client::_wp_remote_request
*
* When Jetpack is registered, the jetpack_fallback_no_verify_ssl_certs option is set to the current time if:
* 1. a certificate error is found AND
* 2. not verifying the certificate works around the problem.
*
* The option is checked on each request.
*
* @internal
* @see Utils::fix_url_for_bad_hosts()
*
* @param String $url the request URL.
* @param Array $args request arguments.
* @param Boolean $set_fallback whether to allow flagging this request to use a fallback certficate override.
* @return array|WP_Error WP HTTP response on success
*/
public static function _wp_remote_request( $url, $args, $set_fallback = false ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
return Client::_wp_remote_request( $url, $args, $set_fallback );
}
}
|