Plugin Directory

Changeset 3176363


Ignore:
Timestamp:
10/27/2024 01:15:00 PM (18 months ago)
Author:
bostateam
Message:

feat(): updated Wordpress and Woocommerce Tested Up to versions

Location:
bosta-woocommerce
Files:
15 added
2 edited

Legend:

Unmodified
Added
Removed
  • bosta-woocommerce/trunk/bosta-woocommerce.php

    r3017345 r3176363  
    55 * Author: Bosta
    66 * Author URI: https://www.bosta.co/
    7  * Version: 3.0.11
     7 * Version: 3.0.12
    88 * Requires at least: 5.0
    99 * php version 7.0
    10  * Tested up to: 6.1.1
     10 * Tested up to: 6.6.1
    1111 * WC requires at least: 2.6
    12  * WC tested up to: 7.2.2
     12 * WC tested up to: 9.3.3
    1313 * Text Domain: bosta-woocommerce
    1414 * Domain Path: /languages
     
    2424
    2525const BOSTA_ENV_URL = 'https://app.bosta.co/api/v0';
    26 const PLUGIN_VERSION = '3.0.11';
     26const PLUGIN_VERSION = '3.0.12';
    2727const bosta_cache_duration = 86400;
    2828const bosta_country_id_duration = 604800;
     
    3030add_action('admin_print_styles', 'bosta_stylesheet');
    3131
     32function checkValidApiKey($bostaApiKey) {
     33    if($bostaApiKey == null){
     34        return false;
     35    }
     36   
     37    $url = BOSTA_ENV_URL . '/businesses/' . esc_html($bostaApiKey). '/info';
     38    $business_result = wp_remote_get($url, array(
     39        'timeout' => 30,
     40        'method' => 'GET',
     41        'headers' => array(
     42            'Content-Type' => 'application/json',
     43            'X-Requested-By' => 'WooCommerce',
     44            'X-Plugin-Version' => PLUGIN_VERSION
     45        ),
     46    ));
     47   
     48    $response_body = wp_remote_retrieve_body($business_result);
     49
     50    $response_code = wp_remote_retrieve_response_code($business_result);
     51
     52    if (is_wp_error($business_result) || $response_code!==200 || $response_body =='null' ) {
     53        return false;
     54    }
     55   
     56    return true;
     57   
     58}
     59
    3260function bosta_get_api_key() {
    33     if(isset(get_option('woocommerce_bosta_settings')['APIKey'])){
    34         return sanitize_text_field(get_option('woocommerce_bosta_settings')['APIKey']);
     61    $apikey = get_option('woocommerce_bosta_settings')['APIKey'];
     62    if(isset($apikey) ){
     63        return sanitize_text_field($apikey);
    3564    }
     65
    3666}
    3767
     
    11911221                    ),
    11921222                );
     1223            }
     1224            public function process_admin_options()
     1225            {
     1226                $settings_saved = parent::process_admin_options();
     1227
     1228                $apikey = $this->get_option('APIKey');
     1229                if (empty($apikey)) {
     1230                    WC_Admin_Settings::add_error(__('Error: API Key is required.', 'bosta'));
     1231                    $settings_saved = false;
     1232                } elseif (!checkValidApiKey($apikey)) {
     1233                    WC_Admin_Settings::add_error(__('Error: API Key is invalid.', 'bosta'));
     1234                    $settings_saved = false;
     1235                }
     1236
     1237                return $settings_saved;
    11931238            }
    11941239        }
  • bosta-woocommerce/trunk/readme.txt

    r3017345 r3176363  
    66Requires at least: 5.0
    77Requires PHP: 7.0
    8 Tested up to: 6.1.1
    9 Stable tag: 3.0.11
     8Tested up to: 6.6.1
     9Stable tag: 3.0.12
    1010WC requires at least: 2.6
    11 WC tested up to: 7.2.2
     11WC tested up to: 9.3.3
    1212License: GPLv3
    1313License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    194194= 3.0.11 =
    195195* Bug Fixes
     196
     197= 3.0.12 =
     198* Upgrading Tested Up to Versions
Note: See TracChangeset for help on using the changeset viewer.