Skip to content

Commit 2a1f121

Browse files
committed
Merge pull request #146 from skyverge/4.4
Nau mai 4.4.0 ✌️
2 parents dc05a95 + ea894a7 commit 2a1f121

File tree

45 files changed

+1281
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1281
-437
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wc-plugin-framework",
3-
"version": "4.3.0",
3+
"version": "4.4.0",
44
"title": "WooCommerce Plugin Framework",
55
"author": "SkyVerge Team",
66
"homepage": "https://github.com/skyverge/wc-plugin-framework#readme",

tests/unit/helper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,6 @@ public function test_get_order_line_items() {
532532
$expected_item->product = $this->get_wc_product_mock();
533533
$expected_item->item = $this->get_wc_item_data();
534534

535-
p\redefine( 'SV_WC_Plugin_Compatibility::is_wc_version_gte_2_4', function() { return true; } );
536-
537535
$this->getMockBuilder( 'WC_Order_Item_Meta_Mock' )
538536
->setMethods( [ 'get_formatted'] )
539537
->setMockClassName( 'WC_Order_Item_Meta' )

woocommerce/api/class-sv-wc-api-base.php

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2323
*/
2424

25-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25+
defined( 'ABSPATH' ) or exit;
2626

2727
if ( ! class_exists( 'SV_WC_API_Base' ) ) :
2828

@@ -96,6 +96,11 @@ protected function perform_request( $request ) {
9696

9797
$start_time = microtime( true );
9898

99+
// If this API requires TLS v1.2, force it
100+
if ( $this->require_tls_1_2() ) {
101+
add_action( 'http_api_curl', array( $this, 'set_tls_1_2_request' ), 10, 3 );
102+
}
103+
99104
// perform the request
100105
$response = $this->do_remote_request( $this->get_request_uri(), $this->get_request_args() );
101106

@@ -664,6 +669,47 @@ protected function set_response_handler( $handler ) {
664669
}
665670

666671

672+
/**
673+
* Maybe force TLS v1.2 requests.
674+
*
675+
* @since 4.4.0
676+
*/
677+
public function set_tls_1_2_request( $handle, $r, $url ) {
678+
679+
if ( ! SV_WC_Helper::str_starts_with( $url, 'https://' ) ) {
680+
return;
681+
}
682+
683+
$versions = curl_version();
684+
$curl_version = $versions['version'];
685+
686+
// Get the SSL details
687+
list( $ssl_type, $ssl_version ) = explode( '/', $versions['ssl_version'] );
688+
689+
$ssl_version = substr( $ssl_version, 0, -1 );
690+
691+
// If cURL and/or OpenSSL aren't up to the challenge, bail
692+
if ( ! version_compare( $curl_version, '7.34.0', '>=' ) || ( 'OpenSSL' === $ssl_type && ! version_compare( $ssl_version, '1.0.1', '>=' ) ) ) {
693+
return;
694+
}
695+
696+
curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
697+
}
698+
699+
700+
/**
701+
* Determine if TLS v1.2 is required for API requests.
702+
*
703+
* Subclasses should override this to return true if TLS v1.2 is required.
704+
*
705+
* @since 4.4.0
706+
* @return bool
707+
*/
708+
protected function require_tls_1_2() {
709+
return false;
710+
}
711+
712+
667713
}
668714

669715
endif;

woocommerce/api/class-sv-wc-api-exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2323
*/
2424

25-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25+
defined( 'ABSPATH' ) or exit;
2626

2727
if ( ! class_exists( 'SV_WC_API_Exception' ) ) :
2828

woocommerce/api/class-sv-wc-api-json-response.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

woocommerce/api/class-sv-wc-api-rest-request.php

Lines changed: 0 additions & 136 deletions
This file was deleted.

woocommerce/api/interface-sv-wc-api-request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2323
*/
2424

25-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25+
defined( 'ABSPATH' ) or exit;
2626

2727
if ( ! interface_exists( 'SV_WC_API_Request' ) ) :
2828

woocommerce/api/interface-sv-wc-api-response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2323
*/
2424

25-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25+
defined( 'ABSPATH' ) or exit;
2626

2727
if ( ! interface_exists( 'SV_WC_API_Response' ) ) :
2828

woocommerce/changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*** SkyVerge WooCommerce Plugin Framework Changelog ***
22

3+
2016.06.01 - version 4.4.0
4+
* Feature - Allow bundled framework and plugin translations to be easily overridden
5+
* Tweak - Allow plugins extending SV_WC_API_Base to declare TLS v1.2 as a requirement for requests
6+
* Misc - Added support for WooCommerce 2.6
7+
* Misc - Removed support for WooCommerce 2.3
8+
39
2016.04.18 - version 4.3.0
410
* Feature - Revamped admin payment token editor
511
* Feature - Prevent deleting subscription payment methods

woocommerce/class-sv-wc-admin-notice-handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0
2323
*/
2424

25-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25+
defined( 'ABSPATH' ) or exit;
2626

2727
if ( ! class_exists( 'SV_WC_Admin_Notice_Handler' ) ) :
2828

@@ -125,7 +125,7 @@ public function should_display_notice( $message_id, $params = array() ) {
125125
if ( ! current_user_can( 'manage_woocommerce' ) ) {
126126
return false;
127127
}
128-
128+
129129
$params = wp_parse_args( $params, array(
130130
'dismissible' => true,
131131
'always_show_on_settings' => true,

0 commit comments

Comments
 (0)