fix(ns): class_exists() must use FQCN after PSR-4

Bare class_exists('Balance') looks up global Balance, always false
under AKSRT\* namespaces → REST 403 on balance exchange and friends.
Rewrite string checks to AKSRT\{Domain}\{Class}.
This commit is contained in:
kate522 committed 2026-07-17 15:40:20 +08:00
1 parent d55d1c6b62
commit 68d2e78d77
40 files changed
+105 -105

No files matched your search

+1 -1
View File
@@ -159,7 +159,7 @@ class CartService {
$guest = get_post_meta($product_id, '_aksrt_guest_buy', true);
if ($guest === '0' || $guest === '') {
// Fall back to inheritance chain via TermMeta
if (class_exists('TermMeta')) {
if (class_exists('AKSRT\Shop\TermMeta')) {
$resolved = TermMeta::resolve_inheritance($product_id, 'guest_buy');
if (empty($resolved)) {
return 'login_required';
+1 -1
View File
@@ -301,7 +301,7 @@ trait Part3 {
if ($pid <= 0 || $pay_price <= 0) continue;
$rebate_rate = (float) get_post_meta($pid, '_aksrt_rebate_rate', true);
if ($rebate_rate <= 0 && class_exists('TermMeta')) {
if ($rebate_rate <= 0 && class_exists('AKSRT\Shop\TermMeta')) {
$resolved = TermMeta::resolve_inheritance($pid, 'rebate');
$rebate_rate = (float) ($resolved ?: 0);
}
+1 -1
View File
@@ -275,7 +275,7 @@ class ProductReview {
$order_number = (string) ($order['order_number'] ?? '');
if ($user_id <= 0 || $order_number === '') continue;
$items = class_exists('Shop')
$items = class_exists('AKSRT\\Shop\\Shop')
? Shop::get_instance()->get_order_items($order_number)
: [];
+2 -2
View File
@@ -41,7 +41,7 @@ class ProductVariantsMetaBox {
wp_nonce_field('aksrt_product_variants_save', 'aksrt_product_variants_nonce');
$variants = [];
if (class_exists('Shop')) {
if (class_exists('AKSRT\\Shop\\Shop')) {
$variants = Shop::get_instance()->get_variants((int) $post->ID);
}
@@ -138,7 +138,7 @@ class ProductVariantsMetaBox {
if ($post->post_type !== 'aksrt_product' || !current_user_can('edit_post', $post_id)) {
return;
}
if (!class_exists('Shop')) {
if (!class_exists('AKSRT\\Shop\\Shop')) {
return;
}