Changeset 3478498
- Timestamp:
- 03/09/2026 07:50:13 PM (3 weeks ago)
- Location:
- sendbox-shipping
- Files:
-
- 17 deleted
- 8 edited
- 12 copied
-
tags/5.5.3 (copied) (copied from sendbox-shipping/trunk)
-
tags/5.5.3/README.md (copied) (copied from sendbox-shipping/trunk/README.md)
-
tags/5.5.3/README.txt (copied) (copied from sendbox-shipping/trunk/README.txt) (1 diff)
-
tags/5.5.3/admin/class-wooss-admin.php (deleted)
-
tags/5.5.3/admin/css (deleted)
-
tags/5.5.3/admin/images (deleted)
-
tags/5.5.3/admin/js (deleted)
-
tags/5.5.3/admin/partials (deleted)
-
tags/5.5.3/assets (copied) (copied from sendbox-shipping/trunk/assets)
-
tags/5.5.3/assets/js/admin-settings.js (copied) (copied from sendbox-shipping/trunk/assets/js/admin-settings.js) (1 diff)
-
tags/5.5.3/includes/assets (deleted)
-
tags/5.5.3/includes/class-wooss-activator.php (deleted)
-
tags/5.5.3/includes/class-wooss-deactivator.php (deleted)
-
tags/5.5.3/includes/class-wooss-i18n.php (deleted)
-
tags/5.5.3/includes/class-wooss-loader.php (deleted)
-
tags/5.5.3/includes/class-wooss-sendbox-shipping-api.php (deleted)
-
tags/5.5.3/includes/class-wooss-shipping-method.php (deleted)
-
tags/5.5.3/includes/class-wooss.php (deleted)
-
tags/5.5.3/public/class-wooss-public.php (deleted)
-
tags/5.5.3/public/css (deleted)
-
tags/5.5.3/public/js (deleted)
-
tags/5.5.3/public/partials (deleted)
-
tags/5.5.3/src (copied) (copied from sendbox-shipping/trunk/src)
-
tags/5.5.3/src/Admin/Ajax.php (copied) (copied from sendbox-shipping/trunk/src/Admin/Ajax.php) (2 diffs)
-
tags/5.5.3/src/Admin/SettingsPage.php (copied) (copied from sendbox-shipping/trunk/src/Admin/SettingsPage.php) (1 diff)
-
tags/5.5.3/src/Api/Client.php (modified) (1 diff)
-
tags/5.5.3/src/Plugin.php (copied) (copied from sendbox-shipping/trunk/src/Plugin.php) (1 diff)
-
tags/5.5.3/uninstall.php (copied) (copied from sendbox-shipping/trunk/uninstall.php)
-
tags/5.5.3/wooss-reset.php (copied) (copied from sendbox-shipping/trunk/wooss-reset.php)
-
tags/5.5.3/wooss.php (copied) (copied from sendbox-shipping/trunk/wooss.php) (2 diffs)
-
trunk/README.txt (modified) (1 diff)
-
trunk/assets/js/admin-settings.js (modified) (1 diff)
-
trunk/src/Admin/Ajax.php (modified) (2 diffs)
-
trunk/src/Admin/SettingsPage.php (modified) (1 diff)
-
trunk/src/Api/Client.php (modified) (1 diff)
-
trunk/src/Plugin.php (modified) (1 diff)
-
trunk/wooss.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sendbox-shipping/tags/5.5.3/README.txt
r3478438 r3478498 5 5 Requires at least: 6.0 6 6 Tested up to: 6.9 7 Stable tag: 5.5. 27 Stable tag: 5.5.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later -
sendbox-shipping/tags/5.5.3/assets/js/admin-settings.js
r3478438 r3478498 115 115 } 116 116 117 // Diagnose button 118 var diagnoseBtn = document.querySelector(".wooss-diagnose-plugin"); 119 if (diagnoseBtn) { 120 diagnoseBtn.addEventListener("click", function (e) { 121 e.preventDefault(); 122 diagnoseBtn.disabled = true; 123 diagnoseBtn.textContent = "Checking..."; 124 125 var formData = new FormData(); 126 formData.append("action", "wooss_diagnose"); 127 formData.append("security", wooss_ajax.nonce); 128 129 fetch(wooss_ajax.ajax_url, { method: "POST", body: formData }) 130 .then(function (res) { return res.json(); }) 131 .then(function (response) { 132 diagnoseBtn.disabled = false; 133 diagnoseBtn.textContent = "Diagnose"; 134 135 if (response.success) { 136 var d = response.data; 137 var msg = "--- Sendbox Shipping Diagnostics ---\n\n" 138 + "Plugin Version: " + d.plugin_version + "\n" 139 + "Connection Status: " + d.connection_status + "\n" 140 + "Token: " + d.token + "\n" 141 + "Token Status: " + d.token_status + "\n" 142 + "Outbound Request: " + d.outbound_request + "\n" 143 + "Origin Country: " + d.origin_country + "\n" 144 + "Origin State: " + d.origin_state + "\n" 145 + "Origin City: " + d.origin_city + "\n" 146 + "PHP: " + d.php_version + "\n" 147 + "WordPress: " + d.wp_version + "\n" 148 + "WooCommerce: " + d.wc_version; 149 alert(msg); 150 } else { 151 showError("Diagnosis failed."); 152 } 153 }) 154 .catch(function () { 155 diagnoseBtn.disabled = false; 156 diagnoseBtn.textContent = "Diagnose"; 157 showError("Network error."); 158 }); 159 }); 160 } 161 117 162 // Reset plugin button 118 163 var resetBtn = document.querySelector(".wooss-reset-plugin"); -
sendbox-shipping/tags/5.5.3/src/Admin/Ajax.php
r3478438 r3478498 27 27 28 28 $client = new Client(); 29 if ( ! $client->validate_token( $token ) ) { 29 $result = $client->validate_token( $token ); 30 if ( is_wp_error( $result ) ) { 31 wp_send_json_error( array( 32 'message' => sprintf( 33 __( 'Could not connect to Sendbox: %s', 'wooss' ), 34 $result->get_error_message() 35 ), 36 ) ); 37 } 38 if ( true !== $result ) { 30 39 wp_send_json_error( array( 'message' => __( 'Invalid access token.', 'wooss' ) ) ); 31 40 } … … 212 221 } 213 222 223 public function diagnose() { 224 check_ajax_referer( 'wooss-ajax-nonce', 'security' ); 225 226 if ( ! current_user_can( 'manage_woocommerce' ) ) { 227 wp_send_json_error( array( 'message' => __( 'Permission denied.', 'wooss' ) ), 403 ); 228 } 229 230 $sendbox_data = get_option( 'sendbox_data', array() ); 231 $connection_status = get_option( 'wooss_connection_status', false ); 232 $has_token = ! empty( $sendbox_data['sendbox_auth_token'] ); 233 $token_preview = $has_token ? substr( $sendbox_data['sendbox_auth_token'], 0, 8 ) . '...' : 'empty'; 234 235 // Test outbound connection to Sendbox API. 236 $outbound_test = wp_remote_get( 'https://live.sendbox.co/oauth/profile', array( 237 'timeout' => 15, 238 'headers' => array( 'Content-Type' => 'application/json' ), 239 ) ); 240 241 if ( is_wp_error( $outbound_test ) ) { 242 $outbound_status = 'BLOCKED - ' . $outbound_test->get_error_message(); 243 } else { 244 $outbound_status = 'OK - HTTP ' . wp_remote_retrieve_response_code( $outbound_test ); 245 } 246 247 // Test token validity. 248 $token_status = 'no token'; 249 if ( $has_token ) { 250 $client = new Client(); 251 $token_valid = $client->validate_token( $sendbox_data['sendbox_auth_token'] ); 252 $token_status = $token_valid ? 'valid' : 'invalid'; 253 } 254 255 $results = array( 256 'plugin_version' => defined( 'WOOSS_VERSION' ) ? WOOSS_VERSION : 'unknown', 257 'connection_status' => $connection_status ? 'connected' : 'disconnected', 258 'token' => $token_preview, 259 'token_status' => $token_status, 260 'outbound_request' => $outbound_status, 261 'origin_country' => isset( $sendbox_data['wooss_country'] ) ? $sendbox_data['wooss_country'] : 'not set', 262 'origin_state' => isset( $sendbox_data['wooss_state_name'] ) ? $sendbox_data['wooss_state_name'] : 'not set', 263 'origin_city' => isset( $sendbox_data['wooss_city'] ) ? $sendbox_data['wooss_city'] : 'not set', 264 'php_version' => phpversion(), 265 'wp_version' => get_bloginfo( 'version' ), 266 'wc_version' => defined( 'WC_VERSION' ) ? WC_VERSION : 'not active', 267 ); 268 269 wp_send_json_success( $results ); 270 } 271 214 272 public function reset_plugin() { 215 273 check_ajax_referer( 'wooss-ajax-nonce', 'security' ); -
sendbox-shipping/tags/5.5.3/src/Admin/SettingsPage.php
r3478438 r3478498 153 153 <?php esc_html_e( 'Sync changes', 'wooss' ); ?> 154 154 </button> 155 <button type="button" class="button wooss-diagnose-plugin" style="margin-left:10px;"> 156 <?php esc_html_e( 'Diagnose', 'wooss' ); ?> 157 </button> 155 158 <button type="button" class="button wooss-reset-plugin" style="margin-left:10px;color:#d63638;"> 156 159 <?php esc_html_e( 'Reset Plugin', 'wooss' ); ?> -
sendbox-shipping/tags/5.5.3/src/Api/Client.php
r3478358 r3478498 57 57 58 58 if ( is_wp_error( $response ) ) { 59 return false;59 return new \WP_Error( 'connection_failed', $response->get_error_message() ); 60 60 } 61 61 62 return wp_remote_retrieve_response_code( $response ) === 200; 62 $code = wp_remote_retrieve_response_code( $response ); 63 if ( 200 !== $code ) { 64 $body = json_decode( wp_remote_retrieve_body( $response ) ); 65 $detail = isset( $body->message ) ? $body->message : ( isset( $body->error ) ? $body->error : '' ); 66 return new \WP_Error( 'invalid_token', sprintf( 'Sendbox returned HTTP %d. %s', $code, $detail ) ); 67 } 68 69 return true; 63 70 } 64 71 -
sendbox-shipping/tags/5.5.3/src/Plugin.php
r3478438 r3478498 72 72 add_action( 'wp_ajax_request_states', array( $ajax, 'request_states' ) ); 73 73 add_action( 'wp_ajax_wooss_reset_plugin', array( $ajax, 'reset_plugin' ) ); 74 add_action( 'wp_ajax_wooss_diagnose', array( $ajax, 'diagnose' ) ); 74 75 } 75 76 -
sendbox-shipping/tags/5.5.3/wooss.php
r3478438 r3478498 4 4 * Plugin URI: https://sendbox.co/ 5 5 * Description: WooCommerce shipping integration with Sendbox — ship from your store to anywhere in the world. 6 * Version: 5.5. 26 * Version: 5.5.3 7 7 * Author: Sendbox 8 8 * Author URI: https://sendbox.co/ … … 23 23 } 24 24 25 define( 'WOOSS_VERSION', '5.5. 2' );25 define( 'WOOSS_VERSION', '5.5.3' ); 26 26 define( 'WOOSS_PLUGIN_FILE', __FILE__ ); 27 27 define( 'WOOSS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
sendbox-shipping/trunk/README.txt
r3478438 r3478498 5 5 Requires at least: 6.0 6 6 Tested up to: 6.9 7 Stable tag: 5.5. 27 Stable tag: 5.5.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later -
sendbox-shipping/trunk/assets/js/admin-settings.js
r3478438 r3478498 115 115 } 116 116 117 // Diagnose button 118 var diagnoseBtn = document.querySelector(".wooss-diagnose-plugin"); 119 if (diagnoseBtn) { 120 diagnoseBtn.addEventListener("click", function (e) { 121 e.preventDefault(); 122 diagnoseBtn.disabled = true; 123 diagnoseBtn.textContent = "Checking..."; 124 125 var formData = new FormData(); 126 formData.append("action", "wooss_diagnose"); 127 formData.append("security", wooss_ajax.nonce); 128 129 fetch(wooss_ajax.ajax_url, { method: "POST", body: formData }) 130 .then(function (res) { return res.json(); }) 131 .then(function (response) { 132 diagnoseBtn.disabled = false; 133 diagnoseBtn.textContent = "Diagnose"; 134 135 if (response.success) { 136 var d = response.data; 137 var msg = "--- Sendbox Shipping Diagnostics ---\n\n" 138 + "Plugin Version: " + d.plugin_version + "\n" 139 + "Connection Status: " + d.connection_status + "\n" 140 + "Token: " + d.token + "\n" 141 + "Token Status: " + d.token_status + "\n" 142 + "Outbound Request: " + d.outbound_request + "\n" 143 + "Origin Country: " + d.origin_country + "\n" 144 + "Origin State: " + d.origin_state + "\n" 145 + "Origin City: " + d.origin_city + "\n" 146 + "PHP: " + d.php_version + "\n" 147 + "WordPress: " + d.wp_version + "\n" 148 + "WooCommerce: " + d.wc_version; 149 alert(msg); 150 } else { 151 showError("Diagnosis failed."); 152 } 153 }) 154 .catch(function () { 155 diagnoseBtn.disabled = false; 156 diagnoseBtn.textContent = "Diagnose"; 157 showError("Network error."); 158 }); 159 }); 160 } 161 117 162 // Reset plugin button 118 163 var resetBtn = document.querySelector(".wooss-reset-plugin"); -
sendbox-shipping/trunk/src/Admin/Ajax.php
r3478438 r3478498 27 27 28 28 $client = new Client(); 29 if ( ! $client->validate_token( $token ) ) { 29 $result = $client->validate_token( $token ); 30 if ( is_wp_error( $result ) ) { 31 wp_send_json_error( array( 32 'message' => sprintf( 33 __( 'Could not connect to Sendbox: %s', 'wooss' ), 34 $result->get_error_message() 35 ), 36 ) ); 37 } 38 if ( true !== $result ) { 30 39 wp_send_json_error( array( 'message' => __( 'Invalid access token.', 'wooss' ) ) ); 31 40 } … … 212 221 } 213 222 223 public function diagnose() { 224 check_ajax_referer( 'wooss-ajax-nonce', 'security' ); 225 226 if ( ! current_user_can( 'manage_woocommerce' ) ) { 227 wp_send_json_error( array( 'message' => __( 'Permission denied.', 'wooss' ) ), 403 ); 228 } 229 230 $sendbox_data = get_option( 'sendbox_data', array() ); 231 $connection_status = get_option( 'wooss_connection_status', false ); 232 $has_token = ! empty( $sendbox_data['sendbox_auth_token'] ); 233 $token_preview = $has_token ? substr( $sendbox_data['sendbox_auth_token'], 0, 8 ) . '...' : 'empty'; 234 235 // Test outbound connection to Sendbox API. 236 $outbound_test = wp_remote_get( 'https://live.sendbox.co/oauth/profile', array( 237 'timeout' => 15, 238 'headers' => array( 'Content-Type' => 'application/json' ), 239 ) ); 240 241 if ( is_wp_error( $outbound_test ) ) { 242 $outbound_status = 'BLOCKED - ' . $outbound_test->get_error_message(); 243 } else { 244 $outbound_status = 'OK - HTTP ' . wp_remote_retrieve_response_code( $outbound_test ); 245 } 246 247 // Test token validity. 248 $token_status = 'no token'; 249 if ( $has_token ) { 250 $client = new Client(); 251 $token_valid = $client->validate_token( $sendbox_data['sendbox_auth_token'] ); 252 $token_status = $token_valid ? 'valid' : 'invalid'; 253 } 254 255 $results = array( 256 'plugin_version' => defined( 'WOOSS_VERSION' ) ? WOOSS_VERSION : 'unknown', 257 'connection_status' => $connection_status ? 'connected' : 'disconnected', 258 'token' => $token_preview, 259 'token_status' => $token_status, 260 'outbound_request' => $outbound_status, 261 'origin_country' => isset( $sendbox_data['wooss_country'] ) ? $sendbox_data['wooss_country'] : 'not set', 262 'origin_state' => isset( $sendbox_data['wooss_state_name'] ) ? $sendbox_data['wooss_state_name'] : 'not set', 263 'origin_city' => isset( $sendbox_data['wooss_city'] ) ? $sendbox_data['wooss_city'] : 'not set', 264 'php_version' => phpversion(), 265 'wp_version' => get_bloginfo( 'version' ), 266 'wc_version' => defined( 'WC_VERSION' ) ? WC_VERSION : 'not active', 267 ); 268 269 wp_send_json_success( $results ); 270 } 271 214 272 public function reset_plugin() { 215 273 check_ajax_referer( 'wooss-ajax-nonce', 'security' ); -
sendbox-shipping/trunk/src/Admin/SettingsPage.php
r3478438 r3478498 153 153 <?php esc_html_e( 'Sync changes', 'wooss' ); ?> 154 154 </button> 155 <button type="button" class="button wooss-diagnose-plugin" style="margin-left:10px;"> 156 <?php esc_html_e( 'Diagnose', 'wooss' ); ?> 157 </button> 155 158 <button type="button" class="button wooss-reset-plugin" style="margin-left:10px;color:#d63638;"> 156 159 <?php esc_html_e( 'Reset Plugin', 'wooss' ); ?> -
sendbox-shipping/trunk/src/Api/Client.php
r3478358 r3478498 57 57 58 58 if ( is_wp_error( $response ) ) { 59 return false;59 return new \WP_Error( 'connection_failed', $response->get_error_message() ); 60 60 } 61 61 62 return wp_remote_retrieve_response_code( $response ) === 200; 62 $code = wp_remote_retrieve_response_code( $response ); 63 if ( 200 !== $code ) { 64 $body = json_decode( wp_remote_retrieve_body( $response ) ); 65 $detail = isset( $body->message ) ? $body->message : ( isset( $body->error ) ? $body->error : '' ); 66 return new \WP_Error( 'invalid_token', sprintf( 'Sendbox returned HTTP %d. %s', $code, $detail ) ); 67 } 68 69 return true; 63 70 } 64 71 -
sendbox-shipping/trunk/src/Plugin.php
r3478438 r3478498 72 72 add_action( 'wp_ajax_request_states', array( $ajax, 'request_states' ) ); 73 73 add_action( 'wp_ajax_wooss_reset_plugin', array( $ajax, 'reset_plugin' ) ); 74 add_action( 'wp_ajax_wooss_diagnose', array( $ajax, 'diagnose' ) ); 74 75 } 75 76 -
sendbox-shipping/trunk/wooss.php
r3478438 r3478498 4 4 * Plugin URI: https://sendbox.co/ 5 5 * Description: WooCommerce shipping integration with Sendbox — ship from your store to anywhere in the world. 6 * Version: 5.5. 26 * Version: 5.5.3 7 7 * Author: Sendbox 8 8 * Author URI: https://sendbox.co/ … … 23 23 } 24 24 25 define( 'WOOSS_VERSION', '5.5. 2' );25 define( 'WOOSS_VERSION', '5.5.3' ); 26 26 define( 'WOOSS_PLUGIN_FILE', __FILE__ ); 27 27 define( 'WOOSS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.