kompass/includes/frontend-functions.php

184 lines
4.2 KiB
PHP
Raw Permalink Normal View History

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() {
$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);
}
function bdp_update_dashboard_style() {
wp_enqueue_style('custom-dashboard-styles', BDP_LV_PLUGIN_URL . '/assets/wordpress-bdp.css');
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');
}
function bdp_add_menu_security() {
2024-02-26 14:47:51 +01:00
2023-12-30 14:28:21 +01:00
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
2024-02-26 14:47:51 +01:00
2023-12-30 14:28:21 +01:00
}
function bdp_add_menu_contents() {
add_menu_page(
'Beiträge',
'Inhalte',
'edit_posts',
'edit.php',
'',
'dashicons-format-aside',
4
);
add_submenu_page('edit.php',
'media',
'Medienverwaltung',
'edit_posts',
'upload.php'
);
add_submenu_page('edit.php',
'media',
'Statische Seiten',
'edit_posts',
'edit.php?post_type=page'
);
add_submenu_page('edit.php',
'comments',
'Kommentare',
'edit_posts',
'edit-comments.php'
);
}
function bdp_add_menu_mein_lv() {
$location = BDP_LV_PLUGIN_DIR . '/modules/';
$mainSlug = $location . 'index.php';
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
add_menu_page(
2024-02-26 14:47:51 +01:00
'Mein BdP',
2023-12-30 14:28:21 +01:00
'BdP',
'manage_options',
$mainSlug,
'',
BDP_LV_PLUGIN_URL . '/icon.png',
3
);
add_submenu_page($mainSlug,
'calendar_settings',
'Kalender-Einstellungen',
'manage_options',
$moduleLoad . 'calendar'
);
add_submenu_page($mainSlug,
'calendar_settings',
'Über',
'manage_options',
$moduleLoad . 'about'
);
}
function bdp_add_menu_setup() {
add_menu_page(
'Allgemeine Einstellungen',
'Webseiten-Setup',
'manage_options',
'users.php',
'',
'dashicons-admin-generic',
6
);
add_submenu_page('users.php',
'Allgemeine Einstellungen',
'Allgemeine Einstellungen',
'manage_options',
'options-general.php'
);
add_submenu_page('users.php',
'Design-Einstellungen',
2024-02-26 14:47:51 +01:00
'Template bearbeiten',
2023-12-30 14:28:21 +01:00
'manage_options',
'customize.php?return=/wp-admin/'
);
add_submenu_page('users.php',
'plugins',
'Erweiterungen',
'manage_options',
'plugins.php'
);
add_submenu_page('users.php',
'themes',
'Designs',
'manage_options',
'themes.php'
);
2024-02-26 14:47:51 +01:00
add_submenu_page('users.php',
'Sicherheit',
'Webseiten-Sicherheit',
'manage_options',
'site-health.php'
);
$loginOption = new \Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage();
add_submenu_page('users.php',
'Login-Sicherheit',
'Login-Sicherheit',
'manage_options',
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts',
[$loginOption, 'limit_login_option_page']
);
2023-12-30 14:28:21 +01:00
}
function bdp_cleanup_menu()
{
global $submenu;
remove_menu_page('edit-comments.php');
remove_menu_page('edit.php');
remove_menu_page('edit.php?post_type=page');
remove_menu_page('upload.php');
remove_menu_page('themes.php');
remove_menu_page('plugins.php');
remove_menu_page('options-general.php');
remove_menu_page('users.php');
remove_menu_page('tools.php');
bdp_add_menu_contents();
bdp_add_menu_setup();
bdp_add_menu_security();
remove_submenu_page('users.php','user-new.php');
remove_submenu_page('users.php','profile.php');
remove_submenu_page('edit.php','post-new.php');
remove_submenu_page('edit.php','edit-tags.php?taxonomy=category');
remove_submenu_page('edit.php','edit-tags.php?taxonomy=post_tag');
}
function bdp_create_menu_structure()
{
add_action('admin_menu', 'bdp_cleanup_menu');
bdp_add_menu_mein_lv();
}