mirror of
https://github.com/woodchen-ink/czlexpress-for-woocommerce.git
synced 2025-07-18 14:01:58 +08:00
- Renamed the plugin from "woocommerce-czlexpress" to "CZL Express for WooCommerce" for better branding. - Updated README and readme.txt files to reflect the new plugin name and improved description. - Enhanced system requirements to support PHP 8.0 and tested compatibility with WordPress 6.7. - Removed outdated files and references, including the main plugin file and language files. - Improved localization by updating text domain references throughout the codebase. - Streamlined the admin interface for better usability, including updated labels and descriptions. These changes enhance the clarity, performance, and user experience of the CZL Express plugin.
69 lines
2.5 KiB
PHP
69 lines
2.5 KiB
PHP
<?php
|
|
defined('ABSPATH') || exit;
|
|
?>
|
|
|
|
<div class="czl-api-test">
|
|
<h2><?php _e('API连接测试', 'czlexpress-for-woocommerce'); ?></h2>
|
|
|
|
<p class="description">
|
|
<?php _e('点击下面的按钮测试与CZL Express API的连接。', 'czlexpress-for-woocommerce'); ?>
|
|
</p>
|
|
|
|
<div class="test-buttons">
|
|
<button type="button" class="button" id="czl-test-connection">
|
|
<?php _e('测试连接', 'czlexpress-for-woocommerce'); ?>
|
|
</button>
|
|
|
|
<button type="button" class="button" id="czl-test-shipping-rate">
|
|
<?php _e('测试运费查询', 'czlexpress-for-woocommerce'); ?>
|
|
</button>
|
|
</div>
|
|
|
|
<div id="czl-test-result"></div>
|
|
</div>
|
|
|
|
<script>
|
|
jQuery(function($) {
|
|
$('#czl-test-connection').on('click', function() {
|
|
var $button = $(this);
|
|
var $result = $('#czl-test-result');
|
|
|
|
$button.prop('disabled', true);
|
|
$result.html('<?php _e('测试中...', 'czlexpress-for-woocommerce'); ?>');
|
|
|
|
$.post(ajaxurl, {
|
|
action: 'czl_test_connection',
|
|
nonce: '<?php echo wp_create_nonce('czl_test_api'); ?>'
|
|
}, function(response) {
|
|
$button.prop('disabled', false);
|
|
if (response.success) {
|
|
$result.html('<div class="notice notice-success"><p>' + wp.escapeHtml(response.data.message) + '</p></div>');
|
|
} else {
|
|
$result.html('<div class="notice notice-error"><p>' + wp.escapeHtml(response.data.message) + '</p></div>');
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#czl-test-shipping-rate').on('click', function() {
|
|
var $button = $(this);
|
|
var $result = $('#czl-test-result');
|
|
|
|
$button.prop('disabled', true);
|
|
$result.html('<?php _e('测试中...', 'czlexpress-for-woocommerce'); ?>');
|
|
|
|
$.post(ajaxurl, {
|
|
action: 'czl_test_shipping_rate',
|
|
nonce: '<?php echo wp_create_nonce('czl_test_api'); ?>'
|
|
}, function(response) {
|
|
$button.prop('disabled', false);
|
|
if (response.success) {
|
|
var html = '<div class="notice notice-success"><p><?php _e('运费查询成功:', 'czlexpress-for-woocommerce'); ?></p>';
|
|
html += '<pre>' + wp.escapeHtml(JSON.stringify(response.data, null, 2)) + '</pre></div>';
|
|
$result.html(html);
|
|
} else {
|
|
$result.html('<div class="notice notice-error"><p>' + wp.escapeHtml(response.data.message) + '</p></div>');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|