sanitize_key((string) $l['key']), 'label' => sanitize_text_field((string) $l['label']), 'unlocked' => !empty($l['unlocked']), 'min_plan_name' => sanitize_text_field(isset($l['minPlanName']) ? (string) $l['minPlanName'] : ''), 'path' => isset($l['path']) && preg_match('#^/dashboard(/[a-z0-9\-/]*)?$#', (string) $l['path']) ? (string) $l['path'] : '/dashboard', ); if (count($locks) >= 20) break; } $channel = isset($e['upgradeChannel']) ? (string) $e['upgradeChannel'] : 'stripe'; return array( 'plan_name' => sanitize_text_field(isset($e['planName']) ? (string) $e['planName'] : ''), 'locks' => $locks, 'upgrade_channel' => in_array($channel, array('stripe', 'wix', 'shopify'), true) ? $channel : 'stripe', ); } /** The plan block saved by the last health ping, or null. */ function citami_plan_info() { $health = get_option(CITAMI_HEALTH_OPT, array()); return is_array($health) && isset($health['plan']) && is_array($health['plan']) ? $health['plan'] : null; } /** The Overview card (empty when not connected or the platform did not say). */ function citami_plan_card_html() { $p = citami_plan_info(); if ($p === null || empty($p['locks'])) return ''; $base = function_exists('citami_brand_site') ? citami_brand_site() : citami_default_endpoint(); $rows = ''; $locked = 0; foreach ($p['locks'] as $l) { if ($l['unlocked']) { $rows .= '
' . esc_html(citami_t('Il tuo piano si cambia dall\'app CiteProof in Wix.', 'Your plan is changed from the CiteProof app in Wix.')) . '
'; } elseif ($p['upgrade_channel'] === 'shopify') { $action = '' . esc_html(citami_t('Il tuo piano si cambia dall\'app CiteProof in Shopify.', 'Your plan is changed from the CiteProof app in Shopify.')) . '
'; } else { $action = '' . esc_html(citami_t('Sblocca con un piano', 'Unlock with a plan')) . '
'; } } $title = $p['plan_name'] !== '' ? sprintf(citami_t('Piano %s: cosa include', '%s plan: what it includes'), $p['plan_name']) : citami_t('Cosa include il tuo piano', 'What your plan includes'); return '' . esc_html(citami_t('Lo stesso piano vale nella dashboard, su Wix, su Shopify e qui.', 'The same plan applies in the dashboard, on Wix, on Shopify and here.')) . '
' . '' . esc_html($n['text']) . '
' . '' . esc_html($n['cta']) . ' ' . '' . esc_html(citami_t('Non ora', 'Not now')) . '