'; echo '

' . esc_html__( 'Understand your findings', 'shieldlume-security' ) . '

' . esc_html__( 'Choose a finding to see what it means and what to do next.', 'shieldlume-security' ) . '

' . esc_html__( 'Saved evidence', 'shieldlume-security' ) . '
'; echo '

' . esc_html__( 'This guidance uses the saved scan evidence. Reading it does not change your site.', 'shieldlume-security' ) . '

'; echo '
'; foreach ( $items as $id => $finding ) { self::panel( $finding, $id, $scan ); } echo '
'; ProPreviews::invitation( 'ai' ); foreach ( $items as $finding ) { if ( ! empty( $finding['action_eligibility']['repair'] ) && in_array( $finding['_status'] ?? '', array( 'open', 'acknowledged' ), true ) ) { ProPreviews::invitation( 'batches' ); break; } } echo ''; } private static function selected( array $items, array $input ): string { $requested = isset( $input['finding'] ) && is_string( $input['finding'] ) && strlen( $input['finding'] ) <= 128 ? sanitize_key( wp_unslash( $input['finding'] ) ) : ''; if ( preg_match( '/^f_[a-f0-9]{60}$/D', $requested ) && $requested === $input['finding'] && isset( $items[ $requested ] ) ) { return FindingGuide::id( $items[ $requested ] ); } return array_key_first( $items ); } private static function panel( array $finding, string $id, ?array $scan ): void { $guide = FindingGuide::describe( $finding ); $prefix = 'avai-guide-' . $id; $record = '#avai-evidence-' . $id; echo '

' . esc_html( $guide['title'] ) . '

'; echo '

' . esc_html( FindingGuide::text( $finding['location'] ?? null, __( 'Location not recorded', 'shieldlume-security' ), 500 ) ) . '

'; echo ''; self::sectionStart( $prefix, 'explain', __( 'What to do', 'shieldlume-security' ), true ); echo '

' . esc_html( $guide['explanation'] ) . '

' . esc_html__( 'Next step', 'shieldlume-security' ) . '

' . esc_html( $guide['next'] ) . '

' . esc_html__( 'Review available actions', 'shieldlume-security' ) . '

' . esc_html__( 'Review the recorded evidence before approving changes.', 'shieldlume-security' ) . '

' . esc_html__( 'Why this matters', 'shieldlume-security' ) . '

' . esc_html( $guide['why'] ) . '

'; $limitations = is_array( $finding['limitations'] ?? null ) ? $finding['limitations'] : array(); if ( $limitations ) { echo '
' . esc_html__( 'Limits of this check', 'shieldlume-security' ) . '
'; } do_action( 'antivirus_ai_finding_guidance', $finding, $scan ); echo ''; self::sectionStart( $prefix, 'evidence', __( 'Evidence', 'shieldlume-security' ) ); echo '

' . esc_html__( 'Recorded observation', 'shieldlume-security' ) . '

' . esc_html( FindingGuide::text( $finding['reason'] ?? null, __( 'No observation text is recorded. Review the original record before taking action.', 'shieldlume-security' ) ) ) . '

'; $source = is_array( $finding['source'] ?? null ) ? $finding['source'] : array(); self::fact( __( 'Source', 'shieldlume-security' ), FindingGuide::text( $source['provider'] ?? null, __( 'Source provider not recorded', 'shieldlume-security' ) ) ); self::fact( __( 'How the source supports this finding', 'shieldlume-security' ), FindingGuide::text( $source['provenance'] ?? null, __( 'See the full source record; no brief provenance is recorded.', 'shieldlume-security' ) ) ); self::fact( __( 'Detector / version', 'shieldlume-security' ), FindingGuide::text( $finding['detector_id'] ?? null, __( 'Not recorded', 'shieldlume-security' ), 300 ) . ' / ' . FindingGuide::text( $finding['detector_version'] ?? null, __( 'Not recorded', 'shieldlume-security' ), 100 ) ); self::fact( __( 'Component version', 'shieldlume-security' ), FindingGuide::text( $finding['component_version'] ?? null, __( 'Not recorded', 'shieldlume-security' ), 100 ) ); $freshness = is_array( $finding['rule_freshness'] ?? null ) ? $finding['rule_freshness'] : array(); if ( isset( $freshness['status'] ) ) { self::fact( __( 'Recorded rule freshness', 'shieldlume-security' ), FindingGuide::text( $freshness['status'], __( 'Not recorded', 'shieldlume-security' ), 100 ) ); } self::fact( __( 'Finding ID', 'shieldlume-security' ), $id ); echo '

' . esc_html__( 'Open complete recorded evidence', 'shieldlume-security' ) . '

'; $advisory = FindingGuide::text( $source['advisory_url'] ?? null ); if ( preg_match( '~^https://[^\s]+$~D', $advisory ) ) { echo '

' . esc_html__( 'Read source advisory (external site)', 'shieldlume-security' ) . '

'; } echo ''; echo '
' . esc_html__( 'Guidance based on saved checks', 'shieldlume-security' ) . '' . esc_html__( 'Observed:', 'shieldlume-security' ) . ' '; self::time( $finding['observed_at'] ?? null ); echo ''; $scanId = FindingGuide::text( $finding['scan_id'] ?? null, '', 100 ); if ( '' !== $scanId && is_array( $scan ) && $scanId === ( $scan['_id'] ?? $scan['id'] ?? null ) ) { echo '' . esc_html__( 'Associated scan started:', 'shieldlume-security' ) . ' '; self::time( $scan['started_at'] ?? null ); echo ''; } echo '' . esc_html__( 'Original evidence', 'shieldlume-security' ) . '
'; } private static function sectionStart( string $prefix, string $key, string $label, bool $open = false ): void { echo '
' . esc_html( $label ) . ''; } private static function fact( string $label, string $value ): void { echo '
' . esc_html( $label ) . '
' . esc_html( $value ) . '
'; } private static function time( mixed $value ): void { $text = FindingGuide::text( $value, __( 'Time not recorded', 'shieldlume-security' ), 100 ); $valid = is_string( $value ) && preg_match( '/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}:\d{2})$/D', $value ); echo $valid ? '' : esc_html( $text ); } }