usageSummary if usage data exists * @param array $extras optional data injected from the page: * - 'site_score' int|null 0-100 * - 'pages_scanned' int|null * - 'pending_fixes' int|null * - 'active_fixes' int|null * - 'fixes_url' string * - 'images_total' int|null live alt_text_data count * - 'images_ai_generated' int|null subset with AI alt text * - 'images_pending' int|null AI suggested, awaiting review */ if (!function_exists('aacb_info_tip')) { /** * Tiny accessible "ⓘ" affordance for a stat/card label. * * @param string $text Short plain-text explanation (one or two sentences). */ function aacb_info_tip($text) { $text = (string) $text; if ($text === '') { return ''; } return '' . 'i' . ''; } } if (!function_exists('aacb_ov_dial')) { /** * Score dial for the Site Overview hero. */ function aacb_ov_dial($score, $band) { $has = is_int($score); $val = $has ? max(0, min(100, $score)) : 0; $r = 40; $cx = 52; $cy = 52; $circ = 2 * M_PI * $r; $off = $circ * (1 - $val / 100); $colors = array( 'ok' => '#16a34a', 'primary' => '#2563eb', 'warn' => '#d97706', 'danger' => '#dc2626', 'none' => '#94a3b8', ); $stroke = isset($colors[$band]) ? $colors[$band] : $colors['primary']; ob_start(); ?> / 100 __('Daily', 'allaccessible'), 'weekly' => __('Weekly', 'allaccessible'), 'monthly' => __('Monthly', 'allaccessible'), 'never' => __('On-demand', 'allaccessible'), ); if (isset($freq_word[$freq])) { $cad_freq = $freq_word[$freq]; } elseif (!empty($sched['scanFrequencyDays'])) { $cad_freq = sprintf( /* translators: %s: number of days between scans */ __('Every %s days', 'allaccessible'), number_format_i18n((int) $sched['scanFrequencyDays']) ); } if ($cad_freq !== '' || $last_at) { // 'never' = no recurring schedule (e.g. free tier) — scans are // on-demand, so don't label them "Scheduled". $cad_header = ($freq === 'never') ? __('Scans', 'allaccessible') : __('Scheduled scans', 'allaccessible'); $now = current_time('timestamp'); if ($last_at && ($lt = strtotime($last_at))) { $cad_last = sprintf( /* translators: %s: human time diff, e.g. "2 hours" */ __('%s ago', 'allaccessible'), human_time_diff($lt, $now) ); } else { $cad_last = __('No scans yet', 'allaccessible'); } if ($freq !== 'never' && $next_at && ($nt = strtotime($next_at))) { $cad_next = $nt > $now ? sprintf(/* translators: %s: human time diff */ __('in %s', 'allaccessible'), human_time_diff($now, $nt)) : __('due now', 'allaccessible'); } } } $has_cadence = ($cad_header !== ''); // Verdict + score band. if ($score === null) { $verdict = __('Run your first scan', 'allaccessible'); $band = 'none'; $accent = 'var(--aacx-slate-400)'; } elseif ($score >= 90) { // NOTE: never claim "compliant" / "compliance" — legal-exposure // phrasing (see legal language audit). Describe the score/coverage. $verdict = __('Excellent — strong accessibility coverage.', 'allaccessible'); $band = 'ok'; $accent = 'var(--aacx-ok-600)'; } elseif ($score >= 75) { $verdict = __('Good — a few fixes to go.', 'allaccessible'); $band = 'primary'; $accent = 'var(--aacx-primary-600)'; } elseif ($score >= 50) { $verdict = __('Needs attention.', 'allaccessible'); $band = 'warn'; $accent = 'var(--aacx-warn-600)'; } else { $verdict = __('Needs work — start with the top issues.', 'allaccessible'); $band = 'danger'; $accent = 'var(--aacx-danger-600)'; } // Sub-line (pre-escaped segments joined by a muted dot). $dot = ' · '; if ($score === null) { $sub_html = esc_html__('Run a scan and AllAccessible agents will check every page for accessibility issues.', 'allaccessible'); } else { $bits = array(); if ($remediation !== null) { $bits[] = sprintf( /* translators: %s: percentage with wrapper */ esc_html__('%s%% of issues remediated', 'allaccessible'), '' . esc_html(number_format_i18n($remediation)) . '' ); } if ($pages !== null && $pages > 0) { $pg = sprintf( esc_html(_n('%s page audited', '%s pages audited', $pages, 'allaccessible')), '' . esc_html(number_format_i18n($pages)) . '' ); if ($pages_url) { $pg .= ' ' . esc_html__('View pages', 'allaccessible') . ' →'; } $bits[] = $pg; } $sub_html = implode($dot, $bits); } // Smart action bar — single most important next step. $act_class = 'aacb-ov-action--clear'; $act_icon = '✓'; $act_text = ''; $act_btn = ''; if ($has_agentic && $pending > 0) { $act_class = 'aacb-ov-action--attention'; $act_icon = '⚡'; $act_text = sprintf( esc_html(_n('%s fix is ready for your review', '%s fixes are ready for your review', $pending, 'allaccessible')), '' . esc_html(number_format_i18n($pending)) . '' ); $act_btn = '' . esc_html__('Review fixes', 'allaccessible') . ' →'; } elseif ($manual > 0) { $act_class = 'aacb-ov-action--attention'; $act_icon = '⚠'; $act_text = sprintf( esc_html(_n('%s issue needs a manual fix', '%s issues need a manual fix', $manual, 'allaccessible')), '' . esc_html(number_format_i18n($manual)) . '' ); $act_btn = '' . esc_html__('View issues', 'allaccessible') . ' ↓'; } elseif ($score !== null) { $act_class = 'aacb-ov-action--clear'; $act_icon = '✓'; $act_text = esc_html__('You\'re all caught up — AllAccessible agents are monitoring your site.', 'allaccessible'); } else { $act_class = 'aacb-ov-action--attention'; $act_icon = '✦'; $act_text = esc_html__('No scan yet — run one to find and fix accessibility issues.', 'allaccessible'); $act_btn = '' . esc_html__('Get started', 'allaccessible') . ' →'; } // Metric strip (proof) — only items we have data for. $metrics = array(); $metrics[] = '✦ ' . esc_html(number_format_i18n($ai_res)) . ' ' . esc_html__('AI-resolved', 'allaccessible') . ''; $metrics[] = '' . esc_html(number_format_i18n($manual)) . ' ' . esc_html__('manual', 'allaccessible') . ''; if ($img_total > 0) { $metrics[] = '' . esc_html(number_format_i18n($alt_ai)) . ' ' . esc_html__('images with alt text', 'allaccessible') . ''; } if ($pv_lim) { $metrics[] = '' . esc_html(number_format_i18n((int) $pv_cur)) . ' / ' . esc_html(number_format_i18n($pv_lim)) . ' ' . esc_html__('pageviews', 'allaccessible') . ''; } $metric_sep = ''; ?>