refactor: rename the theme brand and every identifier from AKSRT to Jio
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>
This commit is contained in:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
@@ -2,34 +2,34 @@
|
||||
/**
|
||||
* Comment city / IP geo helpers.
|
||||
*
|
||||
* Meta: aksrt_comment_addr {country,province,city}
|
||||
* Meta: jio_comment_addr {country,province,city}
|
||||
* Gates: ip_geo_enabled + ip_geo_display has comment(扩展&增强 / IP归属地统一控制)
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_comment_city_enabled')) :
|
||||
function aksrt_comment_city_enabled(): bool {
|
||||
if (!function_exists('jio_comment_city_enabled')) :
|
||||
function jio_comment_city_enabled(): bool {
|
||||
// 评论区位置显示的开关与精度统一由「扩展&增强 / IP归属地」配置提供。
|
||||
return function_exists('aksrt_ip_geo_display_enabled') && aksrt_ip_geo_display_enabled('comment');
|
||||
return function_exists('jio_ip_geo_display_enabled') && jio_ip_geo_display_enabled('comment');
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_comment_city_type')) :
|
||||
function aksrt_comment_city_type(): string {
|
||||
return function_exists('aksrt_ip_geo_format_key') ? aksrt_ip_geo_format_key() : 'province_city';
|
||||
if (!function_exists('jio_comment_city_type')) :
|
||||
function jio_comment_city_type(): string {
|
||||
return function_exists('jio_ip_geo_format_key') ? jio_ip_geo_format_key() : 'province_city';
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_store_comment_addr')) :
|
||||
if (!function_exists('jio_store_comment_addr')) :
|
||||
/**
|
||||
* @param int $comment_id Comment ID.
|
||||
* @param string|null $ip Optional IP override.
|
||||
*/
|
||||
function aksrt_store_comment_addr(int $comment_id, ?string $ip = null): void {
|
||||
if ($comment_id <= 0 || !aksrt_comment_city_enabled()) {
|
||||
function jio_store_comment_addr(int $comment_id, ?string $ip = null): void {
|
||||
if ($comment_id <= 0 || !jio_comment_city_enabled()) {
|
||||
return;
|
||||
}
|
||||
if ($ip === null || $ip === '') {
|
||||
@@ -43,8 +43,8 @@ if (!function_exists('aksrt_store_comment_addr')) :
|
||||
if (!$needs_live && function_exists('filter_var')) {
|
||||
$needs_live = !filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||
}
|
||||
if ($needs_live && function_exists('aksrt_get_client_ip')) {
|
||||
$live = trim((string) aksrt_get_client_ip());
|
||||
if ($needs_live && function_exists('jio_get_client_ip')) {
|
||||
$live = trim((string) jio_get_client_ip());
|
||||
if ($live !== '' && $live !== '0.0.0.0'
|
||||
&& filter_var($live, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
|
||||
) {
|
||||
@@ -55,10 +55,10 @@ if (!function_exists('aksrt_store_comment_addr')) :
|
||||
if ($ip === '') {
|
||||
return;
|
||||
}
|
||||
if (function_exists('aksrt_lookup_geo_for_ip')) {
|
||||
$addr = aksrt_lookup_geo_for_ip($ip);
|
||||
} elseif (class_exists('\AKSRT\Extensions\IPGeo')) {
|
||||
$geo = \AKSRT\Extensions\IPGeo::get_instance()->lookup($ip);
|
||||
if (function_exists('jio_lookup_geo_for_ip')) {
|
||||
$addr = jio_lookup_geo_for_ip($ip);
|
||||
} elseif (class_exists('\Jio\Extensions\IPGeo')) {
|
||||
$geo = \Jio\Extensions\IPGeo::get_instance()->lookup($ip);
|
||||
$addr = [
|
||||
'country' => (string) ($geo['country'] ?? ''),
|
||||
'province' => (string) ($geo['province'] ?? ''),
|
||||
@@ -70,60 +70,60 @@ if (!function_exists('aksrt_store_comment_addr')) :
|
||||
if ($addr['country'] === '' && $addr['province'] === '' && $addr['city'] === '') {
|
||||
return;
|
||||
}
|
||||
update_comment_meta($comment_id, 'aksrt_comment_addr', $addr);
|
||||
update_comment_meta($comment_id, 'jio_comment_addr', $addr);
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_get_comment_addr')) :
|
||||
if (!function_exists('jio_get_comment_addr')) :
|
||||
/**
|
||||
* @param int|WP_Comment $comment Comment.
|
||||
* @return array{country:string,province:string,city:string}
|
||||
*/
|
||||
function aksrt_get_comment_addr($comment): array {
|
||||
function jio_get_comment_addr($comment): array {
|
||||
$comment_id = $comment instanceof WP_Comment ? (int) $comment->comment_ID : (int) $comment;
|
||||
if ($comment_id <= 0) {
|
||||
return ['country' => '', 'province' => '', 'city' => ''];
|
||||
}
|
||||
$raw = get_comment_meta($comment_id, 'aksrt_comment_addr', true);
|
||||
if (function_exists('aksrt_normalize_geo_addr')) {
|
||||
return aksrt_normalize_geo_addr($raw);
|
||||
$raw = get_comment_meta($comment_id, 'jio_comment_addr', true);
|
||||
if (function_exists('jio_normalize_geo_addr')) {
|
||||
return jio_normalize_geo_addr($raw);
|
||||
}
|
||||
return is_array($raw) ? $raw : ['country' => '', 'province' => '', 'city' => ''];
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_format_comment_city_label')) :
|
||||
if (!function_exists('jio_format_comment_city_label')) :
|
||||
/**
|
||||
* @param array<string,string> $addr Addr.
|
||||
* @param string $type Format.
|
||||
*/
|
||||
function aksrt_format_comment_city_label(array $addr, string $type = 'province_city'): string {
|
||||
if (function_exists('aksrt_format_geo_label')) {
|
||||
return aksrt_format_geo_label($addr, $type);
|
||||
function jio_format_comment_city_label(array $addr, string $type = 'province_city'): string {
|
||||
if (function_exists('jio_format_geo_label')) {
|
||||
return jio_format_geo_label($addr, $type);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_get_comment_city_badge_html')) :
|
||||
function aksrt_get_comment_city_badge_html($comment): string {
|
||||
if (!aksrt_comment_city_enabled()) {
|
||||
if (!function_exists('jio_get_comment_city_badge_html')) :
|
||||
function jio_get_comment_city_badge_html($comment): string {
|
||||
if (!jio_comment_city_enabled()) {
|
||||
return '';
|
||||
}
|
||||
// legacy 契约:无属地数据时不渲染徽章(不使用查询失败兜底文案)。
|
||||
$addr = aksrt_get_comment_addr($comment);
|
||||
$label = function_exists('aksrt_format_geo_label')
|
||||
? aksrt_format_geo_label(is_array($addr) ? $addr : [], aksrt_comment_city_type())
|
||||
$addr = jio_get_comment_addr($comment);
|
||||
$label = function_exists('jio_format_geo_label')
|
||||
? jio_format_geo_label(is_array($addr) ? $addr : [], jio_comment_city_type())
|
||||
: '';
|
||||
if ($label === '') {
|
||||
return '';
|
||||
}
|
||||
return '<span class="badg badg-sm comment-city-badge aksrt-ip-geo-badge" title="' . esc_attr__('IP 属地', 'aksrt') . '">' . esc_html($label) . '</span>';
|
||||
return '<span class="badg badg-sm comment-city-badge jio-ip-geo-badge" title="' . esc_attr__('IP 属地', 'jio') . '">' . esc_html($label) . '</span>';
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action('comment_post', static function ($comment_id): void {
|
||||
if (function_exists('aksrt_store_comment_addr')) {
|
||||
aksrt_store_comment_addr((int) $comment_id);
|
||||
if (function_exists('jio_store_comment_addr')) {
|
||||
jio_store_comment_addr((int) $comment_id);
|
||||
}
|
||||
}, 20, 1);
|
||||
Reference in new issue
Block a user