ID); if ($post_url === '') $post_url = (string) get_permalink($post->ID); if ($post->post_status !== 'publish') { ?>
get_page_audit((int) $post->ID, $post_url); if (!is_wp_error($audit) && isset($audit['data_source']) && $audit['data_source'] === 'page') { // Only attempt linkage when we actually got a page row. $client->link_post_to_page((int) $post->ID, $post_url); } AllAccessible_Debug::console('EditorMetaBox — post ' . (int) $post->ID, array( 'post_id' => (int) $post->ID, 'raw_permalink' => (string) get_permalink($post->ID), 'canonical_url' => $post_url, 'api_is_error' => is_wp_error($audit), 'api_error' => is_wp_error($audit) ? $audit->get_error_message() : null, 'api_response' => is_wp_error($audit) ? null : $audit, 'render_branch' => (is_wp_error($audit) || !is_array($audit)) ? 'score_unavailable' : 'full_panel', )); if (is_wp_error($audit) || !is_array($audit)) { ?> = 90) { $score_class = 'score-excellent'; $grade_label = __('Excellent', 'allaccessible'); } elseif ($score >= 75) { $score_class = 'score-good'; $grade_label = __('Good', 'allaccessible'); } elseif ($score >= 50) { $score_class = 'score-fair'; $grade_label = __('Needs review', 'allaccessible'); } // Last-scan human-readable. $last_scan_human = ''; if ($last_scan !== '') { $ts = strtotime($last_scan); if ($ts) { $last_scan_human = sprintf( /* translators: %s: human-readable time diff (e.g., "2 hours") */ __('%s ago', 'allaccessible'), human_time_diff($ts, current_time('timestamp')) ); } } $deeplink = 'https://app.allaccessible.org'; $score_deeplink = ''; $opts = $client->get_site_options(); $audit_id = isset($audit['audit_id']) ? (int) $audit['audit_id'] : 0; $sub_id_api = isset($audit['subdomain_id']) ? (int) $audit['subdomain_id'] : 0; if (!is_wp_error($opts) && is_object($opts) && !empty($opts->siteID)) { $sub = $sub_id_api > 0 ? $sub_id_api : (int) get_option('aacb_siteID'); $tok = (string) $opts->siteID; if ($sub > 0 && $tok !== '') { $deeplink = sprintf( 'https://app.allaccessible.org/site/%s/%d/accessibility-audits', rawurlencode($tok), $sub ); if ($audit_id > 0) { $score_deeplink = sprintf( 'https://app.allaccessible.org/site/%s/%d/audit/%d', rawurlencode($tok), $sub, $audit_id ); } } } ?> $score); $score_str = $score !== null ? (string) $score : '—'; $circle_aria = $score !== null ? sprintf(__('Accessibility score %1$d out of 100, %2$s. Open full audit.', 'allaccessible'), (int) $score, $grade_label) : __('Accessibility score not available yet.', 'allaccessible'); ?>