Basic release
This commit is contained in:
		
							
								
								
									
										179
									
								
								core/frontend-functions.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								core/frontend-functions.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,179 @@
 | 
			
		||||
<?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() {
 | 
			
		||||
    $moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
 | 
			
		||||
 | 
			
		||||
    add_menu_page(
 | 
			
		||||
        'Sicherheit',
 | 
			
		||||
        'Erweiterte<br />Sicherheit',
 | 
			
		||||
        'manage_options',
 | 
			
		||||
        'site-health.php',
 | 
			
		||||
        '',
 | 
			
		||||
        'dashicons-admin-network',
 | 
			
		||||
        5
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    https://wordpress.local.development.contelli.de/wp-admin/admin.php?page=limit-login-attempts
 | 
			
		||||
    add_submenu_page('site-health.php',
 | 
			
		||||
        'Login-Kontrolle',
 | 
			
		||||
        'Login-Kontrolle',
 | 
			
		||||
        'manage_options',
 | 
			
		||||
        get_admin_url() . 'admin.php?page=limit-login-attempts'
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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(
 | 
			
		||||
        'Mein BDP',
 | 
			
		||||
        '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',
 | 
			
		||||
        'Design',
 | 
			
		||||
        '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'
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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();
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user