diff --git a/inc/helpers/user-center-renderers/sidebar-stats.php b/inc/helpers/user-center-renderers/sidebar-stats.php
index 3a83fe47..a1897372 100644
--- a/inc/helpers/user-center-renderers/sidebar-stats.php
+++ b/inc/helpers/user-center-renderers/sidebar-stats.php
@@ -7,13 +7,12 @@
defined('ABSPATH') || exit;
-$public_home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($target_user ?? null) : '';
$stats = [
[
'label' => __('文章', 'aksrt'),
'value' => (int) ($post_count ?? 0),
- 'url' => isset($dashboard_tabs['posts']) ? aksrt_get_user_center_tab_url('posts') : $public_home_url,
- 'tab' => isset($dashboard_tabs['posts']) ? 'posts' : '',
+ 'url' => aksrt_get_user_center_tab_url('posts'),
+ 'tab' => 'posts',
],
[
'label' => __('评论', 'aksrt'),
@@ -30,7 +29,8 @@ $stats = [
[
'label' => __('粉丝', 'aksrt'),
'value' => (int) ($follower_count ?? 0),
- 'url' => $public_home_url !== '' ? add_query_arg(['tab' => 'follow', 'follow_sub' => 'followers'], $public_home_url) : '',
+ 'url' => aksrt_get_user_center_tab_url('follow'),
+ 'tab' => 'follow',
],
];
?>
diff --git a/inc/modules/user-parts/routing.php b/inc/modules/user-parts/routing.php
index ffb7b496..670f3460 100644
--- a/inc/modules/user-parts/routing.php
+++ b/inc/modules/user-parts/routing.php
@@ -16,8 +16,6 @@ add_filter('query_vars', function ($vars) {
$vars[] = 'aksrt_user_center';
$vars[] = 'aksrt_user_center_tab';
$vars[] = 'aksrt_author_identifier';
- $vars[] = 'aksrt_orders';
- $vars[] = 'aksrt_revenue';
return $vars;
});
@@ -57,7 +55,7 @@ add_action('template_redirect', function () {
$tab = $tab === 'balance' ? 'credits' : sanitize_key($tab);
$allowed = class_exists('\\AKSRT\\User\\Center')
? array_keys(\AKSRT\User\Center::get_instance()->get_dashboard_tabs())
- : ['profile', 'level', 'creator', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
+ : ['profile', 'level', 'creator', 'posts', 'follow', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
if (!in_array($tab, $allowed, true)) {
global $wp_query;
if ($wp_query instanceof WP_Query) { $wp_query->set_404(); }
@@ -70,13 +68,8 @@ add_action('init', function () {
add_rewrite_tag('%aksrt_user_center%', '([^&]+)');
add_rewrite_tag('%aksrt_user_center_tab%', '([^/]+)');
add_rewrite_tag('%aksrt_author_identifier%', '([^/]+)');
- add_rewrite_tag('%aksrt_orders%', '([0-1])');
- add_rewrite_tag('%aksrt_revenue%', '([0-1])');
add_rewrite_rule('^user/([a-z0-9_-]+)/?$', 'index.php?aksrt_user_center=1&aksrt_user_center_tab=$matches[1]', 'top');
add_rewrite_rule('^author/([^/]+)/?$', 'index.php?aksrt_author_identifier=$matches[1]', 'top');
- // Commerce center aliases (work even before WP page is assigned).
- add_rewrite_rule('^orders/?$', 'index.php?aksrt_orders=1', 'top');
- add_rewrite_rule('^revenue/?$', 'index.php?aksrt_revenue=1', 'top');
});
// --- 3b. 统一模板拦截器(核心)---
diff --git a/inc/modules/user-parts/template-registry.php b/inc/modules/user-parts/template-registry.php
index 1a8150ad..734f6771 100644
--- a/inc/modules/user-parts/template-registry.php
+++ b/inc/modules/user-parts/template-registry.php
@@ -106,19 +106,6 @@ $_aksrt_special_templates = [
'title' => '个人中心',
'fallback' => '/profile/',
],
- // Commerce center pages (权益与消费 / 购物车 / 收益)
- 'orders' => [
- 'file' => 'templates/pages/page-orders.php',
- 'slug' => 'orders',
- 'title' => '我的订单',
- 'fallback' => '/orders/',
- ],
- 'revenue' => [
- 'file' => 'templates/pages/page-revenue.php',
- 'slug' => 'revenue',
- 'title' => '收益中心',
- 'fallback' => '/revenue/',
- ],
'messages' => [
'file' => 'templates/pages/page-messages.php',
'slug' => 'messages',
@@ -402,16 +389,6 @@ function aksrt_get_current_special_template_path(): string {
return $profile_template ?: '';
}
- if (get_query_var('aksrt_orders')) {
- $orders_template = aksrt_locate_template_file('templates/pages/page-orders.php');
- return $orders_template ?: '';
- }
-
- if (get_query_var('aksrt_revenue')) {
- $revenue_template = aksrt_locate_template_file('templates/pages/page-revenue.php');
- return $revenue_template ?: '';
- }
-
if (get_query_var('aksrt_sign')) {
$auth_template = aksrt_get_auth_template_file((string) get_query_var('aksrt_auth_tab'), true);
$auth_template_path = aksrt_locate_template_file($auth_template);
diff --git a/inc/modules/user-parts/urls.php b/inc/modules/user-parts/urls.php
index 1eee54dd..db012415 100644
--- a/inc/modules/user-parts/urls.php
+++ b/inc/modules/user-parts/urls.php
@@ -54,37 +54,6 @@ function aksrt_get_new_post_url(int $edit_id = 0): string {
}
endif;
-if (!function_exists('aksrt_get_orders_page_url')) :
-/**
- * 订单中心 URL — 嵌在用户中心 tab=orders(zibll 同构)。
- * 旧 /orders/ 页面模板会 302 到此地址。
- */
-function aksrt_get_orders_page_url(): string {
- if (function_exists('aksrt_get_user_center_tab_url')) {
- return aksrt_get_user_center_tab_url('orders');
- }
- if (function_exists('aksrt_get_user_center_url')) {
- return aksrt_get_user_center_url('orders');
- }
- return home_url('/user/orders/');
-}
-endif;
-
-if (!function_exists('aksrt_get_revenue_page_url')) :
-/**
- * 收益中心 URL — 嵌在用户中心 tab=revenue。
- */
-function aksrt_get_revenue_page_url(): string {
- if (function_exists('aksrt_get_user_center_tab_url')) {
- return aksrt_get_user_center_tab_url('revenue');
- }
- if (function_exists('aksrt_get_user_center_url')) {
- return aksrt_get_user_center_url('revenue');
- }
- return home_url('/user/revenue/');
-}
-endif;
-
if (!function_exists('aksrt_get_messages_page_url')) :
/**
* 消息中心页面 URL(模板 templates/pages/page-messages.php)。
diff --git a/src/Admin/Schema/SchemaExtensions.php b/src/Admin/Schema/SchemaExtensions.php
index 465bb4c2..7f6dc87d 100644
--- a/src/Admin/Schema/SchemaExtensions.php
+++ b/src/Admin/Schema/SchemaExtensions.php
@@ -18,7 +18,6 @@ class SchemaExtensions {
'audit' => SchemaExtensionsAudit::build(),
'push' => SchemaExtensionsPush::build(),
'security' => SchemaExtensionsSecurity::build(),
- 'docs-mode' => SchemaExtensionsDocsMode::build(),
],
];
}
diff --git a/src/Admin/Schema/SchemaExtensionsDocsMode.php b/src/Admin/Schema/SchemaExtensionsDocsMode.php
deleted file mode 100644
index 765ed2eb..00000000
--- a/src/Admin/Schema/SchemaExtensionsDocsMode.php
+++ /dev/null
@@ -1,53 +0,0 @@
- 'docs-mode',
- 'title' => '文档模式',
- 'version' => '1.0.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['key' => 'basic', 'title' => '基础配置', 'fields' => [
- ['key' => 'docs_mode_enabled', 'label' => '启用文档模式', 'type' => 'switch', 'default' => false],
- ['key' => 'docs_mode_default_template', 'label' => '文档首页模板', 'type' => 'select', 'default' => 'documentnav', 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true], 'options' => [
- ['label' => '文档导航页', 'value' => 'documentnav'],
- ['label' => '专题聚合页', 'value' => 'special'],
- ]],
- ]],
- ['key' => 'navigation', 'title' => '导航设置', 'fields' => [
- ['key' => 'docs_mode_toc_enabled', 'label' => '显示目录树', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ['key' => 'docs_mode_chapter_nav_enabled', 'label' => '显示章节导航', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ['key' => 'docs_mode_default_order', 'label' => '默认排序', 'type' => 'radio', 'default' => 'menu_order', 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true], 'options' => [
- ['label' => '按菜单顺序', 'value' => 'menu_order'],
- ['label' => '按发布时间', 'value' => 'date'],
- ['label' => '按标题排序', 'value' => 'title'],
- ]],
- ['key' => 'docs_mode_toc_depth', 'label' => '目录深度', 'type' => 'number', 'default' => 3, 'min' => 1, 'max' => 6, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ['key' => 'docs_mode_chapter_title', 'label' => '章节标题', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ]],
- ['key' => 'filter', 'title' => '筛选设置', 'fields' => [
- ['key' => 'docs_mode_cats', 'label' => '文档分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ['key' => 'docs_mode_exclude', 'label' => '在首页排除此类内容', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ]],
- ['key' => 'style', 'title' => '样式设置', 'fields' => [
- ['key' => 'docs_mode_style', 'label' => '文档样式', 'type' => 'select', 'default' => 'default', 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true], 'options' => [
- ['label' => '默认', 'value' => 'default'],
- ['label' => '简洁', 'value' => 'simple'],
- ['label' => '卡片', 'value' => 'card'],
- ]],
- ['key' => 'docs_mode_icon', 'label' => '显示图标', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ['key' => 'docs_mode_count', 'label' => '显示文章数', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'docs_mode_enabled', 'value' => true]],
- ]],
- ],
- ];
- }
-}
diff --git a/src/Core/DocumentNav.php b/src/Core/DocumentNav.php
deleted file mode 100644
index c2c749f3..00000000
--- a/src/Core/DocumentNav.php
+++ /dev/null
@@ -1,316 +0,0 @@
- $cat,
- 'initial_content' => $initial,
- ];
- }
-
- /**
- * Render posts list HTML (zibll zib_get_documentnav_posts).
- */
- public static function render_posts_html(\WP_Query $query): string {
- if (!$query->have_posts()) {
- $empty = function_exists('aksrt_get_null')
- ? aksrt_get_null(__('暂无相应内容', 'aksrt'), 40)
- : '' . esc_html__('暂无相应内容', 'aksrt') . '
';
- return '' . $empty . '
';
- }
-
- $html = '';
- while ($query->have_posts()) {
- $query->the_post();
- $time_ago = human_time_diff(get_the_time('U'), current_time('timestamp')) . __('前', 'aksrt');
- $subtitle = (string) get_post_meta(get_the_ID(), 'subtitle', true);
- if ($subtitle === '') {
- $subtitle = (string) get_post_meta(get_the_ID(), 'aksrt_subtitle', true);
- }
- $html .= '
';
- $html .= '' . esc_html($time_ago) . '';
- $html .= esc_html(get_the_title());
- if ($subtitle !== '') {
- $html .= ' ' . esc_html($subtitle) . '';
- }
- $html .= '';
- }
- $html .= '
';
- wp_reset_postdata();
- return $html;
- }
-
- /**
- * Simple paginate links for document nav container.
- */
- public static function render_paginate(int $total, int $current, int $page_size, array $args = []): string {
- $max = (int) ceil(max(0, $total) / max(1, $page_size));
- if ($max <= 1) {
- return '';
- }
- $current = max(1, min($current, $max));
- $html = '';
- for ($i = 1; $i <= $max; $i++) {
- $url = add_query_arg(array_merge($args, ['paged' => $i]));
- $cls = $i === $current ? 'current' : '';
- $html .= '
' . (int) $i . ' ';
- }
- $html .= '
';
- return $html;
- }
-
- /**
- * Recursive category accordion HTML.
- */
- public static function render_panels(int $cat_id, string $data_parent = 'accordion', string $class = 'panel', bool &$is_on_open = true): string {
- if ($cat_id <= 0) {
- return '';
- }
- $terms = _get_term_hierarchy('category');
- if (empty($terms[$cat_id]) || !is_array($terms[$cat_id])) {
- return '';
- }
-
- $html = '';
- foreach ($terms[$cat_id] as $child) {
- $child = (int) $child;
- if ($child === $cat_id) {
- continue;
- }
- $cat_obj = get_category($child);
- if (!$cat_obj || is_wp_error($cat_obj)) {
- continue;
- }
- $has_kids = !empty($terms[$child]);
- if ($has_kids) {
- $open = $is_on_open;
- $is_on_open = false;
- $html .= '
';
- $html .= '
';
- $html .= '
';
- $html .= '
';
- $html .= self::render_panels($child, 'dosc-cat-nav-panel-' . $child, 'panel panel-child', $is_on_open);
- $html .= '
';
- } else {
- $html .= '
';
- $html .= '' . esc_html($cat_obj->name);
- $html .= '';
- }
- }
- $html .= '
';
- return $html;
- }
-
- public function ajax_posts(): void {
- $search = isset($_REQUEST['search']) ? sanitize_text_field(wp_unslash((string) $_REQUEST['search'])) : '';
- $cat_id = isset($_REQUEST['cat_id']) ? absint($_REQUEST['cat_id']) : 0;
- $one_cat = isset($_REQUEST['one_cat']) ? absint($_REQUEST['one_cat']) : 0;
- $paged = isset($_REQUEST['paged']) ? max(1, absint($_REQUEST['paged'])) : 1;
- $page_size = 12;
-
- if ($search === '' && $cat_id <= 0) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => __('参数传入错误!', 'aksrt')]);
- }
-
- $args = [
- 'ignore_sticky_posts' => true,
- 'paged' => $paged,
- 'posts_per_page' => $page_size,
- 'post_status' => 'publish',
- 'post_type' => 'post',
- ];
-
- if ($search !== '') {
- $args['s'] = $search;
- $args['cat'] = $one_cat > 0 ? $one_cat : 0;
- // Persist simple history (user meta or cookie-less option list is optional).
- $this->remember_search($search);
- } else {
- $args['cat'] = $cat_id;
- }
-
- $query = new \WP_Query($args);
- $html = self::render_posts_html($query);
- $html .= self::render_paginate(
- (int) $query->found_posts,
- $paged,
- $page_size,
- [
- 'action' => 'aksrt_documentnav_posts',
- 'cat_id' => $cat_id,
- 'search' => $search,
- 'one_cat' => $one_cat,
- ]
- );
-
- wp_send_json([
- 'error' => 0,
- 'html' => $html,
- 'total' => (int) $query->found_posts,
- 'history_search' => $this->history_buttons_html(),
- ]);
- }
-
- private function remember_search(string $term): void {
- $term = trim($term);
- if ($term === '' || mb_strlen($term) < 2) {
- return;
- }
- $key = is_user_logged_in() ? 'aksrt_doc_search_history_' . get_current_user_id() : '';
- $list = [];
- if ($key !== '') {
- $saved = get_user_meta(get_current_user_id(), 'aksrt_doc_search_history', true);
- $list = is_array($saved) ? $saved : [];
- } else {
- $cookie = isset($_COOKIE['aksrt_doc_search_history']) ? wp_unslash((string) $_COOKIE['aksrt_doc_search_history']) : '';
- $decoded = json_decode($cookie, true);
- $list = is_array($decoded) ? $decoded : [];
- }
- $list = array_values(array_unique(array_filter(array_map('strval', $list))));
- array_unshift($list, $term);
- $list = array_slice(array_values(array_unique($list)), 0, 8);
- if ($key !== '') {
- update_user_meta(get_current_user_id(), 'aksrt_doc_search_history', $list);
- } elseif (!headers_sent()) {
- setcookie('aksrt_doc_search_history', wp_json_encode($list), time() + WEEK_IN_SECONDS, COOKIEPATH ?: '/', COOKIE_DOMAIN, is_ssl(), true);
- }
- }
-
- /**
- * @return list
- */
- private function get_history(): array {
- if (is_user_logged_in()) {
- $saved = get_user_meta(get_current_user_id(), 'aksrt_doc_search_history', true);
- return is_array($saved) ? array_values(array_filter(array_map('strval', $saved))) : [];
- }
- $cookie = isset($_COOKIE['aksrt_doc_search_history']) ? wp_unslash((string) $_COOKIE['aksrt_doc_search_history']) : '';
- $decoded = json_decode($cookie, true);
- return is_array($decoded) ? array_values(array_filter(array_map('strval', $decoded))) : [];
- }
-
- public function history_buttons_html(): string {
- $items = $this->get_history();
- if (!$items) {
- return '';
- }
- $html = '';
- foreach ($items as $term) {
- $html .= '' . esc_html($term) . '';
- }
- return $html;
- }
-
- public function register_meta_box(): void {
- add_meta_box(
- 'aksrt_documentnav_meta',
- __('文档导航设置', 'aksrt'),
- [$this, 'render_meta_box'],
- 'page',
- 'side',
- 'default'
- );
- }
-
- public function render_meta_box(\WP_Post $post): void {
- $tpl = (string) get_post_meta($post->ID, '_wp_page_template', true);
- if ($tpl !== 'templates/pages/page-documentnav.php') {
- echo '' . esc_html__('将模板设为「AKSRT - 文档导航」后配置。', 'aksrt') . '
';
- return;
- }
- $opt = self::get_options((int) $post->ID);
- wp_nonce_field('aksrt_documentnav_meta', 'aksrt_documentnav_meta_nonce');
- $cats = get_categories(['hide_empty' => false, 'parent' => 0]);
- ?>
-
-
-
-
-
-
-
-
- $cat,
- 'initial_content' => $initial,
- ]);
- }
-}
diff --git a/src/Core/LinksPageMeta.php b/src/Core/LinksPageMeta.php
deleted file mode 100644
index fc6aa66b..00000000
--- a/src/Core/LinksPageMeta.php
+++ /dev/null
@@ -1,302 +0,0 @@
-ID;
- if (!$this->is_links_template($post_id)) {
- echo '' . esc_html__('将页面模板设为「AKSRT - 网址导航」后在此配置分类、样式与提交模块。', 'aksrt') . '
';
- return;
- }
-
- $s = function_exists('aksrt_get_page_links_settings')
- ? aksrt_get_page_links_settings($post_id)
- : [];
-
- wp_nonce_field('aksrt_page_links_meta', 'aksrt_page_links_meta_nonce');
-
- $terms = get_terms([
- 'taxonomy' => 'link_category',
- 'hide_empty' => false,
- ]);
- if (is_wp_error($terms)) {
- $terms = [];
- }
-
- $selected_cats = array_map('intval', (array) ($s['category'] ?? []));
- $submit_cats = array_map('intval', (array) ($s['submit_cats'] ?? []));
- $search_types = (array) ($s['search_types'] ?? []);
- $engine_options = [
- 'self' => __('站内', 'aksrt'),
- 'baidu' => __('百度', 'aksrt'),
- 'google' => __('谷歌', 'aksrt'),
- 'bing' => __('必应', 'aksrt'),
- 'sogou' => __('搜狗', 'aksrt'),
- '360' => '360',
- ];
- ?>
-
-
- |
-
-
-
-
-
-
-
- |
-
-
- |
-
-
-
-
- |
-
-
- |
-
-
-
- 链接管理 中创建分类与链接。', 'aksrt')),
- esc_url(admin_url('link-manager.php'))
- );
- ?>
-
-
-
-
-
- |
-
-
- |
-
- __('图文列表', 'aksrt'),
- 'bigcard' => __('大卡片', 'aksrt'),
- 'image' => __('纯图片', 'aksrt'),
- ];
- foreach ($styles as $key => $label) :
- ?>
-
-
- |
-
-
- |
-
-
-
-
-
-
- |
-
-
- |
-
-
-
-
- |
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- is_links_template($post_id) && empty($_POST['page_links_category']) && empty($_POST['page_links_submit_s'])) {
- // Still allow save if user just switched template in same request.
- $tpl = isset($_POST['page_template']) ? (string) wp_unslash($_POST['page_template']) : '';
- if ($tpl !== 'templates/pages/page-links.php') {
- return;
- }
- }
-
- $bool_keys = [
- 'page_links_content_s',
- 'page_links_search_s',
- 'page_links_go_s',
- 'page_links_blank_s',
- 'page_links_nofollow_s',
- 'page_links_submit_s',
- 'page_links_submit_sign_s',
- ];
- foreach ($bool_keys as $key) {
- update_post_meta($post_id, $key, isset($_POST[$key]) ? 1 : 0);
- }
-
- $position = isset($_POST['page_links_content_position']) ? sanitize_key((string) wp_unslash($_POST['page_links_content_position'])) : 'top';
- if (!in_array($position, ['top', 'bottom'], true)) {
- $position = 'top';
- }
- update_post_meta($post_id, 'page_links_content_position', $position);
-
- $style = isset($_POST['page_links_style']) ? sanitize_key((string) wp_unslash($_POST['page_links_style'])) : 'card';
- if (!in_array($style, ['card', 'bigcard', 'image', 'simple'], true)) {
- $style = 'card';
- }
- update_post_meta($post_id, 'page_links_style', $style);
-
- $orderby = isset($_POST['page_links_orderby']) ? sanitize_key((string) wp_unslash($_POST['page_links_orderby'])) : 'name';
- if (!in_array($orderby, ['name', 'updated', 'rating', 'rand', 'id', 'length'], true)) {
- $orderby = 'name';
- }
- update_post_meta($post_id, 'page_links_orderby', $orderby);
-
- $order = isset($_POST['page_links_order']) ? strtoupper(sanitize_text_field(wp_unslash((string) $_POST['page_links_order']))) : 'ASC';
- update_post_meta($post_id, 'page_links_order', $order === 'DESC' ? 'DESC' : 'ASC');
-
- $limit = isset($_POST['page_links_limit']) ? max(0, (int) $_POST['page_links_limit']) : 0;
- update_post_meta($post_id, 'page_links_limit', $limit);
-
- $cats = isset($_POST['page_links_category']) ? array_values(array_filter(array_map('intval', (array) wp_unslash($_POST['page_links_category'])))) : [];
- update_post_meta($post_id, 'page_links_category', $cats);
-
- $submit_cats = isset($_POST['page_links_submit_cats']) ? array_values(array_filter(array_map('intval', (array) wp_unslash($_POST['page_links_submit_cats'])))) : [];
- update_post_meta($post_id, 'page_links_submit_cats', $submit_cats);
-
- $engines = isset($_POST['page_links_search_types']) ? array_values(array_filter(array_map('sanitize_key', (array) wp_unslash($_POST['page_links_search_types'])))) : [];
- $allowed = ['self', 'baidu', 'google', 'bing', 'sogou', '360'];
- $engines = array_values(array_intersect($engines, $allowed));
- update_post_meta($post_id, 'page_links_search_types', $engines);
-
- $title = isset($_POST['page_links_submit_title']) ? sanitize_text_field(wp_unslash((string) $_POST['page_links_submit_title'])) : '';
- update_post_meta($post_id, 'page_links_submit_title', $title);
-
- $dec = isset($_POST['page_links_submit_dec']) ? wp_kses_post(wp_unslash((string) $_POST['page_links_submit_dec'])) : '';
- update_post_meta($post_id, 'page_links_submit_dec', $dec);
- }
-}
diff --git a/src/Core/LinksSubmit.php b/src/Core/LinksSubmit.php
deleted file mode 100644
index 50a1de5e..00000000
--- a/src/Core/LinksSubmit.php
+++ /dev/null
@@ -1,123 +0,0 @@
- 1, 'ys' => 'danger', 'msg' => __('安全校验失败,请刷新后重试', 'aksrt')]);
- }
-
- if (isset($_COOKIE['aksrt_links_submit_time'])) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => __('操作过于频繁,请稍候再试', 'aksrt')]);
- }
-
- $link_name = isset($_POST['link_name']) ? sanitize_text_field(wp_unslash((string) $_POST['link_name'])) : '';
- $link_url = isset($_POST['link_url']) ? esc_url_raw(wp_unslash((string) $_POST['link_url'])) : '';
- $link_desc = isset($_POST['link_description']) ? sanitize_text_field(wp_unslash((string) $_POST['link_description'])) : '';
- $cat_raw = isset($_POST['link_category']) ? wp_unslash($_POST['link_category']) : [];
-
- if ($link_name === '') {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => __('请填写网站名称', 'aksrt')]);
- }
- if ($link_url === '' || !wp_http_validate_url($link_url)) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => __('网站地址格式错误', 'aksrt')]);
- }
-
- // Optional logo upload.
- $logo_url = '';
- if (!empty($_FILES['image']['name'])) {
- require_once ABSPATH . 'wp-admin/includes/file.php';
- require_once ABSPATH . 'wp-admin/includes/media.php';
- require_once ABSPATH . 'wp-admin/includes/image.php';
- $attachment_id = media_handle_upload('image', 0);
- if (is_wp_error($attachment_id)) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => $attachment_id->get_error_message()]);
- }
- $src = wp_get_attachment_image_src((int) $attachment_id, 'medium');
- $logo_url = !empty($src[0]) ? (string) $src[0] : (string) wp_get_attachment_url((int) $attachment_id);
- }
-
- $categories = [];
- if (is_array($cat_raw)) {
- $categories = array_values(array_filter(array_map('intval', $cat_raw)));
- } elseif ($cat_raw !== '' && $cat_raw !== null) {
- $categories = [absint($cat_raw)];
- }
-
- // Duplicate URL guard.
- global $wpdb;
- $exists = (int) $wpdb->get_var(
- $wpdb->prepare(
- "SELECT COUNT(1) FROM {$wpdb->links} WHERE link_url = %s",
- $link_url
- )
- );
- if ($exists > 0) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => __('您的链接已提交,请勿重复提交', 'aksrt')]);
- }
-
- if (!function_exists('wp_insert_link')) {
- require_once ABSPATH . 'wp-admin/includes/bookmark.php';
- }
-
- $linkdata = [
- 'link_name' => $link_name,
- 'link_url' => $link_url,
- 'link_description' => $link_desc,
- 'link_image' => $logo_url,
- // Non-admins create invisible links pending review (zibll parity).
- 'link_visible' => current_user_can('manage_links') ? 'Y' : 'N',
- 'link_category' => $categories,
- ];
-
- $links_id = wp_insert_link($linkdata, true);
- if (is_wp_error($links_id)) {
- wp_send_json(['error' => 1, 'ys' => 'danger', 'msg' => $links_id->get_error_message()]);
- }
-
- // 30s client throttle cookie.
- if (!headers_sent()) {
- setcookie('aksrt_links_submit_time', (string) time(), time() + 30, COOKIEPATH ?: '/', COOKIE_DOMAIN, is_ssl(), true);
- }
-
- $msg = $linkdata['link_visible'] === 'Y'
- ? __('提交成功', 'aksrt')
- : __('提交成功,等待管理员处理', 'aksrt');
-
- /**
- * Fires after a frontend link submission is stored.
- *
- * @param array $linkdata Sanitized bookmark data.
- * @param int $links_id New link ID.
- */
- do_action('aksrt_frontend_links_submit_success', $linkdata, (int) $links_id);
-
- wp_send_json(['error' => 0, 'msg' => $msg, 'reload' => true]);
- }
-}
diff --git a/src/Core/ScriptsPart1b.php b/src/Core/ScriptsPart1b.php
index 1f80b802..af879a32 100644
--- a/src/Core/ScriptsPart1b.php
+++ b/src/Core/ScriptsPart1b.php
@@ -564,28 +564,6 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
}
// 网址导航页(zibll links.php)
- if (is_page_template('templates/pages/page-links.php')) {
- $links_css = get_template_directory() . '/assets/css/routes/links.css';
- if (file_exists($links_css)) {
- wp_enqueue_style(
- 'aksrt-route-links',
- $base_uri . '/assets/css/routes/links.css',
- ['aksrt-tokens'],
- (string) filemtime($links_css)
- );
- }
- $links_js = get_template_directory() . '/assets/js/links-page.js';
- if (file_exists($links_js)) {
- wp_enqueue_script(
- 'aksrt-links-page',
- $base_uri . '/assets/js/links-page.js',
- ['jquery'],
- (string) filemtime($links_js),
- true
- );
- }
- }
-
// 文章导航页(zibll postsnavs.php)
if (is_page_template('templates/pages/page-posts-navs.php')) {
$page_navs_js = get_template_directory() . '/assets/js/page-navs.js';
@@ -643,29 +621,6 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
}
}
- // 文档导航页(zibll documentnav.php)
- if (is_page_template('templates/pages/page-documentnav.php')) {
- $dn_css = get_template_directory() . '/assets/css/routes/documentnav.css';
- if (file_exists($dn_css)) {
- wp_enqueue_style(
- 'aksrt-route-documentnav',
- $base_uri . '/assets/css/routes/documentnav.css',
- ['aksrt-tokens'],
- (string) filemtime($dn_css)
- );
- }
- $dn_js = get_template_directory() . '/assets/js/documentnav-page.js';
- if (file_exists($dn_js)) {
- wp_enqueue_script(
- 'aksrt-documentnav-page',
- $base_uri . '/assets/js/documentnav-page.js',
- [],
- (string) filemtime($dn_js),
- true
- );
- }
- }
-
// 禁封申诉页
if (is_page_template('templates/pages/page-ban-appeal.php')) {
$ba_css = get_template_directory() . '/assets/css/routes/ban-appeal.css';
@@ -689,69 +644,6 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
}
}
- // 交易中心共享壳层(订单 / 收益)
- // Virtual rewrite routes (aksrt_orders / aksrt_revenue) also count.
- $is_commerce_center = is_page_template('templates/pages/page-orders.php')
- || is_page_template('templates/pages/page-revenue.php')
- || (bool) get_query_var('aksrt_orders')
- || (bool) get_query_var('aksrt_revenue');
- if ($is_commerce_center) {
- $commerce_css = get_template_directory() . '/assets/css/routes/commerce.css';
- if (file_exists($commerce_css)) {
- wp_enqueue_style(
- 'aksrt-commerce-shell',
- $base_uri . '/assets/css/routes/commerce.css',
- ['aksrt-tokens'],
- (string) filemtime($commerce_css)
- );
- }
- }
-
- // 订单中心:独立页 / 虚拟 rewrite;用户中心在上方按可用 tab 预载。
- $is_orders_surface = is_page_template('templates/pages/page-orders.php')
- || (bool) get_query_var('aksrt_orders');
- if ($is_orders_surface) {
- $orders_css = get_template_directory() . '/assets/css/routes/orders.css';
- if (file_exists($orders_css)) {
- wp_enqueue_style(
- 'aksrt-orders',
- $base_uri . '/assets/css/routes/orders.css',
- ['aksrt-tokens'],
- (string) filemtime($orders_css)
- );
- }
-
- $order_center_js = get_template_directory() . '/assets/js/order-center.js';
- if (file_exists($order_center_js)) {
- wp_enqueue_script(
- 'aksrt-order-center',
- $base_uri . '/assets/js/order-center.js',
- ['aksrt-script', 'aksrt-rehydrate', 'aksrt-core-request', 'aksrt-core-modal-runtime'],
- (string) filemtime($order_center_js),
- true
- );
- }
- }
-
- // 收益中心:旧路由重定向页 / 用户中心 tab=revenue。
- $is_revenue_surface = is_page_template('templates/pages/page-revenue.php')
- || (bool) get_query_var('aksrt_revenue')
- || (
- (function_exists('aksrt_is_user_center_page') && aksrt_is_user_center_page())
- && isset($_GET['tab'])
- && 'revenue' === sanitize_key((string) wp_unslash($_GET['tab']))
- );
- if ($is_revenue_surface && !$is_profile_page) {
- $revenue_js = get_template_directory() . '/assets/js/revenue.js';
- wp_enqueue_script(
- 'aksrt-revenue',
- $base_uri . '/assets/js/revenue.js',
- ['aksrt-script'],
- file_exists($revenue_js) ? (string) filemtime($revenue_js) : $version,
- true
- );
- }
-
// 消息中心页
if (is_page_template('templates/pages/page-messages.php')) {
$messages_css = get_template_directory() . '/assets/css/frontend/messages.css';
diff --git a/src/Core/ScriptsPart2.php b/src/Core/ScriptsPart2.php
index 95fc0c38..edfad7eb 100644
--- a/src/Core/ScriptsPart2.php
+++ b/src/Core/ScriptsPart2.php
@@ -264,7 +264,7 @@ trait ScriptsPart2 {
*/
private function resolve_frontend_routes(): array {
return [
- 'orders' => $this->resolve_template_page_url('templates/pages/page-orders.php', '/orders/'),
+ 'orders' => function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('orders') : home_url('/user/orders/'),
'resources' => home_url('/resources/'),
];
}
diff --git a/src/Core/Templates.php b/src/Core/Templates.php
index 510bd6b6..3c9f6ef3 100644
--- a/src/Core/Templates.php
+++ b/src/Core/Templates.php
@@ -39,17 +39,13 @@ class Templates {
'templates/pages/page-profile.php' => __('AKSRT - 个人中心', 'aksrt'),
'templates/pages/page-user-home.php' => __('AKSRT - 用户主页', 'aksrt'),
'templates/pages/page-archives.php' => __('AKSRT - 文章归档', 'aksrt'),
- 'templates/pages/page-documentnav.php' => __('AKSRT - 文档导航', 'aksrt'),
'templates/pages/page-categories.php' => __('AKSRT - 分类汇总', 'aksrt'),
'templates/pages/page-newposts.php' => __('AKSRT - 最新文章', 'aksrt'),
// 注意:page-newposts = 最新文章列表;投稿页是 page-submit(写文章/投稿)
'templates/pages/page-submit.php' => __('AKSRT - 写文章/投稿', 'aksrt'),
'templates/pages/page-posts-navs.php' => __('AKSRT - 文章导航', 'aksrt'),
'templates/pages/page-friends.php' => __('AKSRT - 友情链接', 'aksrt'),
- 'templates/pages/page-links.php' => __('AKSRT - 网址导航', 'aksrt'),
'templates/pages/page-ban-appeal.php' => __('AKSRT - 禁封申诉', 'aksrt'),
- 'templates/pages/page-orders.php' => __('AKSRT - 订单中心', 'aksrt'),
- 'templates/pages/page-revenue.php' => __('AKSRT - 收益中心', 'aksrt'),
'templates/pages/page-messages.php' => __('AKSRT - 消息中心', 'aksrt'),
];
}
diff --git a/src/Payment/Gateway.php b/src/Payment/Gateway.php
index 497d158f..649fc5be 100644
--- a/src/Payment/Gateway.php
+++ b/src/Payment/Gateway.php
@@ -408,20 +408,8 @@ class Gateway {
}
private function orders_page_url(): string {
- $pages = get_posts([
- 'post_type' => 'page',
- 'post_status' => 'publish',
- 'posts_per_page' => 1,
- 'meta_key' => '_wp_page_template',
- 'meta_value' => 'templates/pages/page-orders.php',
- 'fields' => 'ids',
- 'no_found_rows' => true,
- ]);
-
- if (!empty($pages)) {
- return (string) get_permalink((int) $pages[0]);
- }
-
- return home_url('/orders/');
+ return function_exists('aksrt_get_user_center_tab_url')
+ ? aksrt_get_user_center_tab_url('orders')
+ : home_url('/user/orders/');
}
}
diff --git a/src/Settings/DomainGroups.php b/src/Settings/DomainGroups.php
index 12e5e639..d47305c9 100644
--- a/src/Settings/DomainGroups.php
+++ b/src/Settings/DomainGroups.php
@@ -27,13 +27,6 @@ trait DomainGroups {
Integration::update_wechat_settings($settings);
}
- /**
- * 获取文档模式设置
- */
- public static function get_docs_mode_settings(): array {
- return Integration::get_docs_mode_settings();
- }
-
/**
* 获取全局背景设置
*/
diff --git a/src/Settings/Integration.php b/src/Settings/Integration.php
index 5d06371d..94e278ff 100644
--- a/src/Settings/Integration.php
+++ b/src/Settings/Integration.php
@@ -567,55 +567,4 @@ class Integration {
update_option('aksrt_wechat_settings', $clean);
}
- /**
- * 获取文档模式设置
- */
- public static function get_docs_mode_settings(): array {
- $all = Settings::get_all();
-
- $template = in_array($all['docs_mode_default_template'] ?? '', ['documentnav', 'special'], true)
- ? $all['docs_mode_default_template']
- : 'documentnav';
-
- $order = in_array($all['docs_mode_default_order'] ?? '', ['menu_order', 'date', 'title'], true)
- ? $all['docs_mode_default_order']
- : 'menu_order';
-
- $style = in_array($all['docs_mode_style'] ?? '', ['default', 'simple', 'card'], true)
- ? $all['docs_mode_style']
- : 'default';
-
- $raw_cats = $all['docs_mode_cats'] ?? [];
- if (!is_array($raw_cats)) {
- $raw_cats = array_filter(array_map('trim', explode(',', (string) $raw_cats)));
- }
- $cats = array_values(array_filter(array_map('absint', $raw_cats)));
-
- return [
- 'enabled' => !empty($all['docs_mode_enabled']),
- 'default_template' => $template,
- 'toc_enabled' => !isset($all['docs_mode_toc_enabled']) || !empty($all['docs_mode_toc_enabled']),
- 'chapter_nav_enabled' => !isset($all['docs_mode_chapter_nav_enabled']) || !empty($all['docs_mode_chapter_nav_enabled']),
- 'default_order' => $order,
- 'cats' => $cats,
- 'exclude' => !isset($all['docs_mode_exclude']) || !empty($all['docs_mode_exclude']),
- 'toc_depth' => max(1, min(6, (int) ($all['docs_mode_toc_depth'] ?? 3))),
- 'chapter_title' => sanitize_text_field((string) ($all['docs_mode_chapter_title'] ?? '')),
- 'style' => $style,
- 'icon' => !isset($all['docs_mode_icon']) || !empty($all['docs_mode_icon']),
- 'count' => !isset($all['docs_mode_count']) || !empty($all['docs_mode_count']),
- 'docs_mode_enabled' => !empty($all['docs_mode_enabled']),
- 'docs_mode_default_template' => $template,
- 'docs_mode_toc_enabled' => !isset($all['docs_mode_toc_enabled']) || !empty($all['docs_mode_toc_enabled']),
- 'docs_mode_chapter_nav_enabled' => !isset($all['docs_mode_chapter_nav_enabled']) || !empty($all['docs_mode_chapter_nav_enabled']),
- 'docs_mode_default_order' => $order,
- 'docs_mode_cats' => $cats,
- 'docs_mode_exclude' => !isset($all['docs_mode_exclude']) || !empty($all['docs_mode_exclude']),
- 'docs_mode_toc_depth' => max(1, min(6, (int) ($all['docs_mode_toc_depth'] ?? 3))),
- 'docs_mode_chapter_title' => sanitize_text_field((string) ($all['docs_mode_chapter_title'] ?? '')),
- 'docs_mode_style' => $style,
- 'docs_mode_icon' => !isset($all['docs_mode_icon']) || !empty($all['docs_mode_icon']),
- 'docs_mode_count' => !isset($all['docs_mode_count']) || !empty($all['docs_mode_count']),
- ];
- }
}
diff --git a/src/User/Center.php b/src/User/Center.php
index b8f52701..d6df27d1 100644
--- a/src/User/Center.php
+++ b/src/User/Center.php
@@ -141,6 +141,18 @@ class Center {
'priority' => 18,
'type' => 'panel',
],
+ 'posts' => [
+ 'label' => __('文章', 'aksrt'),
+ 'icon' => 'file-alt',
+ 'priority' => 20,
+ 'type' => 'panel',
+ ],
+ 'follow' => [
+ 'label' => __('粉丝', 'aksrt'),
+ 'icon' => 'users',
+ 'priority' => 25,
+ 'type' => 'panel',
+ ],
'comments' => [
'label' => __('我的评论', 'aksrt'),
'icon' => 'comment',
@@ -200,10 +212,7 @@ class Center {
];
$this->panels = [];
- $configured = array_values(array_filter(
- array_map('sanitize_key', (array) ($settings['tabs'] ?? [])),
- static fn(string $key): bool => $key !== 'posts'
- ));
+ $configured = array_values(array_map('sanitize_key', (array) ($settings['tabs'] ?? [])));
if ($configured === []) {
$configured = ['profile', 'comments', 'favorites'];
}
@@ -232,6 +241,15 @@ class Center {
$order = array_values(array_filter($order, static fn(string $key): bool => $key !== 'creator'));
}
+ if (!in_array('posts', $order, true)) {
+ $insert_at = array_search('creator', $order, true);
+ array_splice($order, $insert_at === false ? 0 : (int) $insert_at + 1, 0, ['posts']);
+ }
+ if (!in_array('follow', $order, true)) {
+ $insert_at = array_search('posts', $order, true);
+ array_splice($order, $insert_at === false ? count($order) : (int) $insert_at + 1, 0, ['follow']);
+ }
+
// Growth level is a dedicated user-center surface, separate from spendable points.
if ($level_on && !in_array('level', $order, true)) {
$insert_at = array_search('profile', $order, true);
diff --git a/templates/pages/page-documentnav.php b/templates/pages/page-documentnav.php
deleted file mode 100644
index 1e199e32..00000000
--- a/templates/pages/page-documentnav.php
+++ /dev/null
@@ -1,116 +0,0 @@
- 0, 'initial_content' => 'updated_posts'];
-$one_cat = (int) ($opt['cat'] ?? 0);
-$initial = (string) ($opt['initial_content'] ?? 'updated_posts');
-
-get_header();
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
- ';
- echo '
';
- the_content();
- echo '';
- }
- } elseif ($one_cat > 0 && class_exists(DocumentNav::class)) {
- $args = [
- 'cat' => $one_cat,
- 'order' => 'DESC',
- 'orderby' => 'modified',
- 'posts_per_page' => 12,
- 'no_found_rows' => true,
- 'ignore_sticky_posts' => true,
- 'post_status' => 'publish',
- ];
- if ($initial === 'date_posts') {
- $args['orderby'] = 'date';
- } elseif ($initial === 'views_posts') {
- $args['orderby'] = 'meta_value_num';
- $args['meta_key'] = 'aksrt_post_views';
- }
- $q = new WP_Query($args);
- echo DocumentNav::render_posts_html($q); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- } else {
- echo '
';
- }
- ?>
-
-
-
-
-
-
-