summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
commit10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch)
treeb4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/class.jetpack-ixr-client.php
parentUpdating script for Update (diff)
downloadblogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/class.jetpack-ixr-client.php')
-rw-r--r--plugins/jetpack/class.jetpack-ixr-client.php135
1 files changed, 5 insertions, 130 deletions
diff --git a/plugins/jetpack/class.jetpack-ixr-client.php b/plugins/jetpack/class.jetpack-ixr-client.php
index 5d2f7516..12e07d1e 100644
--- a/plugins/jetpack/class.jetpack-ixr-client.php
+++ b/plugins/jetpack/class.jetpack-ixr-client.php
@@ -1,135 +1,10 @@
<?php
-
-defined( 'ABSPATH' ) or die( 'No direct access, please.' );
-
-require_once( ABSPATH . WPINC . '/class-IXR.php' );
-
/**
- * IXR_Client
- *
- * @package IXR
- * @since 1.5
+ * Deprecated since 7.7.
*
+ * @deprecated
+ * @package jetpack
*/
-class Jetpack_IXR_Client extends IXR_Client {
- public $jetpack_args = null;
-
- function __construct( $args = array(), $path = false, $port = 80, $timeout = 15 ) {
- $defaults = array(
- 'url' => Jetpack::xmlrpc_api_url(),
- 'user_id' => 0,
- );
-
- $args = wp_parse_args( $args, $defaults );
-
- $this->jetpack_args = $args;
-
- $this->IXR_Client( $args['url'], $path, $port, $timeout );
- }
-
- function query() {
- $args = func_get_args();
- $method = array_shift( $args );
- $request = new IXR_Request( $method, $args );
- $xml = trim( $request->getXml() );
-
- $response = Jetpack_Client::remote_request( $this->jetpack_args, $xml );
-
- if ( is_wp_error( $response ) ) {
- $this->error = new IXR_Error( -10520, sprintf( 'Jetpack: [%s] %s', $response->get_error_code(), $response->get_error_message() ) );
- return false;
- }
-
- if ( !$response ) {
- $this->error = new IXR_Error( -10520, 'Jetpack: Unknown Error' );
- return false;
- }
-
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
- $this->error = new IXR_Error( -32300, 'transport error - HTTP status code was not 200' );
- return false;
- }
-
- $content = wp_remote_retrieve_body( $response );
-
- // Now parse what we've got back
- $this->message = new IXR_Message( $content );
- if ( !$this->message->parse() ) {
- // XML error
- $this->error = new IXR_Error( -32700, 'parse error. not well formed' );
- return false;
- }
-
- // Is the message a fault?
- if ( $this->message->messageType == 'fault' ) {
- $this->error = new IXR_Error( $this->message->faultCode, $this->message->faultString );
- return false;
- }
-
- // Message must be OK
- return true;
- }
-
- function get_jetpack_error( $fault_code = null, $fault_string = null ) {
- if ( is_null( $fault_code ) ) {
- $fault_code = $this->error->code;
- }
-
- if ( is_null( $fault_string ) ) {
- $fault_string = $this->error->message;
- }
-
- if ( preg_match( '#jetpack:\s+\[(\w+)\]\s*(.*)?$#i', $fault_string, $match ) ) {
- $code = $match[1];
- $message = $match[2];
- $status = $fault_code;
- return new Jetpack_Error( $code, $message, $status );
- }
-
- return new Jetpack_Error( "IXR_{$fault_code}", $fault_string );
- }
-}
-
-/**
- * IXR_ClientMulticall
- *
- * @package IXR
- * @since 1.5
- */
-class Jetpack_IXR_ClientMulticall extends Jetpack_IXR_Client {
- public $calls = array();
-
- function __construct( $args = array(), $path = false, $port = 80, $timeout = 15 ) {
- parent::__construct( $args, $path, $port, $timeout );
- }
-
- function addCall() {
- $args = func_get_args();
- $methodName = array_shift( $args );
- $struct = array(
- 'methodName' => $methodName,
- 'params' => $args
- );
- $this->calls[] = $struct;
- }
-
- function query() {
- usort( $this->calls, array( $this, 'sort_calls' ) );
-
- // Prepare multicall, then call the parent::query() method
- return parent::query( 'system.multicall', $this->calls );
- }
-
- // Make sure syncs are always done first
- function sort_calls( $a, $b ) {
- if ( 'jetpack.syncContent' == $a['methodName'] ) {
- return -1;
- }
-
- if ( 'jetpack.syncContent' == $b['methodName'] ) {
- return 1;
- }
- return 0;
- }
-}
+// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+_deprecated_file( basename( __FILE__ ), 'jetpack-7.7' );