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