Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/profile-follow.php
T
kate522andClaude Opus 5 35bb96e82f 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>
2026-11-01 20:05:04 +08:00

65 lines
4.0 KiB
PHP

<?php
/**
* Private follow management panel.
*
* @package Jio
*/
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
$follow = class_exists('\\Jio\\User\\Follow') ? \Jio\User\Follow::get_instance() : null;
$active_list = isset($_GET['follow_list']) ? sanitize_key(wp_unslash($_GET['follow_list'])) : 'followers';
if (!in_array($active_list, ['followers', 'following'], true)) {
$active_list = 'followers';
}
$page = max(1, isset($_GET['follow_page']) ? (int) $_GET['follow_page'] : 1);
$result = $follow
? ($active_list === 'following' ? $follow->get_following((int) $user_id, $page, 20) : $follow->get_followers((int) $user_id, $page, 20))
: ['items' => [], 'total_pages' => 1];
?>
<div class="widget-card uc-follow-management">
<div class="profile-list-header">
<div>
<h2 class="widget-title widget-title--inline"><?php esc_html_e('粉丝与关注', 'jio'); ?></h2>
<p class="muted-2-color em09"><?php esc_html_e('查看谁关注了你,并管理你关注的作者。', 'jio'); ?></p>
</div>
</div>
<div class="profile-status-filter" role="tablist" aria-label="<?php esc_attr_e('关注关系筛选', 'jio'); ?>">
<?php foreach (['followers' => __('粉丝', 'jio'), 'following' => __('我关注的', 'jio')] as $key => $label) :
$url = add_query_arg(['follow_list' => $key, 'follow_page' => 1], jio_get_user_center_tab_url('follow'));
?>
<a class="profile-status-chip<?php echo $active_list === $key ? ' is-active' : ''; ?>" href="<?php echo esc_url($url); ?>" data-tab="follow" role="tab" aria-selected="<?php echo $active_list === $key ? 'true' : 'false'; ?>">
<?php echo esc_html($label); ?> <span class="profile-status-chip__count"><?php echo esc_html(number_format_i18n((int) ($key === 'followers' ? $follower_count : $following_count))); ?></span>
</a>
<?php endforeach; ?>
</div>
<?php if (!empty($result['items'])) : ?>
<div class="uc-follow-management__list">
<?php foreach ($result['items'] as $item) :
$member_id = (int) ($item['user_id'] ?? 0);
$home_url = function_exists('jio_get_user_home_url') ? jio_get_user_home_url($member_id) : '';
?>
<div class="uc-follow-management__item" data-follow-user="<?php echo esc_attr((string) $member_id); ?>">
<a href="<?php echo esc_url($home_url); ?>" class="uc-follow-management__avatar"><?php echo get_avatar($member_id, 48, '', (string) ($item['display_name'] ?? '')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></a>
<div class="uc-follow-management__identity"><a href="<?php echo esc_url($home_url); ?>"><?php echo esc_html((string) ($item['display_name'] ?? '')); ?></a><span><?php echo esc_html(sprintf(__('关注于 %s', 'jio'), get_date_from_gmt((string) ($item['created_at'] ?? ''), get_option('date_format')))); ?></span></div>
<div class="uc-follow-management__actions">
<a class="btn-ghost btn-sm" href="<?php echo esc_url($home_url); ?>"><?php esc_html_e('主页', 'jio'); ?></a>
<?php if ($active_list === 'following') : ?><button type="button" class="btn-outline btn-sm is-following" data-jio-follow="<?php echo esc_attr((string) $member_id); ?>"><i class="fa fas fa-heart" aria-hidden="true"></i><span data-jio-follow-label><?php esc_html_e('已关注', 'jio'); ?></span></button><?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php jio_render_profile_pagination(
(int) ($result['total_pages'] ?? 1),
$page,
'follow_page',
add_query_arg('follow_list', $active_list, jio_get_user_center_tab_url('follow'))
); ?>
<?php else : ?>
<?php jio_render_profile_empty('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"/></svg>', $active_list === 'followers' ? __('还没有粉丝', 'jio') : __('还没有关注任何作者', 'jio')); ?>
<?php endif; ?>
</div>