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:
1 parent
d89752d543
commit
70cba11fb7
8 files changed
+96
-63
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="aksrt-fa-icon-picker">
|
<div class="aksrt-fa-icon-picker">
|
||||||
<n-popover trigger="click" placement="bottom-start" :width="400" :style="{ padding: 0 }">
|
<n-popover trigger="click" placement="bottom-start" :width="460" :style="{ padding: 0 }">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-input
|
<n-input
|
||||||
:value="modelValue"
|
:value="modelValue"
|
||||||
@@ -10,20 +10,8 @@
|
|||||||
@clear="$emit('update:modelValue', '')"
|
@clear="$emit('update:modelValue', '')"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<!-- FA value -->
|
<IconValue v-if="modelValue" :value="modelValue" />
|
||||||
<FaIcon v-if="isFaValue(modelValue)" :icon="modelValue" />
|
<template v-else></template>
|
||||||
<!-- Built-in sprite value -->
|
|
||||||
<span
|
|
||||||
v-else-if="isZibsvgValue(modelValue)"
|
|
||||||
class="aksrt-icon-picker__preview-svg"
|
|
||||||
v-html="zibsvgMarkup(modelValue)"
|
|
||||||
></span>
|
|
||||||
<!-- Inline custom SVG value -->
|
|
||||||
<span
|
|
||||||
v-else-if="isCustomSvgValue(modelValue)"
|
|
||||||
class="aksrt-icon-picker__preview-svg"
|
|
||||||
v-html="cleanSvg(modelValue.slice(10))"
|
|
||||||
></span>
|
|
||||||
</template>
|
</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<FaIcon icon="fa fas fa-chevron-down" :size="12" />
|
<FaIcon icon="fa fas fa-chevron-down" :size="12" />
|
||||||
@@ -80,7 +68,7 @@
|
|||||||
:title="icon"
|
:title="icon"
|
||||||
@click="selectIcon(icon)"
|
@click="selectIcon(icon)"
|
||||||
>
|
>
|
||||||
<i v-if="activeGroup.type === 'fa'" :class="['fa', activeTab, icon]"></i>
|
<i v-if="activeGroup.type === 'fa'" :class="[activeTab, icon]"></i>
|
||||||
<span
|
<span
|
||||||
v-else
|
v-else
|
||||||
class="aksrt-icon-picker__preview-svg"
|
class="aksrt-icon-picker__preview-svg"
|
||||||
@@ -104,12 +92,10 @@
|
|||||||
*/
|
*/
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import FaIcon from './FaIcon.vue'
|
import FaIcon from './FaIcon.vue'
|
||||||
|
import IconValue from './IconValue.vue'
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
import {
|
import {
|
||||||
cleanSvg,
|
cleanSvg,
|
||||||
isFaValue,
|
|
||||||
isZibsvgValue,
|
|
||||||
isCustomSvgValue,
|
|
||||||
zibsvgMarkup,
|
zibsvgMarkup,
|
||||||
composeIconValue,
|
composeIconValue,
|
||||||
} from '@/utils/icons.js'
|
} from '@/utils/icons.js'
|
||||||
@@ -184,6 +170,10 @@ onMounted(async () => {
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aksrt-icon-picker__tabs :deep(.n-radio-group) {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.aksrt-icon-picker__grid {
|
.aksrt-icon-picker__grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(8, 1fr);
|
grid-template-columns: repeat(8, 1fr);
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<template>
|
||||||
|
<!-- FA class value -->
|
||||||
|
<i v-if="isFaValue(value)" :class="faClass" aria-hidden="true"></i>
|
||||||
|
<!-- Built-in sprite value -->
|
||||||
|
<span
|
||||||
|
v-else-if="isZibsvgValue(value)"
|
||||||
|
class="aksrt-icon-value__svg"
|
||||||
|
v-html="zibsvgMarkup(value)"
|
||||||
|
></span>
|
||||||
|
<!-- Inline custom SVG value -->
|
||||||
|
<span
|
||||||
|
v-else-if="isCustomSvgValue(value)"
|
||||||
|
class="aksrt-icon-value__svg"
|
||||||
|
v-html="cleanSvg(value.slice(10))"
|
||||||
|
></span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
/**
|
||||||
|
* IconValue — renders any icon-picker value ("fa fas fa-x", "zibsvg-key",
|
||||||
|
* "customsvg-<svg>") as inline preview markup.
|
||||||
|
*/
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { cleanSvg, isFaValue, isZibsvgValue, isCustomSvgValue, zibsvgMarkup } from '@/utils/icons.js'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
value: { type: String, default: '' },
|
||||||
|
})
|
||||||
|
|
||||||
|
const faClass = computed(() => {
|
||||||
|
const raw = String(props.value || '').trim()
|
||||||
|
if (raw.startsWith('fa-')) return `fa fas ${raw}`
|
||||||
|
return raw
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.aksrt-icon-value__svg {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-icon-value__svg :deep(svg),
|
||||||
|
.aksrt-icon-value__svg svg {
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
fill: currentColor;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
<i class="fa fas fa-bars"></i>
|
<i class="fa fas fa-bars"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="float-btn-sort__icon">
|
<span class="float-btn-sort__icon">
|
||||||
<i v-if="element.icon" :class="element.icon"></i>
|
<IconValue v-if="element.icon" :value="element.icon" />
|
||||||
</span>
|
</span>
|
||||||
<div class="float-btn-sort__meta">
|
<div class="float-btn-sort__meta">
|
||||||
<div class="float-btn-sort__title-row">
|
<div class="float-btn-sort__title-row">
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
<n-select v-model:value="editingItem.type" :options="typeOptions" placeholder="选择按钮类型" @update:value="handleTypeChange" />
|
<n-select v-model:value="editingItem.type" :options="typeOptions" placeholder="选择按钮类型" @update:value="handleTypeChange" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi v-if="editingItem.type !== 'theme_mode'" label="主图标 (Font Awesome)">
|
<n-form-item-gi v-if="editingItem.type !== 'theme_mode'" label="主图标 (Font Awesome)">
|
||||||
<n-input v-model:value="editingItem.icon" placeholder="例如: fa fas fa-home" />
|
<FaIconPicker v-model:value="editingItem.icon" placeholder="选择图标" />
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
<n-form-item-gi v-else label="主题图标">
|
<n-form-item-gi v-else label="主题图标">
|
||||||
<div class="theme-icon-preview">
|
<div class="theme-icon-preview">
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
<template v-if="editingItem.type === 'theme_mode'">
|
<template v-if="editingItem.type === 'theme_mode'">
|
||||||
<span class="theme-icon-preview-inline"><i class="fa fas fa-sun"></i> / <i class="fa fas fa-moon"></i></span>
|
<span class="theme-icon-preview-inline"><i class="fa fas fa-sun"></i> / <i class="fa fas fa-moon"></i></span>
|
||||||
</template>
|
</template>
|
||||||
<i v-else-if="editingItem.icon" :class="editingItem.icon" style="font-size: 18px;"></i>
|
<IconValue v-else-if="editingItem.icon" :value="editingItem.icon" style="font-size: 18px;" />
|
||||||
<span v-else class="muted-text">未设置图标</span>
|
<span v-else class="muted-text">未设置图标</span>
|
||||||
<a href="https://fontawesome.com/search?m=free" target="_blank" rel="noopener">
|
<a href="https://fontawesome.com/search?m=free" target="_blank" rel="noopener">
|
||||||
<i class="fa fas fa-external-link-alt"></i>
|
<i class="fa fas fa-external-link-alt"></i>
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
<i class="fa fas fa-bars"></i>
|
<i class="fa fas fa-bars"></i>
|
||||||
</button>
|
</button>
|
||||||
<n-input v-model:value="element.label" placeholder="名称,例如: 写文章" />
|
<n-input v-model:value="element.label" placeholder="名称,例如: 写文章" />
|
||||||
<n-input v-model:value="element.icon" placeholder="图标,例如: fa fas fa-pen" />
|
<FaIconPicker v-model:value="element.icon" placeholder="选择图标" />
|
||||||
<n-input v-model:value="element.url" placeholder="链接,例如: /submit" />
|
<n-input v-model:value="element.url" placeholder="链接,例如: /submit" />
|
||||||
<n-button quaternary type="error" @click="removeAddItem(subIndex)">
|
<n-button quaternary type="error" @click="removeAddItem(subIndex)">
|
||||||
<template #icon><i class="fa fas fa-trash-alt" /></template>
|
<template #icon><i class="fa fas fa-trash-alt" /></template>
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
<div class="add-items-preview__panel add-items-preview__panel--light">
|
<div class="add-items-preview__panel add-items-preview__panel--light">
|
||||||
<div class="add-items-preview__mode">亮色</div>
|
<div class="add-items-preview__mode">亮色</div>
|
||||||
<div class="add-items-preview__trigger">
|
<div class="add-items-preview__trigger">
|
||||||
<i :class="editingItem.icon || 'fa fas fa-plus'"></i>
|
<IconValue :value="editingItem.icon || 'fa fas fa-plus'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="add-items-preview__menu">
|
<div class="add-items-preview__menu">
|
||||||
<div v-if="editingItem.add_items.length" class="add-items-preview__list">
|
<div v-if="editingItem.add_items.length" class="add-items-preview__list">
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
class="add-items-preview__item"
|
class="add-items-preview__item"
|
||||||
>
|
>
|
||||||
<i :class="subItem.icon || 'fa fas fa-pen'"></i>
|
<IconValue :value="subItem.icon || 'fa fas fa-pen'" />
|
||||||
<span>{{ subItem.label || '未命名子项' }}</span>
|
<span>{{ subItem.label || '未命名子项' }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
<div class="add-items-preview__panel add-items-preview__panel--dark">
|
<div class="add-items-preview__panel add-items-preview__panel--dark">
|
||||||
<div class="add-items-preview__mode">暗色</div>
|
<div class="add-items-preview__mode">暗色</div>
|
||||||
<div class="add-items-preview__trigger add-items-preview__trigger--dark">
|
<div class="add-items-preview__trigger add-items-preview__trigger--dark">
|
||||||
<i :class="editingItem.icon || 'fa fas fa-plus'"></i>
|
<IconValue :value="editingItem.icon || 'fa fas fa-plus'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="add-items-preview__menu add-items-preview__menu--dark">
|
<div class="add-items-preview__menu add-items-preview__menu--dark">
|
||||||
<div v-if="editingItem.add_items.length" class="add-items-preview__list">
|
<div v-if="editingItem.add_items.length" class="add-items-preview__list">
|
||||||
@@ -300,7 +300,7 @@
|
|||||||
href="javascript:void(0)"
|
href="javascript:void(0)"
|
||||||
class="add-items-preview__item add-items-preview__item--dark"
|
class="add-items-preview__item add-items-preview__item--dark"
|
||||||
>
|
>
|
||||||
<i :class="subItem.icon || 'fa fas fa-pen'"></i>
|
<IconValue :value="subItem.icon || 'fa fas fa-pen'" />
|
||||||
<span>{{ subItem.label || '未命名子项' }}</span>
|
<span>{{ subItem.label || '未命名子项' }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -344,6 +344,8 @@ import { NButton, NTag, useDialog, useMessage } from 'naive-ui'
|
|||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
|
import FaIconPicker from '@/components/form/FaIconPicker.vue'
|
||||||
|
import IconValue from '@/components/form/IconValue.vue'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
<i class="fa fas fa-bars"></i>
|
<i class="fa fas fa-bars"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="tabbar-sort__icon">
|
<span class="tabbar-sort__icon">
|
||||||
<i v-if="element.icon" :class="element.icon"></i>
|
<IconValue v-if="element.icon" :value="element.icon" />
|
||||||
</span>
|
</span>
|
||||||
<div class="tabbar-sort__meta">
|
<div class="tabbar-sort__meta">
|
||||||
<div class="tabbar-sort__title-row">
|
<div class="tabbar-sort__title-row">
|
||||||
@@ -128,16 +128,13 @@
|
|||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<n-form-item label="图标 (Font Awesome)">
|
<n-form-item label="图标 (Font Awesome / 内置 SVG)">
|
||||||
<n-input v-model:value="editingItem.icon" placeholder="例如: fa fas fa-home" />
|
<FaIconPicker v-model:value="editingItem.icon" placeholder="选择图标" />
|
||||||
<template #feedback>
|
<template #feedback>
|
||||||
<div class="icon-preview-row">
|
<div class="icon-preview-row">
|
||||||
<span>预览:</span>
|
<span>预览:</span>
|
||||||
<i v-if="editingItem.icon" :class="editingItem.icon" style="font-size: 20px;"></i>
|
<IconValue v-if="editingItem.icon" :value="editingItem.icon" style="font-size: 20px;" />
|
||||||
<span v-else class="muted-text">无图标</span>
|
<span v-else class="muted-text">无图标</span>
|
||||||
<a href="https://fontawesome.com/search?m=free" target="_blank" rel="noopener" style="margin-left: 12px;">
|
|
||||||
<i class="fa fas fa-external-link-alt"></i> Font Awesome 图标库
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
@@ -230,7 +227,7 @@
|
|||||||
<i class="fa fas fa-bars"></i>
|
<i class="fa fas fa-bars"></i>
|
||||||
</button>
|
</button>
|
||||||
<n-input v-model:value="element.label" placeholder="名称,例如:写文章" />
|
<n-input v-model:value="element.label" placeholder="名称,例如:写文章" />
|
||||||
<n-input v-model:value="element.icon" placeholder="图标,例如:fa fas fa-pen" />
|
<FaIconPicker v-model:value="element.icon" placeholder="选择图标" />
|
||||||
<n-input v-model:value="element.url" placeholder="链接,例如:/wp-admin/post-new.php" />
|
<n-input v-model:value="element.url" placeholder="链接,例如:/wp-admin/post-new.php" />
|
||||||
<n-button quaternary type="error" @click="removeAddItem(subIndex)">
|
<n-button quaternary type="error" @click="removeAddItem(subIndex)">
|
||||||
<template #icon><i class="fa fas fa-trash-alt" /></template>
|
<template #icon><i class="fa fas fa-trash-alt" /></template>
|
||||||
@@ -268,6 +265,8 @@ import { NButton, NTag, useDialog, useMessage } from 'naive-ui'
|
|||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
|
import FaIconPicker from '@/components/form/FaIconPicker.vue'
|
||||||
|
import IconValue from '@/components/form/IconValue.vue'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|||||||
@@ -98,7 +98,8 @@
|
|||||||
(group.icons || []).forEach((name) => {
|
(group.icons || []).forEach((name) => {
|
||||||
if (group.type === 'fa') {
|
if (group.type === 'fa') {
|
||||||
const value = `fa ${group.id} fa-${name}`;
|
const value = `fa ${group.id} fa-${name}`;
|
||||||
$grid.append(itemButton(value, name, `<i class="fa ${group.id} fa-${escapeText(name)}" aria-hidden="true"></i>`));
|
// Style-class-only preview: immune to the .fa family override in FA5's css.
|
||||||
|
$grid.append(itemButton(value, name, `<i class="${group.id} fa-${escapeText(name)}" aria-hidden="true"></i>`));
|
||||||
} else if (group.type === 'svg') {
|
} else if (group.type === 'svg') {
|
||||||
const value = `zibsvg-${name}`;
|
const value = `zibsvg-${name}`;
|
||||||
const key = escapeText(name).replace(/[^a-zA-Z0-9_-]/g, '');
|
const key = escapeText(name).replace(/[^a-zA-Z0-9_-]/g, '');
|
||||||
|
|||||||
+9
-11
@@ -132,9 +132,7 @@ $_footer_conter = wp_kses_post(trim((string) $footer_customize_code));
|
|||||||
$m_url = (string) ($more_item['link'] ?? '');
|
$m_url = (string) ($more_item['link'] ?? '');
|
||||||
$m_text = (string) ($more_item['desc'] ?? '');
|
$m_text = (string) ($more_item['desc'] ?? '');
|
||||||
$m_icon = (string) ($more_item['icon'] ?? '');
|
$m_icon = (string) ($more_item['icon'] ?? '');
|
||||||
$m_icon_html = ($m_icon !== '' && function_exists('aksrt_brand_icon'))
|
$m_icon_html = $m_icon !== '' ? aksrt_icon_markup($m_icon) : '';
|
||||||
? aksrt_brand_icon($m_icon)
|
|
||||||
: '';
|
|
||||||
if ($m_icon_html === '') {
|
if ($m_icon_html === '') {
|
||||||
$m_icon_html = '<i class="fa fas fa-heart" aria-hidden="true"></i>';
|
$m_icon_html = '<i class="fa fas fa-heart" aria-hidden="true"></i>';
|
||||||
}
|
}
|
||||||
@@ -262,7 +260,7 @@ if ($floating_enabled) :
|
|||||||
$item_class .= ' ontop';
|
$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; ?>>
|
<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>
|
<?php echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
</a>
|
</a>
|
||||||
<?php elseif ($item_type === 'theme_mode') :
|
<?php elseif ($item_type === 'theme_mode') :
|
||||||
$item_class .= ' theme-toggle-btn';
|
$item_class .= ' theme-toggle-btn';
|
||||||
@@ -282,7 +280,7 @@ if ($floating_enabled) :
|
|||||||
$wechat_img = $item['wechat_img'] ?? ($item['qrcode_img'] ?? '');
|
$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; ?>>
|
<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 echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
<?php if ($wechat_img) : ?>
|
<?php if ($wechat_img) : ?>
|
||||||
<div class="hover-show-con">
|
<div class="hover-show-con">
|
||||||
<img src="<?php echo esc_url($wechat_img); ?>" alt="<?php esc_attr_e('微信二维码', 'aksrt'); ?>">
|
<img src="<?php echo esc_url($wechat_img); ?>" alt="<?php esc_attr_e('微信二维码', 'aksrt'); ?>">
|
||||||
@@ -296,7 +294,7 @@ if ($floating_enabled) :
|
|||||||
$qq_img = $item['qrcode_img'] ?? '';
|
$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; ?>>
|
<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 echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
<?php if ($qq_img || $qq_number) : ?>
|
<?php if ($qq_img || $qq_number) : ?>
|
||||||
<div class="hover-show-con">
|
<div class="hover-show-con">
|
||||||
<?php if ($qq_img) : ?>
|
<?php if ($qq_img) : ?>
|
||||||
@@ -311,7 +309,7 @@ if ($floating_enabled) :
|
|||||||
$add_items = is_array($item['add_items'] ?? null) ? $item['add_items'] : [];
|
$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; ?>>
|
<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 echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
<?php if (!empty($add_items)) : ?>
|
<?php if (!empty($add_items)) : ?>
|
||||||
<div class="hover-show-con">
|
<div class="hover-show-con">
|
||||||
<div class="float-add-menu">
|
<div class="float-add-menu">
|
||||||
@@ -321,7 +319,7 @@ if ($floating_enabled) :
|
|||||||
$sub_text = $sub['text'] ?? '';
|
$sub_text = $sub['text'] ?? '';
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo esc_url($sub_url); ?>" class="float-add-menu__item">
|
<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>
|
<?php echo aksrt_icon_markup((string) $sub_icon); // pre-escaped ?>
|
||||||
<span><?php echo esc_html($sub_text); ?></span>
|
<span><?php echo esc_html($sub_text); ?></span>
|
||||||
</a>
|
</a>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -333,7 +331,7 @@ if ($floating_enabled) :
|
|||||||
$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; ?>>
|
<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 echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
<div class="hover-show-con">
|
<div class="hover-show-con">
|
||||||
<div
|
<div
|
||||||
class="qrcode float-btn-qrcode"
|
class="qrcode float-btn-qrcode"
|
||||||
@@ -348,7 +346,7 @@ if ($floating_enabled) :
|
|||||||
$hover_width = (int) ($item['hover_width'] ?? 200);
|
$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; ?>>
|
<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 echo aksrt_icon_markup((string) $item_icon); // pre-escaped ?>
|
||||||
<?php if ($hover_html !== '') : ?>
|
<?php if ($hover_html !== '') : ?>
|
||||||
<div class="hover-show-con"<?php echo $hover_width !== 200 ? ' style="min-width:' . (int) $hover_width . 'px"' : ''; ?>>
|
<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 class="float-right__html"><?php echo wp_kses_post($hover_html); ?></div>
|
||||||
@@ -390,7 +388,7 @@ if ($floating_enabled) :
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo esc_url($tab_href); ?>" class="tabbar-item" data-type="<?php echo esc_attr($tab_type); ?>">
|
<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 echo aksrt_icon_markup((string) $tab_icon); // pre-escaped ?>
|
||||||
<?php if (!empty($tabbar_settings['show_text'])) : ?><span><?php echo esc_html($tab_text); ?></span><?php endif; ?>
|
<?php if (!empty($tabbar_settings['show_text'])) : ?><span><?php echo esc_html($tab_text); ?></span><?php endif; ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endforeach;
|
<?php endforeach;
|
||||||
|
|||||||
@@ -43,11 +43,9 @@ if (!function_exists('aksrt_get_float_pay_vip_html')) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
$icon = trim((string) ($item['icon'] ?? ''));
|
$icon = trim((string) ($item['icon'] ?? ''));
|
||||||
if ($icon === '') {
|
$icon_html = aksrt_icon_markup($icon);
|
||||||
$icon = 'fa fas fa-gem';
|
if ($icon_html === '') {
|
||||||
}
|
$icon_html = aksrt_icon_markup('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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logged-in: open modal. Guest: open login.
|
// Logged-in: open modal. Guest: open login.
|
||||||
@@ -72,7 +70,7 @@ if (!function_exists('aksrt_get_float_pay_vip_html')) :
|
|||||||
: '';
|
: '';
|
||||||
|
|
||||||
return '<a class="' . esc_attr($cls) . '" href="javascript:;" role="button" aria-label="' . esc_attr($title) . '" title="' . esc_attr($title) . '"' . $style_attr . $vip_level_attr . '>'
|
return '<a class="' . esc_attr($cls) . '" href="javascript:;" role="button" aria-label="' . esc_attr($title) . '" title="' . esc_attr($title) . '"' . $style_attr . $vip_level_attr . '>'
|
||||||
. '<i class="' . esc_attr($icon) . '" aria-hidden="true"></i>'
|
. $icon_html
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
@@ -56,7 +56,7 @@ trait GlobalControllerPart1 {
|
|||||||
if (!empty($item['add_items']) && is_array($item['add_items'])) {
|
if (!empty($item['add_items']) && is_array($item['add_items'])) {
|
||||||
foreach ($item['add_items'] as $sub_item) {
|
foreach ($item['add_items'] as $sub_item) {
|
||||||
$label = sanitize_text_field($sub_item['label'] ?? '');
|
$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'] ?? '');
|
$url = esc_url_raw($sub_item['url'] ?? '');
|
||||||
if ($label === '') {
|
if ($label === '') {
|
||||||
continue;
|
continue;
|
||||||
@@ -73,7 +73,7 @@ trait GlobalControllerPart1 {
|
|||||||
return [
|
return [
|
||||||
'id' => sanitize_text_field($item['id'] ?? uniqid('tab_')),
|
'id' => sanitize_text_field($item['id'] ?? uniqid('tab_')),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'icon' => sanitize_text_field($item['icon'] ?? ''),
|
'icon' => aksrt_sanitize_icon_value((string) ($item['icon'] ?? '')),
|
||||||
'text' => sanitize_text_field($item['text'] ?? ''),
|
'text' => sanitize_text_field($item['text'] ?? ''),
|
||||||
'link' => esc_url_raw($item['link'] ?? ''),
|
'link' => esc_url_raw($item['link'] ?? ''),
|
||||||
'badge' => sanitize_text_field($item['badge'] ?? ''),
|
'badge' => sanitize_text_field($item['badge'] ?? ''),
|
||||||
@@ -220,7 +220,7 @@ trait GlobalControllerPart1 {
|
|||||||
}
|
}
|
||||||
$label = sanitize_text_field($add_item['label'] ?? '');
|
$label = sanitize_text_field($add_item['label'] ?? '');
|
||||||
$url = esc_url_raw($add_item['url'] ?? '');
|
$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 === '') {
|
if ($label === '' && $url === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -233,9 +233,9 @@ trait GlobalControllerPart1 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$icon = sanitize_text_field($item['icon'] ?? '');
|
$icon = aksrt_sanitize_icon_value((string) ($item['icon'] ?? ''));
|
||||||
$icon_dark = sanitize_text_field($item['icon_dark'] ?? '');
|
$icon_dark = aksrt_sanitize_icon_value((string) ($item['icon_dark'] ?? ''));
|
||||||
$icon_light = sanitize_text_field($item['icon_light'] ?? '');
|
$icon_light = aksrt_sanitize_icon_value((string) ($item['icon_light'] ?? ''));
|
||||||
if ($type === 'theme_mode') {
|
if ($type === 'theme_mode') {
|
||||||
$icon = 'fa fas fa-sun';
|
$icon = 'fa fas fa-sun';
|
||||||
$icon_dark = '';
|
$icon_dark = '';
|
||||||
@@ -247,12 +247,9 @@ trait GlobalControllerPart1 {
|
|||||||
if ($type === 'pay_vip') {
|
if ($type === 'pay_vip') {
|
||||||
$link = '';
|
$link = '';
|
||||||
$hover = '';
|
$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';
|
$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 [
|
return [
|
||||||
|
|||||||
Reference in new issue
Block a user