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:
1 parent
8f349b40fb
commit
aaf458af1c
404 files changed
+13602
-7705
No files matched your search
@@ -283,8 +283,8 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
|
||||
* @return array{tabs:array,keys:array<int,string>,default:string,active:string,urls:array<string,string>}
|
||||
*/
|
||||
function aksrt_user_center_resolve_tabs(): array {
|
||||
$tabs = class_exists('AKSRT_User_Center')
|
||||
? AKSRT_User_Center::get_instance()->get_dashboard_tabs()
|
||||
$tabs = class_exists('\AKSRT\User\Center')
|
||||
? \AKSRT\User\Center::get_instance()->get_dashboard_tabs()
|
||||
: [
|
||||
'profile' => ['label' => __('个人信息', 'aksrt'), 'icon' => 'user'],
|
||||
'posts' => ['label' => __('我的文章', 'aksrt'), 'icon' => 'file-alt'],
|
||||
@@ -411,8 +411,8 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
function aksrt_get_user_center_render_context(WP_User $current_user): array {
|
||||
$user_id = (int) $current_user->ID;
|
||||
|
||||
$user_center_settings = class_exists('AKSRT_Settings')
|
||||
? AKSRT_Settings::get_user_center_settings()
|
||||
$user_center_settings = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_user_center_settings()
|
||||
: [
|
||||
'tabs' => ['profile', 'posts', 'comments', 'favorites'],
|
||||
'avatar_upload' => true,
|
||||
@@ -438,7 +438,7 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
$user_contacts = $dashboard['user_contacts'] ?? get_user_meta($user_id, 'aksrt_user_contacts', true);
|
||||
$user_contacts = is_array($user_contacts) ? $user_contacts : [];
|
||||
$user_background_url = (string) ($dashboard['background_url'] ?? get_user_meta($user_id, 'aksrt_background_image', true));
|
||||
$allow_bg_upload = !empty($user_center_settings['cover_upload']) && class_exists('AKSRT_Settings') && aksrt_get_setting('allow_background_upload', false);
|
||||
$allow_bg_upload = !empty($user_center_settings['cover_upload']) && class_exists('\AKSRT\Settings\Settings') && aksrt_get_setting('allow_background_upload', false);
|
||||
|
||||
$post_status_filter = isset($_GET['post_status']) ? sanitize_key(wp_unslash($_GET['post_status'])) : 'publish';
|
||||
if (!in_array($post_status_filter, ['all', 'publish', 'draft', 'pending', 'private'], true)) {
|
||||
@@ -454,8 +454,8 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
$svgs = aksrt_user_center_empty_svgs();
|
||||
require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
||||
|
||||
$vip_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_payment_vip_settings() : [];
|
||||
$affiliate_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_payment_affiliate_settings() : [];
|
||||
$vip_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_vip_settings() : [];
|
||||
$affiliate_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_affiliate_settings() : [];
|
||||
$show_credit_tabs = (bool) ($dashboard['credits_enabled'] ?? false);
|
||||
$currency_name = (string) ($dashboard['currency_name'] ?? __('积分', 'aksrt'));
|
||||
$balance_enabled = (bool) ($dashboard['balance_enabled'] ?? false);
|
||||
@@ -502,9 +502,9 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
'wallet_balance' => $wallet_balance,
|
||||
'vip_settings' => $vip_settings,
|
||||
'show_invite_section' => $show_credit_tabs
|
||||
&& class_exists('AKSRT_Settings')
|
||||
&& AKSRT_Settings::invite_enabled()
|
||||
&& AKSRT_Settings::invite_registration_enabled(),
|
||||
&& class_exists('\AKSRT\Settings\Settings')
|
||||
&& \AKSRT\Settings\Settings::invite_enabled()
|
||||
&& \AKSRT\Settings\Settings::invite_registration_enabled(),
|
||||
'user_email' => (string) $current_user->user_email,
|
||||
'runtime_config' => aksrt_user_center_runtime_config($user_id, $tabs['default'], $active_tab, $tabs['urls']),
|
||||
'cover_upload_config' => aksrt_user_center_cover_upload_config($allow_bg_upload),
|
||||
|
||||
Reference in new issue
Block a user