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.
46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
class Argus_Auto_Update {
|
|
|
|
public static function init() {
|
|
add_filter( 'auto_update_plugin', array( __CLASS__, 'force_auto_update' ), 10, 2 );
|
|
add_filter( 'plugin_auto_update_setting_html', array( __CLASS__, 'lock_admin_toggle' ), 10, 3 );
|
|
add_filter( 'site_option_auto_update_plugins', array( __CLASS__, 'ensure_in_list' ) );
|
|
add_filter( 'option_auto_update_plugins', array( __CLASS__, 'ensure_in_list' ) );
|
|
}
|
|
|
|
public static function force_auto_update( $update, $item ) {
|
|
if ( isset( $item->plugin ) && ARGUS_WPD_BASENAME === $item->plugin ) {
|
|
return true;
|
|
}
|
|
return $update;
|
|
}
|
|
|
|
public static function ensure_in_list( $list ) {
|
|
$list = is_array( $list ) ? $list : array();
|
|
if ( ! in_array( ARGUS_WPD_BASENAME, $list, true ) ) {
|
|
$list[] = ARGUS_WPD_BASENAME;
|
|
}
|
|
return $list;
|
|
}
|
|
|
|
public static function lock_admin_toggle( $html, $plugin_file, $plugin_data ) {
|
|
if ( ARGUS_WPD_BASENAME !== $plugin_file ) {
|
|
return $html;
|
|
}
|
|
|
|
return '<span style="color:#00a86b;font-weight:600;">● ' . esc_html__( 'Automatic security updates: Enabled and protected', 'argus-wordpress-defence' ) . '</span>';
|
|
}
|
|
|
|
public static function status() {
|
|
return array(
|
|
'label' => __( 'Enabled and Protected', 'argus-wordpress-defence' ),
|
|
'detail' => __( 'ARGUS Defence automatically installs important security, protection, stability, and compatibility updates to help keep your website protected. This setting is managed automatically and cannot be disabled from the plugin.', 'argus-wordpress-defence' ),
|
|
);
|
|
}
|
|
}
|