refactor(autoload): migrate theme classes to Composer PSR-4
Move 288 types from global AKSRT_* + inc/classes manual requires into
namespace AKSRT\{Domain} under src/AKSRT/, wire composer.json psr-4,
and slim bootstrap to helpers/modules/hooks only. Split multi-class
widget/gateway files, update admin contract audit paths, and document
the layout in ADR/README.
This commit is contained in:
@@ -26,49 +26,36 @@ AKSRT 是一款现代化的 WordPress 主题,采用**原生 WordPress 主题
|
||||
|
||||
```
|
||||
AKSRT-theme/
|
||||
├── functions.php # 入口文件(精简版:常量+bootstrap加载+实例初始化)
|
||||
├── functions.php # 入口:常量 + Composer autoload + bootstrap + 单例 init
|
||||
├── style.css # WordPress 主题声明头
|
||||
├── composer.json # 第三方依赖 + 主题 PSR-4(AKSRT\ → src/AKSRT/)
|
||||
│
|
||||
├── *.php # WP 核心模板保留根目录
|
||||
│ ├── index.php # 首页(文章列表 Loop)
|
||||
│ ├── single.php # 文章详情页
|
||||
│ ├── page.php # 默认页面模板
|
||||
│ ├── front-page.php # 首页静态页面
|
||||
│ ├── archive.php # 归档页
|
||||
│ ├── author.php # 作者存档
|
||||
│ ├── search.php # 搜索结果
|
||||
│ ├── 404.php # 错误页
|
||||
│ ├── header.php / footer.php # 页头/页脚
|
||||
│ ├── sidebar.php # 侧边栏
|
||||
│ └── comments.php # 评论模板
|
||||
│
|
||||
├── inc/ # 核心代码目录
|
||||
│ ├── bootstrap.php # 自动加载器(统一 require 所有模块)
|
||||
│ ├── core-hooks.php # 核心功能钩子(Gravatar/SMTP/评论/CPT等)
|
||||
│ │
|
||||
│ ├── classes/ # ← 类文件按领域目录组织
|
||||
│ │ ├── core/ # 主题壳层(setup/scripts/templates/SEO/DB…)
|
||||
│ │ ├── frontend/ # 前端渲染辅助(inline style / custom code…)
|
||||
│ │ ├── settings/ # 设置门面 + 运行时 delegates
|
||||
│ │ ├── admin/ # SPA 编排 + 域控制器 + schema + native ops
|
||||
│ │ ├── auth/ # 登录/OAuth/验证码/审核/邮箱
|
||||
│ │ ├── user/ # 用户中心/主页/徽章/等级/关注
|
||||
│ │ ├── credits/ # 积分/钱包/签到/邀请
|
||||
│ │ ├── content/ # 下载 token / 付费内容 / VIP / 可见性
|
||||
│ │ ├── payment/ # 订单/网关/售后/物流/充值卡/分成
|
||||
│ │ │ └── gateways/ # 支付宝/微信/PayPal/Stripe
|
||||
│ │ ├── forum/ # 论坛服务 + 收银台 + meta box
|
||||
│ │ ├── shop/ # 商城服务 + meta box + 评价
|
||||
│ │ ├── sms/ # 短信编排 + 各云厂商 adapter
|
||||
│ │ ├── ai/ # AI / SEO prompt
|
||||
│ │ ├── messages/ # 站内信/私信/公告/举报
|
||||
│ │ ├── extensions/ # MeiliSearch / 推送 / IP / 内容审核
|
||||
│ │ └── widgets/ # 小工具实现 + 注册中心
|
||||
│ │
|
||||
│ └── helpers/ # ← 辅助函数文件
|
||||
│ ├── aksrt-icons.php # SVG 图标系统(读取/缓存/映射)
|
||||
│ ├── aksrt-template-tags.php # 模板标签(Banners/友链/Logo/SEO Head)
|
||||
│ └── aksrt-frontend-tags.php # 前端标签(阅读时长/面包屑/评论回调)
|
||||
├── src/AKSRT/ # Composer PSR-4 类型根(namespace AKSRT\)
|
||||
│ ├── Admin/ # SPA 编排 + 域控制器 + Schema + Native ops
|
||||
│ ├── Auth/ # 登录 / OAuth / 审核 / 邮箱
|
||||
│ ├── Content/ # 下载 token / 付费内容 / VIP / 可见性
|
||||
│ ├── Core/ # 主题壳层(Setup / Scripts / Templates / SEO / DB…)
|
||||
│ ├── Credits/ # 积分 / 钱包 / 签到 / 邀请
|
||||
│ ├── Extensions/ # MeiliSearch / 推送 / IP / 内容审核
|
||||
│ ├── Forum/ # 论坛服务 + 收银台
|
||||
│ ├── Frontend/ # 前端渲染辅助
|
||||
│ ├── Messages/ # 站内信 / 私信 / 公告 / 举报
|
||||
│ ├── Payment/ # 订单 / 网关 / 售后 / 物流 / 分成
|
||||
│ │ └── Gateways/ # 支付宝 / 微信 / PayPal / Stripe
|
||||
│ ├── Settings/ # 设置门面 + 运行时 delegates
|
||||
│ ├── Shop/ # 商城服务 + meta box
|
||||
│ ├── Sms/ # 短信编排 + 云厂商 adapter
|
||||
│ ├── Ai/ # AI / SEO prompt
|
||||
│ ├── User/ # 用户中心 / 主页 / 徽章 / 等级 / 关注
|
||||
│ └── Widgets/ # 小工具类(一类一文件)
|
||||
│
|
||||
├── inc/ # 过程式引导与辅助
|
||||
│ ├── bootstrap.php # helpers + modules + core-hooks(类由 Composer 加载)
|
||||
│ ├── core-hooks.php # 核心功能钩子
|
||||
│ ├── modules/ # 非类过程式模块(captcha / user-parts / widgets 注册…)
|
||||
│ └── helpers/ # 辅助函数
|
||||
│
|
||||
├── templates/ # 模板目录(与 inc/ 隔离)
|
||||
│ ├── pages/ # 自定义页面模板
|
||||
|
||||
Reference in New Issue
Block a user