Files
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

102 lines
3.9 KiB
PHP

<?php
/**
* 用户页面共享辅助函数
*
* 分页渲染和空状态卡片,供本人中心和公开主页共用。
*
* @package Jio
*/
defined('ABSPATH') || exit;
if (!function_exists('jio_render_profile_pagination')) {
/**
* 渲染分页
*
* @param int $total_pages 总页数
* @param int $current 当前页
* @param string $param URL 参数名
*/
function jio_render_profile_pagination($total_pages, $current, $param, $base_url = '') {
if ($total_pages <= 1) {
return;
}
$base = $base_url !== '' ? $base_url : remove_query_arg($param);
$base = remove_query_arg($param, $base);
$base = add_query_arg($param, '%#%', $base);
$links = paginate_links([
'base' => $base,
'format' => '',
'current' => $current,
'total' => $total_pages,
'prev_text' => '<span aria-hidden="true">&lsaquo;</span><span class="screen-reader-text">' . esc_html__('上一页', 'jio') . '</span>',
'next_text' => '<span aria-hidden="true">&rsaquo;</span><span class="screen-reader-text">' . esc_html__('下一页', 'jio') . '</span>',
'mid_size' => 1,
'end_size' => 1,
]);
if ($links) {
echo '<nav class="profile-pagination" aria-label="' . esc_attr__('分页', 'jio') . '">' . $links . '</nav>'; // phpcs:ignore
}
}
}
if (!function_exists('jio_render_asset_pagination')) {
/**
* Render user asset pagination without URL state.
*/
function jio_render_asset_pagination(int $total_pages, int $current, string $asset): void {
if ($total_pages <= 1) {
return;
}
$current = max(1, min($total_pages, $current));
$pages = array_values(array_unique(array_filter([
1,
$current - 1,
$current,
$current + 1,
$total_pages,
], static fn(int $page): bool => $page >= 1 && $page <= $total_pages)));
sort($pages);
echo '<nav class="profile-pagination" aria-label="' . esc_attr__('分页', 'jio') . '">';
if ($current > 1) {
echo '<button type="button" class="page-numbers prev" data-jio-asset-page="' . (int) ($current - 1) . '" data-jio-asset-key="' . esc_attr($asset) . '"><span aria-hidden="true">&lsaquo;</span><span class="screen-reader-text">' . esc_html__('上一页', 'jio') . '</span></button>';
}
$previous = 0;
foreach ($pages as $page) {
if ($previous > 0 && $page > $previous + 1) {
echo '<span class="page-numbers dots">&hellip;</span>';
}
if ($page === $current) {
echo '<span class="page-numbers current" aria-current="page">' . (int) $page . '</span>';
} else {
echo '<button type="button" class="page-numbers" data-jio-asset-page="' . (int) $page . '" data-jio-asset-key="' . esc_attr($asset) . '">' . (int) $page . '</button>';
}
$previous = $page;
}
if ($current < $total_pages) {
echo '<button type="button" class="page-numbers next" data-jio-asset-page="' . (int) ($current + 1) . '" data-jio-asset-key="' . esc_attr($asset) . '"><span aria-hidden="true">&rsaquo;</span><span class="screen-reader-text">' . esc_html__('下一页', 'jio') . '</span></button>';
}
echo '</nav>';
}
}
if (!function_exists('jio_render_profile_empty')) {
/**
* 渲染空状态卡片
*/
function jio_render_profile_empty($icon_svg, $title, $desc = '', $cta_url = '', $cta_label = '') {
echo '<div class="profile-empty">';
echo '<div class="profile-empty__icon" aria-hidden="true">' . $icon_svg . '</div>'; // phpcs:ignore
echo '<h4 class="profile-empty__title">' . esc_html($title) . '</h4>';
if ($desc) {
echo '<p class="profile-empty__desc">' . esc_html($desc) . '</p>';
}
if ($cta_url && $cta_label) {
echo '<a class="btn-primary btn-sm profile-empty__cta" href="' . esc_url($cta_url) . '">' . esc_html($cta_label) . '</a>';
}
echo '</div>';
}
}