Plugin Directory

Changeset 3040317


Ignore:
Timestamp:
02/23/2024 03:57:13 PM (2 years ago)
Author:
cryptapi
Message:

v4.7.11 - minor bugfix

Location:
cryptapi-payment-gateway-for-woocommerce
Files:
9 edited
17 copied

Legend:

Unmodified
Added
Removed
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.11/CryptAPI.php

    r2959171 r3040317  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.7.10
     6Version: 4.7.11
    77Requires at least: 5
    8 Tested up to: 6.3
     8Tested up to: 6.4.3
    99WC requires at least: 5.8
    10 WC tested up to: 8.0.2
     10WC tested up to: 8.6.1
    1111Requires PHP: 7.2
    1212Author: cryptapi
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.11/README.md

    r2959171 r3040317  
    359359* Add new choices for order cancellation.
    360360
     361#### 4.7.11
     362* Minor fixes and improvements
     363
    361364### Upgrade Notice
    362365#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.11/controllers/CryptAPI.php

    r2959171 r3040317  
    77{
    88    private static $HAS_TRIGGERED = false;
    9     private static $COIN_OPTIONS = [];
    109
    1110    function __construct()
     
    2928            'multiple_subscriptions',
    3029        );
    31 
    32         $this->load_coins();
    33 
    3430        $this->init_form_fields();
    3531        $this->init_settings();
     
    6662    function load_coins()
    6763    {
    68         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
    69             return;
    70         }
    71 
    7264        $transient = get_transient('cryptapi_coins');
    7365        if (!empty($transient)) {
    74             WC_CryptAPI_Gateway::$COIN_OPTIONS = $transient;
    75 
    76             return;
     66            return $transient;
    7767        }
    7868
    7969        $coins = CryptAPI\Helper::get_supported_coins();
    8070        set_transient('cryptapi_coins', $coins, 86400);
    81         WC_CryptAPI_Gateway::$COIN_OPTIONS = $coins;
     71        return $coins;
    8272    }
    8373
     
    180170    private function ca_settings()
    181171    {
     172        $load_coins = $this->load_coins();
     173
    182174        $this->enabled = $this->get_option('enabled');
    183175        $this->title = $this->get_option('title');
     
    199191        $this->icon = '';
    200192
    201         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
    202             foreach (array_keys(WC_CryptAPI_Gateway::$COIN_OPTIONS) as $coin) {
     193        if (!empty($load_coins)) {
     194            foreach (array_keys($load_coins) as $coin) {
    203195                $this->{$coin . '_address'} = $this->get_option($coin . '_address');
    204196            }
     
    208200    function init_form_fields()
    209201    {
    210 
    211         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
     202        $load_coins = $this->load_coins();
     203
     204        if (!empty($load_coins)) {
    212205            $this->form_fields = array(
    213206                'enabled' => array(
     
    376369
    377370            $c = 0;
    378             foreach (WC_CryptAPI_Gateway::$COIN_OPTIONS as $ticker => $coin) {
     371            foreach ($load_coins as $ticker => $coin) {
    379372                $this->form_fields["{$ticker}_address"] = array(
    380373                    'title' => is_array($coin) ? $coin['name'] : $coin,
     
    416409
    417410    function payment_fields()
    418     { ?>
     411    {
     412        $load_coins = $this->load_coins();
     413        ?>
    419414        <div class="form-row form-row-wide">
    420415            <p><?php echo esc_attr($this->description); ?></p>
     
    433428                                $apikey = $this->api_key;
    434429                                if (!empty($addr) || !empty($apikey)) { ?>
    435                                     <option data-image="<?php echo esc_url(WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]['logo']); ?>"
     430                                    <option data-image="<?php echo esc_url($load_coins[$val]['logo']); ?>"
    436431                                            value="<?php echo esc_attr($val); ?>" <?php
    437432                                    if (!empty($selected) && $selected === $val) {
    438433                                        echo esc_attr("selected='true'");
    439434                                    }
    440                                     $crypto_name = is_array(WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]) ? WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]['name'] : WC_CryptAPI_Gateway::$COIN_OPTIONS[$val];
     435                                    $crypto_name = is_array($load_coins[$val]) ? $load_coins[$val]['name'] : $load_coins[$val];
    441436                                    ?>> <?php echo esc_attr(__('Pay with', 'cryptapi') . ' ' . $crypto_name); ?></option>
    442437                                    <?php
     
    479474    function validate_fields()
    480475    {
    481         return array_key_exists(sanitize_text_field($_POST['cryptapi_coin']), WC_CryptAPI_Gateway::$COIN_OPTIONS);
     476        $load_coins = $this->load_coins();
     477        return array_key_exists(sanitize_text_field($_POST['cryptapi_coin']), $load_coins);
    482478    }
    483479
     
    579575                $order->save_meta_data();
    580576
    581                 $order->update_status('on-hold', __('Awaiting payment', 'cryptapi') . ': ' . WC_CryptAPI_Gateway::$COIN_OPTIONS[$selected]);
     577                $load_coins = $this->load_coins();
     578
     579                $order->update_status('on-hold', __('Awaiting payment', 'cryptapi') . ': ' . $load_coins[$selected]);
    582580                $woocommerce->cart->empty_cart();
    583581
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.11/define.php

    r2959171 r3040317  
    11<?php
    22
    3 define('CRYPTAPI_PLUGIN_VERSION', '4.7.10');
     3define('CRYPTAPI_PLUGIN_VERSION', '4.7.11');
    44define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
    55define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.11/readme.txt

    r2959171 r3040317  
    33Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, litecoin, bitcoin cash, shib, doge
    44Requires at least: 5
    5 Tested up to: 6.3
    6 Stable tag: 4.7.10
     5Tested up to: 6.4.3
     6Stable tag: 4.7.11
    77Requires PHP: 7.2
    88WC requires at least: 5.8
    9 WC tested up to: 8.0.2
     9WC tested up to: 8.6.1
    1010License: MIT
    1111
     
    357357* Add new choices for order cancellation.
    358358
     359= 4.7.11 =
     360* Minor fixes and improvements
    359361
    360362== Upgrade Notice ==
  • cryptapi-payment-gateway-for-woocommerce/trunk/CryptAPI.php

    r2959171 r3040317  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.7.10
     6Version: 4.7.11
    77Requires at least: 5
    8 Tested up to: 6.3
     8Tested up to: 6.4.3
    99WC requires at least: 5.8
    10 WC tested up to: 8.0.2
     10WC tested up to: 8.6.1
    1111Requires PHP: 7.2
    1212Author: cryptapi
  • cryptapi-payment-gateway-for-woocommerce/trunk/README.md

    r2959171 r3040317  
    359359* Add new choices for order cancellation.
    360360
     361#### 4.7.11
     362* Minor fixes and improvements
     363
    361364### Upgrade Notice
    362365#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/trunk/controllers/CryptAPI.php

    r2959171 r3040317  
    77{
    88    private static $HAS_TRIGGERED = false;
    9     private static $COIN_OPTIONS = [];
    109
    1110    function __construct()
     
    2928            'multiple_subscriptions',
    3029        );
    31 
    32         $this->load_coins();
    33 
    3430        $this->init_form_fields();
    3531        $this->init_settings();
     
    6662    function load_coins()
    6763    {
    68         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
    69             return;
    70         }
    71 
    7264        $transient = get_transient('cryptapi_coins');
    7365        if (!empty($transient)) {
    74             WC_CryptAPI_Gateway::$COIN_OPTIONS = $transient;
    75 
    76             return;
     66            return $transient;
    7767        }
    7868
    7969        $coins = CryptAPI\Helper::get_supported_coins();
    8070        set_transient('cryptapi_coins', $coins, 86400);
    81         WC_CryptAPI_Gateway::$COIN_OPTIONS = $coins;
     71        return $coins;
    8272    }
    8373
     
    180170    private function ca_settings()
    181171    {
     172        $load_coins = $this->load_coins();
     173
    182174        $this->enabled = $this->get_option('enabled');
    183175        $this->title = $this->get_option('title');
     
    199191        $this->icon = '';
    200192
    201         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
    202             foreach (array_keys(WC_CryptAPI_Gateway::$COIN_OPTIONS) as $coin) {
     193        if (!empty($load_coins)) {
     194            foreach (array_keys($load_coins) as $coin) {
    203195                $this->{$coin . '_address'} = $this->get_option($coin . '_address');
    204196            }
     
    208200    function init_form_fields()
    209201    {
    210 
    211         if (!empty(WC_CryptAPI_Gateway::$COIN_OPTIONS)) {
     202        $load_coins = $this->load_coins();
     203
     204        if (!empty($load_coins)) {
    212205            $this->form_fields = array(
    213206                'enabled' => array(
     
    376369
    377370            $c = 0;
    378             foreach (WC_CryptAPI_Gateway::$COIN_OPTIONS as $ticker => $coin) {
     371            foreach ($load_coins as $ticker => $coin) {
    379372                $this->form_fields["{$ticker}_address"] = array(
    380373                    'title' => is_array($coin) ? $coin['name'] : $coin,
     
    416409
    417410    function payment_fields()
    418     { ?>
     411    {
     412        $load_coins = $this->load_coins();
     413        ?>
    419414        <div class="form-row form-row-wide">
    420415            <p><?php echo esc_attr($this->description); ?></p>
     
    433428                                $apikey = $this->api_key;
    434429                                if (!empty($addr) || !empty($apikey)) { ?>
    435                                     <option data-image="<?php echo esc_url(WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]['logo']); ?>"
     430                                    <option data-image="<?php echo esc_url($load_coins[$val]['logo']); ?>"
    436431                                            value="<?php echo esc_attr($val); ?>" <?php
    437432                                    if (!empty($selected) && $selected === $val) {
    438433                                        echo esc_attr("selected='true'");
    439434                                    }
    440                                     $crypto_name = is_array(WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]) ? WC_CryptAPI_Gateway::$COIN_OPTIONS[$val]['name'] : WC_CryptAPI_Gateway::$COIN_OPTIONS[$val];
     435                                    $crypto_name = is_array($load_coins[$val]) ? $load_coins[$val]['name'] : $load_coins[$val];
    441436                                    ?>> <?php echo esc_attr(__('Pay with', 'cryptapi') . ' ' . $crypto_name); ?></option>
    442437                                    <?php
     
    479474    function validate_fields()
    480475    {
    481         return array_key_exists(sanitize_text_field($_POST['cryptapi_coin']), WC_CryptAPI_Gateway::$COIN_OPTIONS);
     476        $load_coins = $this->load_coins();
     477        return array_key_exists(sanitize_text_field($_POST['cryptapi_coin']), $load_coins);
    482478    }
    483479
     
    579575                $order->save_meta_data();
    580576
    581                 $order->update_status('on-hold', __('Awaiting payment', 'cryptapi') . ': ' . WC_CryptAPI_Gateway::$COIN_OPTIONS[$selected]);
     577                $load_coins = $this->load_coins();
     578
     579                $order->update_status('on-hold', __('Awaiting payment', 'cryptapi') . ': ' . $load_coins[$selected]);
    582580                $woocommerce->cart->empty_cart();
    583581
  • cryptapi-payment-gateway-for-woocommerce/trunk/define.php

    r2959171 r3040317  
    11<?php
    22
    3 define('CRYPTAPI_PLUGIN_VERSION', '4.7.10');
     3define('CRYPTAPI_PLUGIN_VERSION', '4.7.11');
    44define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
    55define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cryptapi-payment-gateway-for-woocommerce/trunk/readme.txt

    r2959171 r3040317  
    33Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, litecoin, bitcoin cash, shib, doge
    44Requires at least: 5
    5 Tested up to: 6.3
    6 Stable tag: 4.7.10
     5Tested up to: 6.4.3
     6Stable tag: 4.7.11
    77Requires PHP: 7.2
    88WC requires at least: 5.8
    9 WC tested up to: 8.0.2
     9WC tested up to: 8.6.1
    1010License: MIT
    1111
     
    357357* Add new choices for order cancellation.
    358358
     359= 4.7.11 =
     360* Minor fixes and improvements
    359361
    360362== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.