PHP Class Jetpack_Client, jetpack

Mostra file Open project: automattic/jetpack Class Usage Examples

Public Methods

Method Description
_stringify_data ( array | mixed $data ) : array | string Takes an array or similar structure and recursively turns all values into strings. This is used to make sure that body hashes are made ith the string version, which is what will be seen after a server pulls up the data in the $_POST array.
_wp_remote_request ( $url, $args, $set_fallback = false ) : array | WP_Error Wrapper for wp_remote_request(). Turns off SSL verification for certain SSL errors.
remote_request ( $args, $body = null ) : array | WP_Error Makes an authorized remote request using Jetpack_Signature
set_time_diff ( &$response, $force_set = false )
wpcom_json_api_request_as_blog ( string $path, string $version = self::WPCOM_JSON_API_VERSION, array $args = [], string $body = null ) : array | WP_Error Query the WordPress.com REST API using the blog token

Method Details

_stringify_data() public static method

Takes an array or similar structure and recursively turns all values into strings. This is used to make sure that body hashes are made ith the string version, which is what will be seen after a server pulls up the data in the $_POST array.
public static _stringify_data ( array | mixed $data ) : array | string
$data array | mixed
return array | string

_wp_remote_request() public static method

This is lame, but many, many, many hosts have misconfigured SSL. 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.
See also: Jetpack::fix_url_for_bad_hosts()
public static _wp_remote_request ( $url, $args, $set_fallback = false ) : array | WP_Error
return array | WP_Error WP HTTP response on success

remote_request() public static method

Makes an authorized remote request using Jetpack_Signature
public static remote_request ( $args, $body = null ) : array | WP_Error
return array | WP_Error WP HTTP response on success

set_time_diff() public static method

public static set_time_diff ( &$response, $force_set = false )

wpcom_json_api_request_as_blog() static public method

Query the WordPress.com REST API using the blog token
static public wpcom_json_api_request_as_blog ( string $path, string $version = self::WPCOM_JSON_API_VERSION, array $args = [], string $body = null ) : array | WP_Error
$path string
$version string
$args array
$body string
return array | WP_Error $response Data.