$slug ), $args ), admin_url( 'admin.php' ) ); } /** * Stop unless the current user may manage the plugin. */ public static function guard() { if ( ! current_user_can( Plugin::capability() ) ) { wp_die( esc_html__( 'Sorry, you are not allowed to access this page.', '007aj-security-scanner-firewall' ), 403 ); } } /** * Print the result message of a previous action (fixed messages chosen by key). */ public static function messages() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display only; the key selects a fixed message. $key = isset( $_GET['ajsec_msg'] ) ? sanitize_key( wp_unslash( $_GET['ajsec_msg'] ) ) : ''; $messages = array( 'unlocked' => array( 'success', __( 'Lockout removed.', '007aj-security-scanner-firewall' ) ), 'not_locked' => array( 'warning', __( 'That IP address was not locked out.', '007aj-security-scanner-firewall' ) ), 'log_cleared' => array( 'success', __( 'Activity log cleared.', '007aj-security-scanner-firewall' ) ), 'scan_done' => array( 'success', __( 'Integrity scan finished.', '007aj-security-scanner-firewall' ) ), 'scan_error' => array( 'error', __( 'The integrity scan could not run. See the details below.', '007aj-security-scanner-firewall' ) ), ); if ( isset( $messages[ $key ] ) ) { printf( '

%2$s

', esc_attr( $messages[ $key ][0] ), esc_html( $messages[ $key ][1] ) ); } } /** * On/Off badge. * * @param bool $on State. * @return string HTML. */ public static function badge( $on ) { return $on ? '' . esc_html__( 'On', '007aj-security-scanner-firewall' ) . '' : '' . esc_html__( 'Off', '007aj-security-scanner-firewall' ) . ''; } /** * Format a Unix timestamp in the site's time zone. * * @param int $timestamp Timestamp. * @return string */ public static function time( $timestamp ) { return wp_date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), (int) $timestamp ); } /** * Render the Dashboard. */ public static function render() { self::guard(); $stats = Stats::today(); $locks = LoginLockout::locks(); $scan = IntegrityScan::last(); $log_on = Log::enabled(); $waf_on = (bool) Settings::get( 'waf_lite' ); ?>

–

!

·

$row ) : ?>

label() ); ?> description() ); ?> is_enabled() ) ); ?>