Changeset 3697440
- Timestamp:
- 09/15/2026 05:14:32 PM (2 months ago)
- Location:
- shiprazor-shipping-price
- Files:
-
- 9 added
- 3 edited
-
tags/3.0.2/shiprazor-shipping-price.php (modified) (4 diffs)
-
tags/3.0.3 (added)
-
tags/3.0.3/README.txt (added)
-
tags/3.0.3/assets (added)
-
tags/3.0.3/assets/css (added)
-
tags/3.0.3/assets/css/admin-style.css (added)
-
tags/3.0.3/assets/js (added)
-
tags/3.0.3/assets/js/admin-script.js (added)
-
tags/3.0.3/shiprazor-shipping-price.php (added)
-
tags/3.0.3/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/shiprazor-shipping-price.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shiprazor-shipping-price/tags/3.0.2/shiprazor-shipping-price.php
r3697418 r3697440 371 371 add_action('admin_init', 'sspssp_maybe_repair_shipping_instances', 5); 372 372 373 /** 374 * Zone-enabled methods are hidden from Shipping sub-tabs by default — add Shiprazor (Connect) back. 375 * 376 * @param array<string, string> $sections Shipping settings sections. 377 * @return array<string, string> 378 */ 379 function sspssp_add_shiprazor_shipping_settings_section($sections) { 380 $sections[SSPSSP_SHIPPING_METHOD_ID] = __('Shiprazor', 'shiprazor-shipping-price'); 381 return $sections; 382 } 383 add_filter('woocommerce_get_sections_shipping', 'sspssp_add_shiprazor_shipping_settings_section'); 384 385 /** 386 * WooCommerce skips global settings UI for zone methods unless "settings" is supported. 387 * 388 * @param bool $supported Whether the feature is supported. 389 * @param string $feature Feature name. 390 * @param WC_Shipping_Method $method Shipping method instance. 391 * @return bool 392 */ 393 function sspssp_shiprazor_supports_global_settings($supported, $feature, $method) { 394 if ('settings' !== $feature || !is_object($method) || SSPSSP_SHIPPING_METHOD_ID !== $method->id) { 395 return $supported; 396 } 397 398 if (!is_admin()) { 399 return $supported; 400 } 401 402 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 403 $section = isset($_GET['section']) ? sanitize_text_field(wp_unslash($_GET['section'])) : ''; 404 405 if (SSPSSP_SHIPPING_METHOD_ID === $section) { 406 return true; 407 } 408 409 return $supported; 410 } 411 add_filter('woocommerce_shipping_method_supports', 'sspssp_shiprazor_supports_global_settings', 10, 3); 373 412 374 413 /** … … 391 430 function sspssp_enqueue_admin_styles($hook) { 392 431 if (strpos($hook, 'woocommerce_page_wc-settings') === false) { 432 return; 433 } 434 435 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 436 $section = isset($_GET['section']) ? sanitize_text_field(wp_unslash($_GET['section'])) : ''; 437 if (SSPSSP_SHIPPING_METHOD_ID !== $section) { 393 438 return; 394 439 } … … 565 610 function init() 566 611 { 567 $this->sspssp_init_form_fields(); 568 $this->init_settings(); 569 // Remove any legacy full credentials, keeping only the last 5 digits. 570 if (!$this->instance_id) { 612 if ($this->instance_id) { 613 $this->sspssp_init_form_fields(); 614 $this->init_settings(); 615 } else { 616 // Same bootstrap order as 3.0.1 (credentials + connect UI on the Shiprazor tab). 617 $this->form_fields = array(); 618 $this->init_settings(); 571 619 $this->sspssp_migrate_stored_credentials(); 572 620 $this->sspssp_sync_api_key_status(); 573 } 574 // Save the settings 621 $this->sspssp_init_form_fields(); 622 } 623 575 624 add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_admin_options')); 576 625 … … 648 697 function sspssp_init_form_fields() 649 698 { 699 if ($this->instance_id) { 700 $this->form_fields = array( 701 'title' => array( 702 'title' => __('Method title', 'shiprazor-shipping-price'), 703 'type' => 'text', 704 'description' => __('Shown to customers at checkout.', 'shiprazor-shipping-price'), 705 'default' => __('Shiprazor Shipping', 'shiprazor-shipping-price'), 706 'desc_tip' => true, 707 ), 708 ); 709 return; 710 } 711 650 712 $this->form_fields = array( 651 'title' => array( 652 'title' => __('Method title', 'shiprazor-shipping-price'), 653 'type' => 'text', 654 'description' => __('Shown to customers at checkout.', 'shiprazor-shipping-price'), 655 'default' => __('Shiprazor Shipping', 'shiprazor-shipping-price'), 656 'desc_tip' => true, 713 'connect' => array( 714 'title' => '', 715 'type' => 'connect_button', 657 716 ), 658 717 ); 659 660 if (!$this->instance_id) {661 $this->form_fields['connect'] = array(662 'title' => '',663 'type' => 'connect_button',664 );665 }666 718 } 667 719 -
shiprazor-shipping-price/trunk/README.txt
r3697418 r3697440 3 3 Tags: WooCommerce, shipping, Shiprazor, shipping rate, shipping calculator 4 4 Tested up to: 7.0 5 Stable tag: 3.0. 25 Stable tag: 3.0.3 6 6 License: GPLv2 or later 7 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 103 103 5. Store connection credentials apply to all zone instances for live rates at checkout. 104 104 105 = 3.0.3 = 106 1. Restored the Shiprazor sub-tab under WooCommerce > Settings > Shipping (zone methods no longer hide it). 107 2. Restored the Connect with Shiprazor screen and automatic API key setup on that tab (same flow as 3.0.1). 108 3. Fixed global method init order so stored credentials and connection status load correctly before the connect UI renders. 109 4. Admin connect scripts and styles load only on the Shiprazor settings section. 110 105 111 == Upgrade Notice == 112 113 = 3.0.3 = 114 Restores the Shiprazor settings tab and Connect / API key admin experience. Update if the Shiprazor tab or connect screen was missing after 3.0.2. 106 115 107 116 = 3.0.2 = -
shiprazor-shipping-price/trunk/shiprazor-shipping-price.php
r3697418 r3697440 4 4 * Plugin URI: https://shiprazor.com/ 5 5 * Description: A WooCommerce plugin for calculating dynamic shipping rates using Shiprazor's API. 6 * Version: 3.0. 26 * Version: 3.0.3 7 7 * Author: Team Shiprazor 8 8 * Author URI: https://shiprazor.com … … 30 30 31 31 if (!defined('SSPSSP_PLUGIN_VERSION')) { 32 define('SSPSSP_PLUGIN_VERSION', '3.0. 2');32 define('SSPSSP_PLUGIN_VERSION', '3.0.3'); 33 33 } 34 34 … … 371 371 add_action('admin_init', 'sspssp_maybe_repair_shipping_instances', 5); 372 372 373 /** 374 * Zone-enabled methods are hidden from Shipping sub-tabs by default — add Shiprazor (Connect) back. 375 * 376 * @param array<string, string> $sections Shipping settings sections. 377 * @return array<string, string> 378 */ 379 function sspssp_add_shiprazor_shipping_settings_section($sections) { 380 $sections[SSPSSP_SHIPPING_METHOD_ID] = __('Shiprazor', 'shiprazor-shipping-price'); 381 return $sections; 382 } 383 add_filter('woocommerce_get_sections_shipping', 'sspssp_add_shiprazor_shipping_settings_section'); 384 385 /** 386 * WooCommerce skips global settings UI for zone methods unless "settings" is supported. 387 * 388 * @param bool $supported Whether the feature is supported. 389 * @param string $feature Feature name. 390 * @param WC_Shipping_Method $method Shipping method instance. 391 * @return bool 392 */ 393 function sspssp_shiprazor_supports_global_settings($supported, $feature, $method) { 394 if ('settings' !== $feature || !is_object($method) || SSPSSP_SHIPPING_METHOD_ID !== $method->id) { 395 return $supported; 396 } 397 398 if (!is_admin()) { 399 return $supported; 400 } 401 402 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 403 $section = isset($_GET['section']) ? sanitize_text_field(wp_unslash($_GET['section'])) : ''; 404 405 if (SSPSSP_SHIPPING_METHOD_ID === $section) { 406 return true; 407 } 408 409 return $supported; 410 } 411 add_filter('woocommerce_shipping_method_supports', 'sspssp_shiprazor_supports_global_settings', 10, 3); 373 412 374 413 /** … … 391 430 function sspssp_enqueue_admin_styles($hook) { 392 431 if (strpos($hook, 'woocommerce_page_wc-settings') === false) { 432 return; 433 } 434 435 // phpcs:ignore WordPress.Security.NonceVerification.Recommended 436 $section = isset($_GET['section']) ? sanitize_text_field(wp_unslash($_GET['section'])) : ''; 437 if (SSPSSP_SHIPPING_METHOD_ID !== $section) { 393 438 return; 394 439 } … … 565 610 function init() 566 611 { 567 $this->sspssp_init_form_fields(); 568 $this->init_settings(); 569 // Remove any legacy full credentials, keeping only the last 5 digits. 570 if (!$this->instance_id) { 612 if ($this->instance_id) { 613 $this->sspssp_init_form_fields(); 614 $this->init_settings(); 615 } else { 616 // Same bootstrap order as 3.0.3 (credentials + connect UI on the Shiprazor tab). 617 $this->form_fields = array(); 618 $this->init_settings(); 571 619 $this->sspssp_migrate_stored_credentials(); 572 620 $this->sspssp_sync_api_key_status(); 573 } 574 // Save the settings 621 $this->sspssp_init_form_fields(); 622 } 623 575 624 add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_admin_options')); 576 625 … … 648 697 function sspssp_init_form_fields() 649 698 { 699 if ($this->instance_id) { 700 $this->form_fields = array( 701 'title' => array( 702 'title' => __('Method title', 'shiprazor-shipping-price'), 703 'type' => 'text', 704 'description' => __('Shown to customers at checkout.', 'shiprazor-shipping-price'), 705 'default' => __('Shiprazor Shipping', 'shiprazor-shipping-price'), 706 'desc_tip' => true, 707 ), 708 ); 709 return; 710 } 711 650 712 $this->form_fields = array( 651 'title' => array( 652 'title' => __('Method title', 'shiprazor-shipping-price'), 653 'type' => 'text', 654 'description' => __('Shown to customers at checkout.', 'shiprazor-shipping-price'), 655 'default' => __('Shiprazor Shipping', 'shiprazor-shipping-price'), 656 'desc_tip' => true, 713 'connect' => array( 714 'title' => '', 715 'type' => 'connect_button', 657 716 ), 658 717 ); 659 660 if (!$this->instance_id) {661 $this->form_fields['connect'] = array(662 'title' => '',663 'type' => 'connect_button',664 );665 }666 718 } 667 719
Note:
See TracChangeset
for help on using the changeset viewer.