$shopid);
$content = $this->api->call('/NewGetShopData', $data, 'get');
// ---------- SAFE DATA WRAPPER ----------
$content = is_array($content) ? $content : [];
$dataArray = isset($content['data']) && is_array($content['data']) ? $content['data'] : [];
$data_defaults = [
'id' => '',
'plan' => '',
'plan_display_name' => '',
'access_by_admin' => 0,
'has_yearly' => '0',
'is_installation_popup_shown' => 0,
'is_plan_select_popup_shown' => 0,
];
$dataArray = wp_parse_args($dataArray, $data_defaults);
$content['data'] = $dataArray;
// Safe assignments
$primary_id = $dataArray['id'] ?? null;
$current_plan = (string) $dataArray['plan'];
$member_plan = (string) $dataArray['plan_display_name'];
$access_by_admin = (string) $dataArray['access_by_admin'];
$has_yearly = (string) $dataArray['has_yearly'];
$is_installation_popup_shown = (int) $dataArray['is_installation_popup_shown'];
$is_plan_select_popup_shown = (int) $dataArray['is_plan_select_popup_shown'];
// Update DB only if values exist
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', '');
$dataArray['plan'] = $current_plan;
$content['data'] = $dataArray;
}
if (!empty($current_plan)) {
update_option('accessibility_plan', $current_plan);
}
$plugin_url = plugin_dir_url(__FILE__);
// Popup Logic Safely
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 &&
!empty($current_plan) &&
$is_installation_popup_shown == 1 &&
$current_plan !== "free" &&
!empty($member_plan) &&
strpos(strtolower($member_plan), 'develop') !== false
) {
require_once plugin_dir_path(__FILE__) . 'popups/thankyou-popup.php';
}
// Access notices (safe)
if ((string)$access_by_admin === '1') {
echo "
" . esc_html__('You have admin access', 'accessibility-assistant') . "
";
}
if (!empty($current_plan) && !empty($member_plan) && strpos(strtolower($member_plan), 'develop') !== false) {
echo "" . esc_html__('You have member access', 'accessibility-assistant') . "
";
}
?>
";
_e('Unlock full functionality by upgrading to a paid plan', 'accessibility-assistant');
echo "";
}
?>