2024-02-26 14:47:51 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (!isset($loginHandler)) {
|
|
|
|
$loginHandler = new \Bdp\Modules\LimitLoginAttempts\Controllers\LoginHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action('wp_login_failed', [$loginHandler, 'onFailedLogin']);
|
|
|
|
add_filter('wp_authenticate_user', [$loginHandler, 'onSuccessFullLogin'], 99999, 2);
|
|
|
|
add_filter( 'admin_enqueue_scripts', 'enqueue_custom_password_js',10 );
|
|
|
|
|
2024-03-16 14:21:57 +01:00
|
|
|
add_action('admin_init', 'kompass_admin_init');
|
2024-02-26 14:47:51 +01:00
|
|
|
|
|
|
|
if (get_option('kompass_cookies', false)) {
|
|
|
|
$loginHandler->handleCookies();
|
|
|
|
add_action('auth_cookie_bad_username', [$loginHandler, 'checkFailedCookies']);
|
|
|
|
add_action('auth_cookie_valid', [$loginHandler, 'onValidCookie'], 10, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST['save_kompass_balist_list_type'])) {
|
|
|
|
updateBlockOrAllowList($_POST);
|
|
|
|
}
|
|
|
|
|
2024-03-23 00:37:20 +01:00
|
|
|
function add_custom_admin_bar_item() {
|
|
|
|
global $wp_admin_bar;
|
|
|
|
|
|
|
|
// Überprüfen, ob der Benutzer die erforderliche Berechtigung hat
|
|
|
|
if ( current_user_can( 'show_groups' ) ) {
|
|
|
|
// Das Array mit den Eigenschaften des benutzerdefinierten Elements
|
|
|
|
$args = [
|
|
|
|
'id' => 'kompass_gruppen',
|
|
|
|
'title' => '<span class="ab-icon dashicons-groups"></span>' .
|
|
|
|
'<span class="ab-label">' .__('Groups', BDP_LV_PLUGIN_SLUG) . '</span>',
|
2024-03-24 19:52:32 +01:00
|
|
|
'href' => get_admin_url() . 'admin.php?page=kompass-groups',
|
2024-03-23 00:37:20 +01:00
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
// Das benutzerdefinierte Element zur Admin-Leiste hinzufügen
|
|
|
|
$wp_admin_bar->add_node( $args );
|
2024-05-27 16:59:30 +02:00
|
|
|
|
|
|
|
$args = [
|
|
|
|
'id' => 'kompass_events',
|
|
|
|
'title' => '<span class="ab-icon dashicons-tickets-alt"></span>' .
|
|
|
|
'<span class="ab-label">' .__('Events', BDP_LV_PLUGIN_SLUG) . '</span>',
|
|
|
|
'href' => get_admin_url() . 'admin.php?page=kompass-events',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
// Das benutzerdefinierte Element zur Admin-Leiste hinzufügen
|
|
|
|
$wp_admin_bar->add_node( $args );
|
|
|
|
|
|
|
|
|
2024-03-23 00:37:20 +01:00
|
|
|
}
|
|
|
|
}
|
2024-02-26 14:47:51 +01:00
|
|
|
|
2024-03-23 00:37:20 +01:00
|
|
|
// Die Funktion aufrufen, um das benutzerdefinierte Element zur Admin-Leiste hinzuzufügen
|
|
|
|
add_action( 'admin_bar_menu', 'add_custom_admin_bar_item', 50 );
|
2024-03-16 14:21:57 +01:00
|
|
|
|
2024-03-23 00:37:20 +01:00
|
|
|
add_action('wp_head', 'kompass_seo_add_verifications' );
|