__('Approve, edit, and revert agentic fixes', 'allaccessible'), 'image_alt_text_manager' => __('Image Descriptions', 'allaccessible'), 'reports_export' => __('Reports & Statement deep-links', 'allaccessible'), 'per_page_editor_metabox' => __('Per-page accessibility breakdown in editor', 'allaccessible'), 'notification_center' => __('Notification center', 'allaccessible'), 'csv_export' => __('CSV export of fixes', 'allaccessible'), 'pdf_export' => __('PDF report export', 'allaccessible'), 'white_label' => __('White-label branding', 'allaccessible'), 'weekly_scanning' => __('Weekly automatic scans', 'allaccessible'), 'change_detection' => __('Page change detection', 'allaccessible'), 'accommodation_widget' => __('Accommodation request widget', 'allaccessible'), ); } return self::$known_features; } /** * Does the current account have this feature enabled? * * Returns false on any error (missing account, API unreachable, etc.) so * callers can render an upgrade CTA without special-casing failure modes. * * @param string $feature One of the known feature keys. * @return bool */ public static function can($feature) { if (!is_string($feature) || $feature === '') return false; if (!class_exists('AllAccessible_ApiClient')) return false; $opts = AllAccessible_ApiClient::get_instance()->get_site_options(); if (is_wp_error($opts)) return false; // /validate returns the projected features array under `features`. $features = array(); if (is_object($opts) && isset($opts->features)) { $features = (array) $opts->features; } elseif (is_array($opts) && isset($opts['features'])) { $features = (array) $opts['features']; } return in_array($feature, $features, true); } /** * Render a compact inline upgrade prompt. Use as the else-branch of can(). * * @param string $feature Feature key (label looked up from known list). * @param array $opts { * @type string $heading Override headline. Default uses feature label. * @type string $description Override copy. * @type string $url Upgrade URL. Defaults to app billing. * @type bool $compact Tight padding when true (sidebar / wizard contexts). * } */ public static function render_upgrade_cta($feature, $opts = array()) { $known = self::known_features(); $label = isset($known[$feature]) ? $known[$feature] : (string) $feature; $heading = isset($opts['heading']) ? (string) $opts['heading'] : sprintf( /* translators: %s: feature label */ __('%s is available on paid plans', 'allaccessible'), $label ); $description = isset($opts['description']) ? (string) $opts['description'] : __('Upgrade to unlock this feature plus everything else included in the AllAccessible AI suite.', 'allaccessible'); $url = isset($opts['url']) ? esc_url((string) $opts['url']) : 'https://app.allaccessible.org/billing'; $compact = !empty($opts['compact']); $body_padding = $compact ? 'var(--aacx-space-4)' : 'var(--aacx-space-6)'; ?>