' . $text . ''; } endif; if (!function_exists('aksrt_header_user_checkin_btn')) : /** * Check-in CTA for header dropdown and compact card placements. * * @param int $user_id Current user ID. * @param string|null $class Override the classes and render the reference-parity * badge (user-card 签到书签); null keeps the header * dropdown runtime. */ 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(); if ($user_id <= 0 || !class_exists('\AKSRT\Credits\Signin')) { return ''; } $cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_signin_reward_settings() : ['enabled' => false]; if (empty($cfg['enabled'])) { return ''; } $signed = \AKSRT\Credits\Signin::get_instance()->is_signed_today($user_id); // 已签到:与参考主题一致,入口按钮变为签到详情弹窗触发链接(可点击)。 if ($signed) { if ($class !== null) { // 用户卡片签到书签:保留书签类与 is-done 视觉,仅将行为切换为打开详情弹窗。 return aksrt_get_user_checkin_details_link( $class . ' is-done', '' . '' . esc_html__('已签到', 'aksrt') . '' ); } return aksrt_get_user_checkin_details_link( 'but block c-yellow is-done', '' . esc_html__('今日已签到', 'aksrt') ); } // Card badge variant (explicit $class, e.g. the user-card 签到 badge): // reference parity renders an so the badge inherits the card font // instead of the UA button stylesheet (font/UI 1:1 with the reference). if ($class !== null) { return '' . '' . '' . esc_html__('签到', 'aksrt') . '' . ''; } return '' . '' . '' . esc_html__('签到领取今日奖励', 'aksrt') . '' . ''; } endif; if (!function_exists('aksrt_render_signin_captcha')) : /** * Render the single global captcha mount used by every sign-in button. */ function aksrt_render_signin_captcha(): void { if ( !is_user_logged_in() || !class_exists('\AKSRT\Credits\Signin') || !class_exists('\AKSRT\Settings\Settings') || empty(\AKSRT\Settings\Settings::get_signin_reward_settings()['enabled']) || !function_exists('aksrt_is_captcha_enabled_for') || !function_exists('aksrt_render_captcha') || !aksrt_is_captcha_enabled_for('signin') ) { return; } ?>
0 ? $user_id : get_current_user_id(); if ($user_id <= 0 || !class_exists('\AKSRT\Settings\Settings')) { return ''; } $balance_on = !empty(\AKSRT\Settings\Settings::get_payment_recharge_settings()['enabled']); $points_on = \AKSRT\Settings\Settings::credits_enabled(); if (!$balance_on && !$points_on) { return ''; } $center = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url('credits') : '#'; $box = ''; if ($balance_on) { $box .= '' . '
' . esc_html__('余额', 'aksrt') . '
' . '
' . esc_html(aksrt_cut_count((float) aksrt_user_balance_decimal($user_id))) . '
'; } if ($points_on) { $currency = \AKSRT\Settings\Settings::get_currency_name(); $box .= '' . '
' . esc_html($currency) . '
' . '
' . esc_html(aksrt_cut_count(aksrt_user_points($user_id))) . '
'; } return '
' . $box . '
'; } endif; if (!function_exists('aksrt_header_user_badges_row')) : /** * Interaction stats row under the wallet (reference parity). */ function aksrt_header_user_badges_row(int $user_id = 0): string { $user_id = $user_id > 0 ? $user_id : get_current_user_id(); if ($user_id <= 0 || !function_exists('aksrt_get_user_badges')) { return ''; } $items = aksrt_get_user_badges($user_id); if ($items === '') { return ''; } return '
' . $items . '
'; } endif; if (!function_exists('aksrt_header_payvip_bar')) : /** * VIP status / open CTA bar (legacy parity). */ function aksrt_header_payvip_bar(int $user_id = 0): string { $user_id = $user_id > 0 ? $user_id : get_current_user_id(); if ($user_id <= 0) { return ''; } $vip = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_vip_settings() : ['enabled' => false, 'levels' => []]; if (empty($vip['enabled'])) { return ''; } $level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0; if ($level > 0) { $levels = is_array($vip['levels'] ?? null) ? $vip['levels'] : []; $name = (string) ($levels[$level]['name'] ?? ($level === 2 ? __('二级会员', 'aksrt') : __('一级会员', 'aksrt'))); $exp_label = ''; if (function_exists('aksrt_get_vip_info')) { $info = aksrt_get_vip_info($user_id); $expires = max(0, (int) ($info['expires'] ?? 0)); // 到期文案对齐参考主题:已过期 / 永久会员 / 裸日期。 if ((string) ($info['state'] ?? '') === 'expired') { $exp_label = __('会员已过期', 'aksrt'); } elseif ($expires > 0) { $exp_label = wp_date('Y年m月d日', $expires); } else { $exp_label = __('永久会员', 'aksrt'); } } $html = '
'; $html .= ''; $html .= function_exists('aksrt_get_vip_icon') ? aksrt_get_vip_icon($user_id, 'em12 mr6', false) : ''; $html .= '' . esc_html($name) . ''; if ($exp_label !== '') { $html .= '' . '' . esc_html($exp_label) . ''; } $html .= '
'; return $html; } if (empty($vip['nav_user_pay_vip'])) { return ''; } // 几何对齐参考主题 CTA(通栏、radius4)——不是顶导 navbar-cta chips。 return '
' . '' . '' . '' . esc_html__('开通会员 尊享会员权益', 'aksrt') . '' . '
'; } endif; if (!function_exists('aksrt_render_signout_modal')) : /** * Confirm logout modal markup (once per page). */ function aksrt_render_signout_modal(): void { static $done = false; if ($done || !is_user_logged_in()) { return; } $done = true; $logout = wp_logout_url(home_url('/')); ?>