'累计签到', 'value' => 10, 'key' => 'total_days'), * array('label' => '积分', 'value' => 50, 'key' => 'credits'), * ) * $sidebar_btn - 主操作按钮,格式: * array('url' => '...', 'icon' => 'ti-pencil', 'text' => '发帖') * 或 null(不显示按钮) * * 可选变量: * $sidebar_extra_html - 额外 HTML(如勋章佩戴图标等),插入到用户名后面 * 若未设置,自动获取已佩戴勋章 */ // 移动端跳过右侧栏 $_is_mobile = (function() { if (empty($_SERVER['HTTP_USER_AGENT'])) return false; $ua = $_SERVER['HTTP_USER_AGENT']; return (bool)preg_match('/Android|iPhone|iPod|Mobile|Opera Mini|IEMobile|WPDesktop/i', $ua); })(); if ($_is_mobile) return; $_ttype = $sidebar_ttype ?? 'home'; $_stats = $sidebar_stats ?? array(); $_btn = $sidebar_btn ?? null; // 自动获取勋章(如果未传入 $sidebar_extra_html 且勋章插件已安装) if (!isset($sidebar_extra_html) && !empty($uid) && class_exists('MedalService')) { $_sidebar_medals = MedalService::getUserWearingMedalsCached($uid); if (!empty($_sidebar_medals)) { $sidebar_extra_html = ''; } else { $sidebar_extra_html = ''; } } $_extra_html = $sidebar_extra_html ?? ''; $_cols = count($_stats) > 0 ? min(count($_stats), 4) : 4; ?>