Completed
Push — renovate/wordpress-monorepo ( afed45...1558f1 )
by
unknown
18:07 queued 11:47
created

Jetpack_Client::_wp_remote_request()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
	 * Jetpack API version.
22
	 *
23
	 * @deprecated use Automattic\Jetpack\Connection\Client::WPCOM_JSON_API_VERSION
24
	 */
25
	const WPCOM_JSON_API_VERSION = '1.1';
26
27
	/**
28
	 * Perform remote request.
29
	 *
30
	 * @deprecated use Automattic\Jetpack\Connection\Client::remote_request
31
	 *
32
	 * @param array $args Arguments.
33
	 * @param null  $body Request body.
34
	 *
35
	 * @return array|WP_Error
36
	 */
37
	public static function remote_request( $args, $body = null ) {
38
		_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
39
		return Client::remote_request( $args, $body );
40
	}
41
42
	/**
43
	 * Request to wpcom using the blog id.
44
	 *
45
	 * @deprecated use Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog
46
	 *
47
	 * @param string $path Endpoint path.
48
	 * @param string $version Endpoint version.
49
	 * @param array  $args Arguments.
50
	 * @param null   $body Request body.
51
	 * @param string $base_api_path Endpoint base prefix.
52
	 *
53
	 * @return Array|WP_Error
54
	 */
55
	public static function wpcom_json_api_request_as_blog(
56
		$path,
57
		$version = self::WPCOM_JSON_API_VERSION,
0 ignored issues
show
Deprecated Code introduced by
The constant Jetpack_Client::WPCOM_JSON_API_VERSION has been deprecated with message: use Automattic\Jetpack\Connection\Client::WPCOM_JSON_API_VERSION

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
58
		$args = array(),
59
		$body = null,
60
		$base_api_path = 'rest'
61
	) {
62
		_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
63
		return Client::wpcom_json_api_request_as_blog( $path, $version, $args, $body, $base_api_path );
64
	}
65
66
	/**
67
	 * Wrapper for wp_remote_request().  Turns off SSL verification for certain SSL errors.
68
	 * This is lame, but many, many, many hosts have misconfigured SSL.
69
	 *
70
	 * @deprecated use Automattic\Jetpack\Connection\Client::_wp_remote_request
71
	 *
72
	 * When Jetpack is registered, the jetpack_fallback_no_verify_ssl_certs option is set to the current time if:
73
	 * 1. a certificate error is found AND
74
	 * 2. not verifying the certificate works around the problem.
75
	 *
76
	 * The option is checked on each request.
77
	 *
78
	 * @internal
79
	 * @see Jetpack::fix_url_for_bad_hosts()
80
	 *
81
	 * @param String  $url the request URL.
82
	 * @param Array   $args request arguments.
83
	 * @param Boolean $set_fallback whether to allow flagging this request to use a fallback certficate override.
84
	 * @return array|WP_Error WP HTTP response on success
85
	 */
86
	public static function _wp_remote_request( $url, $args, $set_fallback = false ) {
87
		_deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' );
88
		return Client::_wp_remote_request( $url, $args, $set_fallback );
89
	}
90
}
91