$shopid, 'language' => true); $content = $this->api->call('/NewGetShopData', $data, 'get'); $has_content = !empty($content); // ๐Ÿ”น Ensure array exists even if API fails $content = is_array($content) ? $content : []; $content['data'] = $content['data'] ?? []; // ๐Ÿ”น Fill with safe default keys to prevent warnings $content['data'] = array_merge([ 'id' => null, 'plan' => '', 'plan_display_name' => '', 'access_by_admin' => 0, 'language_data' => [], // Safe defaults: don't show popups unless API explicitly asks for them. 'is_installation_popup_shown' => 1, 'is_plan_select_popup_shown' => 1 ], $content['data']); $primary_id = $content['data']['id']; if ($primary_id) { update_option('accessibility_primaryid', $primary_id); } else { $primary_id = get_option('accessibility_primaryid'); } $current_plan = $content['data']['plan']; if (empty($current_plan)) { $current_plan = (string) get_option('accessibility_plan', ''); $content['data']['plan'] = $current_plan; } if ($current_plan) { update_option('accessibility_plan', $current_plan); } $access_by_admin = (string) $content['data']['access_by_admin']; $member_plan = (string) $content['data']['plan_display_name']; if ($has_content) { $access_by_admin = $content['data']['access_by_admin']; $current_plan = $content['data']['plan']; $member_plan = $content['data']['plan_display_name']; $is_installation_popup_shown = $content['data']['is_installation_popup_shown']; $is_plan_select_popup_shown = $content['data']['is_plan_select_popup_shown']; if ($is_installation_popup_shown == 0 && $is_plan_select_popup_shown == 0) { require_once plugin_dir_path(__FILE__) . 'popups/installation-popup.php'; } if ($is_plan_select_popup_shown == 0 && !empty($current_plan) && $is_installation_popup_shown == 1 && $current_plan !== "free" && (strpos(strtolower($member_plan), 'develop') !== false)) { require_once plugin_dir_path(__FILE__) . 'popups/thankyou-popup.php'; } } $js_url = CDN_URL . "wp_js/{$shopid}.js"; if ($current_plan) { update_option('accessibility_url', $js_url); } else { update_option('accessibility_url', ''); } if ($access_by_admin == '1') { echo "

" . esc_html__('You have admin access', 'accessibility-assistant') . "

"; } if (!empty($current_plan) && strpos(strtolower($member_plan), 'develop') !== false) { echo "

" . esc_html__('You have member access', 'accessibility-assistant') . "

"; } if (empty($current_plan)) { echo "

"; _e('Unlock full functionality by upgrading to a paid plan', 'accessibility-assistant'); echo "

"; } ?>

$name) { $api_languages[] = [ 'id' => 'fallback-' . $code, 'language_name' => $name, 'language_code' => $code, 'is_default' => (int) ($code === 'en_US'), 'is_visible' => (int) ($code === 'en_US'), 'shop_id' => $shopid, 'rank' => $rank_i++, ]; } } if (!empty($api_languages)) { $rank = 1; foreach ($api_languages as $getdata) { ?>
>