兼容层收口:隔离非主线入口

将文档模式、下载中心、专题聚合、消息中心、前台投稿等非 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 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-07-06 15:22:34 +08:00
1 parent 5402768f23
commit 8afb4ec856
5 files changed
+139 -11

No files matched your search

+32 -6
View File
@@ -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.
*/