usageSummary) * @param string $account_tier free|trial|starter|legacy|enterprise|unknown * @param string $addon_url URL to plan/addons page on app.allaccessible.org * @param string $audits_url URL to accessibility audits page on app.allaccessible.org */ function aacb_render_usage_dashboard($site_options, $account_tier, $addon_url, $audits_url) { $is_free = ($account_tier === 'free'); $is_paid = in_array($account_tier, array('starter', 'legacy', 'enterprise', 'trial'), true); $has_usage = ($site_options && !is_wp_error($site_options) && isset($site_options->usageSummary)); $usage = $has_usage ? $site_options->usageSummary : null; $site_id = $has_usage && isset($site_options->siteID) ? $site_options->siteID : get_option('aacb_siteID'); $sub_id = $has_usage && isset($site_options->subID) ? $site_options->subID : null; ?>

array( 'label' => __('Pageviews', 'allaccessible'), 'help' => __('Active visits served by your widget this month.', 'allaccessible'), 'ai' => false, ), 'ai_images_monthly' => array( 'label' => __('AI image alt text', 'allaccessible'), 'help' => __('Alt text generated by AllAccessible AI for images on your site.', 'allaccessible'), 'ai' => true, ), 'audit_runs_monthly' => array( 'label' => __('Accessibility audits', 'allaccessible'), 'help' => __('Automated scans run by AllAccessible agents.', 'allaccessible'), 'ai' => false, ), 'reports_monthly' => array( 'label' => __('Compliance reports', 'allaccessible'), 'help' => __('VPAT and accessibility statement PDFs generated.', 'allaccessible'), 'ai' => false, ), ); $rendered = 0; ?>
$meta) : if (!isset($usage->$key)) { continue; } $rendered++; $row = $usage->$key; $current = isset($row->current) ? (int) $row->current : 0; $limit = isset($row->limit) ? (int) $row->limit : 0; $percent = isset($row->percent) ? (int) $row->percent : 0; $exceeded = !empty($row->exceeded); $remaining = isset($row->remaining) ? (int) $row->remaining : max(0, $limit - $current); $is_locked = ($limit === 0); // Severity → badge class + bar color (token-based) if ($exceeded || $percent >= 100) { $badge_class = 'aacx-v2__badge aacx-v2__badge--danger'; $bar_color = 'var(--aacx-danger-500)'; } elseif ($percent >= 80) { $badge_class = 'aacx-v2__badge aacx-v2__badge--warn'; $bar_color = 'var(--aacx-warn-500)'; } else { $badge_class = 'aacx-v2__badge aacx-v2__badge--ok'; $bar_color = 'var(--aacx-ok-500)'; } // Per-feature dashboard URL (paid users) if ($key === 'audit_runs_monthly') { $feature_url = $audits_url; } elseif ($site_id && $sub_id && $key === 'reports_monthly') { $feature_url = 'https://app.allaccessible.org/site/' . rawurlencode($site_id) . '/' . rawurlencode($sub_id) . '/reports'; } elseif ($site_id) { $feature_url = 'https://app.allaccessible.org/site/' . rawurlencode($site_id); } else { $feature_url = 'https://app.allaccessible.org'; } ?>
%

/

 ·  →

→

→