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,21 +2,21 @@
|
||||
/**
|
||||
* Comment action permissions + like/pin primitives.
|
||||
*
|
||||
* Extracted from aksrt-frontend-tags.php for size budget.
|
||||
* Extracted from jio-frontend-tags.php for size budget.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_comment_action_permissions')) :
|
||||
if (!function_exists('jio_comment_action_permissions')) :
|
||||
/**
|
||||
* Single source of truth for per-comment action permissions.
|
||||
*
|
||||
* @param WP_Comment|int $comment Comment object or ID.
|
||||
* @return array{can_edit:bool,can_delete:bool,can_moderate:bool,can_pin:bool}
|
||||
*/
|
||||
function aksrt_comment_action_permissions($comment): array {
|
||||
function jio_comment_action_permissions($comment): array {
|
||||
$comment = $comment instanceof WP_Comment ? $comment : get_comment($comment);
|
||||
$none = ['can_edit' => false, 'can_delete' => false, 'can_moderate' => false, 'can_pin' => false];
|
||||
if (!($comment instanceof WP_Comment) || !is_user_logged_in()) {
|
||||
@@ -31,19 +31,19 @@ if (!function_exists('aksrt_comment_action_permissions')) :
|
||||
$ctx = $post_id > 0 ? $post_id : null;
|
||||
|
||||
$can = static function (string $cap) use ($uid, $ctx): bool {
|
||||
if (function_exists('aksrt_user_can')) {
|
||||
return aksrt_user_can($cap, $uid, $ctx);
|
||||
if (function_exists('jio_user_can')) {
|
||||
return jio_user_can($cap, $uid, $ctx);
|
||||
}
|
||||
if (class_exists('\AKSRT\Settings\Capabilities')) {
|
||||
return \AKSRT\Settings\Capabilities::user_can($cap, $uid, $ctx);
|
||||
if (class_exists('\Jio\Settings\Capabilities')) {
|
||||
return \Jio\Settings\Capabilities::user_can($cap, $uid, $ctx);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 允许用户编辑评论:参考主题 user_edit_comment 总开关(关闭后本人亦不可编辑)。
|
||||
$user_edit = true;
|
||||
if (class_exists('\AKSRT\Settings\Settings')) {
|
||||
$display = \AKSRT\Settings\Settings::get_comment_display_settings();
|
||||
if (class_exists('\Jio\Settings\Settings')) {
|
||||
$display = \Jio\Settings\Settings::get_comment_display_settings();
|
||||
$user_edit = !isset($display['user_edit']) || !empty($display['user_edit']);
|
||||
}
|
||||
|
||||
@@ -71,20 +71,20 @@ if (!function_exists('aksrt_comment_action_permissions')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_is_comment_pinned')) :
|
||||
if (!function_exists('jio_is_comment_pinned')) :
|
||||
/**
|
||||
* @param int|WP_Comment $comment Comment.
|
||||
*/
|
||||
function aksrt_is_comment_pinned($comment): bool {
|
||||
function jio_is_comment_pinned($comment): bool {
|
||||
$comment_id = $comment instanceof WP_Comment ? (int) $comment->comment_ID : (int) $comment;
|
||||
if ($comment_id <= 0) {
|
||||
return false;
|
||||
}
|
||||
return '1' === (string) get_comment_meta($comment_id, '_aksrt_comment_pinned', true);
|
||||
return '1' === (string) get_comment_meta($comment_id, '_jio_comment_pinned', true);
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_update_comment_counter')) :
|
||||
if (!function_exists('jio_update_comment_counter')) :
|
||||
/**
|
||||
* Atomically bump a numeric comment-meta counter, floored at zero.
|
||||
*
|
||||
@@ -93,7 +93,7 @@ if (!function_exists('aksrt_update_comment_counter')) :
|
||||
* @param int $delta Signed delta.
|
||||
* @return int Latest value (>= 0).
|
||||
*/
|
||||
function aksrt_update_comment_counter($comment_id, $meta_key, $delta) {
|
||||
function jio_update_comment_counter($comment_id, $meta_key, $delta) {
|
||||
global $wpdb;
|
||||
$comment_id = (int) $comment_id;
|
||||
$delta = (int) $delta;
|
||||
@@ -119,51 +119,51 @@ if (!function_exists('aksrt_update_comment_counter')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_get_comment_likes')) :
|
||||
if (!function_exists('jio_get_comment_likes')) :
|
||||
/**
|
||||
* @param int|WP_Comment $comment Comment.
|
||||
*/
|
||||
function aksrt_get_comment_likes($comment): int {
|
||||
function jio_get_comment_likes($comment): int {
|
||||
$comment_id = $comment instanceof WP_Comment ? (int) $comment->comment_ID : (int) $comment;
|
||||
if ($comment_id <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return max(0, (int) get_comment_meta($comment_id, 'aksrt_comment_likes', true));
|
||||
return max(0, (int) get_comment_meta($comment_id, 'jio_comment_likes', true));
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_is_comment_liked')) :
|
||||
if (!function_exists('jio_is_comment_liked')) :
|
||||
/**
|
||||
* @param int $comment_id Comment ID.
|
||||
*/
|
||||
function aksrt_is_comment_liked($comment_id): bool {
|
||||
function jio_is_comment_liked($comment_id): bool {
|
||||
$comment_id = (int) $comment_id;
|
||||
if ($comment_id <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (is_user_logged_in()) {
|
||||
$liked = get_user_meta(get_current_user_id(), '_aksrt_liked_comments', true);
|
||||
$liked = get_user_meta(get_current_user_id(), '_jio_liked_comments', true);
|
||||
$liked = is_array($liked) ? array_map('intval', $liked) : [];
|
||||
return in_array($comment_id, $liked, true);
|
||||
}
|
||||
$cookie = 'aksrt_clike_' . $comment_id;
|
||||
$cookie = 'jio_clike_' . $comment_id;
|
||||
return !empty($_COOKIE[$cookie]) && '1' === $_COOKIE[$cookie];
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_set_comment_like_state')) :
|
||||
if (!function_exists('jio_set_comment_like_state')) :
|
||||
/**
|
||||
* @param int $comment_id Comment ID.
|
||||
* @param bool $active Target state.
|
||||
*/
|
||||
function aksrt_set_comment_like_state($comment_id, $active): void {
|
||||
function jio_set_comment_like_state($comment_id, $active): void {
|
||||
$comment_id = (int) $comment_id;
|
||||
if ($comment_id <= 0) {
|
||||
return;
|
||||
}
|
||||
if (is_user_logged_in()) {
|
||||
$user_id = get_current_user_id();
|
||||
$liked = get_user_meta($user_id, '_aksrt_liked_comments', true);
|
||||
$liked = get_user_meta($user_id, '_jio_liked_comments', true);
|
||||
$liked = is_array($liked) ? array_map('intval', $liked) : [];
|
||||
if ($active) {
|
||||
$liked[] = $comment_id;
|
||||
@@ -172,10 +172,10 @@ if (!function_exists('aksrt_set_comment_like_state')) :
|
||||
return (int) $id !== $comment_id;
|
||||
});
|
||||
}
|
||||
update_user_meta($user_id, '_aksrt_liked_comments', array_values(array_unique($liked)));
|
||||
update_user_meta($user_id, '_jio_liked_comments', array_values(array_unique($liked)));
|
||||
return;
|
||||
}
|
||||
$cookie = 'aksrt_clike_' . $comment_id;
|
||||
$cookie = 'jio_clike_' . $comment_id;
|
||||
$path = defined('COOKIEPATH') && COOKIEPATH ? COOKIEPATH : '/';
|
||||
$domain = defined('COOKIE_DOMAIN') ? COOKIE_DOMAIN : '';
|
||||
setcookie($cookie, $active ? '1' : '', $active ? time() + YEAR_IN_SECONDS : time() - HOUR_IN_SECONDS, $path, $domain, is_ssl(), true);
|
||||
@@ -187,7 +187,7 @@ if (!function_exists('aksrt_set_comment_like_state')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_reorder_pinned_comments')) :
|
||||
if (!function_exists('jio_reorder_pinned_comments')) :
|
||||
/**
|
||||
* Float pinned top-level comments to the front of the queried list.
|
||||
*
|
||||
@@ -195,14 +195,14 @@ if (!function_exists('aksrt_reorder_pinned_comments')) :
|
||||
* @param int $post_id Post ID.
|
||||
* @return array
|
||||
*/
|
||||
function aksrt_reorder_pinned_comments($comments, $post_id) {
|
||||
function jio_reorder_pinned_comments($comments, $post_id) {
|
||||
if (!is_array($comments) || count($comments) < 2) {
|
||||
return $comments;
|
||||
}
|
||||
$pinned = [];
|
||||
$normal = [];
|
||||
foreach ($comments as $comment) {
|
||||
if ($comment instanceof WP_Comment && (int) $comment->comment_parent === 0 && aksrt_is_comment_pinned($comment)) {
|
||||
if ($comment instanceof WP_Comment && (int) $comment->comment_parent === 0 && jio_is_comment_pinned($comment)) {
|
||||
$pinned[] = $comment;
|
||||
} else {
|
||||
$normal[] = $comment;
|
||||
@@ -215,4 +215,4 @@ if (!function_exists('aksrt_reorder_pinned_comments')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
add_filter('comments_array', 'aksrt_reorder_pinned_comments', 20, 2);
|
||||
add_filter('comments_array', 'jio_reorder_pinned_comments', 20, 2);
|
||||
Reference in new issue
Block a user