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 ''; } // Lightweight today status via private API if available. $signed = false; try { $signin = \AKSRT\Credits\Signin::get_instance(); // Prefer public method if present. if (method_exists($signin, 'is_signed_today')) { $signed = (bool) $signin->is_signed_today($user_id); } else { // Fallback: direct meta/table probe via rest_today logic is heavy; use option day key. $day = wp_date('Y-m-d'); $signed = (bool) get_user_meta($user_id, 'aksrt_signin_' . $day, true); } } catch (\Throwable $e) { $signed = false; } if ($signed) { return ''; } return ''; } endif; if (!function_exists('aksrt_header_user_wallet_mini')) : /** * Mini wallet strip: credits + cash balance. */ function aksrt_header_user_wallet_mini(int $user_id = 0): string { $user_id = $user_id > 0 ? $user_id : get_current_user_id(); if ($user_id <= 0) { return ''; } $credits = function_exists('aksrt_user_credits') ? (int) aksrt_user_credits($user_id) : 0; $currency = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt'); $wallet = 0.0; if (class_exists('\AKSRT\Credits\Balance')) { $wallet = (float) \AKSRT\Credits\Balance::balance($user_id); } $center = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url('assets') : '#'; $html = ''; $html .= ' ' . esc_html($currency) . ' ' . esc_html(number_format_i18n($credits)) . ''; $html .= ' ' . esc_html__('余额', 'aksrt') . ' ' . esc_html(number_format_i18n($wallet, 2)) . ''; $html .= ''; return $html; } endif; if (!function_exists('aksrt_header_user_badges_row')) : /** * Identity / medal chips under profile. */ 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_render_user_identity_chips')) { return ''; } $chips = aksrt_render_user_identity_chips($user_id, 'card'); if ($chips === '') { return ''; } return '
'; } endif; if (!function_exists('aksrt_header_payvip_bar')) : /** * VIP status / open CTA bar. */ 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 ''; } $badge = function_exists('aksrt_render_vip_badge') ? aksrt_render_vip_badge($user_id, 'md') : ''; if ($badge !== '') { return '