Compare commits

...
2 Commits
Author SHA1 Message Date
kate522 6f815678ec feat(frontend): replicate reference header user box 1:1
顶导航点击小人弹出的用户信息浮层,从 AKSRT 定制结构改为与参考主题 zib_header_user_box() 逐行同构:头像链接包裹、钱包双瓷砖、会员条、签到、消息图标、统计徽章行全部改用参考主题遗留类,渲染交回 main.css(.sub-user-box 242px、.avatar-img 38px、.msg-news-icon、badge.top、.payvip-icon 深色渐变加 gem 水印、.vip-expdate-tag、.muted-box)。

头像改走 aksrt_get_avatar_box(用户ID, avatar-img, true, false),得到参考的 a 链接包裹 avatar-img 结构。消息图标改参考标记 msg-news-icon abs-right 加 toggle-radius msg-icon,未读徽章用 badge.top,avatar_dropdown 位置门控契约保留。管理端行在「后台管理」前插入「支付中心」,跳 admin.php?page=aksrt_pay,即参考主题「商城中心」槽位,图标 fa-credit-card。

钱包重写为参考双瓷砖:余额在前(c-blue-2 加 fa-money-bill-wave)、积分在后(c-yellow 加 fa-coins),分别按充值开关与积分总开关门控,两块皆关则不渲染,并保留 data-aksrt-wallet-value 与 data-aksrt-points-value 两个 JS 刷新钩子。会员条去掉 AKSRT 自创的 vipbg-v2 level-N 金色背景,改参考的 payvip-icon 加 badg jb-yellow vip-expdate-tag,到期文案按参考语义分为已过期、永久会员、裸日期三种。签到入口由 button 改为 a.but block c-yellow,并去掉随之失效的 compact 形参,data-signin 挂载与 wp_footer 验证码不变。统计行删掉文章徽章(本站不做帖子),图标由 SVG sprite 换 FA5+ 的 fa-comment-dots、fa-thumbs-up、fa-fire。

会员等级图标契约不动:aksrt_get_vip_icon 与 User\Level::get_badge_html 的调用与参数保持原样。

顺带清死代码:aksrt_header_user_badges_row 原本取到函数后直接返回空串,现在真正输出统计行;删掉 header-userbox.css 里整套 bespoke 规则与 vip-modal.css 的 vipbg-v2 死规则。

显式偏差:统计行链接保持扁平用户主页 URL(AKSRT 用户主页是干净 URL 加 JS tab,没有 query tab 路由);签到入口沿用积分签到总开关门控,不新增管理端可配置项。

public.css 与 public.min.css 用 tools/build-public-assets.mjs 重建:该 bundle 打包了 header-userbox.css 且作为依赖先于单模块入队,旧的 width 260px 会压过新源码、把卡片钉在 260px 而不是参考的 242px。

验证:node --test tests/**/*.test.cjs 573 项全通过;六个改动 PHP 文件 php -l 无语法错误;卡片用到的 FA5 token 逐个核对 5.15.4 全部命中。未做真实视觉效果验收。
2026-10-10 16:17:01 +08:00
kate522 8ff74f56ee fix(admin): use FA5 long-arrow icons in post list sort
后台文章列表的排序箭头还停留在 FA4 的 fa fa-long-arrow-down / up,而且类名是字符串拼接出来的。契约测试按完整的 fa fas fa-* token 逐个校验,看不穿拼接后的类名,所以这条一直是漏网之鱼。

改为按升降序直接输出完整的 fa fas fa-long-arrow-alt-down / fa-long-arrow-alt-up 两个字面量,走全局 FA5+ 图标系统。

验证:node --test tests/**/*.test.cjs 全量 572 项通过;php -l src/Admin/Native/PostListEnhance.php 无语法错误。
2026-10-10 16:15:48 +08:00
14 changed files with 193 additions and 578 deletions
+5 -240
View File
@@ -2705,8 +2705,10 @@ main.container,
/** /**
* Header account popover. * Header account popover.
* *
* The shared legacy navigation styles provide the popover shell. This module * The shared legacy navigation styles provide the popover shell, and every
* owns AKSRT-specific account content such as check-in, wallet and VIP rows. * account row (avatar, VIP bar, check-in, wallet tiles, stats badges) renders
* through the reference legacy classes. This module only owns the navigation
* shell anchoring plus the account action-row geometry.
*/ */
/* The desktop action cluster owns one horizontal alignment context. */ /* The desktop action cluster owns one horizontal alignment context. */
@@ -2869,85 +2871,10 @@ main.container,
} }
.aksrt-header-userbox { .aksrt-header-userbox {
width: 260px;
color: var(--color-ink-2); color: var(--color-ink-2);
} }
.aksrt-header-userbox .user-info { /* Top-nav bell badge (the card itself uses the legacy badge.top element). */
min-height: 44px;
padding: 2px;
}
.aksrt-header-userbox .user-info > .avatar {
flex: 0 0 44px;
width: 44px;
height: 44px;
object-fit: cover;
}
.aksrt-header-userbox .user-right,
.aksrt-header-userbox .user-right > .flex1 {
min-width: 0;
}
.aksrt-header-userbox .user-right b {
display: flex;
align-items: center;
gap: 4px;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
}
.aksrt-header-userbox .display-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.aksrt-header-userbox .user-right .img-icon,
.aksrt-header-userbox .user-right .aksrt-user-level-icon,
.aksrt-header-userbox .user-right .aksrt-identity-medal,
.aksrt-header-userbox .user-right .aksrt-header-user-medal,
.aksrt-header-userbox .user-right .aksrt-identity-certification-icon {
flex: 0 0 auto;
height: 1.1em;
}
.aksrt-header-userbox .user-info > .abs-right {
top: 50%;
right: 2px;
transform: translateY(-50%);
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
background: var(--surface-2);
color: var(--color-ink-3);
}
.aksrt-header-userbox .aksrt-notification-badge {
position: absolute;
top: -4px;
right: -4px;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 17px;
height: 17px;
padding: 0 4px;
border: 2px solid var(--surface-1);
border-radius: 999px;
background: #e74c3c;
color: #fff;
font-size: 10px;
font-weight: 700;
line-height: 1;
}
.aksrt-nav-notification .aksrt-notification-badge { .aksrt-nav-notification .aksrt-notification-badge {
position: absolute; position: absolute;
top: 2px; top: 2px;
@@ -2967,150 +2894,6 @@ main.container,
line-height: 1; line-height: 1;
} }
.aksrt-header-wallet {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
width: 100%;
padding: 9px 10px;
border-radius: 8px;
background: var(--surface-2);
color: var(--color-ink-2);
font-size: 12px;
line-height: 1.35;
}
.aksrt-header-wallet:hover {
color: var(--color-ink);
}
.aksrt-header-wallet__item {
min-width: 0;
white-space: nowrap;
}
.aksrt-header-wallet__item i {
margin-right: 2px;
color: var(--color-ink-3);
}
.aksrt-header-wallet__item b {
margin-left: 2px;
color: var(--color-ink);
font-weight: 700;
}
.aksrt-header-checkin {
display: inline-flex !important;
align-items: center;
justify-content: center;
gap: 6px;
width: 100% !important;
min-height: 36px;
margin: 0;
padding: 8px 10px !important;
border: 0 !important;
border-radius: 6px !important;
background: #fff6db !important;
color: #8a5a00 !important;
font-size: 13px !important;
font-weight: 600;
line-height: 1.3;
white-space: nowrap;
}
.aksrt-header-checkin > i {
margin: 0 !important;
color: #b78103 !important;
}
.aksrt-header-checkin:hover {
background: #fff0c2 !important;
color: #8a5a00 !important;
}
/* 已签到态对齐参考主题:保留原配色(参考主题签到后仍为同一彩色按钮),
* 且按钮可点击(打开签到详情弹窗);仅请求进行中的禁用态降不透明度。 */
.aksrt-header-checkin:disabled,
.aksrt-header-checkin:disabled:hover {
cursor: default;
opacity: .85;
}
.aksrt-header-payvip__cta,
.aksrt-header-payvip:not(.is-vip) .payvip-icon,
.aksrt-header-payvip:not(.is-vip) .but {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
gap: 6px !important;
width: 100% !important;
min-width: 0 !important;
min-height: 36px;
margin: 0 !important;
padding: 8px 10px !important;
border: 0 !important;
border-radius: 6px !important;
background: linear-gradient(90deg, #ff6b6b, #f04494) !important;
color: #fff !important;
font-size: 13px !important;
font-weight: 600;
line-height: 1.3;
text-align: center;
white-space: nowrap;
}
.aksrt-header-payvip__cta > i,
.aksrt-header-payvip:not(.is-vip) .payvip-icon > i,
.aksrt-header-payvip:not(.is-vip) .but > i {
margin: 0 !important;
color: inherit !important;
}
.aksrt-header-payvip__cta:hover {
color: #fff !important;
opacity: .92;
}
.aksrt-header-payvip__active {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 8px !important;
width: 100%;
min-height: 42px;
padding: 7px 10px !important;
white-space: nowrap;
}
.aksrt-header-payvip__level {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.aksrt-header-payvip__level > i {
margin: 0 !important;
}
.aksrt-header-payvip__exp {
display: inline;
margin: 0;
padding: 0;
border: 0;
background: none !important;
box-shadow: none;
color: inherit;
font-size: .85em;
font-weight: 400;
line-height: 1.3;
opacity: .9;
white-space: nowrap;
}
/* Navigation links are globally capped at 50px. Account actions are taller /* Navigation links are globally capped at 50px. Account actions are taller
* icon tiles and must opt out or their labels overlap the following row. */ * icon tiles and must opt out or their labels overlap the following row. */
.navbar-top .aksrt-header-userbox .header-user-href { .navbar-top .aksrt-header-userbox .header-user-href {
@@ -3155,24 +2938,6 @@ main.container,
margin-left: auto; margin-left: auto;
} }
body.dark-theme .aksrt-header-checkin {
background: rgba(255, 193, 7, .18) !important;
color: #f0c14b !important;
}
body.dark-theme .aksrt-header-checkin > i {
color: #f0c14b !important;
}
body.dark-theme .aksrt-header-wallet {
background: rgba(255, 255, 255, .06);
}
body.dark-theme .aksrt-header-wallet__item,
body.dark-theme .aksrt-header-wallet__item b {
color: inherit;
}
@media (max-width: 360px) { @media (max-width: 360px) {
.aksrt-header-userbox .header-user-href { .aksrt-header-userbox .header-user-href {
gap: 2px; gap: 2px;
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -240
View File
@@ -1,8 +1,10 @@
/** /**
* Header account popover. * Header account popover.
* *
* The shared legacy navigation styles provide the popover shell. This module * The shared legacy navigation styles provide the popover shell, and every
* owns AKSRT-specific account content such as check-in, wallet and VIP rows. * account row (avatar, VIP bar, check-in, wallet tiles, stats badges) renders
* through the reference legacy classes. This module only owns the navigation
* shell anchoring plus the account action-row geometry.
*/ */
/* The desktop action cluster owns one horizontal alignment context. */ /* The desktop action cluster owns one horizontal alignment context. */
@@ -165,85 +167,10 @@
} }
.aksrt-header-userbox { .aksrt-header-userbox {
width: 260px;
color: var(--color-ink-2); color: var(--color-ink-2);
} }
.aksrt-header-userbox .user-info { /* Top-nav bell badge (the card itself uses the legacy badge.top element). */
min-height: 44px;
padding: 2px;
}
.aksrt-header-userbox .user-info > .avatar {
flex: 0 0 44px;
width: 44px;
height: 44px;
object-fit: cover;
}
.aksrt-header-userbox .user-right,
.aksrt-header-userbox .user-right > .flex1 {
min-width: 0;
}
.aksrt-header-userbox .user-right b {
display: flex;
align-items: center;
gap: 4px;
max-width: 100%;
overflow: hidden;
white-space: nowrap;
}
.aksrt-header-userbox .display-name {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.aksrt-header-userbox .user-right .img-icon,
.aksrt-header-userbox .user-right .aksrt-user-level-icon,
.aksrt-header-userbox .user-right .aksrt-identity-medal,
.aksrt-header-userbox .user-right .aksrt-header-user-medal,
.aksrt-header-userbox .user-right .aksrt-identity-certification-icon {
flex: 0 0 auto;
height: 1.1em;
}
.aksrt-header-userbox .user-info > .abs-right {
top: 50%;
right: 2px;
transform: translateY(-50%);
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
background: var(--surface-2);
color: var(--color-ink-3);
}
.aksrt-header-userbox .aksrt-notification-badge {
position: absolute;
top: -4px;
right: -4px;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 17px;
height: 17px;
padding: 0 4px;
border: 2px solid var(--surface-1);
border-radius: 999px;
background: #e74c3c;
color: #fff;
font-size: 10px;
font-weight: 700;
line-height: 1;
}
.aksrt-nav-notification .aksrt-notification-badge { .aksrt-nav-notification .aksrt-notification-badge {
position: absolute; position: absolute;
top: 2px; top: 2px;
@@ -263,150 +190,6 @@
line-height: 1; line-height: 1;
} }
.aksrt-header-wallet {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
width: 100%;
padding: 9px 10px;
border-radius: 8px;
background: var(--surface-2);
color: var(--color-ink-2);
font-size: 12px;
line-height: 1.35;
}
.aksrt-header-wallet:hover {
color: var(--color-ink);
}
.aksrt-header-wallet__item {
min-width: 0;
white-space: nowrap;
}
.aksrt-header-wallet__item i {
margin-right: 2px;
color: var(--color-ink-3);
}
.aksrt-header-wallet__item b {
margin-left: 2px;
color: var(--color-ink);
font-weight: 700;
}
.aksrt-header-checkin {
display: inline-flex !important;
align-items: center;
justify-content: center;
gap: 6px;
width: 100% !important;
min-height: 36px;
margin: 0;
padding: 8px 10px !important;
border: 0 !important;
border-radius: 6px !important;
background: #fff6db !important;
color: #8a5a00 !important;
font-size: 13px !important;
font-weight: 600;
line-height: 1.3;
white-space: nowrap;
}
.aksrt-header-checkin > i {
margin: 0 !important;
color: #b78103 !important;
}
.aksrt-header-checkin:hover {
background: #fff0c2 !important;
color: #8a5a00 !important;
}
/* 已签到态对齐参考主题:保留原配色(参考主题签到后仍为同一彩色按钮),
* 且按钮可点击(打开签到详情弹窗);仅请求进行中的禁用态降不透明度。 */
.aksrt-header-checkin:disabled,
.aksrt-header-checkin:disabled:hover {
cursor: default;
opacity: .85;
}
.aksrt-header-payvip__cta,
.aksrt-header-payvip:not(.is-vip) .payvip-icon,
.aksrt-header-payvip:not(.is-vip) .but {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
gap: 6px !important;
width: 100% !important;
min-width: 0 !important;
min-height: 36px;
margin: 0 !important;
padding: 8px 10px !important;
border: 0 !important;
border-radius: 6px !important;
background: linear-gradient(90deg, #ff6b6b, #f04494) !important;
color: #fff !important;
font-size: 13px !important;
font-weight: 600;
line-height: 1.3;
text-align: center;
white-space: nowrap;
}
.aksrt-header-payvip__cta > i,
.aksrt-header-payvip:not(.is-vip) .payvip-icon > i,
.aksrt-header-payvip:not(.is-vip) .but > i {
margin: 0 !important;
color: inherit !important;
}
.aksrt-header-payvip__cta:hover {
color: #fff !important;
opacity: .92;
}
.aksrt-header-payvip__active {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 8px !important;
width: 100%;
min-height: 42px;
padding: 7px 10px !important;
white-space: nowrap;
}
.aksrt-header-payvip__level {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.aksrt-header-payvip__level > i {
margin: 0 !important;
}
.aksrt-header-payvip__exp {
display: inline;
margin: 0;
padding: 0;
border: 0;
background: none !important;
box-shadow: none;
color: inherit;
font-size: .85em;
font-weight: 400;
line-height: 1.3;
opacity: .9;
white-space: nowrap;
}
/* Navigation links are globally capped at 50px. Account actions are taller /* Navigation links are globally capped at 50px. Account actions are taller
* icon tiles and must opt out or their labels overlap the following row. */ * icon tiles and must opt out or their labels overlap the following row. */
.navbar-top .aksrt-header-userbox .header-user-href { .navbar-top .aksrt-header-userbox .header-user-href {
@@ -451,24 +234,6 @@
margin-left: auto; margin-left: auto;
} }
body.dark-theme .aksrt-header-checkin {
background: rgba(255, 193, 7, .18) !important;
color: #f0c14b !important;
}
body.dark-theme .aksrt-header-checkin > i {
color: #f0c14b !important;
}
body.dark-theme .aksrt-header-wallet {
background: rgba(255, 255, 255, .06);
}
body.dark-theme .aksrt-header-wallet__item,
body.dark-theme .aksrt-header-wallet__item b {
color: inherit;
}
@media (max-width: 360px) { @media (max-width: 360px) {
.aksrt-header-userbox .header-user-href { .aksrt-header-userbox .header-user-href {
gap: 2px; gap: 2px;
-15
View File
@@ -102,21 +102,6 @@
cursor: wait; cursor: wait;
} }
.vipbg-v2 {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 8px 10px;
border-radius: 8px;
color: #fff;
background: linear-gradient(90deg, #ffb347, #ff6b6b);
}
.vipbg-v2.level-2 {
background: linear-gradient(90deg, #9b59b6, #3f51b5);
}
.vip-expdate-tag { .vip-expdate-tag {
font-size: 12px; font-size: 12px;
} }
+73 -50
View File
@@ -35,12 +35,11 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
* Check-in CTA for header dropdown and compact card placements. * Check-in CTA for header dropdown and compact card placements.
* *
* @param int $user_id Current user ID. * @param int $user_id Current user ID.
* @param bool $compact Render a short card-friendly label.
* @param string|null $class Override the classes and render the reference-parity * @param string|null $class Override the classes and render the reference-parity
* <a> badge (user-card 签到书签); null keeps the header * <a> badge (user-card 签到书签); null keeps the header
* dropdown <button> runtime. * dropdown <a> runtime.
*/ */
function aksrt_header_user_checkin_btn(int $user_id = 0, bool $compact = false, ?string $class = null): string { function aksrt_header_user_checkin_btn(int $user_id = 0, ?string $class = null): string {
$user_id = $user_id > 0 ? $user_id : get_current_user_id(); $user_id = $user_id > 0 ? $user_id : get_current_user_id();
if ($user_id <= 0 || !class_exists('\AKSRT\Credits\Signin')) { if ($user_id <= 0 || !class_exists('\AKSRT\Credits\Signin')) {
return ''; return '';
@@ -56,27 +55,26 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
// 已签到:与参考主题一致,入口按钮变为签到详情弹窗触发链接(可点击)。 // 已签到:与参考主题一致,入口按钮变为签到详情弹窗触发链接(可点击)。
if ($signed) { if ($signed) {
$icon = '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>';
if ($class !== null) { if ($class !== null) {
// 用户卡片签到书签:保留书签类与 is-done 视觉,仅将行为切换为打开详情弹窗。 // 用户卡片签到书签:保留书签类与 is-done 视觉,仅将行为切换为打开详情弹窗。
return aksrt_get_user_checkin_details_link( return aksrt_get_user_checkin_details_link(
$class . ' is-done', $class . ' is-done',
$icon . '<span>' . esc_html__('已签到', 'aksrt') . '</span>' '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>'
. '<span>' . esc_html__('已签到', 'aksrt') . '</span>'
); );
} }
return aksrt_get_user_checkin_details_link( return aksrt_get_user_checkin_details_link(
'but block c-yellow aksrt-header-checkin is-done', 'but block c-yellow is-done',
'<i class="fa fas fa-calendar-check" aria-hidden="true"></i> ' . esc_html($compact ? __('已签到', 'aksrt') : __('今日已签到', 'aksrt')) '<i class="fa fas fa-calendar-check mr6" aria-hidden="true"></i>'
. esc_html__('今日已签到', 'aksrt')
); );
} }
$classes = $class ?? ('but block c-yellow aksrt-header-checkin' . ($compact ? ' aksrt-header-checkin--compact' : ''));
// Card badge variant (explicit $class, e.g. the user-card 签到 badge): // Card badge variant (explicit $class, e.g. the user-card 签到 badge):
// reference parity renders an <a> so the badge inherits the card font // reference parity renders an <a> so the badge inherits the card font
// instead of the UA button stylesheet (font/UI 1:1 with the reference). // instead of the UA button stylesheet (font/UI 1:1 with the reference).
if ($class !== null) { if ($class !== null) {
return '<a class="' . esc_attr($classes) . '" href="javascript:;" data-signin-btn' return '<a class="' . esc_attr($class) . '" href="javascript:;" data-signin-btn'
. ' data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '"' . ' data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '"'
. ' data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">' . ' data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">'
. '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>' . '<i class="fa fas fa-calendar-check ml3 mr6" aria-hidden="true"></i>'
@@ -84,10 +82,12 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
. '</a>'; . '</a>';
} }
return '<button type="button" class="' . esc_attr($classes) . '" data-signin-btn data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '" data-signin-done-label="' . esc_attr__('已签到', 'aksrt') . '">' return '<a class="but block c-yellow" href="javascript:;" data-signin-btn'
. '<i class="fa fas fa-calendar-check" aria-hidden="true"></i>' . ' data-signin-idle-label="' . esc_attr__('签到', 'aksrt') . '"'
. '<span data-signin-label>' . esc_html($compact ? __('签到', 'aksrt') : __('签到领取今日奖励', 'aksrt')) . '</span>' . ' data-signin-done-label="' . esc_attr__('今日已签到', 'aksrt') . '">'
. '</button>'; . '<i class="fa fas fa-calendar-check mr6" aria-hidden="true"></i>'
. '<span data-signin-label>' . esc_html__('签到领取今日奖励', 'aksrt') . '</span>'
. '</a>';
} }
endif; endif;
@@ -118,41 +118,63 @@ add_action('wp_footer', 'aksrt_render_signin_captcha');
if (!function_exists('aksrt_header_user_wallet_mini')) : if (!function_exists('aksrt_header_user_wallet_mini')) :
/** /**
* Mini wallet strip: credits + cash balance. * Mini wallet tiles: cash balance + credits (reference parity).
*
* Each tile is gated by its payment switch; an all-off configuration
* renders nothing at all.
*/ */
function aksrt_header_user_wallet_mini(int $user_id = 0): string { function aksrt_header_user_wallet_mini(int $user_id = 0): string {
$user_id = $user_id > 0 ? $user_id : get_current_user_id(); $user_id = $user_id > 0 ? $user_id : get_current_user_id();
if ($user_id <= 0) { if ($user_id <= 0 || !class_exists('\AKSRT\Settings\Settings')) {
return ''; return '';
} }
$credits = aksrt_user_points($user_id);
$currency = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_currency_name()
: __('积分', 'aksrt');
$wallet = aksrt_user_balance_decimal($user_id);
$center = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url('credits') : '#';
$html = '<a class="aksrt-header-wallet flex ac jsb" href="' . esc_url($center) . '">'; $balance_on = !empty(\AKSRT\Settings\Settings::get_payment_recharge_settings()['enabled']);
$html .= '<span class="aksrt-header-wallet__item"><i class="fa fas fa-database" aria-hidden="true"></i> ' $points_on = \AKSRT\Settings\Settings::credits_enabled();
. esc_html($currency) . ' <b data-aksrt-points-value data-credits-value>' . esc_html(number_format_i18n($credits)) . '</b></span>'; if (!$balance_on && !$points_on) {
$html .= '<span class="aksrt-header-wallet__item"><i class="fa fas fa-money-bill" aria-hidden="true"></i> ' return '';
. esc_html__('余额', 'aksrt') . ' <b data-aksrt-wallet-value>' . esc_html(number_format_i18n($wallet, 2)) . '</b></span>'; }
$html .= '</a>';
return $html; $center = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url('credits') : '#';
$box = '';
if ($balance_on) {
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
. '<div class="muted-2-color px12">' . esc_html__('余额', 'aksrt')
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
. '<div class="flex jsb"><span class="font-bold c-blue-2" data-aksrt-wallet-value>'
. esc_html(aksrt_cut_count((float) aksrt_user_balance_decimal($user_id)))
. '</span><i class="fa fas fa-money-bill-wave em14" aria-hidden="true"></i></div></a>';
}
if ($points_on) {
$currency = \AKSRT\Settings\Settings::get_currency_name();
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
. '<div class="muted-2-color px12">' . esc_html($currency)
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
. '<div class="flex jsb"><span class="font-bold c-yellow" data-aksrt-points-value>'
. esc_html(aksrt_cut_count(aksrt_user_points($user_id)))
. '</span><i class="fa fas fa-coins em14" aria-hidden="true"></i></div></a>';
}
return '<div class="flex ab jsb col-ml6">' . $box . '</div>';
} }
endif; endif;
if (!function_exists('aksrt_header_user_badges_row')) : if (!function_exists('aksrt_header_user_badges_row')) :
/** /**
* Identity / medal chips under profile. * Interaction stats row under the wallet (reference parity).
*/ */
function aksrt_header_user_badges_row(int $user_id = 0): string { function aksrt_header_user_badges_row(int $user_id = 0): string {
$user_id = $user_id > 0 ? $user_id : get_current_user_id(); $user_id = $user_id > 0 ? $user_id : get_current_user_id();
if ($user_id <= 0 || !function_exists('aksrt_render_user_identity_chips')) { if ($user_id <= 0 || !function_exists('aksrt_get_user_badges')) {
return ''; return '';
} }
// Certification is displayed beside the name and level icon in the profile row. $items = aksrt_get_user_badges($user_id);
return ''; if ($items === '') {
return '';
}
return '<div class="em09 author-tag mb10 mt6 flex jc">' . $items . '</div>';
} }
endif; endif;
@@ -173,10 +195,6 @@ if (!function_exists('aksrt_header_payvip_bar')) :
return ''; return '';
} }
$settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_all()
: [];
$level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0; $level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0;
if ($level > 0) { if ($level > 0) {
$levels = is_array($vip['levels'] ?? null) ? $vip['levels'] : []; $levels = is_array($vip['levels'] ?? null) ? $vip['levels'] : [];
@@ -185,18 +203,23 @@ if (!function_exists('aksrt_header_payvip_bar')) :
if (function_exists('aksrt_get_vip_info')) { if (function_exists('aksrt_get_vip_info')) {
$info = aksrt_get_vip_info($user_id); $info = aksrt_get_vip_info($user_id);
$expires = max(0, (int) ($info['expires'] ?? 0)); $expires = max(0, (int) ($info['expires'] ?? 0));
$exp_label = $expires > 0 // 到期文案对齐参考主题:已过期 / 永久会员 / 裸日期。
? sprintf(__('到期时间:%s', 'aksrt'), wp_date('Y年m月d日', $expires)) if ((string) ($info['state'] ?? '') === 'expired') {
: (string) ($info['expires_label'] ?? ''); $exp_label = __('会员已过期', 'aksrt');
} elseif ($expires > 0) {
$exp_label = wp_date('Y年m月d日', $expires);
} else {
$exp_label = __('永久会员', 'aksrt');
}
} }
$html = '<div class="mt10 em09 aksrt-header-payvip is-vip">'; $html = '<div class="mt10 em09" style="padding:2px;">';
$html .= '<span class="radius4 payvip-icon btn-block text-center vipbg-v2 level-' . (int) $level . ' aksrt-header-payvip__active">'; $html .= '<span class="radius4 payvip-icon btn-block text-center">';
$html .= '<span class="aksrt-header-payvip__level">'; $html .= function_exists('aksrt_get_vip_icon') ? aksrt_get_vip_icon($user_id, 'em12 mr6', false) : '';
$html .= '<i class="fa fas fa-gem" aria-hidden="true"></i>';
$html .= '<span>' . esc_html($name) . '</span>'; $html .= '<span>' . esc_html($name) . '</span>';
$html .= '</span>';
if ($exp_label !== '') { if ($exp_label !== '') {
$html .= '<span class="aksrt-header-payvip__exp">' . esc_html($exp_label) . '</span>'; $html .= '<span class="ml10 badg jb-yellow vip-expdate-tag">'
. '<i class="fa fas fa-clock mr3" aria-hidden="true"></i>'
. esc_html($exp_label) . '</span>';
} }
$html .= '</span></div>'; $html .= '</span></div>';
return $html; return $html;
@@ -205,10 +228,10 @@ if (!function_exists('aksrt_header_payvip_bar')) :
return ''; return '';
} }
// Match check-in CTA geometry (full width, 6px radius) — not top-nav navbar-cta chips. // 几何对齐参考主题 CTA(通栏、radius4)——不是顶导 navbar-cta chips。
return '<div class="mt10 em09 aksrt-header-payvip">' return '<div class="mt10 em09" style="padding:2px;">'
. '<a class="pay-vip but block payvip-icon aksrt-header-payvip__cta" href="javascript:;" vip-level="1">' . '<a class="pay-vip but radius4 payvip-icon btn-block" href="javascript:;" vip-level="1">'
. '<i class="fa fas fa-gem" aria-hidden="true"></i>' . '<i class="fa fas fa-gem em12 mr6" aria-hidden="true"></i>'
. '<span>' . esc_html__('开通会员 尊享会员权益', 'aksrt') . '</span>' . '<span>' . esc_html__('开通会员 尊享会员权益', 'aksrt') . '</span>'
. '</a></div>'; . '</a></div>';
} }
+5 -6
View File
@@ -327,7 +327,8 @@ if (!function_exists('aksrt_get_user_posts_meta_sum')) {
if (!function_exists('aksrt_get_user_badges')) { if (!function_exists('aksrt_get_user_badges')) {
/** /**
* legacy parity: 作者资料卡统计徽章行(文章 / 评论 / 粉丝|点赞 / 人气值)。 * legacy parity: 作者资料卡统计徽章行(评论 / 粉丝|点赞 / 人气值)。
* 本站不做帖子,故不输出文章徽章。
* *
* @param int $user_id 用户 ID。 * @param int $user_id 用户 ID。
*/ */
@@ -337,7 +338,6 @@ if (!function_exists('aksrt_get_user_badges')) {
} }
$home = aksrt_get_user_home_url($user_id); $home = aksrt_get_user_home_url($user_id);
$post_n = aksrt_cut_count(count_user_posts($user_id, 'post', true));
$com_n = aksrt_cut_count((int) get_comments([ $com_n = aksrt_cut_count((int) get_comments([
'user_id' => $user_id, 'user_id' => $user_id,
'status' => 'approve', 'status' => 'approve',
@@ -351,14 +351,13 @@ if (!function_exists('aksrt_get_user_badges')) {
$view_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, 'aksrt_post_views')); $view_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, 'aksrt_post_views'));
$html = ''; $html = '';
$html .= '<a class="but c-blue tag-posts" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s篇文章', 'aksrt'), $post_n)) . '" href="' . esc_url($home) . '">' . aksrt_renderer_svg_icon('post') . $post_n . '</a>'; $html .= '<a class="but c-green tag-comment" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s条评论', 'aksrt'), $com_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-comment-dots" aria-hidden="true"></i>' . $com_n . '</a>';
$html .= '<a class="but c-green tag-comment" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s条评论', 'aksrt'), $com_n)) . '" href="' . esc_url($home) . '">' . aksrt_renderer_svg_icon('comment') . $com_n . '</a>';
if ($followed_n) { if ($followed_n) {
$html .= '<a class="but c-yellow tag-follow" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s个粉丝', 'aksrt'), $followed_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-heart em09" aria-hidden="true"></i>' . $followed_n . '</a>'; $html .= '<a class="but c-yellow tag-follow" data-toggle="tooltip" title="' . esc_attr(sprintf(__('共%s个粉丝', 'aksrt'), $followed_n)) . '" href="' . esc_url($home) . '"><i class="fa fas fa-heart em09" aria-hidden="true"></i>' . $followed_n . '</a>';
} elseif ($like_n) { } elseif ($like_n) {
$html .= '<span class="badg c-yellow tag-like" data-toggle="tooltip" title="' . esc_attr(sprintf(__('获得%s个点赞', 'aksrt'), $like_n)) . '">' . aksrt_renderer_svg_icon('like') . $like_n . '</span>'; $html .= '<span class="badg c-yellow tag-like" data-toggle="tooltip" title="' . esc_attr(sprintf(__('获得%s个点赞', 'aksrt'), $like_n)) . '"><i class="fa fas fa-thumbs-up" aria-hidden="true"></i>' . $like_n . '</span>';
} }
$html .= '<span class="badg c-red tag-view" data-toggle="tooltip" title="' . esc_attr(sprintf(__('人气值 %s', 'aksrt'), $view_n)) . '">' . aksrt_renderer_svg_icon('hot') . $view_n . '</span>'; $html .= '<span class="badg c-red tag-view" data-toggle="tooltip" title="' . esc_attr(sprintf(__('人气值 %s', 'aksrt'), $view_n)) . '"><i class="fa fas fa-fire" aria-hidden="true"></i>' . $view_n . '</span>';
/** /**
* Filter the author-card count badges row. * Filter the author-card count badges row.
+27 -11
View File
@@ -138,10 +138,10 @@ if (!function_exists('aksrt_header_user_box_html')) :
$con = ''; $con = '';
if ($user_id > 0) { if ($user_id > 0) {
$user = $ctx['current_user'] instanceof WP_User ? $ctx['current_user'] : wp_get_current_user(); $user = $ctx['current_user'] instanceof WP_User ? $ctx['current_user'] : wp_get_current_user();
$display_name = $user->display_name ?: $user->user_login; $display_name = $user->display_name ?: $user->user_login;
$avatar = aksrt_get_avatar_html($user_id, 44, ['alt' => $display_name]); $avatar = aksrt_get_avatar_box($user_id, 'avatar-img', true, false);
$desc = (string) ($ctx['user_desc'] ?? ''); $desc = (string) ($ctx['user_desc'] ?? '');
$vip_badge = function_exists('aksrt_get_vip_icon') ? aksrt_get_vip_icon($user_id) : ''; $vip_badge = function_exists('aksrt_get_vip_icon') ? aksrt_get_vip_icon($user_id) : '';
// Level and certification icons ride inline to the right of the display name. // Level and certification icons ride inline to the right of the display name.
$level_badge = (class_exists('\AKSRT\User\Level') && method_exists('\AKSRT\User\Level', 'get_badge_html')) $level_badge = (class_exists('\AKSRT\User\Level') && method_exists('\AKSRT\User\Level', 'get_badge_html'))
@@ -174,13 +174,13 @@ if (!function_exists('aksrt_header_user_box_html')) :
$msg_icon = ''; $msg_icon = '';
if ($msg_url !== '' && in_array('avatar_dropdown', $positions, true)) { if ($msg_url !== '' && in_array('avatar_dropdown', $positions, true)) {
$msg_icon = '<a class="abs-right" href="' . esc_url($msg_url) . '" title="' . esc_attr__('消息中心', 'aksrt') . '">'; $msg_icon = '<a class="msg-news-icon abs-right" href="' . esc_url($msg_url) . '" title="' . esc_attr__('消息中心', 'aksrt') . '">';
$msg_icon .= '<i class="fa fas fa-bell" aria-hidden="true"></i>'; $msg_icon .= '<span class="toggle-radius msg-icon"><i class="fa fas fa-bell" aria-hidden="true"></i></span>';
if ($unread > 0) { if ($unread > 0) {
$msg_icon .= '<span class="aksrt-notification-badge">' . esc_html((string) min(99, $unread)) . '</span>'; $msg_icon .= '<badge class="top">' . esc_html((string) min(99, $unread)) . '</badge>';
}
$msg_icon .= '</a>';
} }
$msg_icon .= '</a>';
}
$href = '<div class="flex jsa header-user-href">'; $href = '<div class="flex jsa header-user-href">';
$href .= '<a rel="nofollow" href="' . esc_url(function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url() : home_url('/')) . '">'; $href .= '<a rel="nofollow" href="' . esc_url(function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url() : home_url('/')) . '">';
@@ -224,6 +224,10 @@ if (!function_exists('aksrt_header_user_box_html')) :
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url('widgets.php')) . '">'; $href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url('widgets.php')) . '">';
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fa fas fa-chart-pie" aria-hidden="true"></i></div>'; $href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fa fas fa-chart-pie" aria-hidden="true"></i></div>';
$href .= '<div class="c-yellow">' . esc_html__('模块布局', 'aksrt') . '</div></a>'; $href .= '<div class="c-yellow">' . esc_html__('模块布局', 'aksrt') . '</div></a>';
// legacy: 商城中心 → 支付中心(AKSRT 支付中心后台菜单)。
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url('admin.php?page=aksrt_pay')) . '">';
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fa fas fa-credit-card" aria-hidden="true"></i></div>';
$href .= '<div class="c-yellow">' . esc_html__('支付中心', 'aksrt') . '</div></a>';
$href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url()) . '">'; $href .= '<a rel="nofollow" target="_blank" href="' . esc_url(admin_url()) . '">';
$href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fa fas fa-cog" aria-hidden="true"></i></div>'; $href .= '<div class="badg mb6 toggle-radius c-yellow"><i class="fa fas fa-cog" aria-hidden="true"></i></div>';
$href .= '<div class="c-yellow">' . esc_html__('后台管理', 'aksrt') . '</div></a>'; $href .= '<div class="c-yellow">' . esc_html__('后台管理', 'aksrt') . '</div></a>';
@@ -234,7 +238,10 @@ if (!function_exists('aksrt_header_user_box_html')) :
$con .= $avatar; $con .= $avatar;
$con .= '<div class="user-right flex flex1 ac jsb ml10">'; $con .= '<div class="user-right flex flex1 ac jsb ml10">';
$con .= '<div class="flex1" style="max-width: calc(100% - 40px);"><b>' $con .= '<div class="flex1" style="max-width: calc(100% - 40px);"><b>'
. '<span class="display-name text-ellipsis">' . esc_html($display_name) . '</span>' . $vip_badge . $medal_badge . $certification_badge . $level_badge . '<name class="flex ac flex1">'
. '<a class="display-name text-ellipsis" href="' . esc_url(function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($user_id) : get_author_posts_url($user_id)) . '">' . esc_html($display_name) . '</a>'
. $vip_badge . $medal_badge . $certification_badge . $level_badge
. '</name>'
. '</b><div class="px12 muted-2-color text-ellipsis">' . esc_html($desc) . '</div></div>'; . '</b><div class="px12 muted-2-color text-ellipsis">' . esc_html($desc) . '</div></div>';
$con .= '</div>'; $con .= '</div>';
$con .= $msg_icon; $con .= $msg_icon;
@@ -264,7 +271,16 @@ if (!function_exists('aksrt_header_user_box_html')) :
$href .= '<a href="javascript:;" class="signup-loader"><div class="badg mb6 toggle-radius c-green"><i class="fa fas fa-user-plus" aria-hidden="true"></i></div><div class="c-green">' $href .= '<a href="javascript:;" class="signup-loader"><div class="badg mb6 toggle-radius c-green"><i class="fa fas fa-user-plus" aria-hidden="true"></i></div><div class="c-green">'
. esc_html__('注册', 'aksrt') . '</div></a>'; . esc_html__('注册', 'aksrt') . '</div></a>';
} }
$href .= '<a rel="nofollow" href="' . esc_url(wp_lostpassword_url(home_url('/'))) . '"><div class="badg mb6 toggle-radius c-purple"><i class="fa fas fa-key" aria-hidden="true"></i></div><div class="c-purple">' // legacy: 找回密码 → 统一登录页 resetpassword 标签(带回跳)。
$reset_url = function_exists('aksrt_get_sign_page_url')
? aksrt_get_sign_page_url('resetpassword', [
'redirect_to' => remove_query_arg(
'redirect_to',
home_url(isset($_SERVER['REQUEST_URI']) ? wp_unslash($_SERVER['REQUEST_URI']) : '/')
),
])
: wp_lostpassword_url(home_url('/'));
$href .= '<a target="_blank" rel="nofollow" href="' . esc_url($reset_url) . '"><div class="badg mb6 toggle-radius c-purple"><i class="fa fas fa-key" aria-hidden="true"></i></div><div class="c-purple">'
. esc_html__('找回密码', 'aksrt') . '</div></a>'; . esc_html__('找回密码', 'aksrt') . '</div></a>';
$href .= '</div>'; $href .= '</div>';
+3 -1
View File
@@ -92,7 +92,9 @@ class PostListEnhance {
$order = $this->current_order(); $order = $this->current_order();
$order_by = $this->current_orderby(); $order_by = $this->current_orderby();
$o_icon = '<i class="opacity5 ml3 fa fa-long-arrow-' . ($order === 'asc' ? 'down' : 'up') . '"></i>'; $o_icon = $order === 'asc'
? '<i class="opacity5 ml3 fa fas fa-long-arrow-alt-down"></i>'
: '<i class="opacity5 ml3 fa fas fa-long-arrow-alt-up"></i>';
$new_columns = []; $new_columns = [];
foreach ($columns as $key => $label) { foreach ($columns as $key => $label) {
+1 -1
View File
@@ -193,7 +193,7 @@ final class UserRenderer {
]); ]);
} }
if ($args['show_checkin'] && $cuid === $user_id) { if ($args['show_checkin'] && $cuid === $user_id) {
$checkin = aksrt_header_user_checkin_btn($user_id, true, 'img-badge jb-yellow'); $checkin = aksrt_header_user_checkin_btn($user_id, 'img-badge jb-yellow');
} }
if ($args['show_button']) { if ($args['show_button']) {
@@ -167,14 +167,58 @@ test('guest account member VIP and publish contracts share reference header DOM'
assert.match(header, /navbar-form navbar-right navbar-but/); assert.match(header, /navbar-form navbar-right navbar-but/);
assert.match(header, /pay-vip/); assert.match(header, /pay-vip/);
assert.match(scripts, /\$enqueue_module\('header-userbox'\)/); assert.match(scripts, /\$enqueue_module\('header-userbox'\)/);
assert.match(userboxCss, /\.aksrt-header-userbox \.user-info > \.avatar/);
assert.match(userboxCss, /\.aksrt-header-wallet/);
assert.match(userboxCss, /\.aksrt-header-checkin/);
assert.match(userboxCss, /\.aksrt-header-payvip__cta/);
assert.match(userboxCss, /\.header-user-href > a[\s\S]*?max-height: none/); assert.match(userboxCss, /\.header-user-href > a[\s\S]*?max-height: none/);
assert.match(userboxCss, /body\.dark-theme \.aksrt-header-checkin/);
assert.doesNotMatch(userboxCss, /user-dropdown|nav-user|html\.dark|theme-dark/); assert.doesNotMatch(userboxCss, /user-dropdown|nav-user|html\.dark|theme-dark/);
assert.doesNotMatch(userboxCss, /--(?:main|muted|key)-|@import/); assert.doesNotMatch(userboxCss, /--(?:main|muted|key)-|@import/);
// Account rows render through the shared legacy classes; the module keeps only
// the shell anchoring, the account href geometry and the top-nav bell badge.
assert.match(userboxCss, /\.aksrt-nav-notification \.aksrt-notification-badge/);
assert.doesNotMatch(userboxCss, /aksrt-header-wallet|aksrt-header-checkin|aksrt-header-payvip|\.aksrt-header-userbox \.aksrt-notification-badge/);
assert.doesNotMatch(userboxCss, /width:\s*260px/);
});
test('the account popover rows match the reference user box structure', () => {
const identity = read('inc/helpers/aksrt-identity.php');
const legacyMainCss = read('assets/css/main.css');
// Stats row is wired with the reference wrapper and drops the posts chip.
assert.match(header, /aksrt_header_user_badges_row\(\$user_id\)/);
assert.match(header, /class="em09 author-tag mb10 mt6 flex jc"/);
assert.doesNotMatch(identity, /tag-posts/);
assert.match(identity, /fa fas fa-comment-dots/);
assert.match(identity, /fa fas fa-thumbs-up/);
assert.match(identity, /fa fas fa-fire/);
assert.doesNotMatch(identity, /aksrt_renderer_svg_icon/);
// Admin row exposes the AKSRT payment center at the reference mall slot.
assert.match(header, /admin\.php\?page=aksrt_pay/);
assert.match(header, /支付中心/);
// Wallet tiles: balance first, muted-box geometry, FA5 icons.
assert.match(header, /class="flex ab jsb col-ml6"/);
assert.match(header, /muted-box padding-6 flex1 radius4/);
assert.match(header, /font-bold c-blue-2/);
assert.match(header, /font-bold c-yellow/);
assert.match(header, /fa fas fa-money-bill-wave/);
assert.match(header, /fa fas fa-coins/);
// Message icon uses the reference markup.
assert.match(header, /msg-news-icon abs-right/);
assert.match(header, /toggle-radius msg-icon/);
assert.match(header, /<badge class="top">/);
// VIP bar and CTA use the reference payvip geometry.
assert.match(header, /radius4 payvip-icon btn-block text-center/);
assert.match(header, /vip-expdate-tag/);
assert.match(header, /pay-vip but radius4 payvip-icon btn-block/);
assert.doesNotMatch(header, /vipbg-v2/);
// Check-in entry is an anchor with the reference button classes.
assert.match(header, /but block c-yellow/);
assert.match(header, /data-signin-done-label[\s\S]{0,120}?今日已签到/);
// Card geometry falls back to the reference .sub-user-box width.
assert.match(legacyMainCss, /\.sub-user-box\s*\{\s*width:\s*242px;/s);
}); });
test('the only menu metadata and Walker contract is the legacy runtime', () => { test('the only menu metadata and Walker contract is the legacy runtime', () => {
@@ -27,6 +27,7 @@ test('notification icon positions map to their four render locations', () => {
const integration = read('src/Settings/Integration.php'); const integration = read('src/Settings/Integration.php');
const header = read('inc/helpers/header/aksrt-header-navbar.php'); const header = read('inc/helpers/header/aksrt-header-navbar.php');
const headerStyles = read('assets/css/frontend/header-userbox.css'); const headerStyles = read('assets/css/frontend/header-userbox.css');
const legacyMainCss = read('assets/css/main.css');
const userCenter = read('inc/helpers/aksrt-user-center.php'); const userCenter = read('inc/helpers/aksrt-user-center.php');
const userHome = read('templates/parts/user/author-hero.php'); const userHome = read('templates/parts/user/author-hero.php');
@@ -40,7 +41,13 @@ test('notification icon positions map to their four render locations', () => {
assert.match(integration, /\['nav_menu', 'avatar_dropdown', 'user_center_header', 'user_home_header'\]/); assert.match(integration, /\['nav_menu', 'avatar_dropdown', 'user_center_header', 'user_home_header'\]/);
assert.match(header, /in_array\('nav_menu', \$positions, true\)/); assert.match(header, /in_array\('nav_menu', \$positions, true\)/);
assert.match(header, /in_array\('avatar_dropdown', \$positions, true\)/); assert.match(header, /in_array\('avatar_dropdown', \$positions, true\)/);
assert.match(headerStyles, /\.aksrt-header-userbox \.user-info > \.abs-right \{[\s\S]*?top: 50%;[\s\S]*?transform: translateY\(-50%\);/); // The card message icon uses the reference msg-news-icon markup, positioned by
// the shared legacy stylesheet instead of a bespoke popover rule.
assert.match(header, /msg-news-icon abs-right/);
assert.match(header, /toggle-radius msg-icon/);
assert.match(header, /<badge class="top">/);
assert.match(legacyMainCss, /\.sub-user-box \.msg-news-icon \{[\s\S]*?top: 0\.4em;[\s\S]*?right: 0;/);
assert.doesNotMatch(headerStyles, /\.aksrt-header-userbox \.user-info > \.abs-right/);
assert.match(header, /aksrt-nav-icon aksrt-nav-notification/); assert.match(header, /aksrt-nav-icon aksrt-nav-notification/);
assert.match(header, /\$notification_but \. \$sign_but \. \$search_but/); assert.match(header, /\$notification_but \. \$sign_but \. \$search_but/);
assert.match(userCenter, /in_array\('user_center_header'/); assert.match(userCenter, /in_array\('user_center_header'/);
@@ -290,7 +290,7 @@ test('user profile and author widgets render the reference user-card contract',
// 用户个人信息小工具不显示文章模块,显示签到徽章。 // 用户个人信息小工具不显示文章模块,显示签到徽章。
assert.match(userRenderer, /'show_posts' => false,/) assert.match(userRenderer, /'show_posts' => false,/)
assert.match(userRenderer, /'show_checkin' => true,/) assert.match(userRenderer, /'show_checkin' => true,/)
assert.match(userRenderer, /aksrt_header_user_checkin_btn\(\$user_id, true, 'img-badge jb-yellow'\)/) assert.match(userRenderer, /aksrt_header_user_checkin_btn\(\$user_id, 'img-badge jb-yellow'\)/)
// 文章作者信息小工具显示文章模块,并走同一 widget 变体。 // 文章作者信息小工具显示文章模块,并走同一 widget 变体。
assert.match(userRenderer, /'show_posts' => !isset\(\$i\['show_posts'\]\) \|\| !empty\(\$i\['show_posts'\]\),/) assert.match(userRenderer, /'show_posts' => !isset\(\$i\['show_posts'\]\) \|\| !empty\(\$i\['show_posts'\]\),/)
assert.match(userRenderer, /'post_type' => 'post',/) assert.match(userRenderer, /'post_type' => 'post',/)
@@ -372,8 +372,16 @@ test('header user-card publish controls are removed from configuration and runti
test('header user-card membership stays on one row with a date-only expiry', () => { test('header user-card membership stays on one row with a date-only expiry', () => {
assert.match(headerUserbox, /wp_date\('Y年m月d日', \$expires\)/) assert.match(headerUserbox, /wp_date\('Y年m月d日', \$expires\)/)
assert.doesNotMatch(headerUserbox, /wp_date\('Y-m-d H:i', \$expires\)/) assert.doesNotMatch(headerUserbox, /wp_date\('Y-m-d H:i', \$expires\)/)
assert.match(headerCss, /\.aksrt-header-payvip__active\s*\{[^}]*flex-direction:\s*row;[^}]*gap:\s*8px !important;[^}]*white-space:\s*nowrap;/s) // Reference VIP bar: legacy payvip-icon geometry, the untouched level-icon
assert.match(headerCss, /\.aksrt-header-payvip__exp\s*\{[^}]*display:\s*inline;[^}]*white-space:\s*nowrap;/s) // contract, and the yellow expiry pill.
assert.match(headerUserbox, /radius4 payvip-icon btn-block text-center/)
assert.match(headerUserbox, /aksrt_get_vip_icon\(\$user_id, 'em12 mr6', false\)/)
assert.match(headerUserbox, /class="ml10 badg jb-yellow vip-expdate-tag"/)
assert.match(legacyMainCss, /\.sub-user-box \.payvip-icon\s*\{[^}]*padding:\s*8px;/s)
assert.doesNotMatch(headerCss, /aksrt-header-payvip/)
// The CTA wrapper is the reference padding wrapper, not a bespoke hook.
assert.match(headerUserbox, /'<div class="mt10 em09" style="padding:2px;">'/)
assert.doesNotMatch(headerUserbox, /aksrt-header-payvip/)
}) })
test('save contract rejects invalid input and round-trips canonical nested values', () => { test('save contract rejects invalid input and round-trips canonical nested values', () => {
@@ -307,7 +307,8 @@ test('after-box author card mirrors legacy user-card structure', () => {
assert.match(render, /<div class="user-desc mt10 muted-2-color em09">/); assert.match(render, /<div class="user-desc mt10 muted-2-color em09">/);
assert.doesNotMatch(render, /user-btns/); assert.doesNotMatch(render, /user-btns/);
assert.doesNotMatch(render, /发布文章.*用户中心/s); assert.doesNotMatch(render, /发布文章.*用户中心/s);
assert.match(identity, /tag-posts/); // The project ships no posts, so the stats row carries no posts chip.
assert.doesNotMatch(identity, /tag-posts/);
assert.match(identity, /tag-comment/); assert.match(identity, /tag-comment/);
assert.match(identity, /tag-follow/); assert.match(identity, /tag-follow/);
assert.match(identity, /tag-like/); assert.match(identity, /tag-like/);
@@ -110,9 +110,9 @@ namespace {
} }
function aksrt_get_user_badges(int $user_id): string { return '<span class="badg">' . $user_id . '</span>'; } function aksrt_get_user_badges(int $user_id): string { return '<span class="badg">' . $user_id . '</span>'; }
function aksrt_get_user_description(int $user_id): string { return 'Description ' . $user_id; } function aksrt_get_user_description(int $user_id): string { return 'Description ' . $user_id; }
function aksrt_header_user_checkin_btn(int $user_id, bool $large, string $class): string { function aksrt_header_user_checkin_btn(int $user_id, string $class): string {
unset($user_id, $large); unset($user_id);
return '<button class="' . esc_attr($class) . '">签到</button>'; return '<a class="' . esc_attr($class) . '" href="javascript:;">签到</a>';
} }
function aksrt_render_user_card_posts(array $args): string { function aksrt_render_user_card_posts(array $args): string {
return '<div data-post-type="' . esc_attr((string) ($args['post_type'] ?? '')) . '" data-post-style="' . esc_attr((string) ($args['post_style'] ?? '')) . '"></div>'; return '<div data-post-type="' . esc_attr((string) ($args['post_type'] ?? '')) . '" data-post-style="' . esc_attr((string) ($args['post_style'] ?? '')) . '"></div>';