Files
wordpress-theme-aksrt/footer.php
T
kate522andClaude Opus 5 d07cffe99e fix(creator-studio): 沉浸式布局与公众号式写作体验
首轮实机体验暴露的问题:

- 投稿页仍在渲染主题头部的 all_top_fluid 挂件区、页脚与浮动入口,
  与工作台顶栏重复。header.php / footer.php 新增 jio_render_header、
  jio_render_footer、jio_render_fluid_widgets 过滤器,工作台模式下全部关闭
- 区块 Inspector 被写在 BlockList 之后,作为正文流的一部分渲染出
  一个巨大的「未选择区块」白框;移除内联 Inspector(区块设置改由
  行内工具栏的区块菜单提供)
- 中文正文被 wordcount 的 'words' 口径算成「字数:1」;改用
  characters_excluding_spaces,与前台 TinyMCE 字数一致
- 行宽 820px、标题 34px 偏松散;收窄到 720px / 27px,正文 16px/1.85,
  段落间距与选区描边收敛,行内工具栏改为深色圆角悬浮条

新增本地视觉验收脚本(不参与运行时):
- scripts/preview.cjs:用模拟 bootstrap 生成离线预览页
- scripts/shoot.cjs:桌面/移动端截图与控制台错误采集

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 15:49:57 +08:00

257 lines
12 KiB
PHP
Raw 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 Jio
* @version 4.1.0
*/
defined('ABSPATH') || exit;
// 数据准备
$blog_name = function_exists('jio_get_site_logo_text') ? jio_get_site_logo_text() : get_bloginfo('name');
$has_settings = class_exists('\Jio\Settings\Settings');
// §2.3 三列结构化字段(legacy keys)
$footer_brand = $has_settings ? \Jio\Settings\Settings::get_footer_brand_settings() : ['m_s' => ['pc', 'mobile'], 'img' => '', 'img_dark' => '', 'title' => '', 'custom_code' => ''];
$footer_contact_ext = $has_settings ? \Jio\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 ? \Jio\Settings\Settings::get_footer_mini_img_settings() : ['m_s' => ['pc', 'mobile'], 'items' => [], 'items_2' => []];
$footer_customize_code = $has_settings ? \Jio\Settings\Settings::get_footer_customize_code() : '';
$footer_template = $has_settings ? \Jio\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('jio_get_adaptive_theme_img')) {
$_logo_html = jio_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 \Jio\WidgetSystem\WidgetAreas::render('all_bottom_fluid', 'fluid-widget-wrap'); ?>
<?php if (apply_filters('jio_render_footer', true)) : ?>
<footer class="footer" data-jio-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('微信', 'jio'); ?>">
<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('微信', 'jio'); ?>">
</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', 'jio'); ?>" 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('微博', 'jio'); ?>" 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('邮箱', 'jio'); ?>" 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 !== '' ? jio_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 jio_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
// 右侧悬浮按钮由 jio_float_right() 挂 wp_footer 输出(inc/helpers/jio-float-buttons.php)。
$jio_hide_chrome = is_page_template('templates/pages/page-submit.php');
$tabbar_settings = $has_settings ? \Jio\Settings\Settings::get_footer_tabbar_settings() : [];
$tabbar_items = $has_settings ? \Jio\Settings\Settings::get_footer_tabbar_items() : [];
$tabbar_enabled = !$jio_hide_chrome && !empty($tabbar_settings['enabled']) && !empty($tabbar_items);
?>
<?php if ($tabbar_enabled) :
$tabbar_use_single_extend = function_exists('jio_should_use_footer_tabbar_single_extend')
&& jio_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('底部导航', 'jio'); ?>">
<?php if ($tabbar_use_single_extend && function_exists('jio_render_footer_tabbar_single_extend')) :
jio_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() ? jio_get_user_center_url() : jio_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 jio_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 endif; // jio_render_footer ?>
<?php
// 弹窗登录/注册模板(仅未登录用户)
if (
!is_user_logged_in()
&& class_exists('\Jio\Settings\Settings')
&& \Jio\Settings\Settings::user_sign_type() === 'modal'
&& file_exists(JIO_DIR . '/templates/parts/modal-auth.php')
) {
include JIO_DIR . '/templates/parts/modal-auth.php';
}
?>
<?php wp_footer(); ?>
</html>