Update in code structure

This commit is contained in:
Thomas Günther 2024-02-21 21:41:11 +01:00
parent 80fb6cd452
commit bb741539f6
3 changed files with 22 additions and 14 deletions

View File

@ -2,7 +2,7 @@
add_action( 'plugins_loaded', 'bdp_kompass_load_plugin_textdomain' ); add_action( 'plugins_loaded', 'bdp_kompass_load_plugin_textdomain' );
register_activation_hook(__FILE__, 'bdp_plugin_install'); register_activation_hook(BDP_LV_STARTUP_FILE, 'bdp_plugin_install');
add_action('init', 'bdp_plugin_init'); add_action('init', 'bdp_plugin_init');

View File

@ -8,28 +8,36 @@ use ZipArchive;
class Security class Security
{ {
public const required_security_plugins = [ public const required_security_plugins = [];
'wps_hide_login' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/wps-hide-login.1.9.10.zip'],
];
public const delete_plugins = [ public const delete_plugins = [
'akismet/akismet.php', 'akismet/akismet.php',
'hello.php', 'hello.php',
'limit-login-attempts-reloaded' 'limit-login-attempts-reloaded',
'wps-hide-login/wps-hide-login.php'
]; ];
public static function setup() public static function setup()
{ {
self::deletePlugins(); self::deletePlugins();
foreach (self::required_security_plugins as $pluginSlug => $pluginData) { foreach (self::required_security_plugins as $pluginSlug => $pluginData) {
if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) { if (!is_dir(WP_PLUGIN_DIR . '/' . $pluginSlug)) {
self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']); self::installSecurityPlugin($pluginSlug, $pluginData['downloadUrl']);
} }
} }
$loginUrl = get_option('whl_page', 'bdp_login'); $loginUrl = get_option('whl_page', null) ?? 'bdp-login';
update_option('whl_page', $loginUrl); enable_option_rewrite_url($loginUrl);
enable_option_disable_xmlrpc();
enable_option_block_authorscan();
enable_option_block_execution_in_uploads();
enable_option_prohibit_special_files();
enable_option_file_editor();
enable_option_disable_conatenation();
enable_option_secure_include_dir();
enable_option_prohibit_bot_access();
enable_option_block_directory_listing();
} }

View File

@ -11,7 +11,7 @@ class Security
public const delete_plugins = [ public const delete_plugins = [
'akismet/akismet.php', 'akismet/akismet.php',
'hello.php', 'hello.php',
'wps_hide_login', 'wps-hide-login/wps-hide-login.php',
'limit-login-attempts-reloaded' 'limit-login-attempts-reloaded'
]; ];