` below and is driven by user-center-auth.js. * * @package AKSRT */ defined('ABSPATH') || exit; use AKSRT\User\AuthApply; $context = is_array($args['context'] ?? null) ? $args['context'] : []; $user_id = (int) ($context['user_id'] ?? get_current_user_id()); $snapshot = class_exists(AuthApply::class) ? AuthApply::snapshot($user_id) : [ 'status' => '', 'stage' => '', 'can_apply' => false, 'verified' => false, 'info' => [], 'apply' => [], 'active' => null, 'latest' => null, 'poll_interval' => 5, ]; $settings = class_exists(AuthApply::class) ? AuthApply::settings() : ['enabled' => false, 'allow_apply' => false]; $status = (string) ($snapshot['status'] ?? ''); $info = is_array($snapshot['info'] ?? null) ? $snapshot['info'] : []; $active = is_array($snapshot['active'] ?? null) ? $snapshot['active'] : []; $latest = is_array($snapshot['latest'] ?? null) ? $snapshot['latest'] : []; $stage = sanitize_key((string) ($active['status'] ?? '')); $locks_application = $stage !== ''; $reason = (string) (($latest['review_note'] ?? '') ?: ($latest['provider_result_summary'] ?? '')); $can_apply = !empty($snapshot['can_apply']); $config = [ 'restBase' => untrailingslashit(rest_url('aksrt/v1/identity/applications')), 'nonce' => wp_create_nonce('wp_rest'), 'currentUuid' => $locks_application ? (string) ($active['application_uuid'] ?? '') : '', 'currentStage' => $locks_application ? $stage : '', 'provider' => sanitize_key((string) ($settings['provider'] ?? 'aliyun')), 'allowManual' => !empty($settings['allow_manual_fallback']), 'pollInterval' => max(5, (int) ($snapshot['poll_interval'] ?? 5)), 'snapshot' => class_exists(AuthApply::class) ? AuthApply::snapshot_view($user_id) : [], ]; $auth_icon = ''; ?>