Changeset 3375982
- Timestamp:
- 10/09/2025 08:43:31 PM (6 months ago)
- Location:
- helloextend-protection
- Files:
-
- 14 edited
- 1 copied
-
tags/1.2.2 (copied) (copied from helloextend-protection/trunk)
-
tags/1.2.2/admin/class-helloextend-protection-admin.php (modified) (5 diffs)
-
tags/1.2.2/helloextend-protection.php (modified) (1 diff)
-
tags/1.2.2/includes/class-helloextend-global.php (modified) (3 diffs)
-
tags/1.2.2/includes/class-helloextend-protection-logger.php (modified) (4 diffs)
-
tags/1.2.2/includes/class-helloextend-protection-orders.php (modified) (1 diff)
-
tags/1.2.2/js/helloextend-global.js (modified) (2 diffs)
-
tags/1.2.2/readme.txt (modified) (2 diffs)
-
trunk/admin/class-helloextend-protection-admin.php (modified) (5 diffs)
-
trunk/helloextend-protection.php (modified) (1 diff)
-
trunk/includes/class-helloextend-global.php (modified) (3 diffs)
-
trunk/includes/class-helloextend-protection-logger.php (modified) (4 diffs)
-
trunk/includes/class-helloextend-protection-orders.php (modified) (1 diff)
-
trunk/js/helloextend-global.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
helloextend-protection/tags/1.2.2/admin/class-helloextend-protection-admin.php
r3348358 r3375982 162 162 $helloextend_sync_batch = $this->helloextend_protection_for_woocommerce_settings_catalog_sync_options['helloextend_sync_batch']; 163 163 $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'); 166 168 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')); 168 170 169 171 /* end for sync */ … … 481 483 ); 482 484 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 483 493 add_settings_field( 484 494 'enable_helloextend_debug', // id … … 569 579 $settings = [ 570 580 'enable_helloextend_debug' => '0', 581 'enable_helloextend_log' => '0', 571 582 'helloextend_environment' => 'sandbox', 572 583 'helloextend_sandbox_store_id' => '', … … 682 693 $sanitary_values['enable_helloextend_debug'] = $input['enable_helloextend_debug']; 683 694 } 695 696 if (isset($input['enable_helloextend_log'])) { 697 $sanitary_values['enable_helloextend_log'] = $input['enable_helloextend_log']; 698 } 684 699 685 700 if (isset($input['helloextend_enable_cart_offers'])) { … … 1226 1241 } 1227 1242 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 1228 1252 public function helloextend_use_special_price_callback() 1229 1253 { -
helloextend-protection/tags/1.2.2/helloextend-protection.php
r3359410 r3375982 17 17 * Plugin URI: https://docs.extend.com/docs/extend-protection-plugin-for-woocommerce 18 18 * Description: Extend Protection for Woocommerce. Allows WooCommerce merchants to offer product and shipping protection to their customers. 19 * Version: 1.2. 119 * Version: 1.2.2 20 20 * Author: Extend, Inc. 21 21 * Author URI: https://extend.com/ -
helloextend-protection/tags/1.2.2/includes/class-helloextend-global.php
r3358723 r3375982 187 187 ? $helloextend_protection_general_settings['enable_helloextend_debug'] : 0; 188 188 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 189 192 /* shipping protection */ 190 193 if ($helloextend_protection_shipping_protection_settings) { … … 253 256 ? $settings['warranty_product_id'] : helloextend_product_protection_id(); 254 257 255 if (empty($settings['warranty_product_id'])) { 258 /* circular reference removed. 259 if (empty($settings['warranty_product_id'])) { 256 260 HelloExtend_Protection_Logger::helloextend_log_error('Error: Warranty product is not created.'); 257 261 } 262 */ 258 263 259 264 return $settings; … … 405 410 $helloextend_enabled = array_key_exists('enable_helloextend', $settings) ? $settings['enable_helloextend'] : 0; 406 411 $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 } 430 431 } 431 432 -
helloextend-protection/tags/1.2.2/includes/class-helloextend-protection-logger.php
r3348358 r3375982 14 14 } 15 15 16 16 17 class HelloExtend_Protection_Logger 17 18 { 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 19 28 public static function helloextend_log_error( $message ) 20 29 { 21 30 self::helloextend_log_initialize(); 31 if (self::$settings['enable_helloextend_log'] == 0) { 32 return; 33 } 22 34 /* Get error logs from the wp_options table... */ 23 35 $error_log = get_option('helloextend_error_log'); … … 64 76 public static function helloextend_log_notice( $message ) 65 77 { 66 78 self::helloextend_log_initialize(); 79 if (self::$settings['enable_helloextend_log'] == 0) { 80 return; 81 } 67 82 /* Get notice logs from the wp_options table... */ 68 83 $notice_log = get_option('helloextend_notice_log', true); … … 111 126 public static function helloextend_log_debug( $message ) 112 127 { 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 } 113 135 114 136 /* Get debug logs from the wp_options table... */ … … 564 586 public static function helloextend_logger_ajax_call() 565 587 { 588 self::helloextend_log_initialize(); 589 if (self::$settings['enable_helloextend_log'] == 0) { 590 return; 591 } 592 566 593 $method = isset($_POST['method']) ? sanitize_text_field(wp_unslash($_POST['method'])) : null; 567 594 $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 157 157 private function get_price_in_cents($item_price) 158 158 { 159 return (int) floatval($item_price * 100);159 return (int) round((float) $item_price * 100); 160 160 } 161 161 -
helloextend-protection/tags/1.2.2/js/helloextend-global.js
r3358723 r3375982 5 5 } 6 6 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; 8 8 9 9 Extend.config({ … … 92 92 warrantyAlreadyInCart, 93 93 extendAjaxLog, 94 debugLogEnabled 94 debugLogEnabled, 95 logEnabled 95 96 } 96 97 -
helloextend-protection/tags/1.2.2/readme.txt
r3359410 r3375982 6 6 Requires at least: 4.0 7 7 Tested up to: 6.8 8 Stable tag: 1.2. 18 Stable tag: 1.2.2 9 9 Requires PHP: 7.4 10 10 License: GPLv2 or later … … 80 80 == Changelog == 81 81 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 82 86 = 1.2.1 2025-09-09 = 83 87 * Hotfix: Resolved price being double scaled on order creation -
helloextend-protection/trunk/admin/class-helloextend-protection-admin.php
r3348358 r3375982 162 162 $helloextend_sync_batch = $this->helloextend_protection_for_woocommerce_settings_catalog_sync_options['helloextend_sync_batch']; 163 163 $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'); 166 168 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')); 168 170 169 171 /* end for sync */ … … 481 483 ); 482 484 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 483 493 add_settings_field( 484 494 'enable_helloextend_debug', // id … … 569 579 $settings = [ 570 580 'enable_helloextend_debug' => '0', 581 'enable_helloextend_log' => '0', 571 582 'helloextend_environment' => 'sandbox', 572 583 'helloextend_sandbox_store_id' => '', … … 682 693 $sanitary_values['enable_helloextend_debug'] = $input['enable_helloextend_debug']; 683 694 } 695 696 if (isset($input['enable_helloextend_log'])) { 697 $sanitary_values['enable_helloextend_log'] = $input['enable_helloextend_log']; 698 } 684 699 685 700 if (isset($input['helloextend_enable_cart_offers'])) { … … 1226 1241 } 1227 1242 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 1228 1252 public function helloextend_use_special_price_callback() 1229 1253 { -
helloextend-protection/trunk/helloextend-protection.php
r3359410 r3375982 17 17 * Plugin URI: https://docs.extend.com/docs/extend-protection-plugin-for-woocommerce 18 18 * Description: Extend Protection for Woocommerce. Allows WooCommerce merchants to offer product and shipping protection to their customers. 19 * Version: 1.2. 119 * Version: 1.2.2 20 20 * Author: Extend, Inc. 21 21 * Author URI: https://extend.com/ -
helloextend-protection/trunk/includes/class-helloextend-global.php
r3358723 r3375982 187 187 ? $helloextend_protection_general_settings['enable_helloextend_debug'] : 0; 188 188 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 189 192 /* shipping protection */ 190 193 if ($helloextend_protection_shipping_protection_settings) { … … 253 256 ? $settings['warranty_product_id'] : helloextend_product_protection_id(); 254 257 255 if (empty($settings['warranty_product_id'])) { 258 /* circular reference removed. 259 if (empty($settings['warranty_product_id'])) { 256 260 HelloExtend_Protection_Logger::helloextend_log_error('Error: Warranty product is not created.'); 257 261 } 262 */ 258 263 259 264 return $settings; … … 405 410 $helloextend_enabled = array_key_exists('enable_helloextend', $settings) ? $settings['enable_helloextend'] : 0; 406 411 $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 } 430 431 } 431 432 -
helloextend-protection/trunk/includes/class-helloextend-protection-logger.php
r3348358 r3375982 14 14 } 15 15 16 16 17 class HelloExtend_Protection_Logger 17 18 { 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 19 28 public static function helloextend_log_error( $message ) 20 29 { 21 30 self::helloextend_log_initialize(); 31 if (self::$settings['enable_helloextend_log'] == 0) { 32 return; 33 } 22 34 /* Get error logs from the wp_options table... */ 23 35 $error_log = get_option('helloextend_error_log'); … … 64 76 public static function helloextend_log_notice( $message ) 65 77 { 66 78 self::helloextend_log_initialize(); 79 if (self::$settings['enable_helloextend_log'] == 0) { 80 return; 81 } 67 82 /* Get notice logs from the wp_options table... */ 68 83 $notice_log = get_option('helloextend_notice_log', true); … … 111 126 public static function helloextend_log_debug( $message ) 112 127 { 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 } 113 135 114 136 /* Get debug logs from the wp_options table... */ … … 564 586 public static function helloextend_logger_ajax_call() 565 587 { 588 self::helloextend_log_initialize(); 589 if (self::$settings['enable_helloextend_log'] == 0) { 590 return; 591 } 592 566 593 $method = isset($_POST['method']) ? sanitize_text_field(wp_unslash($_POST['method'])) : null; 567 594 $message = isset($_POST['message']) ? sanitize_text_field(wp_unslash($_POST['message'])) : null; -
helloextend-protection/trunk/includes/class-helloextend-protection-orders.php
r3359410 r3375982 157 157 private function get_price_in_cents($item_price) 158 158 { 159 return (int) floatval($item_price * 100);159 return (int) round((float) $item_price * 100); 160 160 } 161 161 -
helloextend-protection/trunk/js/helloextend-global.js
r3358723 r3375982 5 5 } 6 6 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; 8 8 9 9 Extend.config({ … … 92 92 warrantyAlreadyInCart, 93 93 extendAjaxLog, 94 debugLogEnabled 94 debugLogEnabled, 95 logEnabled 95 96 } 96 97 -
helloextend-protection/trunk/readme.txt
r3359410 r3375982 6 6 Requires at least: 4.0 7 7 Tested up to: 6.8 8 Stable tag: 1.2. 18 Stable tag: 1.2.2 9 9 Requires PHP: 7.4 10 10 License: GPLv2 or later … … 80 80 == Changelog == 81 81 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 82 86 = 1.2.1 2025-09-09 = 83 87 * Hotfix: Resolved price being double scaled on order creation
Note: See TracChangeset
for help on using the changeset viewer.