ARGUS WordPress Defence 1.0.0 — first production release
Automatic WordPress security: local firewall, malware and file-integrity scanning, vulnerability protection, quarantine, scheduled backups, an optional page cache, and automatic global threat intelligence. See README.md for installation, update, and uninstall instructions.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Argus_Explain {
|
||||
|
||||
const TEMPLATE_FIELDS = array(
|
||||
'what_happened',
|
||||
'why_it_matters',
|
||||
'what_argus_found',
|
||||
'when_it_happened',
|
||||
'why_suspicious',
|
||||
'what_could_be_affected',
|
||||
'what_should_you_do',
|
||||
);
|
||||
|
||||
public static function require_fields( array $explain ) {
|
||||
foreach ( self::TEMPLATE_FIELDS as $field ) {
|
||||
if ( empty( $explain[ $field ] ) ) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf( 'Argus_Explain: finding is missing required field "%s" -- every finding must be fully explainable (ADR-0053 §19.3), no exceptions.', $field )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function labels() {
|
||||
return array(
|
||||
'what_happened' => __( 'What happened', 'argus-wordpress-defence' ),
|
||||
'why_it_matters' => __( 'Why it matters', 'argus-wordpress-defence' ),
|
||||
'what_argus_found' => __( 'What ARGUS found', 'argus-wordpress-defence' ),
|
||||
'when_it_happened' => __( 'When it happened', 'argus-wordpress-defence' ),
|
||||
'why_suspicious' => __( 'Why ARGUS considers this suspicious', 'argus-wordpress-defence' ),
|
||||
'what_could_be_affected' => __( 'What could be affected', 'argus-wordpress-defence' ),
|
||||
'what_should_you_do' => __( 'What should you do', 'argus-wordpress-defence' ),
|
||||
);
|
||||
}
|
||||
|
||||
public static function render( array $explain ) {
|
||||
$labels = self::labels();
|
||||
ob_start();
|
||||
?>
|
||||
<dl class="argus-explain">
|
||||
<?php foreach ( self::TEMPLATE_FIELDS as $field ) : ?>
|
||||
<dt><?php echo esc_html( $labels[ $field ] ); ?></dt>
|
||||
<dd><?php echo wp_kses_post( wpautop( $explain[ $field ] ?? '' ) ); ?></dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user