kompass/modules/security/security.php

58 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2023-12-30 14:28:21 +01:00
<?php
require_once dirname(__FILE__) . '/includes/settings_reader.php';
require_once dirname(__FILE__) . '/includes/settings_writer.php';
2023-12-30 14:28:21 +01:00
function wp_example_site_health_navigation_tabs( $tabs ) {
// translators: Tab heading for Site Health navigation.
$tabs['bdp_enhanced_security'] = esc_html_x('Erweiterte Sicherheit', 'Site Health', 'text-domain');
2023-12-30 14:28:21 +01:00
return $tabs;
}
add_filter( 'site_health_navigation_tabs', 'wp_example_site_health_navigation_tabs' );
function wp_example_site_health_tab_content($tab)
{
if ('bdp_enhanced_security' === $tab) {
if (isset($_GET['subpage']) && $_GET['subpage'] == 'botlist') {
if (isset($_POST['save_settings']) && isset($_POST['existing_bots']) && isset($_POST['new_bots'])) {
protect_wp_save_bots($_POST['existing_bots'], $_POST['new_bots']);
}
echo '<div class="health-check-body health-check-status-tab hide-if-no-js">';
echo '<form method="post" action="site-health.php?tab=' . BDP_LV_PLUGIN_SLUG . '&subpage=botlist">';
echo '<input type="hidden" name="save_settings" value="true" />';
require BDP_LV_PLUGIN_DIR . 'modules/security/internal/botlist-tab.php';
echo '</form>';
echo '</div>';
return;
}
update_option('protect_wp_needs_attention', false);
if (isset($_POST['save_settings'])) {
$securitySettings = [];
if (isset($_POST['security_settings'])) {
$securitySettings = $_POST['security_settings'];
}
kompass_sec_save_settings($securitySettings);
}
if (isset($_GET['action']) && $_GET['action'] == 'updatesitekeys') {
kompass_sec_site_keys();
}
echo '<div class="health-check-body health-check-status-tab hide-if-no-js">';
echo '<form method="post" action="site-health.php?tab=bdp_enhanced_security">';
echo '<input type="hidden" name="save_settings" value="true" />';
require BDP_LV_PLUGIN_DIR . 'modules/security/internal/site-health-tab.php';
echo '</form>';
echo '</div>';
return;
}
2023-12-30 14:28:21 +01:00
}
add_action('site_health_tab_content', 'wp_example_site_health_tab_content');
require_once dirname(__FILE__) . '/classes/Security.class.php';