2023-12-30 14:28:21 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Plugin Name: BdP Kompass
|
|
|
|
* Description: Wordpress-Plugin zur Unterstützung von Stämmen im Bund der Pfadfinderinnen und Pfadfinder e.V. zur optimalen Verwaltung eurer Webseite
|
2024-06-03 23:51:58 +02:00
|
|
|
* Version: 4.6.2
|
2023-12-30 14:28:21 +01:00
|
|
|
* Tags: bdp, utility, helper
|
|
|
|
* Requires at least: 6.0
|
|
|
|
* Requires PHP: 8.2
|
|
|
|
* Author: Thomas Günther
|
|
|
|
* Author URI: https://www.sachsen.pfadfinden.de
|
2024-02-21 21:31:00 +01:00
|
|
|
* Update URI: http://lv-sachsen-main.bdp.mein-verein.online/wordpress/
|
2023-12-30 14:28:21 +01:00
|
|
|
* Text Domain: bdp-kompass
|
|
|
|
*/
|
|
|
|
|
2024-05-27 16:59:30 +02:00
|
|
|
use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain;
|
2024-03-23 00:37:20 +01:00
|
|
|
use Bdp\Modules\Gruppen\Controllers\MainController as GruppenMain;
|
2024-03-16 14:21:57 +01:00
|
|
|
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
|
2024-02-26 14:47:51 +01:00
|
|
|
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
|
2024-03-24 19:52:32 +01:00
|
|
|
use Bdp\Modules\Mail\Controllers\MailController;
|
2023-12-30 14:28:21 +01:00
|
|
|
use Bdp\Modules\Security\Security;
|
|
|
|
use Bdp\Modules\Seo\Seo;
|
|
|
|
|
2024-02-21 21:31:00 +01:00
|
|
|
require_once dirname(__FILE__) . '/includes/setup.php';
|
2023-12-30 14:28:21 +01:00
|
|
|
|
|
|
|
function bdp_plugin_install() {
|
2024-02-27 11:33:24 +01:00
|
|
|
|
2023-12-30 14:28:21 +01:00
|
|
|
}
|
|
|
|
|
2024-02-21 21:31:00 +01:00
|
|
|
|
|
|
|
function bdp_plugin_init() {
|
2024-03-05 22:59:15 +01:00
|
|
|
bdp_kompass_load_plugin_textdomain();
|
2024-02-21 21:31:00 +01:00
|
|
|
Security::ProhibitBots();
|
|
|
|
Security::SetPageFilters();
|
2024-05-27 16:59:30 +02:00
|
|
|
EventsMain::setup();
|
2024-02-21 21:31:00 +01:00
|
|
|
|
2024-02-27 11:33:24 +01:00
|
|
|
if (null == get_option('kompass_already_installed', null)) {
|
|
|
|
Seo::setup();
|
|
|
|
Calendar::setup();
|
|
|
|
Security::setup();
|
|
|
|
update_option('kompass_already_installed', true);
|
2024-02-21 21:31:00 +01:00
|
|
|
wp_redirect( 'site-health.php?tab=bdp_enhanced_security');
|
|
|
|
}
|
2024-03-16 14:21:57 +01:00
|
|
|
Seo::importVerificationKeys();
|
2024-02-27 11:33:24 +01:00
|
|
|
|
2023-12-30 14:28:21 +01:00
|
|
|
}
|
|
|
|
|
2024-02-26 14:47:51 +01:00
|
|
|
add_action('admin_menu', function () {
|
2024-03-05 22:59:15 +01:00
|
|
|
bdp_kompass_load_plugin_textdomain();
|
2024-02-26 14:47:51 +01:00
|
|
|
new OptionsPageAlias();
|
2024-03-16 14:21:57 +01:00
|
|
|
new KomnpassSettings();
|
2024-05-27 16:59:30 +02:00
|
|
|
new EventsMain();
|
2024-03-24 19:52:32 +01:00
|
|
|
new MailController();
|
2023-12-30 14:28:21 +01:00
|
|
|
|
|
|
|
|
2024-05-27 16:59:30 +02:00
|
|
|
|
|
|
|
});
|
|
|
|
add_action('wp_ajax_kompass_show_ajax', 'kompass_load_ajax_content');
|
|
|
|
add_action('wp_ajax_nopriv_kompass_show_ajax', 'kompass_load_ajax_content');
|
|
|
|
|
2023-12-30 14:28:21 +01:00
|
|
|
function register_custom_theme_directory() {
|
|
|
|
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/buena/' ;
|
|
|
|
|
|
|
|
system('mkdir ' . ABSPATH . 'wp-content/themes/buena/');
|
|
|
|
system('cp -r ' . $file . '* ' . ABSPATH . 'wp-content/themes/buena/');
|
|
|
|
|
|
|
|
switch_theme('buena');
|
|
|
|
}
|
|
|
|
|
2024-02-26 14:47:51 +01:00
|
|
|
function enqueue_custom_password_js() {
|
2024-05-27 16:59:30 +02:00
|
|
|
wp_enqueue_script( 'kompass-ajax', BDP_LV_PLUGIN_URL . '/assets/ajax.js');
|
2024-03-02 15:09:07 +01:00
|
|
|
wp_enqueue_script( 'searchable-table', BDP_LV_PLUGIN_URL . '/assets/searchtable.js');
|
2024-05-27 16:59:30 +02:00
|
|
|
wp_enqueue_script( 'custom-password-js', BDP_LV_PLUGIN_URL . 'assets/password.js');
|
2024-02-26 14:47:51 +01:00
|
|
|
wp_localize_script( 'custom-password-js', 'php_vars', [
|
|
|
|
'allowed_strengths' => kompass_get_minimal_password_strength(),
|
|
|
|
'password_too_short_text' => 'Dass Passwort entspricht nicht den Anforderungen.'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-05-27 16:59:30 +02:00
|
|
|
|
2024-03-16 16:35:18 +01:00
|
|
|
add_action( 'after_setup_theme', 'kompass_after_setup_theme' );
|