Aegis Shield Daily Scan Report';
$body .= '
Scanned: ' . esc_html($results['scanned_files']) . ' PHP files.
';
if (!empty($results['suspicious_matches'])) {
$body .= 'Suspicious Code Found:
';
foreach ($results['suspicious_matches'] as $match) {
$body .= '- ' . esc_html($match['file']) . '
';
foreach ($match['matches'] as $m) {
$body .= '- Line ' . esc_html($m['line']) . ': ' . esc_html($m['description']) . '
' . esc_html($m['snippet']) . ' ';
}
$body .= '
';
}
$body .= '
';
} else {
$body .= 'No suspicious code found.
';
}
if (!empty($results['integrity_issues'])) {
$body .= 'Integrity Issues:
';
foreach ($results['integrity_issues'] as $issue) {
$body .= '- ' . esc_html($issue['file']) . ': ' . esc_html($issue['issue']) . '
';
}
$body .= '
';
}
// Send email in HTML format
wp_mail(
get_option('admin_email'),
$subject,
$body,
['Content-Type: text/html; charset=UTF-8']
);
// Save last scan timestamp
update_option('aegis_shield_last_cron_scan', current_time('mysql'));
}