手机底部Tab and 右侧悬浮按钮 settings pages swap their icon text inputs for the shared FaIconPicker (with a new IconValue preview component that renders FA/sprite/custom SVG values in lists and previews). footer.php tabbar/floating/sub-item icons and the VIP float render through aksrt_icon_markup so every stored format displays; GlobalControllerPart1 and the VIP helper drop the FA-only regex gate and sanitize icon values through aksrt_sanitize_icon_value. The picker popover tabs now wrap instead of overflowing, and FA grid previews use style-only classes.
77 lines
2.4 KiB
PHP
77 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Float button commerce types + runtime window._win bridge (legacy parity).
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
if (!function_exists('aksrt_get_float_pay_vip_html')) :
|
|
/**
|
|
* Floating VIP open button.
|
|
*
|
|
* Always opens the site VIP modal for logged-in non-max VIP users
|
|
* (class pay-vip → assets/js/pay-vip.js). Guests get signin-loader.
|
|
* Admin "link/hover" fields are intentionally ignored for this type.
|
|
*/
|
|
function aksrt_get_float_pay_vip_html(array $item = []): string {
|
|
$show_vip = false;
|
|
if (class_exists('\AKSRT\Settings\Settings')) {
|
|
$vs = \AKSRT\Settings\Settings::get_payment_vip_settings();
|
|
$show_vip = !empty($vs['enabled']);
|
|
}
|
|
if (!$show_vip) {
|
|
return '';
|
|
}
|
|
$user_id = get_current_user_id();
|
|
$level = 0;
|
|
if ($user_id > 0 && function_exists('aksrt_get_user_vip_level')) {
|
|
$level = (int) aksrt_get_user_vip_level($user_id);
|
|
}
|
|
// Already top tier — no upsell entry on float rail.
|
|
if ($level >= 2) {
|
|
return '';
|
|
}
|
|
|
|
// Prefer admin title; fallback by upgrade vs open.
|
|
$admin_title = trim((string) ($item['text'] ?? ''));
|
|
if ($admin_title !== '') {
|
|
$title = $admin_title;
|
|
} else {
|
|
$title = $level === 1 ? __('升级会员', 'aksrt') : __('开通会员', 'aksrt');
|
|
}
|
|
|
|
$icon = trim((string) ($item['icon'] ?? ''));
|
|
$icon_html = aksrt_icon_markup($icon);
|
|
if ($icon_html === '') {
|
|
$icon_html = aksrt_icon_markup('fa fas fa-gem');
|
|
}
|
|
|
|
// Logged-in: open modal. Guest: open login.
|
|
$cls = $user_id > 0 ? 'float-btn pay-vip nowave' : 'float-btn signin-loader nowave';
|
|
$style = [];
|
|
if (!empty($item['color'])) {
|
|
$style[] = '--this-color:' . esc_attr((string) $item['color']);
|
|
}
|
|
if (!empty($item['bg'])) {
|
|
$style[] = '--this-bg:' . esc_attr((string) $item['bg']);
|
|
}
|
|
// Default VIP accent when admin left color empty.
|
|
if (empty($item['color'])) {
|
|
$style[] = '--this-color:#f5a623';
|
|
}
|
|
$style_attr = $style ? ' style="' . implode(';', $style) . '"' : '';
|
|
|
|
// Prefer upgrading one tier when already VIP1.
|
|
$target_level = $user_id > 0 ? max(1, min(2, $level + 1)) : 1;
|
|
$vip_level_attr = $user_id > 0
|
|
? ' vip-level="' . esc_attr((string) $target_level) . '" data-vip-level="' . esc_attr((string) $target_level) . '"'
|
|
: '';
|
|
|
|
return '<a class="' . esc_attr($cls) . '" href="javascript:;" role="button" aria-label="' . esc_attr($title) . '" title="' . esc_attr($title) . '"' . $style_attr . $vip_level_attr . '>'
|
|
. $icon_html
|
|
. '</a>';
|
|
}
|
|
endif;
|