get_manifest_summary(false, $status); $err = is_wp_error($summary) ? $summary->get_error_message() : null; $tier = (string) $client->get_subscription_tier(); if ($tier === '') $tier = 'free'; $isFree = ($tier === 'free'); $isBeta = in_array($tier, self::BETA_TIERS, true); $site_options_obj = $client->get_site_options(); $features_list = array(); if (is_object($site_options_obj) && isset($site_options_obj->features) && is_array($site_options_obj->features)) { $features_list = $site_options_obj->features; } $has_agentic = in_array('agentic_fixes_approve', $features_list, true); $is_legacy_v1 = ($tier === 'legacy') || (!$has_agentic && !$isFree); AllAccessible_Debug::console('AgenticFixesPage', array( 'status_tab' => $status, 'tier' => $tier, 'is_free' => $isFree, 'is_beta' => $isBeta, 'is_legacy_v1' => $is_legacy_v1, 'has_agentic_feature'=> $has_agentic, 'features_list' => $features_list, 'summary_is_error' => is_wp_error($summary), 'summary_error' => $err, 'summary_keys' => is_array($summary) ? array_keys($summary) : null, 'summary' => is_wp_error($summary) ? null : $summary, )); if ($is_legacy_v1) { self::render_legacy_upgrade_page(); return; } $agg = $client->get_audit_aggregation(); if (is_wp_error($agg) || !is_array($agg)) { $agg = null; } $hero_site_score = null; $hero_remediation_score = null; $hero_pages_scanned = null; $hero_is_live_estimate = false; if ($agg && !empty($agg['hasData'])) { $hero_site_score = isset($agg['overallScore']) ? (float) $agg['overallScore'] : null; $hero_remediation_score = isset($agg['remediationScore']) ? (float) $agg['remediationScore'] : null; $hero_pages_scanned = isset($agg['totalPagesScanned']) ? (int) $agg['totalPagesScanned'] : (isset($agg['coverage']['totalPagesScanned']) ? (int) $agg['coverage']['totalPagesScanned'] : null); $hero_is_live_estimate = !empty($agg['isLiveEstimate']); } $deeplink_token = $client->get_subscription_id() ?: ''; $extras_hero = array( 'site_score' => $hero_site_score, 'remediation_score' => $hero_remediation_score, 'pages_scanned' => $hero_pages_scanned, 'is_live_estimate' => $hero_is_live_estimate, 'fixes_url' => admin_url('admin.php?page=aacb-agentic-fixes'), 'site_id_external' => $deeplink_token, ); $counts = is_array($summary['countsByStatus'] ?? null) ? $summary['countsByStatus'] : array(); $groups = is_array($summary['groups'] ?? null) ? $summary['groups'] : array(); $pending = (int) ($counts['draft'] ?? 0); $approved = (int) ($counts['approved'] ?? 0); $reverted = (int) ($counts['reverted'] ?? 0); $show_first_run_hint = ($status === 'draft' && $approved === 0 && $reverted === 0); ?>

→
' . esc_html(number_format_i18n((float) $hero_site_score, 0)) . ' ' . esc_html__('score', 'allaccessible') . ''; } if ($hero_pages_scanned !== null && $hero_pages_scanned > 0) { $ctx[] = '' . esc_html(number_format_i18n($hero_pages_scanned)) . ' ' . esc_html__('pages audited', 'allaccessible') . ''; } $last_scan_at = is_array($summary) ? ($summary['lastScanAt'] ?? null) : null; if ($last_scan_at) { $ls_ts = strtotime($last_scan_at); if ($ls_ts) { $ctx[] = '' . sprintf( /* translators: %s: human-readable time difference (e.g. "2 hours") */ esc_html__('Last scan %s ago', 'allaccessible'), esc_html(human_time_diff($ls_ts, current_time('timestamp'))) ) . ''; } } if (!empty($ctx)) : ?>
· ', $ctx); // pre-escaped // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
aiQuota)) ? $site_options_obj->aiQuota : null; $is_preview = $isFree && $ai_quota !== null; ?>
array( 'label' => __('Pending review', 'allaccessible'), 'count' => $pending, ), 'approved' => array( 'label' => __('Approved & applied', 'allaccessible'), 'count' => $approved, ), 'reverted' => array( 'label' => __('Reverted', 'allaccessible'), 'count' => $reverted, ), ); ?>
$tab) : $is_active = ($active === $key); $url = esc_url(add_query_arg(array('page' => self::PAGE_SLUG, 'status' => $key), admin_url('admin.php'))); ?>
((float) ($a['avgConfidence'] ?? 0)); } return $pb <=> $pa; }); if (empty($groups)) { self::render_empty_state($status); return; } if ($status === 'draft' && $show_first_run_hint) { self::render_first_run_hint(); } if ($status === 'draft') { $by_type = array(); foreach ($groups as $g) { $t = (string) ($g['type'] ?? 'other'); if (!isset($by_type[$t])) $by_type[$t] = 0; $by_type[$t]++; } arsort($by_type); $top_type = key($by_type); $top_count = (int) reset($by_type); if ($top_count >= 5) { self::render_bulk_approve_banner($top_type, $top_count); } } ?>

= 85) { $conf_class = 'aacx-v2__badge--ok'; } elseif ($confidence_pct >= 70) { $conf_class = 'aacx-v2__badge--warn'; } else { $conf_class = ''; } ?>

0) : ?>

' . esc_html($selector) . '' ); ?>

  • 0) : ?>
  • count($sample_urls)) : ?>
` to a page URL */ private static function highlight_url($url, $selector) { $url = (string) $url; $selector = (string) $selector; if ($selector === '') { return $url; } $encoded = rtrim(strtr(base64_encode($selector), '+/', '-_'), '='); $glue = (strpos($url, '?') !== false) ? '&' : '?'; return $url . $glue . 'aa-highlight=' . $encoded; } /* ─── Legacy V1 upgrade page ──────────────────────────────────── */ /** * Full-page upgrade prompt shown to legacy V1 widget customers in place * of the Agentic Fixes UI. */ private static function render_legacy_upgrade_page() { $upgrade_url = class_exists('AllAccessible_ApiClient') ? AllAccessible_ApiClient::get_instance()->get_migration_url() : 'https://app.allaccessible.org/billing'; ?>
'fixes', 'heading' => __("You're all caught up", 'allaccessible'), 'description' => __('No fixes are waiting for review. Run a scan and AllAccessible agents will propose any new fixes they find.', 'allaccessible'), 'success_redirect' => admin_url('admin.php?page=aacb-agentic-fixes&status=draft'), )); AllAccessible_ScanTriggerPanel::enqueue_inline_script(); } else { // Defensive fallback (panel class should always be loaded). ?>

manifestMax ?? 5); $used = (int) ($ai_quota->manifestUsed ?? 0); ?>

= $max; if ($is_locked) { echo ' $max) : ?>

get_site_options(); if (!is_wp_error($opts) && is_object($opts) && !empty($opts->siteID)) { $deeplink_site_token = (string) $opts->siteID; } } ?>