feat(icons): wire the universal picker into tabbar/floating settings and keep customsvg through their save paths

手机底部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.
This commit is contained in:
2026-09-06 14:27:49 +08:00
parent d89752d543
commit 70cba11fb7
8 changed files with 96 additions and 63 deletions
+7 -10
View File
@@ -56,7 +56,7 @@ trait GlobalControllerPart1 {
if (!empty($item['add_items']) && is_array($item['add_items'])) {
foreach ($item['add_items'] as $sub_item) {
$label = sanitize_text_field($sub_item['label'] ?? '');
$icon = sanitize_text_field($sub_item['icon'] ?? 'fa fas fa-pen');
$icon = aksrt_sanitize_icon_value((string) ($sub_item['icon'] ?? 'fa fas fa-pen'));
$url = esc_url_raw($sub_item['url'] ?? '');
if ($label === '') {
continue;
@@ -73,7 +73,7 @@ trait GlobalControllerPart1 {
return [
'id' => sanitize_text_field($item['id'] ?? uniqid('tab_')),
'type' => $type,
'icon' => sanitize_text_field($item['icon'] ?? ''),
'icon' => aksrt_sanitize_icon_value((string) ($item['icon'] ?? '')),
'text' => sanitize_text_field($item['text'] ?? ''),
'link' => esc_url_raw($item['link'] ?? ''),
'badge' => sanitize_text_field($item['badge'] ?? ''),
@@ -220,7 +220,7 @@ trait GlobalControllerPart1 {
}
$label = sanitize_text_field($add_item['label'] ?? '');
$url = esc_url_raw($add_item['url'] ?? '');
$icon_item = sanitize_text_field($add_item['icon'] ?? '');
$icon_item = aksrt_sanitize_icon_value((string) ($add_item['icon'] ?? ''));
if ($label === '' && $url === '') {
continue;
}
@@ -233,9 +233,9 @@ trait GlobalControllerPart1 {
}
}
$icon = sanitize_text_field($item['icon'] ?? '');
$icon_dark = sanitize_text_field($item['icon_dark'] ?? '');
$icon_light = sanitize_text_field($item['icon_light'] ?? '');
$icon = aksrt_sanitize_icon_value((string) ($item['icon'] ?? ''));
$icon_dark = aksrt_sanitize_icon_value((string) ($item['icon_dark'] ?? ''));
$icon_light = aksrt_sanitize_icon_value((string) ($item['icon_light'] ?? ''));
if ($type === 'theme_mode') {
$icon = 'fa fas fa-sun';
$icon_dark = '';
@@ -247,12 +247,9 @@ trait GlobalControllerPart1 {
if ($type === 'pay_vip') {
$link = '';
$hover = '';
if ($icon === '' || str_contains($icon, 'fa-gem') || $icon === 'fa fas fa-gem') {
if ($icon === '' || str_contains($icon, 'fa-gem')) {
$icon = 'fa fas fa-gem';
}
if (!preg_match('/^fa\s+(?:fas|far|fab)\s+fa-[a-z0-9-]+(?:\s+fa-[a-z0-9-]+)*$/i', $icon)) {
$icon = 'fa fas fa-gem';
}
}
return [