$shopid]; $content = $this->api->call('/NewGetShopData', $data, 'get'); $content = is_array($content) ? $content : []; $data_array = (isset($content['data']) && is_array($content['data'])) ? $content['data'] : []; $primary_id = $data_array['id'] ?? null; $current_plan = sanitize_text_field((string) ($data_array['plan'] ?? '')); $member_plan = sanitize_text_field((string) ($data_array['plan_display_name'] ?? '')); $access_by_admin = (int) ($data_array['access_by_admin'] ?? 0); $is_installation_popup_shown = (int) ($data_array['is_installation_popup_shown'] ?? 0); $is_plan_select_popup_shown = (int) ($data_array['is_plan_select_popup_shown'] ?? 0); $widget_status = (int) ($data_array['status'] ?? 0); if (!empty($primary_id)) { update_option('accessibility_primaryid', $primary_id); } else { $primary_id = get_option('accessibility_primaryid'); } if (empty($current_plan)) { $current_plan = (string) get_option('accessibility_plan', ''); $data_array['plan'] = $current_plan; } if (!empty($current_plan)) { update_option('accessibility_plan', $current_plan); } if ( $is_installation_popup_shown === 0 && $is_plan_select_popup_shown === 0 && !empty($member_plan) && strpos(strtolower($member_plan), 'develop') !== false ) { require_once plugin_dir_path(__FILE__) . 'popups/installation-popup.php'; } if ( $is_plan_select_popup_shown === 0 && $is_installation_popup_shown === 1 && $current_plan !== 'free' && !empty($current_plan) && !empty($member_plan) && strpos(strtolower($member_plan), 'develop') !== false ) { require_once plugin_dir_path(__FILE__) . 'popups/thankyou-popup.php'; } $js_url = CDN_URL . "wp_js/{$shopid}.js"; update_option('accessibility_url', $current_plan ? $js_url : ''); $current_lang = get_option('my_plugin_selected_language', 'en_US'); $languages = require plugin_dir_path(__FILE__) . 'language-options.php'; $quickstart_steps = get_option('accessibility_quickstart_steps', []); $quickstart_steps = is_array($quickstart_steps) ? $quickstart_steps : []; $widget_page_url = admin_url('admin.php?page=accessibility-widget-settings'); $menu_page_url = admin_url('admin.php?page=accessibility-menu-settings'); $language_page_url = admin_url('admin.php?page=accessibility-submenu'); $scanner_page_url = admin_url('admin.php?page=accessibility-scanner'); $analytics_page_url = admin_url('admin.php?page=accessibility-analytics-overview'); $normalized_plan_key = strtolower(trim((string) $current_plan)); $normalized_member_plan = trim((string) $member_plan); $plan_labels = [ 'free' => __('Free Plan', 'accessibility-assistant'), 'grow' => __('Growth Plan', 'accessibility-assistant'), 'growth' => __('Growth Plan', 'accessibility-assistant'), 'basic' => __('Basic Plan', 'accessibility-assistant'), 'pro' => __('Pro Plan', 'accessibility-assistant'), 'premium' => __('Premium Plan', 'accessibility-assistant'), 'scale' => __('Scale Plan', 'accessibility-assistant'), 'established' => __('Established Plan', 'accessibility-assistant'), ]; if (!empty($normalized_plan_key) && isset($plan_labels[$normalized_plan_key])) { $plan_badge = $plan_labels[$normalized_plan_key]; } elseif (!empty($normalized_member_plan)) { $plan_badge = $normalized_member_plan; } elseif (!empty($normalized_plan_key)) { $plan_badge = ucwords(str_replace(['-', '_'], ' ', $normalized_plan_key)) . ' ' . __('Plan', 'accessibility-assistant'); } else { $plan_badge = __('Free Plan', 'accessibility-assistant'); } $quickstart_items = [ [ 'key' => 'activate_app', 'label' => __('Activate App', 'accessibility-assistant'), 'note' => __('Enable our plugin to see it visible on your website.', 'accessibility-assistant'), 'url' => $widget_page_url, 'completed' => $widget_status === 1, ], [ 'key' => 'widget_content', 'label' => __('Widget Content / Appearance', 'accessibility-assistant'), 'note' => __('Customize icon, position, and appearance settings.', 'accessibility-assistant'), 'url' => $widget_page_url, 'completed' => !empty($quickstart_steps['widget_content']), ], [ 'key' => 'widget_settings', 'label' => __('Widget Settings', 'accessibility-assistant'), 'note' => __('Configure accessibility menu controls and behavior.', 'accessibility-assistant'), 'url' => $menu_page_url, 'completed' => !empty($quickstart_steps['widget_settings']), ], [ 'key' => 'language_settings', 'label' => __('Language Settings', 'accessibility-assistant'), 'note' => __('Set up translation visibility and language priorities.', 'accessibility-assistant'), 'url' => $language_page_url, 'completed' => !empty($quickstart_steps['language_settings']), ], [ 'key' => 'accessibility_scanner', 'label' => __('Accessibility Scanner', 'accessibility-assistant'), 'note' => __('Run scans and review accessibility findings.', 'accessibility-assistant'), 'url' => $scanner_page_url, 'completed' => !empty($quickstart_steps['accessibility_scanner']), ], ]; $total_steps = count($quickstart_items); $completed_steps = 0; foreach ($quickstart_items as $quickstart_item) { if (!empty($quickstart_item['completed'])) { $completed_steps++; } } $progress_percent = ($total_steps > 0) ? (int) round(($completed_steps / $total_steps) * 100) : 0; $current_user = wp_get_current_user(); $display_name = $current_user instanceof WP_User ? $current_user->display_name : __('Admin', 'accessibility-assistant'); $is_app_active = ($widget_status === 1); $app_status_label = $is_app_active ? __('Enabled', 'accessibility-assistant') : __('Disabled', 'accessibility-assistant'); ?>