Skip to content

Commit fef2977

Browse files
committed
v2.1.1 - Hotfix to improve performance and fix some bugs
1 parent a5e1135 commit fef2977

4 files changed

Lines changed: 20 additions & 5 deletions

File tree

CryptAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: CryptAPI Payment Gateway for WooCommerce
55
Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
66
Description: Accept cryptocurrency payments on your WooCommerce website
7-
Version: 2.1.0
7+
Version: 2.1.1
88
Requires at least: 4.0
99
Tested up to: 5.8
1010
WC requires at least: 2.4

controllers/CryptAPI.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ class WC_CryptAPI_Gateway extends WC_Payment_Gateway
77

88
function __construct()
99
{
10-
WC_CryptAPI_Gateway::$COIN_OPTIONS = CryptAPI\Helper::get_supported_coins();
11-
1210
$this->id = 'cryptapi';
1311
$this->icon = CRYPTAPI_PLUGIN_URL . 'static/200_logo_ca.png';
1412
$this->has_fields = true;
@@ -21,6 +19,7 @@ function __construct()
2119
'add_payment_method',
2220
);
2321

22+
$this->load_coins();
2423

2524
$this->init_form_fields();
2625
$this->init_settings();
@@ -35,6 +34,22 @@ function __construct()
3534

3635
}
3736

37+
function load_coins() {
38+
if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
39+
return;
40+
}
41+
42+
$transient = get_transient('cryptapi_coins');
43+
if (!empty($transient)) {
44+
WC_CryptAPI_Gateway::$COIN_OPTIONS = $transient;
45+
return;
46+
}
47+
48+
$coins = CryptAPI\Helper::get_supported_coins();
49+
set_transient('cryptapi_coins', $coins, 86400);
50+
WC_CryptAPI_Gateway::$COIN_OPTIONS = $coins;
51+
}
52+
3853
function admin_options()
3954
{
4055
parent::admin_options();

define.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

33

4-
define('CRYPTAPI_PLUGIN_VERSION', '2.1.0');
4+
define('CRYPTAPI_PLUGIN_VERSION', '2.1.1');
55
define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
66
define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: cryptapi
33
Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash
44
Requires at least: 4.0
55
Tested up to: 5.8
6-
Stable tag: 2.1.0
6+
Stable tag: 2.1.1
77
Requires PHP: 5.5
88
WC requires at least: 2.4
99
WC tested up to: 5.6

0 commit comments

Comments
 (0)