true, 'icp_number' => '', 'police_enabled' => true, 'police_number' => '']; $icp_number = !empty($filing['icp_enabled']) ? (string) ($filing['icp_number'] ?? '') : ''; $police_number = !empty($filing['police_enabled']) ? (string) ($filing['police_number'] ?? '') : ''; $footer_text = $has_settings ? \AKSRT\Settings\Settings::footer_text() : ''; $copyright_text = $has_settings ? \AKSRT\Settings\Settings::get_copyright_text() : ''; // §2.3 三列结构化字段(Zibll keys) $footer_brand = $has_settings ? \AKSRT\Settings\Settings::get_footer_brand_settings() : ['m_s' => ['pc', 'mobile'], 'img' => '', 'img_dark' => '', 'title' => '', 'custom_code' => '']; $footer_contact_ext = $has_settings ? \AKSRT\Settings\Settings::get_footer_contact_extended_settings() : ['m_s' => ['pc', 'mobile'], 'wechat_img' => '', 'qq' => '', 'weibo' => '', 'email' => '', 'more' => [], 'code_1' => '', 'code_2' => '']; $footer_mini = $has_settings ? \AKSRT\Settings\Settings::get_footer_mini_img_settings() : ['m_s' => ['pc', 'mobile'], 'items' => []]; $footer_customize_code = $has_settings ? \AKSRT\Settings\Settings::get_footer_customize_code() : ''; // 设备可见性 → Zibll hidden-xs(仅在不含 mobile 时隐藏移动端) $_brand_show_sm = in_array('mobile', (array) ($footer_brand['m_s'] ?? []), true); $_contact_show_sm = in_array('mobile', (array) ($footer_contact_ext['m_s'] ?? []), true); $_mini_show_sm = in_array('mobile', (array) ($footer_mini['m_s'] ?? []), true); $_brand_xs_cls = $_brand_show_sm ? '' : ' hidden-xs'; $_contact_xs_cls = $_contact_show_sm ? '' : ' hidden-xs'; $_mini_xs_cls = $_mini_show_sm ? '' : ' hidden-xs'; /** * 渲染快速链接 URL:支持外链 / 站内相对路径 */ $render_link_url = static function ($raw) { if (empty($raw)) { return '#'; } if (strpos((string) $raw, 'http') === 0) { return esc_url($raw); } return esc_url(home_url($raw)); }; /** * 构建 fcode-links 回退 HTML(structured links) */ $build_fallback_links_html = static function () use ($quick_links, $more_links, $friend_links, $hot_cat_count, $render_link_url) { $link_bits = []; foreach ((array) $quick_links as $ql) { $label = $ql['name'] ?? $ql['label'] ?? ''; $url = $render_link_url($ql['url'] ?? ''); if ($label !== '') { $link_bits[] = '' . esc_html($label) . ''; } } foreach ((array) $more_links as $ml) { $label = $ml['name'] ?? $ml['label'] ?? ''; $url = $render_link_url($ml['url'] ?? ''); if ($label !== '') { $link_bits[] = '' . esc_html($label) . ''; } } foreach ((array) $friend_links as $fl) { $label = $fl['name'] ?? ''; $url = $fl['url'] ?? '#'; if ($label !== '') { $link_bits[] = '' . esc_html($label) . ''; } } if ($hot_cat_count > 0) { $_hot_cache_key = 'aksrt_footer_hot_cats_' . (int) $hot_cat_count; $_hot_cats = wp_cache_get($_hot_cache_key, 'aksrt'); if (!is_array($_hot_cats)) { $_hot_cats = get_categories([ 'orderby' => 'count', 'order' => 'DESC', 'number' => $hot_cat_count, 'hide_empty' => true, ]); if (!is_array($_hot_cats)) { $_hot_cats = []; } wp_cache_set($_hot_cache_key, $_hot_cats, 'aksrt', 12 * HOUR_IN_SECONDS); } foreach ($_hot_cats as $hc) { $link_bits[] = '' . esc_html($hc->name) . ''; } } return implode(' ', $link_bits); }; // 品牌 / 联系 / 二维码列内容存在性 $_logo_html = ''; if (function_exists('aksrt_get_adaptive_theme_img')) { $_logo_html = aksrt_get_adaptive_theme_img( (string) ($footer_brand['img'] ?? ''), (string) ($footer_brand['img_dark'] ?? ''), $blog_name, 'style="height: 40px;"' ); } $_has_brand = $_logo_html !== '' || !empty($footer_brand['title']) || !empty($footer_brand['custom_code']); $_fcode_links = trim((string) ($footer_contact_ext['code_1'] ?? '')); if ($_fcode_links === '') { $_fcode_links = $build_fallback_links_html(); } $_fcode_links_is_raw = trim((string) ($footer_contact_ext['code_1'] ?? '')) !== ''; $_has_contact_icons = !empty($footer_contacts) || !empty($footer_contact_ext['wechat_img']) || !empty($footer_contact_ext['qq']) || !empty($footer_contact_ext['email']) || !empty($footer_contact_ext['more']) || !empty($footer_contact_ext['weibo']); $_has_links_col = $_fcode_links !== '' || !empty($footer_contact_ext['code_2']) || $_has_contact_icons; $_has_mini = !empty($footer_mini['items']); $_has_cols = $_has_brand || $_has_links_col || $_has_mini; // 底栏:customize 优先;否则回退版权/备案 $_footer_conter = trim((string) $footer_customize_code); if ($_footer_conter === '') { $footer_bits = []; if ($icp_number !== '') { $footer_bits[] = '' . esc_html($icp_number) . ''; } if ($police_number !== '') { $footer_bits[] = '' . esc_html($police_number) . ''; } $copy = '© ' . esc_html(gmdate('Y')) . ' ' . esc_html($blog_name) . '.'; if ($copyright_text !== '') { $copy .= ' ' . wp_kses_post($copyright_text); } if ($footer_text !== '') { $copy .= ' ' . esc_html($footer_text); } if (!empty($footer_bits)) { $copy .= ' ' . implode(' · ', $footer_bits); } $_footer_conter = $copy; } else { $_footer_conter = wp_kses_post($_footer_conter); } ?>