' . esc_html__('Not synced', 'aam-extension-mainwp') . ''; } if (empty($data['available'])) { return '' . esc_html__('Audit unavailable or disabled', 'aam-extension-mainwp') . ''; } if (!array_key_exists('security_score', $data) || $data['security_score'] === null) { return '' . esc_html__('No audit yet', 'aam-extension-mainwp') . ''; } $score = (int) $data['security_score']; $tone = $score < 75 ? 'poor' : ($score <= 90 ? 'moderate' : 'excellent'); $total = array_sum($data['issues_summary'] ?? []); $stale = !empty($data['synced_at']) && $data['synced_at'] < time() - 2 * DAY_IN_SECONDS; return '' . esc_html($score) . '/100' . esc_html(sprintf(_n('%d finding', '%d findings', $total, 'aam-extension-mainwp'), $total)) . '' . ($stale ? ' ' . esc_html__('Sync overdue', 'aam-extension-mainwp') . '' : ''); } /** * Render the security audit metabox for the current site * * @return void * @access public * @version 2.0.0 */ public function render_metabox() { $site_id = absint($_GET['dashboard'] ?? 0); $data = MainWP_AAM_DB::get($site_id); echo '
'; echo '
' . esc_html__('ACCESS SECURITY SCORE', 'aam-extension-mainwp') . ''; echo '
' . self::indicator($data) . '
'; if ($data && !empty($data['available']) && isset($data['issues_summary'])) { echo '
'; foreach (['error', 'critical', 'warning', 'notice'] as $type) { echo '
' . esc_html(ucfirst($type)) . '' . esc_html((int) ($data['issues_summary'][$type] ?? 0)) . '
'; } echo '
'; } echo '
'; } }