Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
83 lines
2.7 KiB
PHP
83 lines
2.7 KiB
PHP
<?php
|
||
/**
|
||
* AJAX Debug — 记录 admin-ajax 收到的每个请求,用于定位未知 action(WP 返回 400 "0")。
|
||
*
|
||
* 启用条件:WP_DEBUG 开启,或请求带 ?jio_ajax_debug=1
|
||
* 日志位置:wp-content/jio-ajax-debug.log
|
||
*
|
||
* 每行格式:
|
||
* [时间] action=xxx handled=0/1(nopriv) login=0/1 post={...} referer=...
|
||
* handled=0 表示 WP 没有任何 wp_ajax_{action} / wp_ajax_nopriv_{action} 处理器,
|
||
* 这种请求 admin-ajax 会直接 die('0') 并返回 400 —— 即控制台看到的报错来源。
|
||
*
|
||
* @package Jio
|
||
*/
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
if (!function_exists('jio_ajax_debug_enabled')) :
|
||
/**
|
||
* Whether ajax debugging is on for this request.
|
||
*
|
||
* @return bool
|
||
*/
|
||
function jio_ajax_debug_enabled(): bool {
|
||
if (defined('JIO_AJAX_DEBUG') && JIO_AJAX_DEBUG) {
|
||
return true;
|
||
}
|
||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||
return true;
|
||
}
|
||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- 调试开关,无副作用。
|
||
return isset($_GET['jio_ajax_debug']) && '1' === (string) wp_unslash($_GET['jio_ajax_debug']);
|
||
}
|
||
endif;
|
||
|
||
if (!function_exists('jio_ajax_debug_log')) :
|
||
/**
|
||
* Append a line to the ajax debug log.
|
||
*
|
||
* @param string $line Log line.
|
||
*/
|
||
function jio_ajax_debug_log(string $line): void {
|
||
$file = WP_CONTENT_DIR . '/jio-ajax-debug.log';
|
||
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents -- 调试日志。
|
||
@file_put_contents($file, '[' . current_time('Y-m-d H:i:s') . '] ' . $line . "\n", FILE_APPEND | LOCK_EX);
|
||
}
|
||
endif;
|
||
|
||
if (!function_exists('jio_ajax_debug_boot')) :
|
||
/**
|
||
* Hook the admin-ajax logger.
|
||
*/
|
||
function jio_ajax_debug_boot(): void {
|
||
if (!jio_ajax_debug_enabled()) {
|
||
return;
|
||
}
|
||
|
||
add_action('admin_init', static function (): void {
|
||
if (!defined('DOING_AJAX') || !DOING_AJAX) {
|
||
return;
|
||
}
|
||
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- 只读记录,不修改状态。
|
||
$action = isset($_REQUEST['action']) ? sanitize_key((string) wp_unslash($_REQUEST['action'])) : '';
|
||
$has_logged = $action !== '' && has_action('wp_ajax_' . $action);
|
||
$has_nopriv = $action !== '' && has_action('wp_ajax_nopriv_' . $action);
|
||
$payload = $_POST;
|
||
unset($payload['_wpnonce'], $payload['nonce'], $payload['_ajax_nonce']);
|
||
jio_ajax_debug_log(sprintf(
|
||
'action=%s handled=%d|%d login=%d post=%s referer=%s',
|
||
$action !== '' ? $action : '(empty)',
|
||
$has_logged ? 1 : 0,
|
||
$has_nopriv ? 1 : 0,
|
||
is_user_logged_in() ? 1 : 0,
|
||
wp_json_encode($payload, JSON_UNESCAPED_UNICODE),
|
||
isset($_SERVER['HTTP_REFERER']) ? (string) wp_unslash($_SERVER['HTTP_REFERER']) : ''
|
||
));
|
||
// phpcs:enable
|
||
}, 1);
|
||
}
|
||
endif;
|
||
|
||
jio_ajax_debug_boot();
|