Completed
Push — add/legacy-files ( 4cc789...bef25d )
by
unknown
157:43 queued 148:20
created

Jetpack_Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A remote_request() 0 4 1
A wpcom_json_api_request_as_blog() 0 4 1
A _wp_remote_request() 0 4 1
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