From 8afb4ec856952239ae015cfd3296b9e0f6764fe3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jul 2026 15:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=B1=82=E6=94=B6=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A=E9=9A=94=E7=A6=BB=E9=9D=9E=E4=B8=BB=E7=BA=BF=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将文档模式、下载中心、专题聚合、消息中心、前台投稿等非 Zibll 主线能力 收敛为“兼容保留”,默认不再作为主入口暴露,但保留路由/模板/数据/设置键。 - 新增 inc/helpers/aksrt-compat.php 兼容策略中枢: - aksrt_get_messages_url()(补齐此前缺失、被两处模板调用的 helper) - aksrt_pm_frontend_enabled()(前台私信入口开关,默认关闭) - aksrt_show_compat_page_templates()(兼容页面模板下拉开关,默认关闭) - AKSRT_Templates::page_template_map() 拆分为主线/兼容两组,兼容模板默认 移出 wp-admin 页面模板下拉;已分配这些模板的历史页面照常渲染。 - 作者操作条“私信”按钮(停用候选)默认前台隐藏,可经 filter/常量开启。 - 修复 admin-sections.js barrel 未再导出 getAdminSections 的缺陷,该缺陷 会使 router 的兼容分区默认落点重定向在加载时抛错。 Co-Authored-By: Claude Fable 5 --- assets/admin/src/constants/admin-sections.js | 2 +- inc/bootstrap.php | 1 + inc/classes/class-aksrt-templates.php | 38 ++++++-- inc/helpers/aksrt-compat.php | 98 ++++++++++++++++++++ templates/parts/single-author-bar.php | 11 ++- 5 files changed, 139 insertions(+), 11 deletions(-) create mode 100644 inc/helpers/aksrt-compat.php diff --git a/assets/admin/src/constants/admin-sections.js b/assets/admin/src/constants/admin-sections.js index d4a8d1a4..ceaffb35 100644 --- a/assets/admin/src/constants/admin-sections.js +++ b/assets/admin/src/constants/admin-sections.js @@ -6,5 +6,5 @@ * the navigation tree and router definitions while keeping each file focused. */ -export { ADMIN_SECTIONS, getAllAdminPages } from './sections/index.js' +export { ADMIN_SECTIONS, getAdminSections, getAllAdminPages } from './sections/index.js' export { renderFaIcon, customPage, schemaPage, deferredPage } from './sections/helpers.js' diff --git a/inc/bootstrap.php b/inc/bootstrap.php index dcc6dbb5..945ee557 100644 --- a/inc/bootstrap.php +++ b/inc/bootstrap.php @@ -32,6 +32,7 @@ require_once AKSRT_DIR . '/inc/helpers/aksrt-vip.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-i18n-switch.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-posts-renderer.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-resource.php'; +require_once AKSRT_DIR . '/inc/helpers/aksrt-compat.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-pay.php'; require_once AKSRT_DIR . '/inc/helpers/aksrt-credits.php'; require_once AKSRT_DIR . '/inc/helpers/menu-decoration.php'; diff --git a/inc/classes/class-aksrt-templates.php b/inc/classes/class-aksrt-templates.php index 685bee29..b79765dc 100644 --- a/inc/classes/class-aksrt-templates.php +++ b/inc/classes/class-aksrt-templates.php @@ -32,7 +32,10 @@ class AKSRT_Templates { // 短代码注册统一在 AKSRT_Shortcodes(registry);本类只提供 archive/profile 渲染实现。 } - private function page_template_map(): array { + /** + * 主线页面模板:内容 / 用户 / 付费 / 论坛 / 商城主线可选模板。 + */ + private function mainline_page_template_map(): array { return [ 'templates/pages/page-sign.php' => __('AKSRT - 登录/注册', 'aksrt'), 'templates/pages/page-profile.php' => __('AKSRT - 个人中心', 'aksrt'), @@ -41,12 +44,7 @@ class AKSRT_Templates { 'templates/pages/page-categories.php' => __('AKSRT - 分类汇总', 'aksrt'), 'templates/pages/page-newposts.php' => __('AKSRT - 最新文章', 'aksrt'), 'templates/pages/page-posts-navs.php' => __('AKSRT - 文章导航', 'aksrt'), - 'templates/pages/page-special.php' => __('AKSRT - 专题聚合', 'aksrt'), - 'templates/pages/page-documentnav.php' => __('AKSRT - 文档导航', 'aksrt'), 'templates/pages/page-friends.php' => __('AKSRT - 友情链接', 'aksrt'), - 'templates/pages/page-messages.php' => __('AKSRT - 消息中心', 'aksrt'), - 'templates/pages/page-download.php' => __('AKSRT - 下载中心', 'aksrt'), - 'templates/pages/page-submit.php' => __('AKSRT - 前台投稿', 'aksrt'), 'templates/pages/page-orders.php' => __('AKSRT - 订单中心', 'aksrt'), 'templates/pages/page-revenue.php' => __('AKSRT - 收益中心', 'aksrt'), 'templates/pages/page-cart.php' => __('AKSRT - 购物车', 'aksrt'), @@ -57,6 +55,34 @@ class AKSRT_Templates { ]; } + /** + * 兼容保留页面模板:非 Zibll 主线能力(文档模式、下载中心、专题、消息、投稿)。 + * + * 这些模板文件与已分配它们的历史页面继续正常渲染(见 load_page_template()), + * 只是默认不再出现在 wp-admin 页面模板下拉中,避免污染主线内容心智。 + * 站点可通过 aksrt_show_compat_page_templates() 重新暴露下拉选项。 + */ + private function compat_page_template_map(): array { + return [ + 'templates/pages/page-special.php' => __('AKSRT - 专题聚合(兼容)', 'aksrt'), + 'templates/pages/page-documentnav.php' => __('AKSRT - 文档导航(兼容)', 'aksrt'), + 'templates/pages/page-messages.php' => __('AKSRT - 消息中心(兼容)', 'aksrt'), + 'templates/pages/page-download.php' => __('AKSRT - 下载中心(兼容)', 'aksrt'), + 'templates/pages/page-submit.php' => __('AKSRT - 前台投稿(兼容)', 'aksrt'), + ]; + } + + private function page_template_map(): array { + $map = $this->mainline_page_template_map(); + + // 兼容页面模板默认隐藏出下拉;仅在站点显式开启时暴露。 + if (function_exists('aksrt_show_compat_page_templates') && aksrt_show_compat_page_templates()) { + $map = array_merge($map, $this->compat_page_template_map()); + } + + return $map; + } + /** * Register selectable page templates in wp-admin. */ diff --git a/inc/helpers/aksrt-compat.php b/inc/helpers/aksrt-compat.php new file mode 100644 index 00000000..2588d707 --- /dev/null +++ b/inc/helpers/aksrt-compat.php @@ -0,0 +1,98 @@ + - - - - + + + + + + +