Merge pull request 'fix(footer): align template_1 shell with Zibll 1:1' (#98) from worktree-fix-footer-dual-logo into main

Reviewed-on: CYL/wordpress-theme-aksrt#98
This commit is contained in:
2026-07-13 07:48:31 +08:00
11 changed files with 466 additions and 597 deletions
@@ -107,10 +107,10 @@
<n-form-item label="邮箱">
<n-input v-model:value="form.footer_contact_email" placeholder="邮箱地址" />
</n-form-item>
<n-form-item label="联系区上方自定义代码">
<n-input v-model:value="form.fcode_t2_code_1" type="textarea" :rows="2" placeholder="可选 HTML" />
<n-form-item label="链接 HTML(fcode_t2_code_1)">
<n-input v-model:value="form.fcode_t2_code_1" type="textarea" :rows="3" placeholder="推荐直接写 <a href=&quot;/&quot;>首页</a> 等链接 HTML;为空时回退快速链接/友链/热门分类" />
</n-form-item>
<n-form-item label="联系区下方自定义代码">
<n-form-item label="链接下方自定义代码">
<n-input v-model:value="form.fcode_t2_code_2" type="textarea" :rows="2" placeholder="备案号等 HTML" />
</n-form-item>
</n-form>
@@ -283,9 +283,7 @@
<n-form :model="form" label-placement="left" label-width="140" class="aksrt-form">
<n-form-item label="页脚布局模板">
<n-radio-group v-model:value="form.layout_template">
<n-radio-button value="default">默认</n-radio-button>
<n-radio-button value="compact">紧凑</n-radio-button>
<n-radio-button value="centered">居中</n-radio-button>
<n-radio-button value="template_1">模板一(Zibll)</n-radio-button>
</n-radio-group>
</n-form-item>
<n-form-item label="热门分类数量">
@@ -450,7 +448,7 @@ const form = reactive({
more_links: [],
hot_categories: 5,
copyright_text: '',
layout_template: 'default',
layout_template: 'template_1',
// §2.3 三列结构化字段
footer_t1_m_s: ['pc', 'mobile'],
footer_t1_img: '',
@@ -804,7 +802,7 @@ async function loadSettings() {
form.more_links = data.more_links || []
form.hot_categories = data.hot_categories ?? 5
form.copyright_text = data.copyright_text || ''
form.layout_template = data.layout_template || 'default'
form.layout_template = 'template_1'
// §2.3 三列结构化字段
form.footer_t1_m_s = Array.isArray(data.footer_t1_m_s) ? data.footer_t1_m_s : ['pc', 'mobile']
form.footer_t1_img = data.footer_t1_img || ''
@@ -898,8 +898,8 @@ export const pageDisplaySchemas = {
fields: [
{ key: 'footer_contact_m_s', label: '显示设备', type: 'checkbox', default: ['pc', 'mobile'] },
{ key: 'footer_contact_more', label: '更多联系项', type: 'textarea', default: '' },
{ key: 'fcode_t2_code_1', label: '联系区上方自定义代码', type: 'textarea', default: '' },
{ key: 'fcode_t2_code_2', label: '联系区下方自定义代码', type: 'textarea', default: '' },
{ key: 'fcode_t2_code_1', label: '链接 HTML(fcode_t2_code_1)', type: 'textarea', default: '' },
{ key: 'fcode_t2_code_2', label: '链接下方自定义代码', type: 'textarea', default: '' },
],
},
{
+8 -271
View File
@@ -1,289 +1,25 @@
/* ============================================================
* AKSRT Footer — v4.0 Zibll-Inspired
*
* 包含:
* - 页脚主体(Bootstrap Grid)
* - 浮动右侧按钮组
* - 移动端底部 Tab 栏
* AKSRT Footer utilities — float buttons start + device helpers
* Main template_1 shell: zibll-shell.css
* Tabbar / float details: part-2.css+
* ============================================================ */
/* ============================================================
* 页脚主体
* ============================================================ */
:root {
--aksrt-footer-tabbar-height: 49px;
}
.site-footer {
margin-top: auto;
background: var(--footer-bg, var(--surface-1));
border-top: 1px solid rgba(255, 255, 255, 0.55);
padding: 34px 30px 30px;
}
.site-footer__inner {
max-width: var(--container);
margin: 0 auto;
padding: 0 16px;
}
@media (min-width: 768px) {
.site-footer__inner {
padding: 0 24px;
}
}
.site-footer__grid {
padding-bottom: 32px;
}
.site-footer__brand {
margin-bottom: 24px;
}
.site-footer__title {
font-size: 1rem;
font-weight: 700;
margin: 0 0 12px;
color: var(--color-ink);
}
.site-footer__desc {
font-size: 14px;
color: var(--color-ink-4);
line-height: 1.6;
margin: 0 0 16px;
max-width: 360px;
}
.site-footer__col {
margin-bottom: 24px;
}
.site-footer__col ul {
list-style: none;
margin: 0;
padding: 0;
}
.site-footer__col li {
margin-bottom: 8px;
}
.site-footer__col a {
font-size: 14px;
color: var(--footer-color, var(--color-ink-3));
transition: color 0.15s ease;
}
.site-footer__col a:hover {
color: var(--focus-color, var(--color-primary));
}
/* 社交链接行 */
.social-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 16px;
}
.social-row a {
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--surface-4);
border: none;
box-shadow: var(--shadow-sm);
color: var(--color-ink-3);
transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.social-row a:hover {
background: var(--color-primary);
color: #fff;
transform: translateY(-2px);
}
.social-row .social-icon-link {
background: var(--surface-3);
color: var(--color-ink-3);
}
.social-row .social-icon-link:hover {
background: var(--color-primary);
color: #fff;
}
/* 友情链接 */
.site-footer__friends {
margin-top: 16px;
}
.site-footer__friends-title {
font-size: 0.8125rem;
font-weight: 600;
color: var(--color-ink-4);
margin: 0 0 8px;
}
.site-footer__friends-list {
display: flex;
flex-wrap: wrap;
gap: 6px 12px;
}
.site-footer__friends-list a {
font-size: 0.8125rem;
color: var(--color-ink-4);
}
.site-footer__friends-list a:hover {
color: var(--color-primary);
}
/* 底部栏 */
.site-footer__bottom {
border-top: 1px solid var(--color-line);
padding: 20px 0;
text-align: center;
}
.site-footer__filings {
display: flex;
justify-content: center;
gap: 16px;
margin-bottom: 8px;
flex-wrap: wrap;
}
.site-footer__filings a {
font-size: 0.75rem;
color: var(--color-ink-4);
}
.site-footer__filings a:hover {
color: var(--color-primary);
}
.site-footer__copyright {
font-size: 12px;
color: var(--color-ink-4);
margin: 0;
}
/* §2.3 三列结构化字段 */
/* 品牌 Logo — day/night visibility lives in zibll-shell.css */
.site-footer__logo {
margin-bottom: 16px;
}
.site-footer__logo-img {
max-height: 48px;
width: auto;
}
/* 标准联系项 */
.site-footer__contact-std {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
margin: 12px 0;
}
.site-footer__contact-item {
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
background: var(--surface-4, rgba(0,0,0,.05));
border: none;
box-shadow: var(--shadow-sm);
color: var(--color-ink-3, #888);
font-size: 16px;
position: relative;
cursor: pointer;
text-decoration: none;
transition: background .2s, color .2s, box-shadow .2s;
}
.site-footer__contact-item:hover,
.site-footer__contact-item:focus {
background: var(--color-primary);
color: #fff;
}
.site-footer__contact-hover {
display: none;
position: absolute;
bottom: calc(100% + 10px);
left: 50%;
transform: translateX(-50%);
padding: 8px;
background: var(--surface-1, #fff);
border: none;
border-radius: 12px;
box-shadow: var(--shadow-lg);
z-index: 10;
white-space: nowrap;
}
.site-footer__contact-hover img {
width: 120px;
height: 120px;
object-fit: contain;
border-radius: 4px;
}
.site-footer__contact-item:hover .site-footer__contact-hover,
.site-footer__contact-item:focus .site-footer__contact-hover {
display: block;
}
/* 自定义代码区域 */
.site-footer__custom-code,
.site-footer__customize-code {
margin-top: 8px;
font-size: 0.85rem;
color: var(--color-ink-4, #999);
}
/* 二维码图片组 */
.site-footer__mini-qr {
display: flex;
justify-content: center;
gap: 24px;
padding: 20px 0;
border-top: 1px solid var(--color-line, #eee);
}
.site-footer__mini-qr-item {
text-align: center;
}
.site-footer__mini-qr-item img {
width: 80px;
height: 80px;
object-fit: contain;
border-radius: 6px;
border: 1px solid var(--color-line, #eee);
}
.site-footer__mini-qr-item span {
display: block;
margin-top: 6px;
font-size: 12px;
color: var(--color-ink-4, #999);
}
/* 设备可见性工具类 */
/* Device visibility utility classes */
@media (max-width: 767px) {
.hide-on-mobile { display: none !important; }
.hidden-xs { display: none !important; }
}
@media (min-width: 768px) {
.hide-on-desktop { display: none !important; }
.hide-on-pc { display: none !important; }
}
/* ============================================================
* 浮动右侧按钮组(模仿 zibll float-right)
* 浮动右侧按钮组(模仿 zibll float-right)— continued in part-2
* ============================================================ */
/* 对齐 zibll: bottom 60px, z-index 1030 */
.float-right-btns {
@@ -295,3 +31,4 @@
flex-direction: column;
gap: 8px;
transition: opacity 0.3s ease;
}
+1
View File
@@ -139,6 +139,7 @@ body.dark-theme #float-theme-toggle .float-btn__icon-sun {
}
/* 有 tabbar 时页脚需要额外底部间距 */
.footer,
.site-footer {
padding-bottom: calc(var(--aksrt-footer-tabbar-height) + env(safe-area-inset-bottom, 0px));
}
+111 -81
View File
@@ -1,5 +1,6 @@
/**
* Footer — Zibll template_1 shell (list-inline)
* Footer — Zibll template_1 shell (list-inline + float third column)
* Contract: zibll/css/main.css footer block + zib_footer_con markup
*/
.footer {
color: var(--footer-color, var(--color-ink-4));
@@ -7,7 +8,6 @@
padding: 30px;
font-size: 13px;
margin-top: auto;
border-top: 1px solid rgba(255, 255, 255, 0.55);
}
.footer a:not(.but):not(.focus-color) {
@@ -24,15 +24,11 @@
width: 100%;
}
/* Bootstrap-like list-inline — NOT flex (Zibll uses float for third col) */
.footer .list-inline {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: space-between;
list-style: none;
margin: 0 0 12px;
padding: 0;
gap: 10px 0;
}
.footer .list-inline > li {
@@ -41,50 +37,43 @@
display: inline-block;
}
@media (min-width: 992px) {
.footer .list-inline > li + li + li {
margin-left: auto;
}
.footer .list-inline > li + li + li {
float: right;
}
.footer .footer-logo,
.footer .footer-logo-img,
.footer a.footer-logo img {
.footer a.footer-logo img,
.footer .footer-logo img {
height: 40px;
width: auto;
max-width: 180px;
vertical-align: middle;
}
/* Light/dark footer logo toggle — keep display out of size rules so hide wins */
.footer a.footer-logo .site-footer__logo--day {
display: inline-block;
}
.footer a.footer-logo .site-footer__logo--night {
display: none;
}
html.dark .footer a.footer-logo .site-footer__logo--day,
[data-theme="dark"] .footer a.footer-logo .site-footer__logo--day,
body.dark-theme .footer a.footer-logo .site-footer__logo--day {
display: none;
}
html.dark .footer a.footer-logo .site-footer__logo--night,
[data-theme="dark"] .footer a.footer-logo .site-footer__logo--night,
body.dark-theme .footer a.footer-logo .site-footer__logo--night {
display: inline-block;
}
.footer .title-h-left,
.footer .site-footer__title {
/* title-h-left underline bar (Zibll) */
.footer .title-h-left {
position: relative;
margin: 8px 0 10px;
padding-bottom: 8px;
font-size: 15px;
font-weight: 700;
color: var(--color-ink, #333);
}
.footer .title-h-left:before {
transition: 0.4s;
transform-origin: left;
position: absolute;
content: "";
width: 40px;
height: 3px;
background: var(--theme-color, var(--color-primary));
left: 0;
bottom: 3px;
border-radius: 5px;
box-shadow: 1px 1px 3px -1px var(--theme-color, var(--color-primary));
}
.footer .footer-muted,
.footer .em09 {
font-size: 0.92em;
@@ -92,6 +81,10 @@ body.dark-theme .footer a.footer-logo .site-footer__logo--night {
line-height: 1.7;
}
.footer .opacity8 {
opacity: 0.8;
}
.footer .fcode-links {
margin: 0 0 8px;
line-height: 1.9;
@@ -110,35 +103,56 @@ body.dark-theme .footer a.footer-logo .site-footer__logo--night {
vertical-align: 0.2em;
}
/* Circular contact buttons — Zibll .toggle-radius + .footer-contact > a */
.footer .toggle-radius {
background: var(--this-bg, var(--main-border-color, var(--surface-2, #f0f0f0)));
width: 29px;
height: 29px;
display: inline-block;
text-align: center;
border-radius: 100%;
position: relative;
vertical-align: text-top;
line-height: 29px;
color: var(--footer-color, var(--color-ink-3));
text-decoration: none;
}
.footer .footer-contact {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
margin-top: 10px;
}
.footer .footer-contact > a,
.footer .footer-contact__item {
font-size: 18px;
.footer .footer-contact > a {
font-size: 20px;
margin: 5px;
width: 35px;
height: 35px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: var(--surface-2, #f3f3f3);
line-height: 35px;
display: inline-block;
text-align: center;
border-radius: 100%;
background: var(--this-bg, var(--main-border-color, var(--surface-2, #f0f0f0)));
color: var(--footer-color, var(--color-ink-3));
text-decoration: none;
transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
vertical-align: text-top;
position: relative;
transition: color 0.15s ease, background 0.15s ease;
}
.footer .footer-contact > a:hover,
.footer .footer-contact__item:hover {
.footer .footer-contact > a:hover {
color: #fff;
background: var(--focus-color, var(--color-primary));
transform: translateY(-1px);
}
.footer .footer-contact > a i,
.footer .footer-contact > a svg {
vertical-align: middle;
}
.footer .footer-contact > a svg {
width: 1em;
height: 1em;
fill: currentColor;
}
.footer .footer-wechat-img {
@@ -147,7 +161,7 @@ body.dark-theme .footer a.footer-logo .site-footer__logo--night {
width: 140px;
bottom: 90%;
left: -55px;
padding-bottom: 12px;
padding-bottom: 20px;
z-index: 5;
}
@@ -176,49 +190,48 @@ body.dark-theme .footer a.footer-logo .site-footer__logo--night {
display: inline-block;
}
.footer .footer-miniimg img {
width: 90px;
height: 90px;
object-fit: cover;
border-radius: 4px;
background: var(--surface-2);
.footer .footer-miniimg p {
margin: 0 0 4px;
}
.footer .footer-conter,
.footer .site-footer__copyright {
.footer .footer-miniimg img {
width: 90px;
height: auto;
max-width: 100%;
display: block;
margin: 0 auto;
border-radius: 4px;
}
.footer .footer-conter {
margin: 8px 0 0;
line-height: 1.8;
color: var(--footer-color, var(--color-ink-4));
font-size: 13px;
text-align: left;
}
.footer .footer-conter a:hover {
color: var(--focus-color, var(--color-primary));
}
.footer .mt10 {
margin-top: 10px;
}
#float-right-btns.float-right,
.float-right {
position: fixed;
right: 16px;
bottom: 80px;
z-index: 90;
display: flex;
flex-direction: column;
gap: 8px;
}
/* Device visibility — Zibll hidden-xs */
@media (max-width: 767px) {
.footer {
padding: 24px 16px 28px;
.footer .hidden-xs,
.hidden-xs {
display: none !important;
}
.footer .list-inline {
display: block;
.footer {
padding: 20px 0;
}
.footer .container-footer {
text-align: center;
padding: 0 16px;
}
.footer .list-inline > li + li + li {
float: none;
}
.footer .list-inline > li {
@@ -226,4 +239,21 @@ body.dark-theme .footer a.footer-logo .site-footer__logo--night {
margin: 12px 0;
max-width: none !important;
}
.footer .title-h-left:before {
left: 50%;
transform: translateX(-50%);
}
}
/* Float right buttons shell (kept from prior shell) */
#float-right-btns.float-right,
.float-right {
position: fixed;
right: 16px;
bottom: 60px;
z-index: 1030;
display: flex;
flex-direction: column;
gap: 8px;
}
+270 -223
View File
@@ -1,94 +1,170 @@
<?php
/**
* 站点页脚 — v4.0 Zibll-Inspired
* 站点页脚 — Zibll template_1 shell
*
* 新增功能:
* - 浮动右侧按钮组(回到顶部、主题切换、联系方式等)
* - 移动端底部 Tab 栏(首页/分类/用户/更多)
* - 文章页专用底部栏(点赞/收藏/分享/评论)
* - 统一消费 window.aksrtData 全局配置对象
* 主内容区对齐 zibll `zib_footer_con` 契约;浮动按钮与移动端 tabbar 保留。
*
* @package AKSRT
* @version 4.0.0
* @version 4.1.0
*/
defined('ABSPATH') || exit;
// 数据准备
$blog_name = function_exists('aksrt_get_site_logo_text') ? aksrt_get_site_logo_text() : get_bloginfo('name');
$blog_description = get_bloginfo('description', 'display');
$has_settings = class_exists('AKSRT_Settings');
$search_placeholder = function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索', 'aksrt');
$search_hot_keywords = function_exists('aksrt_get_search_hot_keywords') ? aksrt_get_search_hot_keywords() : [];
$search_history_enabled = function_exists('aksrt_search_history_enabled') ? aksrt_search_history_enabled() : true;
$search_suggest_enabled = function_exists('aksrt_search_suggestions_enabled') ? aksrt_search_suggestions_enabled() : false;
// 联系图标 / 社交链接
// 联系图标 / 社交链接(legacy contacts list — fallback for more icons)
$footer_contacts = $has_settings ? AKSRT_Settings::get_footer_contacts() : [];
if (empty($footer_contacts) && function_exists('aksrt_get_about_info')) {
$about = aksrt_get_about_info();
$footer_contacts = $about['contacts'] ?? [];
}
// 友情链接
$friend_links = aksrt_get_friend_links();
// 友情链接 / 快速链接(仅当 fcode_t2_code_1 为空时回退)
$friend_links = function_exists('aksrt_get_friend_links') ? aksrt_get_friend_links() : [];
$quick_links = $has_settings ? AKSRT_Settings::get_quick_links() : [];
$more_links = $has_settings ? AKSRT_Settings::get_more_links() : [];
$hot_cat_count = $has_settings ? AKSRT_Settings::get_hot_categories_count() : 0;
// 快速链接
$quick_links = $has_settings ? AKSRT_Settings::get_quick_links() : [];
// 更多链接
$more_links = $has_settings ? AKSRT_Settings::get_more_links() : [];
// 热门分类数量
$hot_cat_count = $has_settings ? AKSRT_Settings::get_hot_categories_count() : 5;
// 备案信息(统一 page-display footer schema + 全局设置)
// 备案 / 版权(customize 为空时回退)
$filing = $has_settings ? AKSRT_Settings::get_filing_settings() : ['icp_enabled' => true, 'icp_number' => '', 'police_enabled' => true, 'police_number' => ''];
$icp_number = $filing['icp_enabled'] ? $filing['icp_number'] : '';
$police_number = $filing['police_enabled'] ? $filing['police_number'] : '';
$footer_text = $has_settings ? AKSRT_Settings::footer_text() : '';
// 版权文案
$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::footer_text() : '';
$copyright_text = $has_settings ? AKSRT_Settings::get_copyright_text() : '';
// 页脚布局模板
$footer_layout = $has_settings ? AKSRT_Settings::get_footer_layout_template() : 'default';
// §2.3 三列结构化字段
$footer_brand = $has_settings ? AKSRT_Settings::get_footer_brand_settings() : ['m_s' => ['pc', 'mobile'], 'img' => '', 'img_dark' => '', 'title' => '', 'custom_code' => ''];
$footer_contact_ext = $has_settings ? AKSRT_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::get_footer_mini_img_settings() : ['m_s' => ['pc', 'mobile'], 'items' => []];
// §2.3 三列结构化字段(Zibll keys)
$footer_brand = $has_settings ? AKSRT_Settings::get_footer_brand_settings() : ['m_s' => ['pc', 'mobile'], 'img' => '', 'img_dark' => '', 'title' => '', 'custom_code' => ''];
$footer_contact_ext = $has_settings ? AKSRT_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::get_footer_mini_img_settings() : ['m_s' => ['pc', 'mobile'], 'items' => []];
$footer_customize_code = $has_settings ? AKSRT_Settings::get_footer_customize_code() : '';
// 品牌列设备可见性
$_brand_show_pc = in_array('pc', $footer_brand['m_s'], true);
$_brand_show_sm = in_array('mobile', $footer_brand['m_s'], true);
$_brand_vis_cls = '';
if ($_brand_show_pc && !$_brand_show_sm) $_brand_vis_cls = ' hide-on-mobile';
elseif (!$_brand_show_pc && $_brand_show_sm) $_brand_vis_cls = ' hide-on-desktop';
// 联系区设备可见性
$_contact_show_pc = in_array('pc', $footer_contact_ext['m_s'], true);
$_contact_show_sm = in_array('mobile', $footer_contact_ext['m_s'], true);
$_contact_vis_cls = '';
if ($_contact_show_pc && !$_contact_show_sm) $_contact_vis_cls = ' hide-on-mobile';
elseif (!$_contact_show_pc && $_contact_show_sm) $_contact_vis_cls = ' hide-on-desktop';
// 二维码组设备可见性
$_mini_show_pc = in_array('pc', $footer_mini['m_s'], true);
$_mini_show_sm = in_array('mobile', $footer_mini['m_s'], true);
$_mini_vis_cls = '';
if ($_mini_show_pc && !$_mini_show_sm) $_mini_vis_cls = ' hide-on-mobile';
elseif (!$_mini_show_pc && $_mini_show_sm) $_mini_vis_cls = ' hide-on-desktop';
// 设备可见性 → 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 = function ($raw) {
if (empty($raw)) return '#';
if (strpos($raw, 'http') === 0) return esc_url($raw);
$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[] = '<a href="' . esc_url($url) . '">' . esc_html($label) . '</a>';
}
}
foreach ((array) $more_links as $ml) {
$label = $ml['name'] ?? $ml['label'] ?? '';
$url = $render_link_url($ml['url'] ?? '');
if ($label !== '') {
$link_bits[] = '<a href="' . esc_url($url) . '">' . esc_html($label) . '</a>';
}
}
foreach ((array) $friend_links as $fl) {
$label = $fl['name'] ?? '';
$url = $fl['url'] ?? '#';
if ($label !== '') {
$link_bits[] = '<a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($label) . '</a>';
}
}
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[] = '<a href="' . esc_url(get_category_link($hc->term_id)) . '">' . esc_html($hc->name) . '</a>';
}
}
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[] = '<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($icp_number) . '</a>';
}
if ($police_number !== '') {
$footer_bits[] = '<a href="https://beian.mps.gov.cn/" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($police_number) . '</a>';
}
$copy = '&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);
}
?>
<?php if (is_active_sidebar('single_bottom_fluid') && is_singular()) : ?>
@@ -103,127 +179,104 @@ $render_link_url = function ($raw) {
</div>
<?php endif; ?>
<footer class="footer site-footer site-footer--<?php echo esc_attr($footer_layout); ?>" data-aksrt-shell="site-footer" role="contentinfo">
<footer class="footer" data-aksrt-shell="site-footer" role="contentinfo">
<?php if (is_active_sidebar('all_footer')) : ?>
<div class="site-footer__widgets">
<?php dynamic_sidebar('all_footer'); ?>
</div>
<?php endif; ?>
<?php
$_has_brand = !empty($footer_brand['img']) || !empty($footer_brand['title']) || !empty($footer_brand['custom_code']) || $blog_description !== '';
$_has_contact = !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 = !empty($quick_links) || !empty($more_links) || !empty($friend_links);
$_has_mini = !empty($footer_mini['items']);
$_has_cols = $_has_brand || $_has_contact || $_has_links || $_has_mini || $hot_cat_count > 0;
?>
<div class="container-fluid container-footer">
<?php if ($_has_cols) : ?>
<ul class="list-inline footer-template-1">
<li class="footer-col footer-col--brand<?php echo esc_attr($_brand_vis_cls); ?>" style="max-width:300px;">
<?php if (!empty($footer_brand['img'])) : ?>
<ul class="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); ?>">
<img class="site-footer__logo site-footer__logo--day footer-logo-img" src="<?php echo esc_url($footer_brand['img']); ?>" alt="<?php echo esc_attr($blog_name); ?>" style="height:40px;width:auto;">
<?php if (!empty($footer_brand['img_dark'])) : ?>
<img class="site-footer__logo site-footer__logo--night footer-logo-img" src="<?php echo esc_url($footer_brand['img_dark']); ?>" alt="<?php echo esc_attr($blog_name); ?>" style="height:40px;width:auto;">
<?php endif; ?>
<?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 site-footer__title"><?php echo esc_html($footer_brand['title']); ?></p>
<?php endif; ?>
<?php if ($blog_description !== '') : ?>
<div class="footer-muted em09 site-footer__desc"><?php echo esc_html($blog_description); ?></div>
<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 site-footer__brand-code"><?php echo wp_kses_post($footer_brand['custom_code']); ?></div>
<div class="footer-muted em09"><?php echo wp_kses_post($footer_brand['custom_code']); ?></div>
<?php endif; ?>
</li>
<?php endif; ?>
<li class="footer-col footer-col--links" style="max-width:550px;">
<?php
$link_bits = [];
foreach ((array) $quick_links as $ql) {
$label = $ql['name'] ?? $ql['label'] ?? '';
$url = $render_link_url($ql['url'] ?? '');
if ($label !== '') {
$link_bits[] = '<a href="' . esc_url($url) . '">' . esc_html($label) . '</a>';
}
}
foreach ((array) $more_links as $ml) {
$label = $ml['name'] ?? $ml['label'] ?? '';
$url = $render_link_url($ml['url'] ?? '');
if ($label !== '') {
$link_bits[] = '<a href="' . esc_url($url) . '">' . esc_html($label) . '</a>';
}
}
foreach ((array) $friend_links as $fl) {
$label = $fl['name'] ?? '';
$url = $fl['url'] ?? '#';
if ($label !== '') {
$link_bits[] = '<a href="' . esc_url($url) . '" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($label) . '</a>';
}
}
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[] = '<a href="' . esc_url(get_category_link($hc->term_id)) . '">' . esc_html($hc->name) . '</a>';
}
}
if (!empty($link_bits)) :
?>
<p class="fcode-links"><?php echo implode(' ', $link_bits); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php if ($_has_links_col) : ?>
<li style="max-width: 550px;">
<?php if ($_fcode_links !== '') : ?>
<p class="fcode-links"><?php
if ($_fcode_links_is_raw) {
echo wp_kses_post($_fcode_links);
} else {
echo $_fcode_links; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built with esc_* above
}
?></p>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['code_1'])) : ?>
<div class="footer-muted em09"><?php echo wp_kses_post($footer_contact_ext['code_1']); ?></div>
<?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; ?>
<div class="footer-contact mt10<?php echo esc_attr($_contact_vis_cls); ?>">
<?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 footer-contact__item" href="javascript:;" title="<?php esc_attr_e('微信', 'aksrt'); ?>">
<a class="toggle-radius hover-show nowave" href="javascript:;" title="<?php esc_attr_e('微信', 'aksrt'); ?>">
<i class="fab fa-weixin" aria-hidden="true"></i>
<span class="hover-show-con footer-wechat-img">
<img height="100" src="<?php echo esc_url($footer_contact_ext['wechat_img']); ?>" alt="<?php esc_attr_e('微信', 'aksrt'); ?>">
</span>
<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 footer-contact__item" 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'); ?>">
<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="fab fa-qq" aria-hidden="true"></i>
</a>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['weibo'])) : ?>
<a class="toggle-radius footer-contact__item" target="_blank" rel="noopener noreferrer" title="<?php esc_attr_e('微博', 'aksrt'); ?>" href="<?php echo esc_url($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="fab fa-weibo" aria-hidden="true"></i>
</a>
<?php endif; ?>
<?php if (!empty($footer_contact_ext['email'])) : ?>
<a class="toggle-radius footer-contact__item" title="<?php esc_attr_e('邮箱', 'aksrt'); ?>" href="<?php echo esc_url('mailto:' . $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="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_svg = ($m_icon !== '' && function_exists('aksrt_inline_svg')) ? aksrt_inline_svg($m_icon) : '';
$m_icon_html = $m_svg !== '' ? $m_svg : '<i class="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; ?>
<?php foreach ((array) $footer_contacts as $contact) :
$c_icon = $contact['icon'] ?? '';
$c_url = $contact['url'] ?? '#';
$c_label = $contact['title'] ?? ($contact['label'] ?? (function_exists('aksrt_icon_key_to_name') ? aksrt_icon_key_to_name($c_icon) : ''));
$c_svg = function_exists('aksrt_inline_svg') ? aksrt_inline_svg($c_icon) : '';
?>
<a class="toggle-radius footer-contact__item" href="<?php echo esc_url($c_url); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr($c_label); ?>" aria-label="<?php echo esc_attr($c_label); ?>">
$c_icon = $contact['icon'] ?? '';
$c_url = $contact['url'] ?? '#';
$c_label = $contact['title'] ?? ($contact['label'] ?? (function_exists('aksrt_icon_key_to_name') ? aksrt_icon_key_to_name($c_icon) : ''));
$c_svg = function_exists('aksrt_inline_svg') ? aksrt_inline_svg($c_icon) : '';
?>
<a class="toggle-radius" href="<?php echo esc_url($c_url); ?>" target="_blank" rel="noopener noreferrer" title="<?php echo esc_attr($c_label); ?>" aria-label="<?php echo esc_attr($c_label); ?>">
<?php if ($c_svg !== '') : ?>
<?php echo $c_svg; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
@@ -232,17 +285,25 @@ $render_link_url = function ($raw) {
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
</li>
<?php endif; ?>
<?php if ($_has_mini) : ?>
<li class="footer-col footer-col--mini<?php echo esc_attr($_mini_vis_cls); ?>">
<?php foreach ($footer_mini['items'] as $mi) : ?>
<div class="footer-miniimg">
<?php if (!empty($mi['img'])) : ?>
<img src="<?php echo esc_url($mi['img']); ?>" alt="<?php echo esc_attr($mi['label'] ?? ''); ?>" width="90" height="90" loading="lazy">
<?php endif; ?>
<?php if (!empty($mi['label'])) : ?>
<div class="em09 footer-muted"><?php echo esc_html($mi['label']); ?></div>
<li class="<?php echo esc_attr(trim($_mini_xs_cls)); ?>">
<?php foreach ($footer_mini['items'] as $mi) :
$mi_img = (string) ($mi['img'] ?? $mi['image'] ?? '');
$mi_text = (string) ($mi['text'] ?? $mi['label'] ?? '');
if ($mi_img === '') {
continue;
}
?>
<div class="footer-miniimg"<?php echo $mi_text !== '' ? ' title="' . esc_attr($mi_text) . '"' : ''; ?>>
<p>
<img src="<?php echo esc_url($mi_img); ?>" alt="<?php echo esc_attr($mi_text !== '' ? $mi_text : $blog_name); ?>" loading="lazy">
</p>
<?php if ($mi_text !== '') : ?>
<span class="opacity8 em09"><?php echo esc_html($mi_text); ?></span>
<?php endif; ?>
</div>
<?php endforeach; ?>
@@ -251,31 +312,9 @@ $render_link_url = function ($raw) {
</ul>
<?php endif; ?>
<?php
$footer_bits = [];
if (!empty($icp_number)) {
$footer_bits[] = '<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($icp_number) . '</a>';
}
if (!empty($police_number)) {
$footer_bits[] = '<a href="https://beian.mps.gov.cn/" target="_blank" rel="noopener noreferrer nofollow">' . esc_html($police_number) . '</a>';
}
$copy = '&copy; ' . esc_html(gmdate('Y')) . ' ' . esc_html($blog_name) . '.';
if (!empty($copyright_text)) {
$copy .= ' ' . wp_kses_post($copyright_text);
} else {
$copy .= ' ' . esc_html__('由 WordPress 强力驱动。', 'aksrt');
}
if ($footer_text !== '') {
$copy .= ' ' . esc_html($footer_text);
}
if (!empty($footer_bits)) {
$copy .= ' ' . implode(' · ', $footer_bits);
}
if (!empty($footer_customize_code)) {
$copy .= ' ' . wp_kses_post($footer_customize_code);
}
?>
<p class="footer-conter site-footer__copyright"><?php echo $copy; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php if ($_footer_conter !== '') : ?>
<p class="footer-conter"><?php echo $_footer_conter; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<?php endif; ?>
</div>
</footer>
@@ -314,41 +353,49 @@ if ($floating_enabled) :
?>
<div id="float-right-btns" class="<?php echo esc_attr($floating_classes); ?>">
<?php foreach ($floating_items as $item) :
$item_type = $item['type'] ?? 'custom';
$item_icon = $item['icon'] ?? 'fas fa-circle';
$item_text = $item['text'] ?? '';
$item_url = $item['link'] ?? '#';
$item_target = !empty($item['new_window']) ? ' target="_blank" rel="noopener noreferrer"' : '';
$item_color = $item['color'] ?? '';
$item_bg = $item['bg'] ?? '';
$pc_show = $item['pc_s'] ?? true;
$m_show = $item['m_s'] ?? true;
$item_type = $item['type'] ?? 'custom';
$item_icon = $item['icon'] ?? 'fas fa-circle';
$item_text = $item['text'] ?? '';
$item_url = $item['link'] ?? '#';
$item_target = !empty($item['new_window']) ? ' target="_blank" rel="noopener noreferrer"' : '';
$item_color = $item['color'] ?? '';
$item_bg = $item['bg'] ?? '';
$pc_show = $item['pc_s'] ?? true;
$m_show = $item['m_s'] ?? true;
$item_class = 'float-btn';
$inline_styles = [];
if ($item_color !== '') { $inline_styles[] = '--this-color:' . esc_attr($item_color); }
if ($item_bg !== '') { $inline_styles[] = '--this-bg:' . esc_attr($item_bg); }
if (!$pc_show) { $item_class .= ' hide-on-pc'; }
if (!$m_show) { $item_class .= ' hide-on-mobile'; }
$style_attr = $inline_styles ? ' style="' . implode(';', $inline_styles) . '"' : '';
$item_class = 'float-btn';
$inline_styles = [];
if ($item_color !== '') {
$inline_styles[] = '--this-color:' . esc_attr($item_color);
}
if ($item_bg !== '') {
$inline_styles[] = '--this-bg:' . esc_attr($item_bg);
}
if (!$pc_show) {
$item_class .= ' hide-on-pc';
}
if (!$m_show) {
$item_class .= ' hide-on-mobile';
}
$style_attr = $inline_styles ? ' style="' . implode(';', $inline_styles) . '"' : '';
if ($item_type === 'back_top') :
$item_class .= ' ontop';
?>
if ($item_type === 'back_top') :
$item_class .= ' ontop';
?>
<a href="#" class="<?php echo esc_attr($item_class); ?>" id="float-back-to-top" role="button" aria-label="<?php echo esc_attr($item_text ?: __('返回顶部', 'aksrt')); ?>"<?php echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
</a>
<?php elseif ($item_type === 'theme_mode') :
$item_class .= ' theme-toggle-btn';
?>
$item_class .= ' theme-toggle-btn';
?>
<a href="#" class="<?php echo esc_attr($item_class); ?>" role="button" data-action="toggle-theme" aria-label="<?php echo esc_attr($item_text ?: __('切换主题', 'aksrt')); ?>"<?php echo $style_attr; ?>>
<i class="fas fa-sun float-btn__icon-sun" aria-hidden="true"></i>
<i class="fas fa-moon float-btn__icon-moon" aria-hidden="true"></i>
</a>
<?php elseif ($item_type === 'service_wechat') :
$item_class .= ' service-wechat';
$wechat_img = $item['wechat_img'] ?? ($item['qrcode_img'] ?? '');
?>
$item_class .= ' service-wechat';
$wechat_img = $item['wechat_img'] ?? ($item['qrcode_img'] ?? '');
?>
<a href="#" class="<?php echo esc_attr($item_class); ?>" role="button" aria-label="<?php echo esc_attr($item_text ?: __('微信', 'aksrt')); ?>"<?php echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
<?php if ($wechat_img) : ?>
@@ -359,10 +406,10 @@ if ($floating_enabled) :
<?php endif; ?>
</a>
<?php elseif ($item_type === 'service_qq') :
$item_class .= ' service-qq';
$qq_number = $item['qq'] ?? '';
$qq_img = $item['qrcode_img'] ?? '';
?>
$item_class .= ' service-qq';
$qq_number = $item['qq'] ?? '';
$qq_img = $item['qrcode_img'] ?? '';
?>
<a href="<?php echo $qq_number ? esc_url('https://wpa.qq.com/msgrd?v=3&uin=' . $qq_number . '&site=qq&menu=yes') : '#'; ?>" class="<?php echo esc_attr($item_class); ?>" role="button"<?php echo $qq_number ? ' target="_blank" rel="noopener noreferrer"' : ''; ?> aria-label="<?php echo esc_attr($item_text ?: 'QQ'); ?>"<?php echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
<?php if ($qq_img || $qq_number) : ?>
@@ -375,19 +422,19 @@ if ($floating_enabled) :
<?php endif; ?>
</a>
<?php elseif ($item_type === 'add') :
$item_class .= ' newadd-btns';
$add_items = is_array($item['add_items'] ?? null) ? $item['add_items'] : [];
?>
$item_class .= ' newadd-btns';
$add_items = is_array($item['add_items'] ?? null) ? $item['add_items'] : [];
?>
<a href="#" class="<?php echo esc_attr($item_class); ?>" role="button" aria-label="<?php echo esc_attr($item_text ?: __('发布', 'aksrt')); ?>"<?php echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
<?php if (!empty($add_items)) : ?>
<div class="hover-show-con">
<div class="float-add-menu">
<?php foreach ($add_items as $sub) :
$sub_url = $sub['url'] ?? '#';
$sub_icon = $sub['icon'] ?? 'fas fa-plus';
$sub_text = $sub['text'] ?? '';
?>
$sub_url = $sub['url'] ?? '#';
$sub_icon = $sub['icon'] ?? 'fas fa-plus';
$sub_text = $sub['text'] ?? '';
?>
<a href="<?php echo esc_url($sub_url); ?>" class="float-add-menu__item">
<i class="<?php echo esc_attr($sub_icon); ?>" aria-hidden="true"></i>
<span><?php echo esc_html($sub_text); ?></span>
@@ -398,8 +445,8 @@ if ($floating_enabled) :
<?php endif; ?>
</a>
<?php elseif ($item_type === 'qrcode') :
$item_class .= ' qrcode-btn';
?>
$item_class .= ' qrcode-btn';
?>
<a href="#" class="<?php echo esc_attr($item_class); ?>" role="button" aria-label="<?php echo esc_attr($item_text ?: __('二维码', 'aksrt')); ?>"<?php echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
<div class="hover-show-con">
@@ -408,9 +455,9 @@ if ($floating_enabled) :
</div>
</a>
<?php else :
$hover_html = $item['hover'] ?? '';
$hover_width = (int) ($item['hover_width'] ?? 200);
?>
$hover_html = $item['hover'] ?? '';
$hover_width = (int) ($item['hover_width'] ?? 200);
?>
<a href="<?php echo esc_url($item_url ?: '#'); ?>" class="<?php echo esc_attr($item_class); ?>"<?php echo $item_target; echo $style_attr; ?>>
<i class="<?php echo esc_attr($item_icon); ?>" aria-hidden="true"></i>
<?php if ($hover_html !== '') : ?>
@@ -428,18 +475,18 @@ if ($floating_enabled) :
<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' : ''; ?>" aria-label="<?php esc_attr_e('底部导航', 'aksrt'); ?>">
<?php 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'] ?? '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('/');
}
?>
$tab_type = sanitize_key((string) ($tab_item['type'] ?? 'custom'));
$tab_text = (string) ($tab_item['text'] ?? '');
$tab_icon = (string) ($tab_item['icon'] ?? '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('/');
}
?>
<a href="<?php echo esc_url($tab_href); ?>" class="tabbar-item" data-type="<?php echo esc_attr($tab_type); ?>">
<i class="<?php echo esc_attr($tab_icon); ?>" aria-hidden="true"></i>
<?php if (!empty($tabbar_settings['show_text'])) : ?><span><?php echo esc_html($tab_text); ?></span><?php endif; ?>
@@ -452,7 +499,7 @@ if ($floating_enabled) :
// Global search panel (desktop header button + mobile tabbar search).
$aksrt_search_panel = AKSRT_DIR . '/templates/parts/search-panel.php';
if (is_readable($aksrt_search_panel)) {
include $aksrt_search_panel;
include $aksrt_search_panel;
}
?>
@@ -448,7 +448,7 @@ class AKSRT_Admin_Global_Controller extends AKSRT_Admin_Controller_Base {
'more_links' => [],
'hot_categories' => 5,
'copyright_text' => '',
'layout_template' => 'default',
'layout_template' => 'template_1',
'footer_t1_m_s' => ['pc', 'mobile'],
'footer_t1_img' => '',
'footer_t1_img_dark' => '',
@@ -477,8 +477,7 @@ class AKSRT_Admin_Global_Controller extends AKSRT_Admin_Controller_Base {
'more_links' => isset($params['more_links']) ? $this->sanitize_link_list($params['more_links']) : [],
'hot_categories' => (int) ($params['hot_categories'] ?? 5),
'copyright_text' => sanitize_textarea_field($params['copyright_text'] ?? ''),
'layout_template' => in_array($params['layout_template'] ?? '', ['default', 'compact', 'centered'], true)
? $params['layout_template'] : 'default',
'layout_template' => 'template_1',
'footer_t1_m_s' => $this->sanitize_device_visibility($params['footer_t1_m_s'] ?? ['pc', 'mobile']),
'footer_t1_img' => esc_url_raw($params['footer_t1_img'] ?? ''),
'footer_t1_img_dark' => esc_url_raw($params['footer_t1_img_dark'] ?? ''),
@@ -450,8 +450,8 @@ class AKSRT_Admin_Schema_Page_Display {
['label' => '移动端', 'value' => 'mobile'],
]],
['key' => 'footer_contact_more', 'label' => '更多联系项', 'type' => 'textarea', 'default' => '', 'help' => 'JSON 数组,每项含 desc/icon/link/img'],
['key' => 'fcode_t2_code_1', 'label' => '联系区上方自定义代码', 'type' => 'textarea', 'default' => ''],
['key' => 'fcode_t2_code_2', 'label' => '联系区下方自定义代码(备案等)', 'type' => 'textarea', 'default' => ''],
['key' => 'fcode_t2_code_1', 'label' => '链接 HTML(fcode_t2_code_1)', 'type' => 'textarea', 'default' => '', 'help' => '直接写 <a> 链接 HTML;为空时回退快速链接/友链/热门分类'],
['key' => 'fcode_t2_code_2', 'label' => '链接下方自定义代码', 'type' => 'textarea', 'default' => '', 'help' => '备案号等 HTML'],
]],
['key' => 'mini_qr', 'title' => '二维码图片组(第三列)', 'fields' => [
['key' => 'footer_mini_img_m_s', 'label' => '显示设备', 'type' => 'checkbox', 'default' => ['pc', 'mobile'], 'options' => [
@@ -65,11 +65,12 @@ trait AKSRT_Settings_Domain_Groups {
*/
public static function get_footer_layout_template(): string {
$footer = self::get_footer_settings();
$template = sanitize_key((string) ($footer['layout_template'] ?? 'default'));
if (!in_array($template, ['default', 'compact', 'centered'], true)) {
$template = 'default';
$template = sanitize_key((string) ($footer['layout_template'] ?? 'template_1'));
// Legacy aliases map onto Zibll template_1 shell.
if (in_array($template, ['default', 'compact', 'centered', 'template_1'], true)) {
return 'template_1';
}
return $template;
return 'template_1';
}
/**
@@ -16,10 +16,10 @@ class AKSRT_Settings_Home_Cms {
'more_links' => [],
'hot_categories' => 5,
'copyright_text' => '',
'layout_template' => 'default',
'layout_template' => 'template_1',
];
$footer = get_option('aksrt_footer_settings', []);
$merged = array_merge($defaults, $footer);
$merged = array_merge($defaults, is_array($footer) ? $footer : []);
$s = AKSRT_Settings::get_all();
$bridge_keys = [
@@ -92,9 +92,26 @@ class AKSRT_Settings_Home_Cms {
public static function get_footer_mini_img_settings(): array {
$f = self::get_footer_settings();
$raw_items = is_array($f['footer_mini_img'] ?? null) ? $f['footer_mini_img'] : [];
$items = [];
foreach ($raw_items as $item) {
if (!is_array($item)) {
continue;
}
$img = (string) ($item['img'] ?? $item['image'] ?? '');
if ($img === '') {
continue;
}
$items[] = [
'img' => $img,
'image' => $img,
'text' => (string) ($item['text'] ?? $item['label'] ?? ''),
'label' => (string) ($item['label'] ?? $item['text'] ?? ''),
];
}
return [
'm_s' => is_array($f['footer_mini_img_m_s'] ?? null) ? $f['footer_mini_img_m_s'] : ['pc', 'mobile'],
'items' => is_array($f['footer_mini_img'] ?? null) ? $f['footer_mini_img'] : [],
'items' => $items,
];
}
+39
View File
@@ -474,6 +474,45 @@ function aksrt_get_site_logo_width(): int {
}
endif;
if (!function_exists('aksrt_get_adaptive_theme_img')):
/**
* Build a single light/dark adaptive image (Zibll white-src/dark-src contract).
*
* theme.js syncThemeImages() swaps src via white-src / dark-src attributes.
*
* @param string $white_src Light mode image URL.
* @param string $dark_src Dark mode image URL.
* @param string $alt Alt text.
* @param string $more Extra attributes (already escaped by caller if needed).
* @return string
*/
function aksrt_get_adaptive_theme_img(string $white_src = '', string $dark_src = '', string $alt = '', string $more = ''): string {
$white_src = trim($white_src);
$dark_src = trim($dark_src);
if ($white_src === '' && $dark_src === '') {
return '';
}
if ($dark_src === '') {
$dark_src = $white_src;
}
if ($white_src === '') {
$white_src = $dark_src;
}
if ($alt === '') {
$alt = get_bloginfo('name');
}
$is_dark = false;
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'initial_theme_mode')) {
$is_dark = AKSRT_Settings::initial_theme_mode() === 'dark';
}
$this_src = $is_dark ? $dark_src : $white_src;
return '<img src="' . esc_url($this_src) . '" white-src="' . esc_url($white_src) . '" dark-src="' . esc_url($dark_src) . '" alt="' . esc_attr($alt) . '"' . ($more !== '' ? ' ' . $more : '') . ' loading="lazy">';
}
endif;
if (!function_exists('aksrt_get_search_placeholder')):
/**
* 获取搜索占位文案