Files
kate522 6f2adfaef1 feat(float): rebuild right floating buttons 1:1 with reference theme
- Storage: aksrt_floating_buttons now uses reference float_btn shape
  (fixed 8 sortable types, more-buttons group); single source of
  defaults/sanitize in AKSRT\Settings\FloatButtons
- Admin SPA: CSF-parity page split into components/floating/*
- Frontend: aksrt_float_right() on wp_footer mirrors zib_float_right()
  (wp_is_mobile, PC tooltip, toggle-theme, ontop/scrollTopTo, qrcode,
  wechat/qq, pay_vip, add, more)
- CSS: floating-buttons.css rewritten from reference rules; legacy float
  rules removed from main/part/shell/overlay-primitives
- Remove dead code: reorder route/API, get_floating_buttons_items,
  floatingSchema, floatActionsId, float-theme-toggle bindings,
  common/floating.css, aksrt-runtime-win.php, .aksrt-float-btn
2026-09-26 20:44:50 +08:00

255 lines
12 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* 站点页脚 — legacy template_1 shell
*
* 主内容区对齐 legacy `legacy` 契约;浮动按钮与移动端 tabbar 保留。
*
* @package AKSRT
* @version 4.1.0
*/
defined('ABSPATH') || exit;
// 数据准备
$blog_name = function_exists('aksrt_get_site_logo_text') ? aksrt_get_site_logo_text() : get_bloginfo('name');
$has_settings = class_exists('\AKSRT\Settings\Settings');
// §2.3 三列结构化字段(legacy 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' => [], 'items_2' => []];
$footer_customize_code = $has_settings ? \AKSRT\Settings\Settings::get_footer_customize_code() : '';
$footer_template = $has_settings ? \AKSRT\Settings\Settings::get_footer_template() : 'template_1';
// 设备可见性 → legacy 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';
// 品牌 / 联系 / 二维码列内容存在性
$_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'] ?? ''));
$_has_contact_icons = !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']) || !empty($footer_mini['items_2']);
$_has_cols = $_has_brand || $_has_links_col || $_has_mini;
$_footer_conter = wp_kses_post(trim((string) $footer_customize_code));
?>
<?php if (is_active_sidebar('single_bottom_fluid') && is_singular('post')) : ?>
<div class="fluid-widget-wrap">
<?php dynamic_sidebar('single_bottom_fluid'); ?>
</div>
<?php endif; ?>
<?php \AKSRT\WidgetSystem\WidgetAreas::render('all_bottom_fluid', 'fluid-widget-wrap'); ?>
<footer class="footer" data-aksrt-shell="site-footer" data-footer-template="<?php echo esc_attr($footer_template); ?>" role="contentinfo">
<?php if (is_active_sidebar('all_footer')) : ?>
<?php dynamic_sidebar('all_footer'); ?>
<?php endif; ?>
<div class="container-fluid container-footer">
<?php if ($_has_cols) : ?>
<ul class="flex ac gap20 footer-contact-box list-inline">
<?php if ($_has_brand) : ?>
<li class="<?php echo esc_attr(trim($_brand_xs_cls)); ?>" style="max-width: 300px;">
<?php if ($_logo_html !== '') : ?>
<p>
<a class="footer-logo" href="<?php echo esc_url(home_url('/')); ?>" title="<?php echo esc_attr($blog_name); ?>">
<?php echo $_logo_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</a>
</p>
<?php endif; ?>
<?php if (!empty($footer_brand['title'])) : ?>
<p class="title-h-left"><?php echo esc_html($footer_brand['title']); ?></p>
<?php endif; ?>
<?php if (!empty($footer_brand['custom_code'])) : ?>
<div class="footer-muted em09"><?php echo wp_kses_post($footer_brand['custom_code']); ?></div>
<?php endif; ?>
</li>
<?php endif; ?>
<?php if ($_has_links_col) : ?>
<li style="max-width: 550px;">
<?php if ($_fcode_links !== '') : ?>
<p class="fcode-links"><?php echo wp_kses_post($_fcode_links); ?></p>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['code_2'])) : ?>
<div class="footer-muted em09"><?php echo wp_kses_post($footer_contact_ext['code_2']); ?></div>
<?php endif; ?>
<?php if ($_has_contact_icons) : ?>
<div class="footer-contact mt10<?php echo esc_attr($_contact_xs_cls); ?>">
<?php if (!empty($footer_contact_ext['wechat_img'])) : ?>
<a class="toggle-radius hover-show nowave" href="javascript:;" title="<?php esc_attr_e('微信', 'aksrt'); ?>">
<i class="fa fab fa-weixin" aria-hidden="true"></i>
<div class="hover-show-con footer-wechat-img">
<img style="box-shadow: 0 5px 10px rgba(0,0,0,.2); border-radius:4px;" height="100" src="<?php echo esc_url($footer_contact_ext['wechat_img']); ?>" alt="<?php esc_attr_e('微信', 'aksrt'); ?>">
</div>
</a>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['qq'])) : ?>
<a class="toggle-radius" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e('QQ', 'aksrt'); ?>" href="<?php echo esc_url('https://wpa.qq.com/msgrd?v=3&uin=' . rawurlencode((string) $footer_contact_ext['qq']) . '&site=qq&menu=yes'); ?>">
<i class="fa fab fa-qq" aria-hidden="true"></i>
</a>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['weibo'])) : ?>
<a class="toggle-radius" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e('微博', 'aksrt'); ?>" href="<?php echo esc_url($footer_contact_ext['weibo']); ?>">
<i class="fa fab fa-weibo" aria-hidden="true"></i>
</a>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['email'])) : ?>
<a class="toggle-radius" title="<?php esc_attr_e('邮箱', 'aksrt'); ?>" href="<?php echo esc_url('mailto:' . $footer_contact_ext['email']); ?>">
<i class="fa fas fa-envelope" aria-hidden="true"></i>
</a>
<?php endif; ?>
<?php foreach ((array) ($footer_contact_ext['more'] ?? []) as $more_item) :
if (!is_array($more_item)) {
continue;
}
$m_img = (string) ($more_item['img'] ?? '');
$m_url = (string) ($more_item['link'] ?? '');
$m_text = (string) ($more_item['desc'] ?? '');
$m_icon = (string) ($more_item['icon'] ?? '');
$m_icon_html = $m_icon !== '' ? aksrt_icon_markup($m_icon) : '';
if ($m_icon_html === '') {
$m_icon_html = '<i class="fa fas fa-heart" aria-hidden="true"></i>';
}
if ($m_img !== '') :
?>
<a class="toggle-radius hover-show nowave" href="javascript:;" title="<?php echo esc_attr($m_text); ?>">
<?php echo $m_icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<div class="hover-show-con footer-wechat-img">
<img style="box-shadow: 0 5px 10px rgba(0,0,0,.2); border-radius:4px;" height="100" src="<?php echo esc_url($m_img); ?>" alt="<?php echo esc_attr($m_text); ?>">
</div>
</a>
<?php elseif ($m_url !== '') : ?>
<a class="toggle-radius" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr($m_text); ?>" href="<?php echo esc_url($m_url); ?>">
<?php echo $m_icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</li>
<?php endif; ?>
<?php if ($_has_mini) : ?>
<li class="<?php echo esc_attr(trim($_mini_xs_cls)); ?>">
<?php foreach (['items' => 'footer-miniimg flex at hh gap6', 'items_2' => 'footer-miniimg-2 flex at hh gap6'] as $items_key => $items_class) : ?>
<?php if (!empty($footer_mini[$items_key])) : ?>
<div class="<?php echo esc_attr($items_class); ?>">
<?php foreach ($footer_mini[$items_key] as $mi) :
$mi_img = (string) ($mi['image'] ?? '');
$mi_text = (string) ($mi['text'] ?? '');
$mi_link = is_array($mi['link'] ?? null) ? $mi['link'] : [];
$mi_url = (string) ($mi_link['url'] ?? '');
$mi_target = (string) ($mi_link['target'] ?? '');
?>
<?php if ($mi_url !== '') : ?>
<a href="<?php echo esc_url($mi_url); ?>"<?php echo $mi_target !== '' ? ' target="' . esc_attr($mi_target) . '"' : ''; ?>>
<?php endif; ?>
<div<?php echo $mi_text !== '' ? ' title="' . esc_attr($mi_text) . '"' : ''; ?>>
<img<?php echo aksrt_get_lazy_attr('lazy_other', $mi_img); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="<?php echo esc_attr($mi_text !== '' ? $mi_text : $blog_name); ?>">
<?php if ($mi_text !== '') : ?>
<div class="opacity8 em09 mt6 text-center"><?php echo esc_html($mi_text); ?></div>
<?php endif; ?>
</div>
<?php if ($mi_url !== '') : ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
<?php if ($_footer_conter !== '') : ?>
<p class="footer-conter"><?php echo $_footer_conter; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php endif; ?>
</div>
</footer>
<?php
// 右侧悬浮按钮由 aksrt_float_right() 挂 wp_footer 输出(inc/helpers/aksrt-float-buttons.php)。
$aksrt_hide_chrome = is_page_template('templates/pages/page-submit.php');
$tabbar_settings = $has_settings ? \AKSRT\Settings\Settings::get_footer_tabbar_settings() : [];
$tabbar_items = $has_settings ? \AKSRT\Settings\Settings::get_footer_tabbar_items() : [];
$tabbar_enabled = !$aksrt_hide_chrome && !empty($tabbar_settings['enabled']) && !empty($tabbar_items);
?>
<?php if ($tabbar_enabled) :
$tabbar_use_single_extend = function_exists('aksrt_should_use_footer_tabbar_single_extend')
&& aksrt_should_use_footer_tabbar_single_extend();
?>
<div class="footer-tabbar-placeholder" aria-hidden="true"></div>
<nav id="footer-tabbar" class="footer-tabbar<?php echo !empty($tabbar_settings['animation']) ? ' has-animation' : ''; ?><?php echo !empty($tabbar_settings['scroll_down_hide']) ? ' scroll-down-hide' : ''; ?><?php echo empty($tabbar_settings['border']) ? ' no-border' : ''; ?><?php echo empty($tabbar_settings['shadow']) ? ' no-shadow' : ''; ?><?php echo $tabbar_use_single_extend ? ' footer-tabbar--single-extend' : ''; ?>" aria-label="<?php esc_attr_e('底部导航', 'aksrt'); ?>">
<?php if ($tabbar_use_single_extend && function_exists('aksrt_render_footer_tabbar_single_extend')) :
aksrt_render_footer_tabbar_single_extend(!empty($tabbar_settings['show_text']));
else :
foreach ($tabbar_items as $tab_item) :
$tab_type = sanitize_key((string) ($tab_item['type'] ?? 'custom'));
$tab_text = (string) ($tab_item['text'] ?? '');
$tab_icon = (string) ($tab_item['icon'] ?? 'fa fas fa-circle');
$tab_href = home_url('/');
if ($tab_type === 'category') {
$tab_href = get_post_type_archive_link('post') ?: home_url('/');
} elseif ($tab_type === 'auth') {
$tab_href = is_user_logged_in() ? aksrt_get_user_center_url() : aksrt_get_login_url();
} elseif ($tab_type === 'search') {
$tab_href = home_url('/');
} elseif ($tab_type === 'custom' && !empty($tab_item['link'])) {
$tab_href = (string) $tab_item['link'];
} elseif ($tab_type === 'home') {
$tab_href = home_url('/');
}
?>
<a href="<?php echo esc_url($tab_href); ?>" class="tabbar-item" data-type="<?php echo esc_attr($tab_type); ?>">
<?php echo aksrt_icon_markup((string) $tab_icon); // pre-escaped ?>
<?php if (!empty($tabbar_settings['show_text'])) : ?><span><?php echo esc_html($tab_text); ?></span><?php endif; ?>
</a>
<?php endforeach;
endif; ?>
</nav>
<?php endif; ?>
<?php
// 弹窗登录/注册模板(仅未登录用户)
if (
!is_user_logged_in()
&& class_exists('\AKSRT\Settings\Settings')
&& \AKSRT\Settings\Settings::user_sign_type() === 'modal'
&& file_exists(AKSRT_DIR . '/templates/parts/modal-auth.php')
) {
include AKSRT_DIR . '/templates/parts/modal-auth.php';
}
?>
<?php wp_footer(); ?>
</html>