From 68d2e78d771970a0a7a62f31e21af754a0518ed5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Jul 2026 15:40:20 +0800 Subject: [PATCH] fix(ns): class_exists() must use FQCN after PSR-4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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}. --- src/AKSRT/Admin/Native/PayMenus.php | 20 ++++++++++---------- src/AKSRT/Admin/Native/PayOrders.php | 6 +++--- src/AKSRT/Ai/AISEO.php | 4 ++-- src/AKSRT/Auth/EmailRollback.php | 2 +- src/AKSRT/Auth/OAuth.php | 2 +- src/AKSRT/Content/Download.php | 2 +- src/AKSRT/Content/DownloadState.php | 2 +- src/AKSRT/Core/PostMetaBox.php | 12 ++++++------ src/AKSRT/Core/ResourceMetaBox.php | 2 +- src/AKSRT/Core/Shortcodes.php | 4 ++-- src/AKSRT/Credits/BalanceServiceCharge.php | 6 +++--- src/AKSRT/Credits/BalanceServicePoints.php | 6 +++--- src/AKSRT/Credits/BalanceServiceRest.php | 14 +++++++------- src/AKSRT/Credits/Earn.php | 20 ++++++++++---------- src/AKSRT/Credits/Invite.php | 2 +- src/AKSRT/Credits/PointsFree.php | 2 +- src/AKSRT/Credits/Signin.php | 8 ++++---- src/AKSRT/Forum/Forum.php | 2 +- src/AKSRT/Forum/PlateFollowPay.php | 8 ++++---- src/AKSRT/Forum/PlateMetaBox.php | 8 ++++---- src/AKSRT/Forum/TopicPay.php | 6 +++--- src/AKSRT/Messages/PrivateMessage.php | 2 +- src/AKSRT/Payment/AfterSale.php | 6 +++--- src/AKSRT/Payment/ChargeCard.php | 8 ++++---- src/AKSRT/Payment/CreatorRevenue.php | 2 +- src/AKSRT/Payment/Gateway.php | 2 +- src/AKSRT/Payment/OrderRepositoryAdmin.php | 6 +++--- src/AKSRT/Payment/Shipping.php | 4 ++-- src/AKSRT/Payment/ShippingPart1.php | 4 ++-- src/AKSRT/Settings/FacadeBulk.php | 2 +- src/AKSRT/Shop/CartService.php | 2 +- src/AKSRT/Shop/Part3.php | 2 +- src/AKSRT/Shop/ProductReview.php | 2 +- src/AKSRT/Shop/ProductVariantsMetaBox.php | 4 ++-- src/AKSRT/Sms/SMSProviderAliyun.php | 2 +- src/AKSRT/Sms/SMSProviderFactory.php | 8 ++++---- src/AKSRT/User/Badges.php | 2 +- src/AKSRT/User/BadgesAdmin.php | 6 +++--- src/AKSRT/User/Home.php | 4 ++-- src/AKSRT/User/Metrics.php | 4 ++-- 40 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/AKSRT/Admin/Native/PayMenus.php b/src/AKSRT/Admin/Native/PayMenus.php index 7a834bba..7394a987 100644 --- a/src/AKSRT/Admin/Native/PayMenus.php +++ b/src/AKSRT/Admin/Native/PayMenus.php @@ -45,7 +45,7 @@ class PayMenus { 'slug' => 'aksrt_orders', 'title' => __('订单', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayOrders')) { + if (class_exists('AKSRT\Admin\Native\PayOrders')) { PayOrders::get_instance()->render_orders_page(); return; } @@ -56,7 +56,7 @@ class PayMenus { 'slug' => 'aksrt_pay_products', 'title' => __('付费文章', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayProducts')) { + if (class_exists('AKSRT\\Admin\\Native\\PayProducts')) { PayProducts::get_instance()->render_products_page(); return; } @@ -67,7 +67,7 @@ class PayMenus { 'slug' => 'aksrt_download_logs', 'title' => __('下载记录', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayDownloadLogs')) { + if (class_exists('AKSRT\\Admin\\Native\\PayDownloadLogs')) { PayDownloadLogs::get_instance()->render_page(); return; } @@ -78,7 +78,7 @@ class PayMenus { 'slug' => 'aksrt_shipping', 'title' => __('发货及物流', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayShipping')) { + if (class_exists('AKSRT\\Admin\\Native\\PayShipping')) { PayShipping::get_instance()->render_shipping_page(); return; } @@ -89,7 +89,7 @@ class PayMenus { 'slug' => 'aksrt_after_sale', 'title' => __('售后管理', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayAfterSale')) { + if (class_exists('AKSRT\\Admin\\Native\\PayAfterSale')) { PayAfterSale::get_instance()->render_after_sale_page(); return; } @@ -100,7 +100,7 @@ class PayMenus { 'slug' => 'aksrt_coupons', 'title' => __('优惠码', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayCoupons')) { + if (class_exists('AKSRT\\Admin\\Native\\PayCoupons')) { PayCoupons::get_instance()->render_page(); return; } @@ -111,7 +111,7 @@ class PayMenus { 'slug' => 'aksrt_charge_cards', 'title' => __('卡密管理', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayChargeCards')) { + if (class_exists('AKSRT\\Admin\\Native\\PayChargeCards')) { PayChargeCards::get_instance()->render_charge_cards_page(); return; } @@ -122,7 +122,7 @@ class PayMenus { 'slug' => 'aksrt_income', 'title' => __('创作分成', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayIncome')) { + if (class_exists('AKSRT\\Admin\\Native\\PayIncome')) { PayIncome::get_instance()->render_income_page(); return; } @@ -133,7 +133,7 @@ class PayMenus { 'slug' => 'aksrt_rebate', 'title' => __('推广返佣', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayRebate')) { + if (class_exists('AKSRT\\Admin\\Native\\PayRebate')) { PayRebate::get_instance()->render_rebate_page(); return; } @@ -144,7 +144,7 @@ class PayMenus { 'slug' => 'aksrt_withdraw', 'title' => __('提现审核', 'aksrt'), 'callback' => static function (): void { - if (class_exists('PayWithdrawals')) { + if (class_exists('AKSRT\\Admin\\Native\\PayWithdrawals')) { PayWithdrawals::get_instance()->render_withdrawals_page(); return; } diff --git a/src/AKSRT/Admin/Native/PayOrders.php b/src/AKSRT/Admin/Native/PayOrders.php index f0323eac..338b1e62 100644 --- a/src/AKSRT/Admin/Native/PayOrders.php +++ b/src/AKSRT/Admin/Native/PayOrders.php @@ -512,14 +512,14 @@ class PayOrders { } private function shipping_status_options(bool $include_all = false): array { - if (class_exists('PayShipping')) { + if (class_exists('AKSRT\\Admin\\Native\\PayShipping')) { return PayShipping::get_instance()->shipping_status_options_public($include_all); } return $include_all ? ['' => __('全部状态', 'aksrt')] : []; } private function after_sale_type_options(bool $include_all = false): array { - if (class_exists('PayAfterSale')) { + if (class_exists('AKSRT\\Admin\\Native\\PayAfterSale')) { return PayAfterSale::get_instance()->after_sale_type_options_public($include_all); } return $include_all ? ['' => __('全部类型', 'aksrt')] : [ @@ -528,7 +528,7 @@ class PayOrders { } private function render_carrier_field(string $selected = ''): void { - if (class_exists('PayShipping')) { + if (class_exists('AKSRT\\Admin\\Native\\PayShipping')) { PayShipping::get_instance()->render_carrier_field_public($selected); return; } diff --git a/src/AKSRT/Ai/AISEO.php b/src/AKSRT/Ai/AISEO.php index e6909fa7..32ca6641 100644 --- a/src/AKSRT/Ai/AISEO.php +++ b/src/AKSRT/Ai/AISEO.php @@ -42,7 +42,7 @@ class AISEO { ]; } - if (!class_exists('AI') || !class_exists('AIPrompt')) { + if (!class_exists('AKSRT\\Ai\\AI') || !class_exists('AKSRT\\Ai\\AIPrompt')) { return [ 'success' => false, 'message' => __('AI 模块未加载', 'aksrt'), @@ -115,7 +115,7 @@ class AISEO { return ['success' => false, 'message' => __('AI SEO 功能未启用', 'aksrt')]; } - if (!class_exists('AI') || !class_exists('AIPrompt')) { + if (!class_exists('AKSRT\\Ai\\AI') || !class_exists('AKSRT\\Ai\\AIPrompt')) { return ['success' => false, 'message' => __('AI 模块未加载', 'aksrt')]; } diff --git a/src/AKSRT/Auth/EmailRollback.php b/src/AKSRT/Auth/EmailRollback.php index 2aa4e31e..a84d0bc8 100644 --- a/src/AKSRT/Auth/EmailRollback.php +++ b/src/AKSRT/Auth/EmailRollback.php @@ -167,7 +167,7 @@ class EmailRollback { if (count($log) > 10) $log = array_slice($log, -10); update_user_meta($user_id, 'aksrt_email_verification_admin_log', $log); - if (class_exists('Service')) { + if (class_exists('AKSRT\\Auth\\Service')) { Service::log_event('admin.email_rollback', [ 'uid' => $user_id, 'by' => $by_admin_id ?: get_current_user_id(), diff --git a/src/AKSRT/Auth/OAuth.php b/src/AKSRT/Auth/OAuth.php index 71416298..44fd14f7 100644 --- a/src/AKSRT/Auth/OAuth.php +++ b/src/AKSRT/Auth/OAuth.php @@ -41,7 +41,7 @@ class OAuth { */ public function get_auth_url(string $provider, string $action = 'login'): string { if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::oauth_proxy_mode() === 'client') { - if (class_exists('OAuthProxyClient')) { + if (class_exists('AKSRT\\Auth\\OAuthProxyClient')) { return OAuthProxyClient::get_instance()->get_proxy_auth_url($provider, $action); } return ''; diff --git a/src/AKSRT/Content/Download.php b/src/AKSRT/Content/Download.php index 47e69485..855a43ed 100644 --- a/src/AKSRT/Content/Download.php +++ b/src/AKSRT/Content/Download.php @@ -118,7 +118,7 @@ class Download { : ((($meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0'); $display_price = is_array($priced) ? (float) ($priced['amount'] ?? 0) : (float) ($meta['price'] ?? 0); - $access = class_exists('Visibility') + $access = class_exists('AKSRT\\Content\\Visibility') ? Visibility::get_post_access_state($post, $uid) : []; diff --git a/src/AKSRT/Content/DownloadState.php b/src/AKSRT/Content/DownloadState.php index 81073c75..aec6bd26 100644 --- a/src/AKSRT/Content/DownloadState.php +++ b/src/AKSRT/Content/DownloadState.php @@ -63,7 +63,7 @@ class DownloadState { ); } - $access = class_exists('Visibility') + $access = class_exists('AKSRT\\Content\\Visibility') ? Visibility::get_post_access_state($post_id, $user_id) : []; $priced = function_exists('aksrt_get_user_pay_price') diff --git a/src/AKSRT/Core/PostMetaBox.php b/src/AKSRT/Core/PostMetaBox.php index c7c938f6..7c406de2 100644 --- a/src/AKSRT/Core/PostMetaBox.php +++ b/src/AKSRT/Core/PostMetaBox.php @@ -489,7 +489,7 @@ class PostMetaBox { * Content-pay sales summary for posts list (zibll 销售数据 column parity). */ private function render_sales_column(int $post_id): void { - if (!function_exists('aksrt_get_pay_meta') || !class_exists('DomainModel')) { + if (!function_exists('aksrt_get_pay_meta') || !class_exists('AKSRT\\Core\\DomainModel')) { echo '—'; return; } @@ -549,7 +549,7 @@ class PostMetaBox { * Dropdown filter for content pay_type on edit.php?post_type=post. */ public function render_pay_type_filter(string $post_type): void { - if ($post_type !== 'post' || !class_exists('DomainModel')) { + if ($post_type !== 'post' || !class_exists('AKSRT\\Core\\DomainModel')) { return; } $current = isset($_GET['aksrt_pay_type']) ? sanitize_key((string) wp_unslash($_GET['aksrt_pay_type'])) : ''; @@ -582,7 +582,7 @@ class PostMetaBox { return; } $pay_type = sanitize_key((string) wp_unslash($_GET['aksrt_pay_type'])); - if ($pay_type === '' || !class_exists('DomainModel')) { + if ($pay_type === '' || !class_exists('AKSRT\\Core\\DomainModel')) { return; } $pay_type = DomainModel::normalize_pay_type($pay_type); @@ -663,7 +663,7 @@ class PostMetaBox {