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
This commit is contained in:
1 parent
7f60071460
commit
6f2adfaef1
32 files changed
+1338
-3111
No files matched your search
+1
-159
@@ -195,171 +195,13 @@ $_footer_conter = wp_kses_post(trim((string) $footer_customize_code));
|
||||
</footer>
|
||||
|
||||
|
||||
<!-- 浮动右侧按钮组 -->
|
||||
<?php
|
||||
$floating_settings = $has_settings ? \AKSRT\Settings\Settings::get_floating_buttons_settings() : [];
|
||||
$floating_items = $has_settings ? \AKSRT\Settings\Settings::get_floating_buttons_items() : [];
|
||||
// 右侧悬浮按钮由 aksrt_float_right() 挂 wp_footer 输出(inc/helpers/aksrt-float-buttons.php)。
|
||||
$aksrt_hide_chrome = is_page_template('templates/pages/page-submit.php');
|
||||
$floating_enabled = !$aksrt_hide_chrome && !empty($floating_settings['enabled']) && !empty($floating_items);
|
||||
$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);
|
||||
$floating_classes = 'float-right';
|
||||
$floating_classes .= ' ' . (!empty($floating_settings['style']) ? sanitize_html_class($floating_settings['style']) : 'round');
|
||||
$floating_classes .= !empty($floating_settings['position']) && $floating_settings['position'] === 'center' ? ' position-center' : ' position-bottom';
|
||||
if (!empty($floating_settings['scroll_hide'])) {
|
||||
$floating_classes .= ' scrolling-hide';
|
||||
}
|
||||
if (!empty($floating_settings['scroll_down_hide'])) {
|
||||
$floating_classes .= ' scroll-down-hide';
|
||||
}
|
||||
if (empty($floating_settings['shadow'])) {
|
||||
$floating_classes .= ' no-shadow';
|
||||
}
|
||||
if (empty($floating_settings['animation'])) {
|
||||
$floating_classes .= ' no-animation';
|
||||
}
|
||||
$float_blur = is_array($floating_settings['filter_blur'] ?? null) ? $floating_settings['filter_blur'] : [];
|
||||
if (in_array('pc', $float_blur, true)) {
|
||||
$floating_classes .= ' has-blur-pc';
|
||||
}
|
||||
if (in_array('mobile', $float_blur, true)) {
|
||||
$floating_classes .= ' has-blur-mobile';
|
||||
}
|
||||
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'] ?? 'fa 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) . '"' : '';
|
||||
|
||||
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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
</a>
|
||||
<?php elseif ($item_type === 'theme_mode') :
|
||||
$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="fa fas fa-sun float-btn__icon-sun" aria-hidden="true"></i>
|
||||
<i class="fa fas fa-moon float-btn__icon-moon" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php elseif ($item_type === 'pay_vip') :
|
||||
$vip_html = function_exists('aksrt_get_float_pay_vip_html') ? aksrt_get_float_pay_vip_html($item) : '';
|
||||
if ($vip_html !== '') {
|
||||
echo $vip_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
?>
|
||||
<?php elseif ($item_type === 'service_wechat') :
|
||||
$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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
<?php if ($wechat_img) : ?>
|
||||
<div class="hover-show-con">
|
||||
<img src="<?php echo esc_url($wechat_img); ?>" alt="<?php esc_attr_e('微信二维码', 'aksrt'); ?>">
|
||||
<?php if ($item_text !== '') : ?><p><?php echo esc_html($item_text); ?></p><?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php elseif ($item_type === 'service_qq') :
|
||||
$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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
<?php if ($qq_img || $qq_number) : ?>
|
||||
<div class="hover-show-con">
|
||||
<?php if ($qq_img) : ?>
|
||||
<img src="<?php echo esc_url($qq_img); ?>" alt="QQ">
|
||||
<?php endif; ?>
|
||||
<?php if ($qq_number) : ?><p>QQ: <?php echo esc_html($qq_number); ?></p><?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php elseif ($item_type === 'add') :
|
||||
$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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
<?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'] ?? 'fa fas fa-plus';
|
||||
$sub_text = $sub['text'] ?? '';
|
||||
?>
|
||||
<a href="<?php echo esc_url($sub_url); ?>" class="float-add-menu__item">
|
||||
<?php echo aksrt_icon_markup((string) $sub_icon); // pre-escaped ?>
|
||||
<span><?php echo esc_html($sub_text); ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php elseif ($item_type === 'qrcode') :
|
||||
$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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
<div class="hover-show-con">
|
||||
<div
|
||||
class="qrcode float-btn-qrcode"
|
||||
data-qrcode="<?php echo esc_attr(get_permalink() ?: home_url('/')); ?>"
|
||||
data-size="120"
|
||||
></div>
|
||||
<?php if ($item_text !== '') : ?><p class="float-btn-qrcode__title"><?php echo esc_html($item_text); ?></p><?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php else :
|
||||
$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; ?>>
|
||||
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||
<?php if ($hover_html !== '') : ?>
|
||||
<div class="hover-show-con"<?php echo $hover_width !== 200 ? ' style="min-width:' . (int) $hover_width . 'px"' : ''; ?>>
|
||||
<div class="float-right__html"><?php echo wp_kses_post($hover_html); ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach;
|
||||
// After loop: inject missing shop cart once. Never auto-inject pay_vip
|
||||
// (admin may already add one; previous in-loop inject created duplicates).
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($tabbar_enabled) :
|
||||
$tabbar_use_single_extend = function_exists('aksrt_should_use_footer_tabbar_single_extend')
|
||||
|
||||
Reference in new issue
Block a user