Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _inc/lib/debugger/class-jetpack-cxn-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @package Jetpack
*/


/**
* Class Jetpack_Cxn_Tests contains all of the actual tests.
*/
Expand Down
4 changes: 1 addition & 3 deletions class.jetpack-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public static function remote_request( $args, $body = null ) {

$token_key = sprintf( '%s:%d:%d', $token_key, JETPACK__API_VERSION, $token->external_user_id );

require_once JETPACK__PLUGIN_DIR . 'class.jetpack-signature.php';

$time_diff = (int) Jetpack_Options::get_option( 'time_diff' );
$jetpack_signature = new Jetpack_Signature( $token->secret, $time_diff );

Expand Down Expand Up @@ -89,7 +87,7 @@ public static function remote_request( $args, $body = null ) {
return new Jetpack_Error( 'invalid_body', 'Body is malformed.' );
}

$body_hash = jetpack_sha1_base64( $body_to_hash );
$body_hash = Jetpack::connection()->sha1_base64( $body_to_hash );
}

$auth = array(
Expand Down
4 changes: 0 additions & 4 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5203,8 +5203,6 @@ function verify_xml_rpc_signature() {
return false;
}

require_once JETPACK__PLUGIN_DIR . 'class.jetpack-signature.php';

$jetpack_signature = new Jetpack_Signature( $token->secret, (int) Jetpack_Options::get_option( 'time_diff' ) );
if ( isset( $_POST['_jetpack_is_multipart'] ) ) {
$post_data = $_POST;
Expand Down Expand Up @@ -5814,8 +5812,6 @@ function add_token_to_login_redirect_json_api_authorization( $redirect_to, $orig
* @param null|array $environment
*/
function verify_json_api_authorization_request( $environment = null ) {
require_once JETPACK__PLUGIN_DIR . 'class.jetpack-signature.php';

$environment = is_null( $environment )
? $_REQUEST
: $environment;
Expand Down
50 changes: 22 additions & 28 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions functions.compat.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use \Automattic\Jetpack\Connection\Manager as Connection_Manager;

/**
* Required for class.media-extractor.php to match expected function naming convention.
*
Expand Down Expand Up @@ -88,3 +90,11 @@ function wp_in( $needle, $haystack ) {
return false !== strpos( $haystack, $needle );
}
endif;

/**
* @deprecated 7.5 Use Connection_Manager instead.
*/
function jetpack_sha1_base64( $text ) {
$connection = new Connection_Manager();
return $connection->sha1_base64( $text );
}
6 changes: 6 additions & 0 deletions jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
. '-----END PUBLIC KEY-----' . "\r\n"
);

// These constants can be set in wp-config.php to ensure sites behind proxies will still work.
// Setting these constants, though, is *not* the preferred method. It's better to configure
// the proxy to send the X-Forwarded-Port header.
defined( 'JETPACK_SIGNATURE__HTTP_PORT' ) or define( 'JETPACK_SIGNATURE__HTTP_PORT' , 80 );
defined( 'JETPACK_SIGNATURE__HTTPS_PORT' ) or define( 'JETPACK_SIGNATURE__HTTPS_PORT', 443 );

/**
* Returns the location of Jetpack's lib directory. This filter is applied
* in require_lib().
Expand Down
5 changes: 4 additions & 1 deletion packages/connection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"autoload": {
"psr-4": {
"Automattic\\Jetpack\\Connection\\": "src"
}
},
"classmap": [
"legacy"
]
},
"scripts": {
"phpunit": [
Expand Down
Loading