Files
wordpress-theme-aksrt/src/Admin/Schema/GlobalSchema.php
T
kate522andClaude Opus 5 35bb96e82f refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.

Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
  cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
  window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)

Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
  so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
  (dropped 3 stale entries, added the 17 missing ones)

Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
  get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
  when it is empty

Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.

Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 20:05:04 +08:00

504 lines
44 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* @package Jio
*/
namespace Jio\Admin\Schema;
defined('ABSPATH') || exit;
class GlobalSchema {
public static function build(): array {
return [
'domain' => 'global',
'title' => '全局&功能',
'sections' => [
'common' => [
'key' => 'common',
'title' => '常用功能',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'performance', 'title' => '图像异步懒加载', 'fields' => [
['key' => 'lazy_posts_thumb', 'label' => '文章缩略图懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_avatar', 'label' => '头像懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_posts_content', 'label' => '文章内容图片懒加载', 'type' => 'switch', 'default' => false],
['key' => 'lazy_comment', 'label' => '评论内容图片懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_sider', 'label' => '幻灯片图片懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_cover', 'label' => '封面图片懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_other', 'label' => '其它图片懒加载', 'type' => 'switch', 'default' => true],
['key' => 'lazy_animation', 'label' => '懒加载动画效果', 'type' => 'select', 'default' => 'blur', 'options' => [
['label' => '淡出淡入', 'value' => 'fade'],
['label' => '高斯模糊', 'value' => 'blur'],
['label' => '放大缩小', 'value' => 'scale'],
]],
['key' => 'thumbnail', 'label' => '懒加载预载图', 'type' => 'media', 'default' => get_template_directory_uri() . '/assets/img/thumbnail.svg'],
]],
],
],
'logo' => [
'key' => 'logo',
'title' => 'LOGO图像',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'logo', 'title' => 'Logo 设置', 'fields' => [
['key' => 'site_logo', 'label' => '站点 Logo', 'type' => 'media', 'default' => ''],
['key' => 'site_logo_dark', 'label' => '暗色模式 Logo', 'type' => 'media', 'default' => ''],
['key' => 'logo_width', 'label' => 'Logo 宽度', 'type' => 'number', 'default' => 150, 'min' => 50, 'max' => 400],
['key' => 'logo_text', 'label' => 'Logo 文字', 'type' => 'input', 'default' => ''],
]],
['key' => 'favicon', 'title' => '站点图标', 'fields' => [
['key' => 'site_favicon', 'label' => '浏览器图标', 'type' => 'media', 'default' => ''],
['key' => 'site_icon', 'label' => '移动端图标', 'type' => 'media', 'default' => ''],
]],
],
],
'seo' => [
'key' => 'seo',
'title' => 'SEO优化',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'basic', 'title' => 'SEO基础', 'fields' => [
['key' => 'seo_enabled', 'label' => '启用核心SEO优化', 'type' => 'switch', 'default' => true, 'help' => '关闭后主题不再输出 SEO head 标签。'],
['key' => 'seo_ai_enabled', 'label' => 'AI生成SEO内容', 'type' => 'switch', 'default' => false, 'help' => '开启后文章/分类独立 SEO 框显示 AI 生成按钮;需先在 WordPress 配置 AI Connectors。', 'dependsOn' => ['key' => 'seo_enabled', 'value' => true]],
['key' => 'seo_connector', 'label' => 'SEO连接符', 'type' => 'input', 'default' => '-', 'help' => 'AI 生成标题时用于追加站点名。'],
['key' => 'seo_title', 'label' => 'SEO标题(title)', 'type' => 'textarea', 'default' => ''],
['key' => 'seo_keywords', 'label' => 'SEO关键字(keywords)', 'type' => 'textarea', 'default' => ''],
['key' => 'seo_description', 'label' => 'SEO描述(description)', 'type' => 'textarea', 'default' => ''],
]],
['key' => 'ai-seo', 'title' => 'AI SEO 提示词', 'fields' => [
['key' => 'ai_seo_title_prompt', 'label' => '标题提示词', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'seo_ai_enabled', 'value' => true], 'help' => '留空使用内置 原主题风格默认提示词。'],
['key' => 'ai_seo_keywords_prompt', 'label' => '关键词提示词', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'seo_ai_enabled', 'value' => true], 'help' => '留空使用内置默认。'],
['key' => 'ai_seo_description_prompt', 'label' => '描述提示词', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'seo_ai_enabled', 'value' => true], 'help' => '留空使用内置默认。'],
]],
['key' => 'image', 'title' => '图片SEO', 'fields' => [
['key' => 'seo_image_optimize', 'label' => '搜索引擎图片展示优化', 'type' => 'switch', 'default' => true],
['key' => 'seo_image_default', 'label' => '默认图像', 'type' => 'media', 'default' => ''],
['key' => 'seo_image_always_default', 'label' => '固定使用默认图像', 'type' => 'switch', 'default' => false],
['key' => 'seo_auto_alt', 'label' => '文章图片自动添加alt', 'type' => 'switch', 'default' => true],
]],
['key' => 'redirect', 'title' => '外链重定向', 'fields' => [
['key' => 'seo_go_link', 'label' => '启用外链重定向', 'type' => 'switch', 'default' => true],
['key' => 'seo_go_link_nonce', 'label' => '外链重定向鉴权', 'type' => 'switch', 'default' => true],
['key' => 'seo_go_link_post', 'label' => '文章内容外链重定向', 'type' => 'switch', 'default' => true],
['key' => 'seo_go_link_exclude', 'label' => '排除域名', 'type' => 'textarea', 'default' => ''],
]],
['key' => 'advanced', 'title' => '高级SEO', 'fields' => [
['key' => 'seo_no_category', 'label' => '分类URL去除category', 'type' => 'switch', 'default' => false],
['key' => 'seo_jsonld', 'label' => '启用JSON-LD', 'type' => 'switch', 'default' => true],
['key' => 'seo_jsonld_single', 'label' => '文章页JSON-LD', 'type' => 'switch', 'default' => true],
['key' => 'seo_jsonld_page', 'label' => '页面JSON-LD', 'type' => 'switch', 'default' => true],
]],
],
],
'layout' => [
'key' => 'layout',
'title' => '显示&布局',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'color', 'title' => '色彩方案', 'fields' => [
['key' => 'theme_mode', 'label' => '主题模式', 'type' => 'radio', 'default' => 'time-auto', 'help' => '此处设置为默认风格,实际显示风格以用户设置优先。如需固定风格,则关闭还需下方主题切换按钮', 'options' => [
['label' => '日间亮色主题', 'value' => 'white-theme'],
['label' => '夜间深色主题', 'value' => 'dark-theme'],
['label' => '早晚8点自动切换', 'value' => 'time-auto'],
]],
['key' => 'theme_mode_button', 'label' => '主题切换按钮', 'type' => 'checkbox', 'default' => ['pc_nav', 'm_menu'], 'help' => '如果关闭此功能,则前端不会显示切换按钮', 'options' => [
['label' => 'PC端顶部导航', 'value' => 'pc_nav'],
['label' => '移动端弹出菜单', 'value' => 'm_menu'],
]],
self::background_field('theme_img_bg', '全局背景图', '注意:要达到良好的效果需要图片与参数配合,同时需注意颜色搭配!配合不好容易降低显示美感'),
self::background_field('dark_theme_img_bg', '夜间模式背景图', '如未设置夜间模式背景图,则夜间模式也显示上方背景图'),
['key' => 'theme_skin_custom', 'label' => '全局主题色', 'type' => 'color', 'default' => '', 'help' => '默认主题高亮颜色。如需选择下方预置颜色,请先清空上方颜色'],
['key' => 'theme_skin', 'label' => ' ', 'type' => 'palette', 'default' => 'f04494', 'dependsOn' => ['key' => 'theme_skin_custom', 'operator' => 'empty'], 'options' => self::skin_palette()],
['key' => 'dark_theme_skin_custom', 'label' => '夜间模式主题色', 'type' => 'color', 'default' => '', 'help' => '在此可单独设置夜间模式的高亮色,清空此处则使用上方默认高亮色'],
['key' => 'close_backdrop', 'label' => '全局关闭背景高斯模糊', 'type' => 'switch', 'default' => false, 'help' => '在支持的浏览器上部分UI(例如导航栏)会显示背景高斯模糊的特效,但此功能比较消耗浏览器性能。同时系统会自动检测用户浏览器性能情况,如果性能较差,将自动关闭此特效,以提供更流畅的体验'],
['key' => 'theme_main_radius', 'label' => '卡片圆角', 'type' => 'spinner', 'default' => 12, 'min' => 0, 'max' => 30, 'step' => 1, 'unit' => 'PX', 'description' => '页面卡片的圆角尺寸'],
]],
['key' => 'layout', 'title' => '布局设置', 'fields' => [
// 1200–2200 与 Settings::container_max_width() 归一化区间一致。
['key' => 'container_max_width', 'label' => '内容最大宽度', 'type' => 'number', 'default' => 1200, 'min' => 1200, 'max' => 2200, 'step' => 50, 'unit' => 'PX'],
['key' => 'sidebar_enabled', 'label' => '开启侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_position', 'label' => '侧边栏位置', 'type' => 'radio', 'default' => 'right', 'options' => [
['label' => '左侧', 'value' => 'left'],
['label' => '右侧', 'value' => 'right'],
]],
['key' => 'sidebar_width', 'label' => '侧边栏宽度', 'type' => 'number', 'default' => 300, 'min' => 200, 'max' => 400],
['key' => 'sidebar_home_enabled', 'label' => '首页侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_category_enabled', 'label' => '分类页侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_tag_enabled', 'label' => '标签页侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_single_enabled', 'label' => '文章页侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_page_enabled', 'label' => '页面侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'sidebar_search_enabled', 'label' => '搜索页侧边栏', 'type' => 'switch', 'default' => true],
]],
['key' => 'typography', 'title' => '字体设置', 'fields' => [
['key' => 'font_family', 'label' => '正文字体', 'type' => 'select', 'default' => 'system', 'options' => [
['label' => '系统默认', 'value' => 'system'],
['label' => '思源黑体', 'value' => 'noto-sans-sc'],
['label' => '思源宋体', 'value' => 'noto-serif-sc'],
['label' => '自定义', 'value' => 'custom'],
]],
['key' => 'font_family_custom', 'label' => '自定义字体', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'font_family', 'value' => 'custom']],
]],
['key' => 'performance', 'title' => '性能优化', 'fields' => [
['key' => 'qj_loading', 'label' => '全站加载动画', 'type' => 'switch', 'default' => false],
['key' => 'qj_dh_xs', 'label' => '加载动画样式', 'type' => 'select', 'default' => 'no1', 'dependsOn' => ['key' => 'qj_loading', 'value' => true], 'options' => [
['label' => '样式 1', 'value' => 'no1'],
['label' => '样式 2', 'value' => 'no2'],
['label' => '样式 3', 'value' => 'no3'],
['label' => '样式 4', 'value' => 'no4'],
['label' => '样式 5', 'value' => 'no5'],
['label' => '样式 6', 'value' => 'no6'],
['label' => '样式 7', 'value' => 'no7'],
['label' => '样式 8', 'value' => 'no8'],
['label' => '样式 9', 'value' => 'no9'],
['label' => '样式 10', 'value' => 'no10'],
]],
]],
],
],
'code-highlight' => [
'key' => 'code-highlight',
'title' => '代码高亮',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'basic', 'title' => '代码高亮设置', 'fields' => [
['key' => 'highlight_kg', 'label' => '代码高亮开关', 'type' => 'switch', 'default' => true],
['key' => 'highlight_hh', 'label' => '显示行号', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'highlight_kg', 'value' => true]],
['key' => 'highlight_btn', 'label' => '显示扩展按钮', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'highlight_kg', 'value' => true]],
['key' => 'highlight_maxheight', 'label' => '最大高度(px,0=不限)', 'type' => 'number', 'default' => 400, 'min' => 0, 'max' => 2000, 'dependsOn' => ['key' => 'highlight_kg', 'value' => true]],
]],
['key' => 'theme', 'title' => '主题设置', 'fields' => [
['key' => 'highlight_zt', 'label' => '日间默认主题', 'type' => 'select', 'default' => 'enlighter', 'dependsOn' => ['key' => 'highlight_kg', 'value' => true], 'options' => [
['label' => '浅色: Enlighter', 'value' => 'enlighter'],
['label' => '浅色: Bootstrap', 'value' => 'bootstrap4'],
['label' => '浅色: Classic', 'value' => 'classic'],
['label' => '浅色: Beyond', 'value' => 'beyond'],
['label' => '浅色: Mowtwo', 'value' => 'mowtwo'],
['label' => '浅色: Eclipse', 'value' => 'eclipse'],
['label' => '浅色: Droide', 'value' => 'droide'],
['label' => '浅色: Minimal', 'value' => 'minimal'],
['label' => '浅色: Rowhammer', 'value' => 'rowhammer'],
['label' => '浅色: Godzilla', 'value' => 'godzilla'],
['label' => '深色: Dracula', 'value' => 'dracula'],
['label' => '深色: Atomic', 'value' => 'atomic'],
['label' => '深色: Monokai', 'value' => 'monokai'],
]],
['key' => 'highlight_dark_zt', 'label' => '暗色默认主题', 'type' => 'select', 'default' => 'monokai', 'dependsOn' => ['key' => 'highlight_kg', 'value' => true], 'options' => [
['label' => '深色: Dracula', 'value' => 'dracula'],
['label' => '深色: Atomic', 'value' => 'atomic'],
['label' => '深色: Monokai', 'value' => 'monokai'],
['label' => '浅色: Enlighter', 'value' => 'enlighter'],
['label' => '浅色: Bootstrap', 'value' => 'bootstrap4'],
]],
]],
],
],
'system-notice' => [
'key' => 'system-notice',
'title' => '系统公告',
'version' => '2.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'basic', 'title' => '公告设置', 'fields' => [
['key' => 'system_notice_enabled', 'label' => '启用系统公告', 'type' => 'switch', 'default' => true],
['key' => 'system_notice_policy', 'label' => '显示对象', 'type' => 'select', 'default' => '', 'options' => [
['label' => '所有访客', 'value' => ''],
['label' => '仅登录用户', 'value' => 'signin'],
['label' => '仅 VIP 会员', 'value' => 'vip'],
['label' => '仅非 VIP', 'value' => 'free'],
['label' => '仅认证用户', 'value' => 'auth'],
]],
['key' => 'system_notice_title', 'label' => '公告标题', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_content', 'label' => '公告内容', 'type' => 'textarea', 'default' => ''],
]],
['key' => 'buttons', 'title' => '按钮组(留空则不显示)', 'fields' => [
['key' => 'system_notice_btn1_text', 'label' => '按钮 1 文案', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn1_link', 'label' => '按钮 1 链接', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn1_color', 'label' => '按钮 1 颜色', 'type' => 'select', 'default' => 'primary', 'options' => [
['label' => '主题色', 'value' => 'primary'],
['label' => '成功绿', 'value' => 'success'],
['label' => '警告橙', 'value' => 'warning'],
['label' => '危险红', 'value' => 'danger'],
['label' => '信息蓝', 'value' => 'info'],
['label' => '深紫', 'value' => 'purple'],
['label' => '深灰', 'value' => 'dark'],
]],
['key' => 'system_notice_btn2_text', 'label' => '按钮 2 文案', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn2_link', 'label' => '按钮 2 链接', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn2_color', 'label' => '按钮 2 颜色', 'type' => 'select', 'default' => 'primary', 'options' => [
['label' => '主题色', 'value' => 'primary'],
['label' => '成功绿', 'value' => 'success'],
['label' => '警告橙', 'value' => 'warning'],
['label' => '危险红', 'value' => 'danger'],
['label' => '信息蓝', 'value' => 'info'],
['label' => '深紫', 'value' => 'purple'],
['label' => '深灰', 'value' => 'dark'],
]],
['key' => 'system_notice_btn3_text', 'label' => '按钮 3 文案', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn3_link', 'label' => '按钮 3 链接', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn3_color', 'label' => '按钮 3 颜色', 'type' => 'select', 'default' => 'primary', 'options' => [
['label' => '主题色', 'value' => 'primary'],
['label' => '成功绿', 'value' => 'success'],
['label' => '警告橙', 'value' => 'warning'],
['label' => '危险红', 'value' => 'danger'],
['label' => '信息蓝', 'value' => 'info'],
['label' => '深紫', 'value' => 'purple'],
['label' => '深灰', 'value' => 'dark'],
]],
['key' => 'system_notice_btn4_text', 'label' => '按钮 4 文案', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn4_link', 'label' => '按钮 4 链接', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_btn4_color', 'label' => '按钮 4 颜色', 'type' => 'select', 'default' => 'primary', 'options' => [
['label' => '主题色', 'value' => 'primary'],
['label' => '成功绿', 'value' => 'success'],
['label' => '警告橙', 'value' => 'warning'],
['label' => '危险红', 'value' => 'danger'],
['label' => '信息蓝', 'value' => 'info'],
['label' => '深紫', 'value' => 'purple'],
['label' => '深灰', 'value' => 'dark'],
]],
]],
['key' => 'style', 'title' => '样式设置', 'fields' => [
['key' => 'system_notice_size', 'label' => '弹窗尺寸', 'type' => 'select', 'default' => '', 'options' => [
['label' => '默认', 'value' => ''],
['label' => '迷你', 'value' => 'modal-mini'],
['label' => '小号', 'value' => 'modal-sm'],
['label' => '大号', 'value' => 'modal-lg'],
]],
['key' => 'system_notice_radius', 'label' => '按钮圆角', 'type' => 'switch', 'default' => false, 'help' => '开启后弹窗按钮使用圆角样式'],
['key' => 'system_notice_class', 'label' => '公告样式类', 'type' => 'input', 'default' => ''],
['key' => 'system_notice_title_icon', 'label' => '标题图标', 'type' => 'icon', 'default' => ''],
['key' => 'system_notice_title_class', 'label' => '标题背景配色', 'type' => 'select', 'default' => '', 'options' => [
['label' => '无', 'value' => ''],
['label' => '炫彩黄', 'value' => 'jb-yellow'],
['label' => '炫彩蓝', 'value' => 'jb-blue'],
['label' => '炫彩绿', 'value' => 'jb-green'],
['label' => '炫彩紫', 'value' => 'jb-purple'],
['label' => '炫彩红', 'value' => 'jb-red'],
['label' => '炫彩橙', 'value' => 'jb-orange'],
], 'help' => '弹窗标题区域的背景配色方案'],
['key' => 'system_notice_title_style', 'label' => '标题样式', 'type' => 'input', 'default' => ''],
]],
['key' => 'expire', 'title' => '过期设置', 'fields' => [
['key' => 'system_notice_expires', 'label' => '弹窗周期(小时)', 'type' => 'number', 'default' => 24, 'min' => 0, 'max' => 720, 'help' => '0 表示永不过期'],
]],
],
],
'search' => [
'key' => 'search',
'title' => '搜索功能',
'version' => '2.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'basic', 'title' => '搜索基础', 'fields' => [
['key' => 'search_placeholder', 'label' => '搜索框提示文字', 'type' => 'input', 'default' => '开启精彩搜索'],
]],
['key' => 'content-types', 'title' => '搜索内容类型', 'fields' => [
['key' => 'search_type', 'label' => '显示切换搜索类型按钮', 'type' => 'switch', 'default' => true],
['key' => 'search_type_in', 'label' => '默认搜索类型', 'type' => 'radio', 'default' => 'post', 'options' => [
['label' => '文章', 'value' => 'post'],
['label' => '用户', 'value' => 'user'],
]],
]],
['key' => 'features', 'title' => '搜索功能', 'fields' => [
['key' => 'search_history', 'label' => '搜索历史', 'type' => 'switch', 'default' => true],
['key' => 'search_popular_key', 'label' => '热门搜索', 'type' => 'switch', 'default' => true],
['key' => '404_search_s', 'label' => '在 404 页面显示搜索功能', 'type' => 'switch', 'default' => true],
['key' => 'search_posts', 'label' => '搜索框热门文章', 'type' => 'switch', 'default' => true, 'help' => '在搜索面板中显示热门文章列表'],
['key' => 'search_no_page', 'label' => '排除页面', 'type' => 'switch', 'default' => true, 'help' => '搜索结果中排除页面(仅显示文章)'],
['key' => 'search_exclude_cats', 'label' => '排除分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'help' => '搜索结果中排除的文章分类'],
['key' => 'search_custom_key_s', 'label' => '自定义匹配范围', 'type' => 'switch', 'default' => true, 'help' => '启用后可配置搜索匹配字段范围(标题/内容/分类/标签等)'],
['key' => 'search_custom_key', 'label' => '匹配字段', 'type' => 'checkbox', 'default' => ['title', 'content', 'excerpt', 'category', 'post_tag'], 'options' => [
['label' => '标题', 'value' => 'title'], ['label' => '内容', 'value' => 'content'], ['label' => '简介', 'value' => 'excerpt'],
['label' => '分类', 'value' => 'category'], ['label' => '标签', 'value' => 'post_tag'],
['label' => '评论', 'value' => 'coment'], ['label' => '作者昵称', 'value' => 'user'],
]],
['key' => 'search_facets', 'label' => '搜索筛选', 'type' => 'fieldset', 'sanitize_type' => 'array', 'default' => [], 'dependsOn' => ['key' => 'search_ms_s', 'value' => false], 'help' => '搜索结果中显示的筛选列表;启用 Meilisearch 后由搜索引擎生成关联筛选。', 'fields' => [
['key' => 'category', 'label' => '[文章] 分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => []],
['key' => 'post_tag', 'label' => '[文章] 标签', 'type' => 'taxonomy_select', 'taxonomy' => 'post_tag', 'multiple' => true, 'default' => []],
]],
]],
['key' => 'category-search', 'title' => '分类搜索', 'fields' => [
['key' => 'search_cat', 'label' => '启用分类搜索', 'type' => 'switch', 'default' => true, 'help' => '在搜索框旁显示分类选择器'],
['key' => 'search_cat_in', 'label' => '默认分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => false, 'default' => '', 'help' => '留空为全部分类'],
['key' => 'search_more_cat_obj', 'label' => '允许选择的更多分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => []],
]],
['key' => 'popular', 'title' => '热门搜索', 'fields' => [
['key' => 'search_popular_title', 'label' => '标题', 'type' => 'input', 'default' => '热门搜索'],
['key' => 'search_popular_key_num', 'label' => '显示数量', 'type' => 'number', 'default' => 20, 'min' => 10, 'max' => 50, 'step' => 2],
['key' => 'search_popular_sticky', 'label' => '置顶关键词', 'type' => 'input', 'default' => '', 'help' => '使用逗号分隔;可追加 &type=user 指定搜索类型'],
]],
['key' => 'meilisearch', 'title' => 'Meilisearch 智能搜索', 'fields' => [
['key' => 'search_ms_s', 'label' => '启用 Meilisearch', 'type' => 'switch', 'default' => false],
['key' => 'search_ms_opt', 'label' => 'Meilisearch 参数', 'type' => 'fieldset', 'sanitize_type' => 'array', 'default' => [
'api_url' => 'http://127.0.0.1:7700', 'api_key' => '', 'index_prefix' => 'jio',
'synonyms' => [['key' => 'wordpress', 'val' => 'wp,wordp,wordpre']],
], 'dependsOn' => ['key' => 'search_ms_s', 'value' => true], 'fields' => [
['key' => 'api_url', 'label' => 'API 地址', 'type' => 'input', 'default' => 'http://127.0.0.1:7700'],
['key' => 'api_key', 'label' => 'API 密钥', 'type' => 'input', 'default' => ''],
['key' => 'index_prefix', 'label' => '索引前缀', 'type' => 'input', 'default' => 'jio'],
['key' => 'synonyms', 'label' => '同义词', 'type' => 'repeater', 'default' => [['key' => 'wordpress', 'val' => 'wp,wordp,wordpre']], 'addText' => '添加同义词', 'fields' => [
['key' => 'key', 'label' => '关键词', 'type' => 'input', 'default' => ''],
['key' => 'val', 'label' => '同义词', 'type' => 'textarea', 'default' => ''],
]],
]],
]],
],
],
'share' => [
'key' => 'share',
'title' => '社交分享',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [[
'key' => 'share',
'title' => '社交分享',
'fields' => [
['key' => 'share_s', 'label' => '文章分享功能', 'type' => 'switcher', 'default' => true, 'help' => '关闭后,在文章页面将不显示分享按钮。'],
['key' => 'share_items', 'label' => '分享平台', 'type' => 'custom', 'renderer' => 'sorter', 'sanitize_type' => 'array', 'default' => [
'enabled' => ['qzone' => 'QQ空间', 'weibo' => '微博', 'qq' => 'QQ好友', 'poster' => '海报分享', 'copy' => '复制链接'],
'disabled' => ['facebook' => 'Facebook', 'twitter' => 'X', 'telegram' => 'Telegram', 'whatsapp' => 'WhatsApp', 'linkedin' => 'LinkedIn', 'reddit' => 'Reddit', 'line' => 'LINE', 'vk' => 'VK', 'email' => '邮件'],
], 'options' => [
['label' => 'QQ空间', 'value' => 'qzone'], ['label' => '微博', 'value' => 'weibo'], ['label' => 'QQ好友', 'value' => 'qq'],
['label' => 'Facebook', 'value' => 'facebook'], ['label' => 'X', 'value' => 'twitter'], ['label' => 'Telegram', 'value' => 'telegram'],
['label' => 'WhatsApp', 'value' => 'whatsapp'], ['label' => 'LinkedIn', 'value' => 'linkedin'], ['label' => 'Reddit', 'value' => 'reddit'],
['label' => 'LINE', 'value' => 'line'], ['label' => 'VK', 'value' => 'vk'], ['label' => '邮件', 'value' => 'email'],
['label' => '海报分享', 'value' => 'poster'], ['label' => '复制链接', 'value' => 'copy'],
], 'description' => '左侧启用并拖拽排序,右侧为未启用项(同时启用的数量不建议超过 6 个)。若开启海外平台,用户网络必须能正常访问对应服务。'],
['key' => 'wechat_share_s', 'label' => '微信分享有图', 'type' => 'switcher', 'default' => false, 'help' => '使用微信 JSAPI 在微信 App 内分享。'],
['key' => 'wechat_share_hint', 'label' => '', 'type' => 'content', 'ui_only' => true, 'dependsOn' => ['key' => 'wechat_share_s', 'value' => true], 'content' => '<p><strong>微信分享有图配置</strong></p><p>此功能用于用户从公众号进入页面后调用微信默认分享能力,并不会额外显示分享按钮。请在公众号后台将当前站点域名配置为 JS 接口安全域名。</p><p><a href="https://mp.weixin.qq.com/" target="_blank" rel="noopener noreferrer">前往微信公众平台</a></p>'],
['key' => 'wechat_share_option', 'label' => '微信分享有图配置', 'type' => 'fieldset', 'default' => ['appid' => '', 'app_secret' => '', 'only_logo' => false], 'dependsOn' => ['key' => 'wechat_share_s', 'value' => true], 'fields' => [
['key' => 'appid', 'label' => 'AppID', 'type' => 'input', 'default' => ''],
['key' => 'app_secret', 'label' => 'AppSecret', 'type' => 'input', 'default' => ''],
['key' => 'only_logo', 'label' => '全部使用网站图标', 'type' => 'switcher', 'default' => false, 'help' => '默认自动使用页面封面图;开启后所有页面均使用网站图标。图片启用防盗链时建议开启。'],
]],
['key' => 'share_img', 'label' => '生成海报分享', 'type' => 'switcher', 'default' => true, 'help' => '网站图片使用 OSS 等云存储时,请先配置允许本站 Canvas 读取图片的跨域规则。'],
['key' => 'share_img_warning', 'label' => '', 'type' => 'notice', 'ui_only' => true, 'alertType' => 'warning', 'content' => '海报图片加载失败时,请检查图片 CDN/OSS 的跨域响应头。', 'dependsOn' => ['key' => 'share_img', 'value' => true]],
['key' => 'share_img_compatible_s', 'label' => '海报分享兼容模式', 'type' => 'switcher', 'default' => false, 'dependsOn' => ['key' => 'share_img', 'value' => true], 'help' => '通过服务端代理读取海报图片,改善跨域兼容性;会增加服务器图片处理开销。'],
['key' => 'share_img_byimg', 'label' => '海报分享默认图片', 'type' => 'media', 'default' => get_template_directory_uri() . '/assets/img/slider-bg.jpg', 'dependsOn' => ['key' => 'share_img', 'value' => true], 'help' => '文章没有图片时使用,建议尺寸 800×500。'],
['key' => 'share_logo', 'label' => '海报分享 LOGO', 'type' => 'media', 'default' => get_template_directory_uri() . '/assets/img/logo.png', 'dependsOn' => ['key' => 'share_img', 'value' => true], 'help' => '显示在海报底部,建议尺寸 300×100、大小 50KB 以内。'],
['key' => 'share_desc', 'label' => '海报分享底部文案', 'type' => 'input', 'default' => '扫一扫 立即查看', 'dependsOn' => ['key' => 'share_img', 'value' => true]],
],
]],
],
'email' => \Jio\Settings\MailTemplates::build_schema(),
'custom-code' => [
'key' => 'custom-code',
'title' => '自定义代码',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'css', 'title' => '自定义 CSS', 'fields' => [
['key' => 'custom_css', 'label' => '自定义 CSS', 'type' => 'code', 'language' => 'css', 'default' => ''],
]],
['key' => 'code', 'title' => '头部 & 底部代码', 'fields' => [
['key' => 'head_code', 'label' => '头部 HTML 代码', 'type' => 'code', 'default' => '', 'help' => '在 <head> 中输出,支持 meta/link/style/script 等任意 HTML'],
['key' => 'foot_code', 'label' => '底部 HTML 代码', 'type' => 'code', 'default' => '', 'help' => '在 </body> 前输出,支持任意 HTML'],
]],
['key' => 'stats', 'title' => '统计代码', 'fields' => [
['key' => 'trackcode', 'label' => '统计代码', 'type' => 'code', 'default' => '', 'help' => '百度统计/GA/CNZZ/51la 等,自动在 head 中输出'],
]],
],
],
'i18n' => [
'key' => 'i18n',
'title' => '多语言翻译',
'version' => '1.0.0',
'option_key' => 'jio_settings',
'groups' => [
['key' => 'basic', 'title' => '基础配置', 'fields' => [
['key' => 'i18n_enabled', 'label' => '启用多语言', 'type' => 'switch', 'default' => false],
['key' => 'i18n_default_lang', 'label' => '默认语言', 'type' => 'select', 'default' => 'zh-CN', 'options' => [
['label' => '简体中文', 'value' => 'zh-CN'],
['label' => 'English', 'value' => 'en'],
['label' => '繁體中文', 'value' => 'zh-TW'],
['label' => '日本語', 'value' => 'ja'],
['label' => '한국어', 'value' => 'ko'],
['label' => 'Français', 'value' => 'fr'],
['label' => 'Deutsch', 'value' => 'de'],
['label' => 'Español', 'value' => 'es'],
['label' => 'Русский', 'value' => 'ru'],
]],
['key' => 'i18n_auto_detect', 'label' => '自动检测浏览器语言', 'type' => 'switch', 'default' => true, 'help' => '基于浏览器 Accept-Language 自动切换(Jio 方案,区别于 legacy IP 定位方案)'],
]],
['key' => 'languages', 'title' => '语言管理', 'fields' => [
['key' => 'i18n_available_langs', 'label' => '可用语言列表', 'type' => 'textarea', 'default' => "zh-CN|简体中文\nen|English\nzh-TW|繁體中文\nja|日本語\nko|한국어\nfr|Français\nde|Deutsch\nes|Español\nru|Русский", 'help' => '每行一个语言,格式:代码|名称(9 种内置语言)'],
['key' => 'i18n_nomenclature', 'label' => '自定义术语', 'type' => 'code', 'default' => '', 'help' => 'JSON 格式自定义翻译术语(key => 翻译),对齐 legacy nomenclature'],
]],
['key' => 'display', 'title' => '展示设置', 'fields' => [
['key' => 'i18n_switcher_position', 'label' => '语言切换器位置', 'type' => 'radio', 'default' => 'footer', 'options' => [
['label' => '导航栏', 'value' => 'header'],
['label' => '页脚', 'value' => 'footer'],
['label' => '导航栏+页脚', 'value' => 'both'],
['label' => '隐藏', 'value' => 'none'],
]],
['key' => 'i18n_url_strategy', 'label' => 'URL 策略', 'type' => 'radio', 'default' => 'query', 'options' => [
['label' => '查询参数', 'value' => 'query'],
['label' => '路径前缀', 'value' => 'path'],
['label' => '子域名', 'value' => 'subdomain'],
]],
]],
],
],
],
];
}
/** 与 assets/admin/src/schema/sections/global/layout.js 的 skinPalette 保持一致;label 即色块颜色。 */
private static function skin_palette(): array {
$map = [
'ff1856' => '#fd2760', 'f04494' => '#f04494', 'ae53f3' => '#ae53f3', '627bf5' => '#627bf5',
'00a2e3' => '#00a2e3', '16b597' => '#16b597', '36af18' => '#36af18', '8fb107' => '#8fb107',
'b18c07' => '#b18c07', 'e06711' => '#e06711', 'f74735' => '#f74735',
];
$options = [];
foreach ($map as $value => $label) {
$options[] = ['label' => $label, 'value' => (string) $value];
}
return $options;
}
/** 背景图配置(对齐参考主题 background 字段:颜色/图片/位置/重复/附着/尺寸/原点)。 */
private static function background_field(string $key, string $label, string $help): array {
$opts = static function (array $map): array {
$out = [['label' => '默认', 'value' => '']];
foreach ($map as $value => $text) {
$out[] = ['label' => $text, 'value' => $value];
}
return $out;
};
return [
'key' => $key, 'label' => $label, 'type' => 'fieldset', 'help' => $help,
// 子键与 layout.js bgField 及 ThemeSearch::background_css() 白名单一致。
'default' => [
'color' => '', 'image' => '', 'position' => 'center top',
'repeat' => 'no-repeat', 'attachment' => 'fixed', 'size' => '100%', 'origin' => '',
],
'fields' => [
['key' => 'color', 'label' => '背景颜色', 'type' => 'color', 'default' => ''],
['key' => 'image', 'label' => '背景图片', 'type' => 'media', 'default' => ''],
['key' => 'position', 'label' => '背景位置', 'type' => 'select', 'default' => 'center top', 'options' => $opts([
'left top' => '左上', 'left center' => '左中', 'left bottom' => '左下',
'center top' => '中上', 'center center' => '居中', 'center bottom' => '中下',
'right top' => '右上', 'right center' => '右中', 'right bottom' => '右下',
])],
['key' => 'repeat', 'label' => '背景重复', 'type' => 'select', 'default' => 'no-repeat', 'options' => $opts([
'repeat' => '重复', 'no-repeat' => '不重复', 'repeat-x' => '水平重复', 'repeat-y' => '垂直重复',
])],
['key' => 'attachment', 'label' => '背景附着', 'type' => 'select', 'default' => 'fixed', 'options' => $opts([
'scroll' => '滚动', 'fixed' => '固定',
])],
['key' => 'size', 'label' => '背景尺寸', 'type' => 'select', 'default' => '100%', 'options' => $opts([
'100%' => '100%', 'cover' => '覆盖 (cover)', 'contain' => '包含 (contain)', 'auto' => '自动 (auto)',
])],
['key' => 'origin', 'label' => '背景原点', 'type' => 'select', 'default' => '', 'options' => $opts([
'padding-box' => 'Padding Box', 'border-box' => 'Border Box', 'content-box' => 'Content Box',
])],
],
];
}
}