refactor: remove forum and topic feature chains

This commit is contained in:
kate522 committed 2026-08-17 14:52:19 +08:00
1 parent 698e3750f9
commit 6c6c462df8
69 files changed
+339 -2057

No files matched your search

+3 -8
View File
@@ -31,7 +31,6 @@ if (!function_exists('aksrt_archive_get_list_style_settings')) :
'card_cat_ids' => is_array($settings['card_cat_ids'] ?? null) ? array_map('intval', $settings['card_cat_ids']) : [],
'card_home' => !empty($settings['card_home']),
'card_tag' => !empty($settings['card_tag']),
'card_topics' => !empty($settings['card_topics']),
'card_author' => !empty($settings['card_author']),
'list_show_type' => (string) ($settings['list_show_type'] ?? 'separate'),
'list_img_position'=> (string) ($settings['list_img_position'] ?? 'left'),
@@ -55,10 +54,10 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
* Decision order mirrors zib_mian_posts_while():
* 1) explicit override mode/type
* 2) global list_type (post_card_style): only "card" is card grid; thumb/text/thumb_if_has are list
* 3) surface card switches (home/tag/topics/author/cat IDs)
* 3) surface card switches (home/tag/author/cat IDs)
*
* @param array<string,mixed> $args {
* @type string $context home|category|tag|topics|author|search|archive
* @type string $context home|category|tag|author|search|archive
* @type int $term_id Optional term id for list_card_cat
* @type array<string,mixed> $overrides Optional renderer overrides (mode, style, …)
* }
@@ -84,8 +83,6 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
$context = 'category';
} elseif (is_tag()) {
$context = 'tag';
} elseif (is_tax('topics')) {
$context = 'topics';
} elseif (is_author()) {
$context = 'author';
} elseif (is_search()) {
@@ -126,8 +123,6 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
$mode = 'card';
} elseif ($context === 'tag' && !empty($list['card_tag'])) {
$mode = 'card';
} elseif ($context === 'topics' && !empty($list['card_topics'])) {
$mode = 'card';
} elseif ($context === 'author' && !empty($list['card_author'])) {
$mode = 'card';
} elseif ($term_id > 0 && !empty($list['card_cat_ids']) && in_array($term_id, array_map('intval', (array) $list['card_cat_ids']), true)) {
@@ -191,7 +186,7 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
$config['multi_thumb_limit'] = (int) ($thumb_settings['multi_count'] ?? 4);
$config['multi_thumb_min'] = 3;
}
if (($context === 'category' || $context === 'topics') && !empty($thumb_settings['mult_thumb_cat_ids']) && $term_id > 0) {
if ($context === 'category' && !empty($thumb_settings['mult_thumb_cat_ids']) && $term_id > 0) {
if (in_array($term_id, array_map('intval', (array) $thumb_settings['mult_thumb_cat_ids']), true)) {
$config['multi_thumb_enabled'] = true;
$config['multi_thumb_limit'] = (int) ($thumb_settings['multi_count'] ?? 4);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
/**
* Shared coupon burn helpers for cash content / topic orders.
* Shared coupon burn helpers for cash content orders.
*
* Idempotent via coupon_usage.order_number. Prefer note.coupon snapshot ids
* so burn still works after use_coupon increments used_count past limit.
+1 -1
View File
@@ -34,7 +34,7 @@ if (!function_exists('aksrt_get_new_add_actions')) :
/**
* Build multi-type publish actions.
*
* @param string[] $types post|topic|product
* @param string[] $types Currently only post is supported.
* @return list<array{type:string,url:string,label:string,icon:string}>
*/
function aksrt_get_new_add_actions(array $types = ['post']): array {
+1 -1
View File
@@ -87,7 +87,7 @@ if (!function_exists('aksrt_homepage_get_tab_terms')) {
if (!$term || is_wp_error($term)) {
continue;
}
if (!in_array($term->taxonomy, ['category', 'topics'], true)) {
if ($term->taxonomy !== 'category') {
continue;
}
File renamed without changes.
+1 -1
View File
@@ -75,7 +75,7 @@ function aksrt_get_pay_types(): array {
}
/**
* Cash payment methods available for content/topic cashiers.
* Cash payment methods available for content cashiers.
*
* @return array<int, array{id:string,name:string}>
*/
-7
View File
@@ -592,13 +592,6 @@ if (!function_exists('aksrt_renderer_badges')) {
}
}
$topics = taxonomy_exists('topics') ? wp_get_post_terms((int) $data['post_id'], 'topics') : [];
if (!is_wp_error($topics) && !empty($topics)) {
foreach (array_slice($topics, 0, 2) as $topic) {
$items[] = '<a href="' . esc_url(get_term_link($topic)) . '" class="but"><i class="fas fa-cube" aria-hidden="true"></i> ' . esc_html($topic->name) . '</a>';
}
}
if (!empty($data['is_resource'])) {
$items[] = '<span class="but jb-vip">VIP</span>';
}
+3 -16
View File
@@ -175,7 +175,7 @@ endif;
if (!function_exists('aksrt_get_colored_term_tags')) :
/**
* Colored but-links for terms (Zibll cat/topics palette).
* Colored but-links for terms.
*
* @param WP_Term[] $terms Terms.
* @param string $class Base class.
@@ -207,22 +207,9 @@ endif;
if (!function_exists('aksrt_get_single_article_tags_html')) :
/**
* topics → categories → tags (Zibll footer order).
* Categories → tags.
*/
function aksrt_get_single_article_tags_html(int $post_id): string {
$topics_html = '';
if (taxonomy_exists('topics')) {
$topics = wp_get_post_terms($post_id, 'topics');
if (!is_wp_error($topics) && !empty($topics)) {
$topics_html = aksrt_get_colored_term_tags(
array_slice($topics, 0, 6),
'but ml6 radius',
'<i class="fa fa-cube" aria-hidden="true"></i> ',
['c-yellow', 'c-green', 'c-purple', 'c-red', 'c-blue']
);
}
}
$cats = get_the_category($post_id) ?: [];
$cat_html = aksrt_get_colored_term_tags(
$cats,
@@ -246,7 +233,7 @@ if (!function_exists('aksrt_get_single_article_tags_html')) :
}
}
$top = $topics_html . $cat_html;
$top = $cat_html;
if ($top === '' && $tags_html === '') {
return '';
}
+1 -11
View File
@@ -605,7 +605,7 @@ if (!function_exists('aksrt_single_related_query_args')) :
];
}
} else {
// category (default): OR across category + tags + topics like Zibll.
// category (default): OR across category + tags.
$cat_ids = wp_get_post_terms($post_id, 'category', ['fields' => 'ids']);
if (!empty($cat_ids) && !is_wp_error($cat_ids)) {
$tax_query[] = [
@@ -622,16 +622,6 @@ if (!function_exists('aksrt_single_related_query_args')) :
'terms' => array_map('intval', $tag_ids),
];
}
if (taxonomy_exists('topics')) {
$topic_ids = wp_get_post_terms($post_id, 'topics', ['fields' => 'ids']);
if (!empty($topic_ids) && !is_wp_error($topic_ids)) {
$tax_query[] = [
'taxonomy' => 'topics',
'field' => 'term_id',
'terms' => array_map('intval', $topic_ids),
];
}
}
}
if (count($tax_query) > 1) {
+1 -1
View File
@@ -1424,7 +1424,7 @@ if (!function_exists('aksrt_user_can')) :
*
* @param string $cap Capability id (e.g. 'new_post_add', 'comment_edit').
* @param int $user_id User ID. Defaults to current user.
* @param int|null $context Optional plate/post context for moderator-scoped caps.
* @param int|null $context Optional content context for scoped capabilities.
* @return bool
*/
function aksrt_user_can(string $cap, int $user_id = 0, ?int $context = null): bool {
+1 -1
View File
@@ -63,7 +63,7 @@ if (!function_exists('aksrt_homepage_get_tab_query')) {
$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';
}
@@ -16,7 +16,6 @@ if (!function_exists('aksrt_header_components_page_type_keys')) {
function aksrt_header_components_page_type_keys(): array {
return [
'home',
'topics',
'category',
'tag',
'author',
@@ -68,11 +67,6 @@ if (!function_exists('aksrt_header_slide_match_page_type')) {
$post_type = (string) $raw_post_type;
}
// Special keys that are not plain is_{$type} flags.
if ($type === 'topics') {
return is_tax('topics');
}
// Generic WP_Query is_* flags (home/category/tag/author/single/search/page).
$query_flag = 'is_' . $type;
if (empty($wp_query->{$query_flag})) {