refactor: remove forum and topic feature chains
This commit is contained in:
@@ -92,7 +92,6 @@ class ExtensionController extends ControllerBase {
|
||||
'data' => [
|
||||
'total' => 0,
|
||||
'nav_count' => 0,
|
||||
'special_count' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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' => '用户页卡片模式',
|
||||
|
||||
@@ -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' => '全局背景',
|
||||
|
||||
@@ -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' => ''],
|
||||
]],
|
||||
|
||||
@@ -26,7 +26,7 @@ trait PayOrders {
|
||||
if ($post_id <= 0) {
|
||||
return;
|
||||
}
|
||||
// Only count normal posts (content pay), not necessarily forum topics.
|
||||
// Only count normal posts for content purchases.
|
||||
$post = get_post($post_id);
|
||||
if (!($post instanceof \WP_Post) || $post->post_type !== 'post') {
|
||||
return;
|
||||
|
||||
@@ -171,7 +171,6 @@ class FrontSubmit {
|
||||
'allow_category' => true,
|
||||
'allow_tags' => true,
|
||||
'allow_cover' => true,
|
||||
'topics_s' => false,
|
||||
'custom_filter_s' => true,
|
||||
'review_mode' => 'pending',
|
||||
'pay_free_s' => true,
|
||||
|
||||
@@ -170,7 +170,7 @@ trait FrontSubmitSave {
|
||||
wp_set_post_tags((int) $in_id, []);
|
||||
}
|
||||
|
||||
$this->apply_topics_and_filters((int) $in_id, $data, $settings);
|
||||
$this->apply_custom_filters((int) $in_id, $data, $settings);
|
||||
|
||||
$pay_result = $this->save_pay_meta((int) $in_id, $data, $user_id, $settings);
|
||||
if (!$pay_result['success']) {
|
||||
@@ -275,16 +275,7 @@ trait FrontSubmitSave {
|
||||
* @param array<string,mixed> $data
|
||||
* @param array<string,mixed> $settings
|
||||
*/
|
||||
private function apply_topics_and_filters(int $post_id, array $data, array $settings): void {
|
||||
if (!empty($settings['topics_s']) && taxonomy_exists('topics')) {
|
||||
$topics = $data['topics'] ?? [];
|
||||
if (!is_array($topics)) {
|
||||
$topics = $topics === '' || $topics === null ? [] : [$topics];
|
||||
}
|
||||
$topic_ids = array_values(array_filter(array_map('absint', $topics)));
|
||||
wp_set_object_terms($post_id, $topic_ids, 'topics');
|
||||
}
|
||||
|
||||
private function apply_custom_filters(int $post_id, array $data, array $settings): void {
|
||||
if (empty($settings['custom_filter_s'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ trait ScriptsPart1c {
|
||||
'stickyEnabled' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_enabled'] : true,
|
||||
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_pages'] : ['home', 'cat'],
|
||||
'badgeShow' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['badge_show'] : true,
|
||||
'badgeTypes' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['badge_types'] : ['pay', 'tag', 'topics', 'cat'],
|
||||
'badgeTypes' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['badge_types'] : ['pay', 'tag', 'cat'],
|
||||
'search' => [
|
||||
'mode' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::search_mode() : 'default',
|
||||
'placeholder' => function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索...', 'aksrt'),
|
||||
|
||||
@@ -95,7 +95,7 @@ class Shortcodes {
|
||||
}
|
||||
|
||||
/**
|
||||
* [payshow]...[/payshow] — 付费后可见(文章 content-pay 或论坛主题解锁)
|
||||
* [payshow]...[/payshow] — 文章付费后可见。
|
||||
*/
|
||||
public function render_payshow(array $atts = [], string $content = ''): string {
|
||||
$atts = shortcode_atts(['message' => ''], $atts, 'payshow');
|
||||
@@ -178,7 +178,7 @@ class Shortcodes {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether current viewer may see a paid hide block on this post/topic.
|
||||
* Whether current viewer may see a paid hide block on this post.
|
||||
*/
|
||||
private function viewer_can_see_paid_block(int $pid): bool {
|
||||
if ($pid <= 0) {
|
||||
|
||||
@@ -57,7 +57,6 @@ class WidgetAjax {
|
||||
'order' => strtoupper(sanitize_key((string) ($request->get_param('order') ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => max(0, (int) ($request->get_param('cat') ?? 0)),
|
||||
'limit_day' => max(0, (int) ($request->get_param('limit_day') ?? 0)),
|
||||
'topics' => sanitize_text_field((string) ($request->get_param('topics') ?? '')),
|
||||
'pay_type' => sanitize_key((string) ($request->get_param('pay_type') ?? '')),
|
||||
'style' => sanitize_key((string) ($request->get_param('style') ?? 'list')),
|
||||
'show_thumb' => $request->get_param('show_thumb') === null ? 1 : (int) $request->get_param('show_thumb'),
|
||||
@@ -90,8 +89,6 @@ class WidgetAjax {
|
||||
'order' => strtoupper(sanitize_key((string) ($request->get_param('order') ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'count' => max(0, min(20, (int) ($request->get_param('tab_count') ?? 0))),
|
||||
'enabled' => true,
|
||||
|
||||
'topics' => sanitize_text_field((string) ($request->get_param('topics') ?? '')),
|
||||
'limit_day' => max(0, (int) ($request->get_param('limit_day') ?? 0)),
|
||||
'pay_type' => sanitize_key((string) ($request->get_param('pay_type') ?? '')),];
|
||||
$opts = [
|
||||
@@ -201,7 +198,6 @@ class WidgetAjax {
|
||||
'order' => strtoupper(sanitize_key((string) ($request->get_param('order') ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => max(0, (int) ($request->get_param('cat') ?? 0)),
|
||||
'limit_day' => max(0, (int) ($request->get_param('limit_day') ?? 0)),
|
||||
'topics' => sanitize_text_field((string) ($request->get_param('topics') ?? '')),
|
||||
'pay_type' => sanitize_key((string) ($request->get_param('pay_type') ?? '')),
|
||||
];
|
||||
$html = \AKSRT\Widgets\WidgetOnelinePosts::render_html($instance);
|
||||
|
||||
@@ -22,7 +22,7 @@ class Credits {
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias used by forum unlock/purchase paths.
|
||||
* Backward-compatible alias for credit spending.
|
||||
*/
|
||||
public static function get_balance(int $user_id): int {
|
||||
return self::balance($user_id);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Single execution path for "create a payment attempt for an existing order".
|
||||
*
|
||||
* Every cashier (shop / content / VIP / forum / recharge / points) must route
|
||||
* Every cashier (shop / content / VIP / recharge / points) must route
|
||||
* through here so that all of them get:
|
||||
* 1. a cross-request attempt lock (no double deduction on double-click)
|
||||
* 2. a fresh provider out_trade_no on re-pay (providers reject reused numbers)
|
||||
|
||||
@@ -173,7 +173,7 @@ class WeChatNotify {
|
||||
if (empty($config['enabled'])) return;
|
||||
|
||||
// 仅特定类型通知发送微信
|
||||
$allowed_types = ['comment_reply', 'system_notice', 'order_paid', 'credits_change', 'forum_reply'];
|
||||
$allowed_types = ['comment_reply', 'system_notice', 'order_paid', 'credits_change'];
|
||||
if (!in_array($type, $allowed_types, true)) return;
|
||||
|
||||
$this->send($user_id, $type, $data);
|
||||
@@ -219,7 +219,7 @@ class WeChatNotify {
|
||||
'has_template' => !empty($config['template_id']),
|
||||
'bound_users' => $bound_count,
|
||||
'app_secret' => !empty($config['app_secret']) ? '***' : '',
|
||||
'allowed_types' => ['comment_reply', 'system_notice', 'order_paid', 'credits_change', 'forum_reply'],
|
||||
'allowed_types' => ['comment_reply', 'system_notice', 'order_paid', 'credits_change'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -234,7 +234,6 @@ class WeChatNotify {
|
||||
'system_notice' => true,
|
||||
'order_paid' => true,
|
||||
'credits_change' => false,
|
||||
'forum_reply' => false,
|
||||
];
|
||||
}
|
||||
return $subs;
|
||||
@@ -244,7 +243,7 @@ class WeChatNotify {
|
||||
* Update notification subscriptions for a user.
|
||||
*/
|
||||
public function update_user_subscriptions(int $user_id, array $subscriptions): bool {
|
||||
$allowed = ['comment_reply', 'system_notice', 'order_paid', 'credits_change', 'forum_reply'];
|
||||
$allowed = ['comment_reply', 'system_notice', 'order_paid', 'credits_change'];
|
||||
$clean = [];
|
||||
foreach ($allowed as $key) {
|
||||
$clean[$key] = !empty($subscriptions[$key]);
|
||||
|
||||
@@ -53,7 +53,6 @@ trait DisplayPageGroups {
|
||||
$s = self::get_all();
|
||||
$allowed_page_types = [
|
||||
'home',
|
||||
'topics',
|
||||
'category',
|
||||
'tag',
|
||||
'author',
|
||||
@@ -153,7 +152,6 @@ trait DisplayPageGroups {
|
||||
'category_recommend' => self::get_category_recommend_settings(),
|
||||
'category' => self::get_category_page_settings(),
|
||||
'tag' => self::get_tag_page_settings(),
|
||||
'special' => self::get_special_page_settings(),
|
||||
'user_home' => self::get_user_home_settings(),
|
||||
'other' => self::get_other_page_settings(),
|
||||
'background' => self::get_global_background_settings(),
|
||||
@@ -205,7 +203,6 @@ trait DisplayPageGroups {
|
||||
'list_card_home' => $list['card_home'],
|
||||
'list_card_cat' => $list['card_cat_ids'] ?? [],
|
||||
'list_card_tag' => $list['card_tag'],
|
||||
'list_card_topics' => $list['card_topics'],
|
||||
'list_card_author' => $list['card_author'],
|
||||
],
|
||||
'thumb' => [
|
||||
|
||||
@@ -67,7 +67,7 @@ trait FacadeBulk {
|
||||
|
||||
$types = [];
|
||||
if (!empty($s['header_newposts_types']) && is_array($s['header_newposts_types'])) {
|
||||
$types = array_values(array_filter(array_map('sanitize_key', $s['header_newposts_types'])));
|
||||
$types = array_values(array_intersect(array_map('sanitize_key', $s['header_newposts_types']), ['post']));
|
||||
}
|
||||
|
||||
// zibll nav_newposts_radius is bool pill; map true→20px, false→0. Legacy int still accepted once.
|
||||
@@ -218,59 +218,6 @@ trait FacadeBulk {
|
||||
'page_author_posts_per_page' => $author_per_page,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Special/topic page display settings.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_special_page_settings(): array {
|
||||
$s = self::get_all();
|
||||
$layout = sanitize_key((string) ($s['special_layout'] ?? 'grid'));
|
||||
$source_type = sanitize_key((string) ($s['special_source_type'] ?? 'category'));
|
||||
$subpage_display = sanitize_key((string) ($s['special_subpage_display'] ?? 'cards'));
|
||||
$pagination = sanitize_key((string) ($s['special_pagination'] ?? 'numeric'));
|
||||
$orderby = sanitize_key((string) ($s['special_orderby'] ?? 'date'));
|
||||
|
||||
if (!in_array($layout, ['grid', 'list', 'masonry'], true)) {
|
||||
$layout = 'grid';
|
||||
}
|
||||
if (!in_array($source_type, ['category', 'tag', 'custom'], true)) {
|
||||
$source_type = 'category';
|
||||
}
|
||||
if (!in_array($subpage_display, ['cards', 'list', 'grid'], true)) {
|
||||
$subpage_display = 'cards';
|
||||
}
|
||||
if (!in_array($pagination, ['numeric', 'load_more', 'infinite'], true)) {
|
||||
$pagination = 'numeric';
|
||||
}
|
||||
if (!in_array($orderby, ['date', 'modified', 'views', 'comments'], true)) {
|
||||
$orderby = 'date';
|
||||
}
|
||||
|
||||
return [
|
||||
'cover_enabled' => !empty($s['special_cover_enabled']),
|
||||
'summary_enabled' => !empty($s['special_summary_enabled']),
|
||||
'summary_length' => max(50, min(500, (int) ($s['special_summary_length'] ?? 200))),
|
||||
'default_cover' => esc_url_raw((string) ($s['special_default_cover'] ?? '')),
|
||||
'layout' => $layout,
|
||||
'columns' => max(1, min(4, (int) ($s['special_columns'] ?? 2))),
|
||||
'source_type' => $source_type,
|
||||
'source_ids' => trim((string) ($s['special_source_ids'] ?? '')),
|
||||
'subpage_display' => $subpage_display,
|
||||
'subpage_count' => max(1, min(20, (int) ($s['special_subpage_count'] ?? 6))),
|
||||
'sidebar' => !empty($s['special_sidebar']),
|
||||
'pagination' => $pagination,
|
||||
'per_page' => max(4, min(48, (int) ($s['special_per_page'] ?? 12))),
|
||||
'post_count' => !empty($s['special_post_count']),
|
||||
'orderby' => $orderby,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Share and poster settings.
|
||||
*
|
||||
|
||||
@@ -41,7 +41,7 @@ class PostDisplay {
|
||||
|
||||
$sticky_pages_raw = $settings['sticky_s'] ?? null;
|
||||
if (is_array($sticky_pages_raw)) {
|
||||
$allowed_pages = ['home', 'cat', 'tag', 'topics'];
|
||||
$allowed_pages = ['home', 'cat', 'tag'];
|
||||
$sticky_pages = array_values(array_intersect(array_map('sanitize_key', $sticky_pages_raw), $allowed_pages));
|
||||
} else {
|
||||
$sticky_pages = ['home', 'cat'];
|
||||
@@ -49,10 +49,10 @@ class PostDisplay {
|
||||
|
||||
$badge_types_raw = $settings['list_badge_show'] ?? null;
|
||||
if (is_array($badge_types_raw)) {
|
||||
$allowed_types = ['pay', 'cat', 'topics', 'tag'];
|
||||
$allowed_types = ['pay', 'cat', 'tag'];
|
||||
$badge_types = array_values(array_intersect(array_map('sanitize_key', $badge_types_raw), $allowed_types));
|
||||
} else {
|
||||
$badge_types = ['pay', 'cat', 'topics', 'tag'];
|
||||
$badge_types = ['pay', 'cat', 'tag'];
|
||||
}
|
||||
|
||||
$show_author = array_key_exists('post_list_author', $settings)
|
||||
@@ -139,7 +139,6 @@ class PostDisplay {
|
||||
'card_cat' => !empty($card_cat_ids),
|
||||
'card_cat_ids' => $card_cat_ids,
|
||||
'card_tag' => !empty($settings['list_card_tag']),
|
||||
'card_topics' => !empty($settings['list_card_topics']),
|
||||
'card_author' => !empty($settings['list_card_author']),
|
||||
];
|
||||
}
|
||||
@@ -200,8 +199,6 @@ class PostDisplay {
|
||||
'cat_show_tag' => !empty($settings['filter_cat_show_tag']),
|
||||
'tag_show_cat' => !isset($settings['filter_tag_show_cat']) || !empty($settings['filter_tag_show_cat']),
|
||||
'tag_show_tag' => !empty($settings['filter_tag_show_tag']),
|
||||
'topics_show_cat' => !isset($settings['filter_topics_show_cat']) || !empty($settings['filter_topics_show_cat']),
|
||||
'topics_show_tag' => !empty($settings['filter_topics_show_tag']),
|
||||
'custom_filter_show' => is_array($settings['custom_filter_show'] ?? null) ? array_map('sanitize_key', $settings['custom_filter_show']) : ['cat', 'tag'],
|
||||
'custom_filter' => self::sanitize_custom_filter_defs($settings['custom_filter'] ?? []),
|
||||
'cat_custom_filter' => self::sanitize_cat_custom_filter($settings['cat_custom_filter'] ?? []),
|
||||
@@ -219,7 +216,6 @@ class PostDisplay {
|
||||
'cats' => [],
|
||||
'cat_s' => $cfg['cat_show_cat'],
|
||||
'tag_s' => $cfg['cat_show_tag'],
|
||||
'topics_s' => false,
|
||||
'orderby_s' => $cfg['sort'],
|
||||
'custom_filters' => [],
|
||||
];
|
||||
@@ -435,7 +431,6 @@ class PostDisplay {
|
||||
'pay_vip_price_s' => !isset($settings['post_article_pay_vip_price_s']) || !empty($settings['post_article_pay_vip_price_s']),
|
||||
'pay_vip_1_discount' => max(0, min(100, (int) ($settings['post_article_pay_vip_1_discount'] ?? 80))),
|
||||
'pay_vip_2_discount' => max(0, min(100, (int) ($settings['post_article_pay_vip_2_discount'] ?? 50))),
|
||||
'topics_s' => !empty($settings['post_article_topics_s']),
|
||||
'custom_filter_s' => !isset($settings['post_article_custom_filter_s']) || !empty($settings['post_article_custom_filter_s']),
|
||||
];
|
||||
}
|
||||
@@ -660,7 +655,6 @@ class PostDisplay {
|
||||
'cats' => $cats,
|
||||
'cat_s' => !isset($item['cat_s']) || !empty($item['cat_s']),
|
||||
'tag_s' => !empty($item['tag_s']),
|
||||
'topics_s' => !empty($item['topics_s']),
|
||||
'orderby_s' => !isset($item['orderby_s']) || !empty($item['orderby_s']),
|
||||
'custom_filters' => $filters,
|
||||
];
|
||||
|
||||
@@ -683,7 +683,7 @@ class Settings {
|
||||
* Finds the matching cat_custom_filter binding, falls back to global custom_filter.
|
||||
*
|
||||
* @param int $cat_id Category term ID.
|
||||
* @return array{dimensions: array, show_cat: bool, show_tag: bool, show_topics: bool, show_orderby: bool}
|
||||
* @return array{dimensions: array, show_cat: bool, show_tag: bool, show_orderby: bool}
|
||||
*/
|
||||
public static function get_filter_config_for_category(int $cat_id): array {
|
||||
return PostDisplay::get_filter_config_for_category($cat_id);
|
||||
|
||||
@@ -31,7 +31,7 @@ class UserRuntime {
|
||||
return $clean;
|
||||
};
|
||||
|
||||
// Zibll author_main_tab_opt defaults: post, favorite, comment, plate, forum, follow.
|
||||
// Public profile tabs supported by this theme.
|
||||
$normalized_tabs = $parse_csv('user_home_tabs', 'posts,favorites,comments,follow');
|
||||
if (empty($normalized_tabs)) {
|
||||
$normalized_tabs = ['posts', 'favorites', 'comments', 'follow'];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/** Structured marketing widgets (no commerce/forum behavior). */
|
||||
/** Structured marketing widgets. */
|
||||
namespace AKSRT\Widgets;
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ class TabPostsWidget extends \WP_Widget {
|
||||
'orderby' => sanitize_key((string) ($tab['orderby'] ?? 'date')),
|
||||
'order' => strtoupper(sanitize_key((string) ($tab['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => absint($tab['category_id'] ?? 0),
|
||||
'topics' => sanitize_text_field((string) ($tab['topics'] ?? '')),
|
||||
'limit_day' => max(0, (int) ($tab['limit_day'] ?? 0)),
|
||||
'pay_type' => sanitize_key((string) ($tab['pay_type'] ?? '')),
|
||||
'style' => $style,
|
||||
@@ -219,7 +218,6 @@ class TabPostsWidget extends \WP_Widget {
|
||||
data-orderby="<?php echo esc_attr($tab['orderby']); ?>"
|
||||
data-cat="<?php echo (int) $tab['category_id']; ?>"
|
||||
data-tab-count="<?php echo (int) $tab['count']; ?>"
|
||||
data-topics="<?php echo esc_attr((string) ($tab['topics'] ?? '')); ?>"
|
||||
data-limit-day="<?php echo esc_attr((string) ((int) ($tab['limit_day'] ?? 0))); ?>"
|
||||
data-pay-type="<?php echo esc_attr((string) ($tab['pay_type'] ?? '')); ?>"
|
||||
aria-selected="<?php echo $first ? 'true' : 'false'; ?>"
|
||||
@@ -304,7 +302,7 @@ class TabPostsWidget extends \WP_Widget {
|
||||
$max_tabs = 8;
|
||||
$tabs = array_slice($tabs, 0, $max_tabs);
|
||||
while (count($tabs) < 3) {
|
||||
$tabs[] = ['title' => '', 'category_id' => 0, 'orderby' => 'date', 'count' => 0, 'topics' => '', 'limit_day' => 0, 'pay_type' => '', 'enabled' => false];
|
||||
$tabs[] = ['title' => '', 'category_id' => 0, 'orderby' => 'date', 'count' => 0, 'limit_day' => 0, 'pay_type' => '', 'enabled' => false];
|
||||
}
|
||||
foreach ($tabs as $i => $tab) :
|
||||
?>
|
||||
@@ -332,10 +330,6 @@ class TabPostsWidget extends \WP_Widget {
|
||||
<label><?php esc_html_e('数量(0=使用默认):', 'aksrt'); ?></label>
|
||||
<input class="tiny-text" type="number" min="0" max="20" name="<?php echo esc_attr($this->get_field_name("tabs[{$i}][count]")); ?>" value="<?php echo (int) $tab['count']; ?>">
|
||||
</p>
|
||||
<p style="margin:0 0 6px;">
|
||||
<label><?php esc_html_e('专题 topics ID(逗号):', 'aksrt'); ?></label>
|
||||
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name("tabs[{$i}][topics]")); ?>" value="<?php echo esc_attr((string) ($tab['topics'] ?? '')); ?>">
|
||||
</p>
|
||||
<p style="margin:0 0 6px;">
|
||||
<label><?php esc_html_e('最近 N 天(0=不限):', 'aksrt'); ?></label>
|
||||
<input class="tiny-text" type="number" min="0" name="<?php echo esc_attr($this->get_field_name("tabs[{$i}][limit_day]")); ?>" value="<?php echo (int) ($tab['limit_day'] ?? 0); ?>">
|
||||
@@ -385,7 +379,6 @@ class TabPostsWidget extends \WP_Widget {
|
||||
'orderby' => $orderby,
|
||||
'order' => strtoupper(sanitize_key((string) ($tab['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'count' => max(0, min(20, (int) ($tab['count'] ?? 0))),
|
||||
'topics' => sanitize_text_field((string) ($tab['topics'] ?? '')),
|
||||
'limit_day' => max(0, (int) ($tab['limit_day'] ?? 0)),
|
||||
'pay_type' => sanitize_key((string) ($tab['pay_type'] ?? '')),
|
||||
'enabled' => !empty($tab['enabled']),
|
||||
|
||||
@@ -86,21 +86,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
$query['order'] = $order;
|
||||
}
|
||||
|
||||
// Topics taxonomy (CSV term IDs).
|
||||
$topics_raw = trim((string) ($instance['topics'] ?? ''));
|
||||
if ($topics_raw !== '' && taxonomy_exists('topics')) {
|
||||
$topic_ids = array_values(array_filter(array_map('intval', preg_split('/[,,\s]+/', $topics_raw) ?: [])));
|
||||
if ($topic_ids) {
|
||||
$query['tax_query'] = [
|
||||
[
|
||||
'taxonomy' => 'topics',
|
||||
'field' => 'term_id',
|
||||
'terms' => $topic_ids,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Pay type filter (reading/download/gallery/video/vip or any paid).
|
||||
$pay_type = sanitize_key((string) ($instance['pay_type'] ?? ''));
|
||||
if ($pay_type !== '' && $pay_type !== '0' && $pay_type !== 'no') {
|
||||
@@ -252,7 +237,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => (int) ($instance['cat'] ?? 0),
|
||||
'limit_day' => (int) ($instance['limit_day'] ?? 0),
|
||||
'topics' => (string) ($instance['topics'] ?? ''),
|
||||
'pay_type' => sanitize_key((string) ($instance['pay_type'] ?? '')),
|
||||
'style' => sanitize_key((string) ($instance['style'] ?? 'list')),
|
||||
'show_thumb' => !isset($instance['show_thumb']) || !empty($instance['show_thumb']) ? 1 : 0,
|
||||
@@ -318,7 +302,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => (int) ($instance['cat'] ?? 0),
|
||||
'limit_day' => (int) ($instance['limit_day'] ?? 0),
|
||||
'topics' => (string) ($instance['topics'] ?? ''),
|
||||
'pay_type' => sanitize_key((string) ($instance['pay_type'] ?? '')),
|
||||
'style' => $style,
|
||||
'show_thumb' => !isset($instance['show_thumb']) || !empty($instance['show_thumb']) ? 1 : 0,
|
||||
@@ -423,11 +406,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
</select>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('专题 topics ID(逗号)', 'aksrt'); ?>
|
||||
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('topics')); ?>" value="<?php echo esc_attr((string) ($instance['topics'] ?? '')); ?>">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('付费类型', 'aksrt'); ?>
|
||||
<select name="<?php echo esc_attr($this->get_field_name('pay_type')); ?>">
|
||||
@@ -470,7 +448,6 @@ class WidgetMainPosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($new_instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => max(0, (int) ($new_instance['cat'] ?? 0)),
|
||||
'limit_day' => max(0, (int) ($new_instance['limit_day'] ?? 0)),
|
||||
'topics' => sanitize_text_field((string) ($new_instance['topics'] ?? '')),
|
||||
'pay_type' => sanitize_key((string) ($new_instance['pay_type'] ?? '')),
|
||||
'paginate' => $paginate,
|
||||
'load_mode' => sanitize_key((string) ($new_instance['load_mode'] ?? 'detail')) === 'ajax' ? 'ajax' : 'detail',
|
||||
|
||||
@@ -80,17 +80,6 @@ class WidgetOnelinePosts extends \WP_Widget {
|
||||
$query['orderby'] = 'date';
|
||||
$query['order'] = $order;
|
||||
}
|
||||
$topics_raw = trim((string) ($instance['topics'] ?? ''));
|
||||
if ($topics_raw !== '' && taxonomy_exists('topics')) {
|
||||
$topic_ids = array_values(array_filter(array_map('intval', preg_split('/[,,\s]+/', $topics_raw) ?: [])));
|
||||
if ($topic_ids) {
|
||||
$query['tax_query'] = [[
|
||||
'taxonomy' => 'topics',
|
||||
'field' => 'term_id',
|
||||
'terms' => $topic_ids,
|
||||
]];
|
||||
}
|
||||
}
|
||||
$pay_type = sanitize_key((string) ($instance['pay_type'] ?? ''));
|
||||
if ($pay_type !== '' && $pay_type !== '0' && $pay_type !== 'no') {
|
||||
if ($pay_type === 'any' || $pay_type === 'paid') {
|
||||
@@ -257,11 +246,6 @@ class WidgetOnelinePosts extends \WP_Widget {
|
||||
<input class="tiny-text" type="number" min="0" name="<?php echo esc_attr($this->get_field_name('limit_day')); ?>" value="<?php echo esc_attr((string) ((int) ($instance['limit_day'] ?? 0))); ?>">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('专题 topics ID(逗号)', 'aksrt'); ?>
|
||||
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('topics')); ?>" value="<?php echo esc_attr((string) ($instance['topics'] ?? '')); ?>">
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><?php esc_html_e('付费类型', 'aksrt'); ?>
|
||||
<select name="<?php echo esc_attr($this->get_field_name('pay_type')); ?>">
|
||||
@@ -297,7 +281,6 @@ class WidgetOnelinePosts extends \WP_Widget {
|
||||
'order' => strtoupper(sanitize_key((string) ($new_instance['order'] ?? 'desc'))) === 'ASC' ? 'ASC' : 'DESC',
|
||||
'cat' => max(0, (int) ($new_instance['cat'] ?? 0)),
|
||||
'limit_day' => max(0, (int) ($new_instance['limit_day'] ?? 0)),
|
||||
'topics' => sanitize_text_field((string) ($new_instance['topics'] ?? '')),
|
||||
'pay_type' => sanitize_key((string) ($new_instance['pay_type'] ?? '')),
|
||||
]; return $business;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user