refactor: remove forum and topic feature chains

This commit is contained in:
2026-08-17 14:52:19 +08:00
parent 698e3750f9
commit 6c6c462df8
69 changed files with 339 additions and 2057 deletions
-1
View File
@@ -92,7 +92,6 @@ class ExtensionController extends ControllerBase {
'data' => [
'total' => 0,
'nav_count' => 0,
'special_count' => 0,
],
]);
}
+1 -23
View File
@@ -258,7 +258,7 @@ class GlobalController extends ControllerBase {
if ($term_id > 0) {
$term = get_term($term_id);
$taxonomy = ($term && !is_wp_error($term)) ? (string) $term->taxonomy : 'category';
if (!in_array($taxonomy, ['category', 'topics'], true)) {
if ($taxonomy !== 'category') {
$taxonomy = 'category';
}
$args['tax_query'] = [[
@@ -350,28 +350,6 @@ class GlobalController extends ControllerBase {
];
}
if (taxonomy_exists('topics')) {
$topics = get_terms([
'taxonomy' => 'topics',
'hide_empty' => false,
'orderby' => 'name',
'order' => 'ASC',
]);
if (!is_wp_error($topics)) {
foreach ($topics as $term) {
$data[] = [
'id' => (int) $term->term_id,
'term_id' => (int) $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
'count' => (int) $term->count,
'parent' => (int) $term->parent,
'taxonomy' => 'topics',
];
}
}
}
return $this->success(['data' => $data]);
}
+2 -5
View File
@@ -216,11 +216,8 @@ trait HomepageSettingsRest {
continue;
}
$taxonomy = (string) $term->taxonomy;
if (!in_array($taxonomy, ['category', 'topics'], true)) {
// Allow category always; topics if registered.
if ($taxonomy !== 'category') {
continue;
}
if ($taxonomy !== 'category') {
continue;
}
$orderby = sanitize_key((string) ($tab['orderby'] ?? ''));
if ($orderby !== '' && !in_array($orderby, $allowed_sorts, true)) {
-2
View File
@@ -344,14 +344,12 @@ class GlobalSchema {
['key' => 'search_type_category', 'label' => '分类', 'type' => 'switch', 'default' => true],
['key' => 'search_type_tag', 'label' => '标签', 'type' => 'switch', 'default' => true],
['key' => 'search_type_product', 'label' => '商品', 'type' => 'switch', 'default' => false],
['key' => 'search_type_topic', 'label' => '帖子', 'type' => 'switch', 'default' => false],
['key' => 'search_default_type', 'label' => '默认类型', 'type' => 'select', 'default' => 'post', 'options' => [
['label' => '文章', 'value' => 'post'],
['label' => '用户', 'value' => 'user'],
['label' => '分类', 'value' => 'category'],
['label' => '标签', 'value' => 'tag'],
['label' => '商品', 'value' => 'product'],
['label' => '帖子', 'value' => 'topic'],
]],
]],
['key' => 'features', 'title' => '搜索功能', 'fields' => [
@@ -41,7 +41,6 @@ class SchemaPostListList {
['label' => '首页', 'value' => 'home'],
['label' => '分类页', 'value' => 'cat'],
['label' => '标签页', 'value' => 'tag'],
['label' => '专题页', 'value' => 'topics'],
],
],
],
@@ -91,11 +90,10 @@ class SchemaPostListList {
'key' => 'list_badge_show',
'label' => '列表徽章',
'type' => 'checkbox',
'default' => ['pay', 'tag', 'topics', 'cat'],
'default' => ['pay', 'tag', 'cat'],
'options' => [
['label' => '付费', 'value' => 'pay'],
['label' => '分类', 'value' => 'cat'],
['label' => '专题', 'value' => 'topics'],
['label' => '标签', 'value' => 'tag'],
],
],
@@ -261,12 +259,6 @@ class SchemaPostListList {
'type' => 'switch',
'default' => false,
],
[
'key' => 'list_card_topics',
'label' => '专题页卡片模式',
'type' => 'switch',
'default' => false,
],
[
'key' => 'list_card_author',
'label' => '用户页卡片模式',
-64
View File
@@ -60,15 +60,9 @@ class SchemaPageDisplay {
]],
['key' => 'header_newposts_types', 'label' => '发布类型', 'type' => 'checkbox', 'default' => ['post'], 'options' => [
['label' => '文章', 'value' => 'post'],
['label' => '帖子', 'value' => 'topic'],
['label' => '商品', 'value' => 'product'],
['label' => '版块', 'value' => 'plate'],
]],
['key' => 'header_user_newposts_btn', 'label' => '用户卡发布类型', 'type' => 'select', 'default' => 'post', 'options' => [
['label' => '文章', 'value' => 'post'],
['label' => '帖子', 'value' => 'topic'],
['label' => '商品', 'value' => 'product'],
['label' => '版块', 'value' => 'plate'],
]],
['key' => 'header_user_newposts_text', 'label' => '用户卡发布文案', 'type' => 'input', 'default' => '发布内容'],
]],
@@ -92,7 +86,6 @@ class SchemaPageDisplay {
['key' => 'header_components_cards_enabled', 'label' => '启用图标卡片', 'type' => 'switch', 'default' => false],
['key' => 'header_components_show_on', 'label' => '按页面类型启用', 'type' => 'checkbox', 'default' => ['home'], 'options' => [
['label' => '首页', 'value' => 'home'],
['label' => '专题页', 'value' => 'topics'],
['label' => '分类页', 'value' => 'category'],
['label' => '标签页', 'value' => 'tag'],
['label' => '用户页', 'value' => 'author'],
@@ -302,63 +295,6 @@ class SchemaPageDisplay {
]],
],
],
'special' => [
'key' => 'special',
'title' => '专题页面',
'version' => '1.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'header', 'title' => '专题头部', 'fields' => [
['key' => 'special_cover_enabled', 'label' => '显示专题封面', 'type' => 'switch', 'default' => true],
['key' => 'special_summary_enabled', 'label' => '显示专题摘要', 'type' => 'switch', 'default' => true],
['key' => 'special_summary_length', 'label' => '摘要最大长度', 'type' => 'number', 'default' => 200, 'min' => 50, 'max' => 500],
['key' => 'special_default_cover', 'label' => '默认封面图', 'type' => 'media', 'default' => ''],
]],
['key' => 'layout', 'title' => '布局设置', 'fields' => [
['key' => 'special_layout', 'label' => '内容布局', 'type' => 'radio', 'default' => 'grid', 'options' => [
['label' => '网格', 'value' => 'grid'],
['label' => '列表', 'value' => 'list'],
['label' => '瀑布流', 'value' => 'masonry'],
]],
['key' => 'special_columns', 'label' => '网格列数', 'type' => 'number', 'default' => 2, 'min' => 1, 'max' => 4],
['key' => 'special_sidebar', 'label' => '侧边栏', 'type' => 'switch', 'default' => true],
['key' => 'special_post_count', 'label' => '显示文章数', 'type' => 'switch', 'default' => false],
]],
['key' => 'aggregation', 'title' => '聚合规则', 'fields' => [
['key' => 'special_source_type', 'label' => '内容来源', 'type' => 'radio', 'default' => 'category', 'options' => [
['label' => '分类', 'value' => 'category'],
['label' => '标签', 'value' => 'tag'],
['label' => '手动选择', 'value' => 'manual'],
['label' => '最新文章', 'value' => 'latest'],
]],
['key' => 'special_source_ids', 'label' => '来源 ID 列表', 'type' => 'input', 'default' => ''],
]],
['key' => 'subpage', 'title' => '子页面展示', 'fields' => [
['key' => 'special_subpage_display', 'label' => '子页面样式', 'type' => 'radio', 'default' => 'cards', 'options' => [
['label' => '卡片', 'value' => 'cards'],
['label' => '列表', 'value' => 'list'],
['label' => '时间线', 'value' => 'timeline'],
]],
['key' => 'special_subpage_count', 'label' => '每页子页面数', 'type' => 'number', 'default' => 6, 'min' => 1, 'max' => 24],
]],
['key' => 'pagination', 'title' => '分页设置', 'fields' => [
['key' => 'special_pagination', 'label' => '分页模式', 'type' => 'radio', 'default' => 'numeric', 'options' => [
['label' => '数字分页', 'value' => 'numeric'],
['label' => '加载更多', 'value' => 'load_more'],
['label' => '无限滚动', 'value' => 'infinite'],
]],
['key' => 'special_per_page', 'label' => '每页文章数', 'type' => 'number', 'default' => 12, 'min' => 4, 'max' => 48],
]],
['key' => 'orderby', 'title' => '排序设置', 'fields' => [
['key' => 'special_orderby', 'label' => '默认排序', 'type' => 'select', 'default' => 'date', 'options' => [
['label' => '发布时间', 'value' => 'date'],
['label' => '最近更新', 'value' => 'modified'],
['label' => '浏览数', 'value' => 'views'],
['label' => '评论数', 'value' => 'comments'],
]],
]],
],
],
'background' => [
'key' => 'background',
'title' => '全局背景',
+1 -6
View File
@@ -112,7 +112,7 @@ class SchemaPostList {
['label' => '纯文字', 'value' => 'text'],
], 'description' => '对齐 Zibll 相关文章三种样式'],
['key' => 'post_related_source', 'label' => '推荐来源', 'type' => 'radio', 'default' => 'category', 'options' => [
['label' => '同分类/标签/专题', 'value' => 'category'],
['label' => '同分类/标签', 'value' => 'category'],
['label' => '同标签', 'value' => 'tag'],
['label' => '随机', 'value' => 'random'],
]],
@@ -179,7 +179,6 @@ class SchemaPostList {
['key' => 'custom_filter_show', 'label' => '筛选显示页面', 'type' => 'checkbox', 'default' => ['cat', 'tag'], 'options' => [
['label' => '分类页', 'value' => 'cat'],
['label' => '标签页', 'value' => 'tag'],
['label' => '专题页', 'value' => 'topics'],
], 'help' => '选择在哪些页面显示筛选栏'],
['key' => 'filter_categories', 'label' => '分类筛选', 'type' => 'switch', 'default' => true],
['key' => 'filter_tags', 'label' => '标签筛选', 'type' => 'switch', 'default' => false],
@@ -191,8 +190,6 @@ class SchemaPostList {
['key' => 'filter_cat_show_tag', 'label' => '分类页:显示标签筛选', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
['key' => 'filter_tag_show_cat', 'label' => '标签页:显示分类筛选', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
['key' => 'filter_tag_show_tag', 'label' => '标签页:显示标签筛选', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
['key' => 'filter_topics_show_cat', 'label' => '专题页:显示分类筛选', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
['key' => 'filter_topics_show_tag', 'label' => '专题页:显示标签筛选', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
]],
['key' => 'custom_filter', 'title' => '自定义筛选维度', 'fields' => [
['key' => 'custom_filter', 'label' => '筛选维度定义', 'type' => 'repeater', 'default' => [], 'dependsOn' => ['key' => 'filter_enabled', 'value' => true], 'help' => '每项定义一个筛选维度(如"类型""地区""年份"),及其可选值列表', 'fields' => [
@@ -209,7 +206,6 @@ class SchemaPostList {
['key' => 'cats', 'label' => '绑定分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => []],
['key' => 'cat_s', 'label' => '显示分类筛选', 'type' => 'switch', 'default' => false],
['key' => 'tag_s', 'label' => '显示标签筛选', 'type' => 'switch', 'default' => false],
['key' => 'topics_s', 'label' => '显示专题筛选', 'type' => 'switch', 'default' => false],
['key' => 'orderby_s', 'label' => '显示排序按钮', 'type' => 'switch', 'default' => true],
['key' => 'custom_filters', 'label' => '启用的自定义维度', 'type' => 'input', 'default' => '', 'help' => '逗号分隔维度标识,留空使用全部'],
]],
@@ -355,7 +351,6 @@ class SchemaPostList {
['key' => 'front_submit_guest_enabled', 'label' => '允许免登录投稿', 'type' => 'switch', 'default' => false, 'help' => '开启后访客可投稿;文章归属到下方用户'],
['key' => 'post_article_user', 'label' => '免登录归属用户', 'type' => 'user_select', 'default' => 0, 'help' => '免登录投稿时文章归属的用户,搜索选择'],
['key' => 'front_submit_tags', 'label' => '标签输入', 'type' => 'switch', 'default' => true],
['key' => 'post_article_topics_s', 'label' => '专题选择', 'type' => 'switch', 'default' => false, 'help' => '投稿时可选择专题分类'],
['key' => 'post_article_custom_filter_s', 'label' => '高级筛选选择', 'type' => 'switch', 'default' => true, 'help' => '投稿时可选择自定义筛选维度值'],
['key' => 'front_submit_custom_fields', 'label' => '自定义字段', 'type' => 'textarea', 'default' => ''],
]],