Plugin Directory

Changeset 3375982


Ignore:
Timestamp:
10/09/2025 08:43:31 PM (6 months ago)
Author:
helloextend
Message:

Updated to version 1.2.2

Location:
helloextend-protection
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • helloextend-protection/tags/1.2.2/admin/class-helloextend-protection-admin.php

    r3348358 r3375982  
    162162        $helloextend_sync_batch = $this->helloextend_protection_for_woocommerce_settings_catalog_sync_options['helloextend_sync_batch'];
    163163        $debug_log_enabled = $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_debug'];
    164 
    165         wp_enqueue_script('helloextend_script');
     164        $log_enabled = $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'];
     165
     166
     167        wp_enqueue_script('helloextend_script');
    166168        wp_enqueue_script('helloextend_sync_script');
    167         wp_localize_script('helloextend_sync_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'nonce', 'helloextend_sync_batch', 'debug_log_enabled'));
     169        wp_localize_script('helloextend_sync_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'nonce', 'helloextend_sync_batch', 'debug_log_enabled', 'log_enabled'));
    168170
    169171        /* end for sync */
     
    481483        );
    482484
     485        add_settings_field(
     486            'enable_helloextend_log', // id
     487            'Enable General Log', // title
     488            array($this, 'enable_helloextend_log_callback'), // callback
     489            'helloextend-protection-for-woocommerce-settings-admin-general', // page
     490            'helloextend_setting_environment_section' // section
     491        );
     492
    483493        add_settings_field(
    484494            'enable_helloextend_debug', // id
     
    569579            $settings = [
    570580                'enable_helloextend_debug'           => '0',
     581                'enable_helloextend_log'             => '0',
    571582                'helloextend_environment'            => 'sandbox',
    572583                'helloextend_sandbox_store_id'       => '',
     
    682693            $sanitary_values['enable_helloextend_debug'] = $input['enable_helloextend_debug'];
    683694        }
     695
     696        if (isset($input['enable_helloextend_log'])) {
     697            $sanitary_values['enable_helloextend_log'] = $input['enable_helloextend_log'];
     698        }
    684699
    685700        if (isset($input['helloextend_enable_cart_offers'])) {
     
    12261241    }
    12271242
     1243    public function enable_helloextend_log_callback()
     1244    {
     1245        printf(
     1246            '<input type="checkbox" name="helloextend_protection_for_woocommerce_general_settings[enable_helloextend_log]" id="enable_helloextend_log" value="1" %s>',
     1247            (isset($this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'])
     1248             && $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'] === '1') ? 'checked' : ''
     1249        );
     1250    }
     1251
    12281252    public function helloextend_use_special_price_callback()
    12291253    {
  • helloextend-protection/tags/1.2.2/helloextend-protection.php

    r3359410 r3375982  
    1717 * Plugin URI:        https://docs.extend.com/docs/extend-protection-plugin-for-woocommerce
    1818 * Description:       Extend Protection for Woocommerce. Allows WooCommerce merchants to offer product and shipping protection to their customers.
    19  * Version:           1.2.1
     19 * Version:           1.2.2
    2020 * Author:            Extend, Inc.
    2121 * Author URI:        https://extend.com/
  • helloextend-protection/tags/1.2.2/includes/class-helloextend-global.php

    r3358723 r3375982  
    187187            ? $helloextend_protection_general_settings['enable_helloextend_debug'] : 0;
    188188
     189        $settings['enable_helloextend_log'] = array_key_exists('enable_helloextend_log', $helloextend_protection_general_settings)
     190            ? $helloextend_protection_general_settings['enable_helloextend_log'] : 0;
     191
    189192        /* shipping protection */
    190193        if ($helloextend_protection_shipping_protection_settings) {
     
    253256            ? $settings['warranty_product_id'] : helloextend_product_protection_id();
    254257
    255         if (empty($settings['warranty_product_id'])) {
     258        /* circular reference removed.
     259        if (empty($settings['warranty_product_id'])) {
    256260            HelloExtend_Protection_Logger::helloextend_log_error('Error: Warranty product is not created.');
    257261        }
     262        */
    258263
    259264        return $settings;
     
    405410        $helloextend_enabled = array_key_exists('enable_helloextend', $settings) ? $settings['enable_helloextend'] : 0;
    406411        $ajaxurl        = admin_url('admin-ajax.php');
    407 
    408         if ($store_id && ($helloextend_enabled === '1')) {
    409             wp_enqueue_script('helloextend_script');
    410             wp_enqueue_script('helloextend_global_script');
    411             wp_localize_script('helloextend_global_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment'));
    412 
    413             // Get the leadToken from URL parameters
    414             $lead_token = $this->get_lead_token_from_url();
    415             if ($lead_token) {
    416                 // Sanitize the token for safe JavaScript output
    417                 $safe_lead_token = esc_js($lead_token);
    418 
    419                 // Output JavaScript to console
    420                 echo "<script type='text/javascript'>\n";
    421                 echo "console.log('found leadToken: ', '" . $safe_lead_token . "');\n";
    422                 echo "</script>\n";
    423 
    424                 // next step: Run Post Purchase logic to handle lead Token
    425                 $this->helloextend_post_purchase($lead_token, $store_id, $environment, $ajaxurl);
    426             }
    427         } else {
    428             HelloExtend_Protection_Logger::helloextend_log_error('Store Id missing or Extend Product Protection is disabled');
    429         }
     412        $debug_log_enabled = array_key_exists('enable_helloextend_debug', $settings) ? $settings['enable_helloextend_debug'] : 0;
     413        $log_enabled    = array_key_exists('enable_helloextend_log', $settings) ? $settings['enable_helloextend_log'] : 0;
     414
     415        if ($store_id){
     416            if ($helloextend_enabled === '1') {
     417                wp_enqueue_script('helloextend_script');
     418                wp_enqueue_script('helloextend_global_script');
     419                wp_localize_script('helloextend_global_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'debug_log_enabled', 'log_enabled'));
     420
     421                // Get the leadToken from URL parameters
     422                $lead_token = $this->get_lead_token_from_url();
     423                if ($lead_token) {
     424                    // next step: Run Post Purchase logic to handle lead Token
     425                    $this->helloextend_post_purchase($lead_token, $store_id, $environment, $ajaxurl);
     426                }
     427            }
     428        } else {
     429            HelloExtend_Protection_Logger::helloextend_log_error('Store Id is missing');
     430        }
    430431    }
    431432
  • helloextend-protection/tags/1.2.2/includes/class-helloextend-protection-logger.php

    r3348358 r3375982  
    1414}
    1515
     16
    1617class HelloExtend_Protection_Logger
    1718{
    18 
     19    private static ?array $settings = null;
     20
     21    private static function helloextend_log_initialize(): void {
     22        if (self::$settings === null) {
     23            /* retrieve environment variables */
     24            self::$settings = HelloExtend_Protection_Global::helloextend_get_settings();
     25        }
     26    }
     27   
    1928    public static function helloextend_log_error( $message )
    2029    {
    21 
     30        self::helloextend_log_initialize();
     31        if (self::$settings['enable_helloextend_log'] == 0) {
     32            return;
     33        }
    2234        /* Get error logs from the wp_options table... */
    2335        $error_log = get_option('helloextend_error_log');
     
    6476    public static function helloextend_log_notice( $message )
    6577    {
    66 
     78        self::helloextend_log_initialize();
     79        if (self::$settings['enable_helloextend_log'] == 0) {
     80            return;
     81        }
    6782        /* Get notice logs from the wp_options table... */
    6883        $notice_log = get_option('helloextend_notice_log', true);
     
    111126    public static function helloextend_log_debug( $message )
    112127    {
     128        self::helloextend_log_initialize();
     129        if (self::$settings['enable_helloextend_log'] == 0) {
     130            return;
     131        }
     132        if (self::$settings['enable_helloextend_debug'] == 0) {
     133            return;
     134        }
    113135
    114136        /* Get debug logs from the wp_options table... */
     
    564586    public static function helloextend_logger_ajax_call()
    565587    {
     588        self::helloextend_log_initialize();
     589        if (self::$settings['enable_helloextend_log'] == 0) {
     590            return;
     591        }
     592
    566593        $method = isset($_POST['method']) ? sanitize_text_field(wp_unslash($_POST['method'])) : null;
    567594        $message = isset($_POST['message']) ? sanitize_text_field(wp_unslash($_POST['message'])) : null;
  • helloextend-protection/tags/1.2.2/includes/class-helloextend-protection-orders.php

    r3359410 r3375982  
    157157    private function get_price_in_cents($item_price)
    158158    {
    159         return (int) floatval($item_price * 100);
     159        return (int) round((float) $item_price * 100);
    160160    }
    161161
  • helloextend-protection/tags/1.2.2/js/helloextend-global.js

    r3358723 r3375982  
    55        }
    66
    7         const { store_id: storeId, ajaxurl, environment, debug_log_enabled: debugLogEnabled } = ExtendWooCommerce;
     7        const { store_id: storeId, ajaxurl, environment, debug_log_enabled: debugLogEnabled, log_enabled: logEnabled } = ExtendWooCommerce;
    88
    99        Extend.config({
     
    9292            warrantyAlreadyInCart,
    9393            extendAjaxLog,
    94             debugLogEnabled
     94            debugLogEnabled,
     95            logEnabled
    9596        }
    9697
  • helloextend-protection/tags/1.2.2/readme.txt

    r3359410 r3375982  
    66Requires at least: 4.0
    77Tested up to: 6.8
    8 Stable tag: 1.2.1
     8Stable tag: 1.2.2
    99Requires PHP: 7.4
    1010License: GPLv2 or later
     
    8080== Changelog ==
    8181
     82= 1.2.2 2025-10-09 =
     83 * Fix - Resolved an issue where the plugin could create an excessive amount of logs
     84 * Fix - Resolved floating point number calcluation issues
     85
    8286= 1.2.1 2025-09-09 =
    8387 * Hotfix: Resolved price being double scaled on order creation
  • helloextend-protection/trunk/admin/class-helloextend-protection-admin.php

    r3348358 r3375982  
    162162        $helloextend_sync_batch = $this->helloextend_protection_for_woocommerce_settings_catalog_sync_options['helloextend_sync_batch'];
    163163        $debug_log_enabled = $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_debug'];
    164 
    165         wp_enqueue_script('helloextend_script');
     164        $log_enabled = $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'];
     165
     166
     167        wp_enqueue_script('helloextend_script');
    166168        wp_enqueue_script('helloextend_sync_script');
    167         wp_localize_script('helloextend_sync_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'nonce', 'helloextend_sync_batch', 'debug_log_enabled'));
     169        wp_localize_script('helloextend_sync_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'nonce', 'helloextend_sync_batch', 'debug_log_enabled', 'log_enabled'));
    168170
    169171        /* end for sync */
     
    481483        );
    482484
     485        add_settings_field(
     486            'enable_helloextend_log', // id
     487            'Enable General Log', // title
     488            array($this, 'enable_helloextend_log_callback'), // callback
     489            'helloextend-protection-for-woocommerce-settings-admin-general', // page
     490            'helloextend_setting_environment_section' // section
     491        );
     492
    483493        add_settings_field(
    484494            'enable_helloextend_debug', // id
     
    569579            $settings = [
    570580                'enable_helloextend_debug'           => '0',
     581                'enable_helloextend_log'             => '0',
    571582                'helloextend_environment'            => 'sandbox',
    572583                'helloextend_sandbox_store_id'       => '',
     
    682693            $sanitary_values['enable_helloextend_debug'] = $input['enable_helloextend_debug'];
    683694        }
     695
     696        if (isset($input['enable_helloextend_log'])) {
     697            $sanitary_values['enable_helloextend_log'] = $input['enable_helloextend_log'];
     698        }
    684699
    685700        if (isset($input['helloextend_enable_cart_offers'])) {
     
    12261241    }
    12271242
     1243    public function enable_helloextend_log_callback()
     1244    {
     1245        printf(
     1246            '<input type="checkbox" name="helloextend_protection_for_woocommerce_general_settings[enable_helloextend_log]" id="enable_helloextend_log" value="1" %s>',
     1247            (isset($this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'])
     1248             && $this->helloextend_protection_for_woocommerce_settings_general_options['enable_helloextend_log'] === '1') ? 'checked' : ''
     1249        );
     1250    }
     1251
    12281252    public function helloextend_use_special_price_callback()
    12291253    {
  • helloextend-protection/trunk/helloextend-protection.php

    r3359410 r3375982  
    1717 * Plugin URI:        https://docs.extend.com/docs/extend-protection-plugin-for-woocommerce
    1818 * Description:       Extend Protection for Woocommerce. Allows WooCommerce merchants to offer product and shipping protection to their customers.
    19  * Version:           1.2.1
     19 * Version:           1.2.2
    2020 * Author:            Extend, Inc.
    2121 * Author URI:        https://extend.com/
  • helloextend-protection/trunk/includes/class-helloextend-global.php

    r3358723 r3375982  
    187187            ? $helloextend_protection_general_settings['enable_helloextend_debug'] : 0;
    188188
     189        $settings['enable_helloextend_log'] = array_key_exists('enable_helloextend_log', $helloextend_protection_general_settings)
     190            ? $helloextend_protection_general_settings['enable_helloextend_log'] : 0;
     191
    189192        /* shipping protection */
    190193        if ($helloextend_protection_shipping_protection_settings) {
     
    253256            ? $settings['warranty_product_id'] : helloextend_product_protection_id();
    254257
    255         if (empty($settings['warranty_product_id'])) {
     258        /* circular reference removed.
     259        if (empty($settings['warranty_product_id'])) {
    256260            HelloExtend_Protection_Logger::helloextend_log_error('Error: Warranty product is not created.');
    257261        }
     262        */
    258263
    259264        return $settings;
     
    405410        $helloextend_enabled = array_key_exists('enable_helloextend', $settings) ? $settings['enable_helloextend'] : 0;
    406411        $ajaxurl        = admin_url('admin-ajax.php');
    407 
    408         if ($store_id && ($helloextend_enabled === '1')) {
    409             wp_enqueue_script('helloextend_script');
    410             wp_enqueue_script('helloextend_global_script');
    411             wp_localize_script('helloextend_global_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment'));
    412 
    413             // Get the leadToken from URL parameters
    414             $lead_token = $this->get_lead_token_from_url();
    415             if ($lead_token) {
    416                 // Sanitize the token for safe JavaScript output
    417                 $safe_lead_token = esc_js($lead_token);
    418 
    419                 // Output JavaScript to console
    420                 echo "<script type='text/javascript'>\n";
    421                 echo "console.log('found leadToken: ', '" . $safe_lead_token . "');\n";
    422                 echo "</script>\n";
    423 
    424                 // next step: Run Post Purchase logic to handle lead Token
    425                 $this->helloextend_post_purchase($lead_token, $store_id, $environment, $ajaxurl);
    426             }
    427         } else {
    428             HelloExtend_Protection_Logger::helloextend_log_error('Store Id missing or Extend Product Protection is disabled');
    429         }
     412        $debug_log_enabled = array_key_exists('enable_helloextend_debug', $settings) ? $settings['enable_helloextend_debug'] : 0;
     413        $log_enabled    = array_key_exists('enable_helloextend_log', $settings) ? $settings['enable_helloextend_log'] : 0;
     414
     415        if ($store_id){
     416            if ($helloextend_enabled === '1') {
     417                wp_enqueue_script('helloextend_script');
     418                wp_enqueue_script('helloextend_global_script');
     419                wp_localize_script('helloextend_global_script', 'ExtendWooCommerce', compact('store_id', 'ajaxurl', 'environment', 'debug_log_enabled', 'log_enabled'));
     420
     421                // Get the leadToken from URL parameters
     422                $lead_token = $this->get_lead_token_from_url();
     423                if ($lead_token) {
     424                    // next step: Run Post Purchase logic to handle lead Token
     425                    $this->helloextend_post_purchase($lead_token, $store_id, $environment, $ajaxurl);
     426                }
     427            }
     428        } else {
     429            HelloExtend_Protection_Logger::helloextend_log_error('Store Id is missing');
     430        }
    430431    }
    431432
  • helloextend-protection/trunk/includes/class-helloextend-protection-logger.php

    r3348358 r3375982  
    1414}
    1515
     16
    1617class HelloExtend_Protection_Logger
    1718{
    18 
     19    private static ?array $settings = null;
     20
     21    private static function helloextend_log_initialize(): void {
     22        if (self::$settings === null) {
     23            /* retrieve environment variables */
     24            self::$settings = HelloExtend_Protection_Global::helloextend_get_settings();
     25        }
     26    }
     27   
    1928    public static function helloextend_log_error( $message )
    2029    {
    21 
     30        self::helloextend_log_initialize();
     31        if (self::$settings['enable_helloextend_log'] == 0) {
     32            return;
     33        }
    2234        /* Get error logs from the wp_options table... */
    2335        $error_log = get_option('helloextend_error_log');
     
    6476    public static function helloextend_log_notice( $message )
    6577    {
    66 
     78        self::helloextend_log_initialize();
     79        if (self::$settings['enable_helloextend_log'] == 0) {
     80            return;
     81        }
    6782        /* Get notice logs from the wp_options table... */
    6883        $notice_log = get_option('helloextend_notice_log', true);
     
    111126    public static function helloextend_log_debug( $message )
    112127    {
     128        self::helloextend_log_initialize();
     129        if (self::$settings['enable_helloextend_log'] == 0) {
     130            return;
     131        }
     132        if (self::$settings['enable_helloextend_debug'] == 0) {
     133            return;
     134        }
    113135
    114136        /* Get debug logs from the wp_options table... */
     
    564586    public static function helloextend_logger_ajax_call()
    565587    {
     588        self::helloextend_log_initialize();
     589        if (self::$settings['enable_helloextend_log'] == 0) {
     590            return;
     591        }
     592
    566593        $method = isset($_POST['method']) ? sanitize_text_field(wp_unslash($_POST['method'])) : null;
    567594        $message = isset($_POST['message']) ? sanitize_text_field(wp_unslash($_POST['message'])) : null;
  • helloextend-protection/trunk/includes/class-helloextend-protection-orders.php

    r3359410 r3375982  
    157157    private function get_price_in_cents($item_price)
    158158    {
    159         return (int) floatval($item_price * 100);
     159        return (int) round((float) $item_price * 100);
    160160    }
    161161
  • helloextend-protection/trunk/js/helloextend-global.js

    r3358723 r3375982  
    55        }
    66
    7         const { store_id: storeId, ajaxurl, environment, debug_log_enabled: debugLogEnabled } = ExtendWooCommerce;
     7        const { store_id: storeId, ajaxurl, environment, debug_log_enabled: debugLogEnabled, log_enabled: logEnabled } = ExtendWooCommerce;
    88
    99        Extend.config({
     
    9292            warrantyAlreadyInCart,
    9393            extendAjaxLog,
    94             debugLogEnabled
     94            debugLogEnabled,
     95            logEnabled
    9596        }
    9697
  • helloextend-protection/trunk/readme.txt

    r3359410 r3375982  
    66Requires at least: 4.0
    77Tested up to: 6.8
    8 Stable tag: 1.2.1
     8Stable tag: 1.2.2
    99Requires PHP: 7.4
    1010License: GPLv2 or later
     
    8080== Changelog ==
    8181
     82= 1.2.2 2025-10-09 =
     83 * Fix - Resolved an issue where the plugin could create an excessive amount of logs
     84 * Fix - Resolved floating point number calcluation issues
     85
    8286= 1.2.1 2025-09-09 =
    8387 * Hotfix: Resolved price being double scaled on order creation
Note: See TracChangeset for help on using the changeset viewer.