2023-12-30 14:28:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
add_action('admin_enqueue_scripts', 'bdp_update_dashboard_style');
|
|
|
|
add_action('login_enqueue_scripts', 'bdp_update_login_style');
|
|
|
|
|
|
|
|
function bdp_update_login_style() {
|
2024-07-31 17:53:07 +02:00
|
|
|
if (false === (bool)get_option( 'use_mareike_theme', false )) {
|
|
|
|
$css = file_get_contents( BDP_LV_PLUGIN_DIR . 'assets/dashboard.style.css.tpl' );
|
|
|
|
echo str_replace( '%%BDP_LV_PLUGIN_URL%%', BDP_LV_PLUGIN_URL, $css );
|
|
|
|
}
|
2023-12-30 14:28:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function bdp_update_dashboard_style() {
|
2024-07-31 17:53:07 +02:00
|
|
|
if (true === (bool)get_option( 'use_mareike_theme', false )) {
|
2024-07-31 21:20:57 +02:00
|
|
|
#wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/mareike.css' );
|
2024-09-29 18:12:38 +02:00
|
|
|
#wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
2024-07-31 17:53:07 +02:00
|
|
|
} else {
|
2024-09-29 18:12:38 +02:00
|
|
|
#wp_enqueue_style( 'custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css' );
|
2024-07-31 17:53:07 +02:00
|
|
|
}
|
2023-12-30 14:28:21 +01:00
|
|
|
wp_enqueue_style('custom-calendar-styles', BDP_LV_PLUGIN_URL . '/assets/calendar.css');
|
|
|
|
wp_enqueue_style('custom-security-styles', BDP_LV_PLUGIN_URL . '/assets/security.css');
|
|
|
|
}
|
2024-08-12 15:11:25 +02:00
|
|
|
|
|
|
|
function kompass_install_plugin($url, $slug) {
|
|
|
|
// Überprüfen, ob die URL gültig ist
|
|
|
|
if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
|
|
|
|
echo 'Ungültige URL';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dateinamen und Pfad festlegen
|
|
|
|
$tmp_file = download_url($url);
|
|
|
|
|
|
|
|
// Überprüfen, ob der Download erfolgreich war
|
|
|
|
if (is_wp_error($tmp_file)) {
|
|
|
|
echo 'Download-Fehler: ' . $tmp_file->get_error_message();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pfad des Plugins
|
|
|
|
$plugin_folder = WP_PLUGIN_DIR;
|
|
|
|
|
|
|
|
// Plugin Upgrader Klassen einbinden
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/file.php';
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/misc.php';
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php';
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
|
|
|
|
|
|
|
// Plugin upgrader initialisieren
|
|
|
|
$upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin());
|
|
|
|
|
|
|
|
// Plugin installieren
|
|
|
|
$result = $upgrader->install($tmp_file);
|
|
|
|
|
|
|
|
// Temp Datei löschen
|
|
|
|
unlink($tmp_file);
|
|
|
|
activate_plugin($slug . '/' . $slug . '.php' );
|
|
|
|
|
|
|
|
|
|
|
|
// Überprüfen, ob die Installation erfolgreich war
|
|
|
|
if (is_wp_error($result)) {
|
|
|
|
echo 'Installations-Fehler: ' . $result->get_error_message();
|
|
|
|
} else {
|
|
|
|
echo 'Plugin erfolgreich installiert';
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|