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:
kate522 committed 2026-07-17 13:29:22 +08:00
1 parent 8f349b40fb
commit aaf458af1c
404 files changed
+13602 -7705

No files matched your search

+16 -16
View File
@@ -10,23 +10,23 @@
defined('ABSPATH') || exit;
function aksrt_get_order_status_labels(): array {
if (class_exists('AKSRT_Domain_Model')) {
return AKSRT_Domain_Model::order_status_labels();
if (class_exists('\AKSRT\Core\DomainModel')) {
return \AKSRT\Core\DomainModel::order_status_labels();
}
return [];
}
function aksrt_get_product_page_view(int $product_id): array {
if ($product_id <= 0 || !class_exists('AKSRT_Shop')) {
if ($product_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
return [];
}
return AKSRT_Shop::get_instance()->get_product_detail_view($product_id);
return \AKSRT\Shop\Shop::get_instance()->get_product_detail_view($product_id);
}
function aksrt_get_product_edit_page_view(int $user_id, int $product_id = 0): array {
if ($user_id <= 0 || !class_exists('AKSRT_Shop')) {
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
return [
'allowed' => false,
'is_edit' => false,
@@ -34,11 +34,11 @@ function aksrt_get_product_edit_page_view(int $user_id, int $product_id = 0): ar
];
}
return AKSRT_Shop::get_instance()->get_product_edit_view($user_id, $product_id);
return \AKSRT\Shop\Shop::get_instance()->get_product_edit_view($user_id, $product_id);
}
function aksrt_get_cart_page_view(int $user_id): array {
if ($user_id <= 0 || !class_exists('AKSRT_Shop')) {
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
return [
'payment_methods' => [],
'shipping_methods' => [],
@@ -49,11 +49,11 @@ function aksrt_get_cart_page_view(int $user_id): array {
];
}
return AKSRT_Shop::get_instance()->get_cart_page_view($user_id);
return \AKSRT\Shop\Shop::get_instance()->get_cart_page_view($user_id);
}
function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page = 20, string $status = ''): array {
if ($user_id <= 0 || !class_exists('AKSRT_Shop')) {
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
return [
'items' => [],
'total' => 0,
@@ -62,7 +62,7 @@ function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page
];
}
return AKSRT_Shop::get_instance()->get_order_center_view($user_id, [
return \AKSRT\Shop\Shop::get_instance()->get_order_center_view($user_id, [
'page' => $paged,
'per_page' => $per_page,
'status' => $status,
@@ -75,12 +75,12 @@ function aksrt_get_revenue_page_view(int $user_id): array {
$total_withdrawn = 0.0;
$records = [];
if (class_exists('AKSRT_Credits')) {
$balance = (float) AKSRT_Credits::balance($user_id);
if (class_exists('\AKSRT\Credits\Credits')) {
$balance = (float) \AKSRT\Credits\Credits::balance($user_id);
}
if (class_exists('AKSRT_Revenue')) {
$revenues = AKSRT_Revenue::get_instance()->get_user_revenues($user_id, ['limit' => 200]);
if (class_exists('\AKSRT\Payment\Revenue')) {
$revenues = \AKSRT\Payment\Revenue::get_instance()->get_user_revenues($user_id, ['limit' => 200]);
foreach ($revenues as $rev) {
$row = is_array($rev) ? $rev : (array) $rev;
$total_earned += (float) ($row['amount'] ?? 0);
@@ -93,8 +93,8 @@ function aksrt_get_revenue_page_view(int $user_id): array {
}
}
if (class_exists('AKSRT_Withdrawal')) {
$withdrawals = AKSRT_Withdrawal::get_instance()->get_user_withdrawals($user_id, ['limit' => 200]);
if (class_exists('\AKSRT\Payment\Withdrawal')) {
$withdrawals = \AKSRT\Payment\Withdrawal::get_instance()->get_user_withdrawals($user_id, ['limit' => 200]);
foreach ($withdrawals as $w) {
$wrow = is_array($w) ? $w : (array) $w;
$total_withdrawn += (float) ($wrow['amount'] ?? 0);