function __wp_supercustom_cms_dashboard_setup()
{
    global $wp_meta_boxes;
    $SuperCustomCMSoptions = get_option('supercustom_cms');
    $widgets = __wp_supercustom_cms_get_dashboard_widgets();
    $SuperCustomCMSoptions['wp_supercustom_cms_dashboard_widgets'] = $widgets;
    if (current_user_can('manage_options')) {
        update_option('supercustom_cms', $SuperCustomCMSoptions);
    }
    // exclude super admin
    if (__wp_supercustom_cms_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_dashboard_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_dashboard_option_' . $role . '_items');
    }
    //var_dump( get_option('supercustom_cms') );
    foreach ($user_roles as $role) {
        if (!isset($disabled_dashboard_option_[$role]['0'])) {
            $disabled_dashboard_option_[$role]['0'] = '';
        }
    }
    foreach ($user_roles as $role) {
        $user = wp_get_current_user();
        if (is_array($user->roles) && in_array($role, $user->roles)) {
            if (current_user_can($role) && is_array($disabled_dashboard_option_[$role])) {
                foreach ($disabled_dashboard_option_[$role] as $widget) {
                    if (isset($widgets[$widget]['context'])) {
                        remove_meta_box($widget, 'dashboard', $widgets[$widget]['context']);
                    }
                }
            }
        }
    }
}
/**
 * set menu options from database
 */
function __wp_supercustom_cms_set_user_info()
{
    global $pagenow, $menu, $submenu, $user_identity, $wp_version;
    // exclude super admin
    if (__wp_supercustom_cms_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_menu_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_menu_' . $role . '_items');
        $disabled_submenu_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_submenu_' . $role . '_items');
    }
    $__wp_supercustom_cms_admin_head = "\n";
    $__wp_supercustom_cms_user_info = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_user_info');
    $__wp_supercustom_cms_ui_redirect = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_ui_redirect');
    // change user-info
    switch ($__wp_supercustom_cms_user_info) {
        case 1:
            $__wp_supercustom_cms_admin_head .= '<script type="text/javascript">' . "\n";
            $__wp_supercustom_cms_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\' ).remove(); });' . "\n";
            $__wp_supercustom_cms_admin_head .= '</script>' . "\n";
            break;
        case 2:
            if (version_compare($wp_version, "3.2alpha", ">=")) {
                if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) {
                    $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info31.css" type="text/css" />' . "\n";
                }
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info32.css" type="text/css" />' . "\n";
            } elseif (version_compare($wp_version, "3.0alpha", ">=")) {
                if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) {
                    $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info31.css" type="text/css" />' . "\n";
                }
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
            } elseif (version_compare(substr($wp_version, 0, 3), '2.7', '>=')) {
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
            } else {
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
            }
            $__wp_supercustom_cms_admin_head .= '<script type="text/javascript">' . "\n";
            $__wp_supercustom_cms_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\' ).remove();';
            if ($__wp_supercustom_cms_ui_redirect == '1') {
                $__wp_supercustom_cms_admin_head .= 'jQuery(\'div#wpcontent\' ).after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url('/wp-login.php?action=logout&amp;redirect_to=' . get_option('siteurl'), 'log-out') . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\' ) });' . "\n";
            } else {
                $__wp_supercustom_cms_admin_head .= 'jQuery(\'div#wpcontent\' ).after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url('/wp-login.php?action=logout', 'log-out') . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\' ) });' . "\n";
            }
            $__wp_supercustom_cms_admin_head .= '</script>' . "\n";
            break;
        case 3:
            if (version_compare($wp_version, "3.2alpha", ">=")) {
                if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) {
                    $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info31.css" type="text/css" />' . "\n";
                }
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info32.css" type="text/css" />' . "\n";
            } elseif (version_compare($wp_version, "3.0alpha", ">=")) {
                if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) {
                    $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info31.css" type="text/css" />' . "\n";
                }
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
            } elseif (version_compare(substr($wp_version, 0, 3), '2.7', '>=')) {
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
            } else {
                $__wp_supercustom_cms_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
            }
            $__wp_supercustom_cms_admin_head .= '<script type="text/javascript">' . "\n";
            $__wp_supercustom_cms_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\' ).remove();';
            if ($__wp_supercustom_cms_ui_redirect == '1') {
                $__wp_supercustom_cms_admin_head .= 'jQuery(\'div#wpcontent\' ).after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . '/wp-admin/profile.php' . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url('/wp-login.php?action=logout&amp;redirect_to=' . get_option('siteurl'), 'log-out') . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\' ) });' . "\n";
            } else {
                $__wp_supercustom_cms_admin_head .= 'jQuery(\'div#wpcontent\' ).after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . '/wp-admin/profile.php' . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url('/wp-login.php?action=logout', 'log-out') . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\' ) });' . "\n";
            }
            $__wp_supercustom_cms_admin_head .= '</script>' . "\n";
            break;
    }
    echo $__wp_supercustom_cms_admin_head;
}
/**
 * remove objects on wp nav menu
 */
function __wp_supercustom_cms_set_nav_menu_option()
{
    // exclude super admin
    if (__wp_supercustom_cms_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    $__wp_supercustom_cms_admin_head = '';
    // remove_action( 'admin_head', 'index_js' );
    foreach ($user_roles as $role) {
        $disabled_nav_menu_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_nav_menu_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_nav_menu_option_[$role]['0'])) {
            $disabled_nav_menu_option_[$role]['0'] = '';
        }
    }
    // new 1.7.8
    foreach ($user_roles as $role) {
        $user = wp_get_current_user();
        if (is_array($user->roles) && in_array($role, $user->roles)) {
            if (current_user_can($role) && isset($disabled_nav_menu_option_[$role]) && is_array($disabled_nav_menu_option_[$role])) {
                $nav_menu_options = implode(',', $disabled_nav_menu_option_[$role]);
            }
        }
    }
    //remove_meta_box( $id, 'nav-menus', 'side' );
    $__wp_supercustom_cms_admin_head .= '<style type="text/css">' . $nav_menu_options . ' {display: none !important;}</style>' . "\n";
    if ($nav_menu_options) {
        echo $__wp_supercustom_cms_admin_head;
    }
}
/**
 * check user-option and add new style
 * @uses $pagenow
 */
function __wp_supercustom_cms_admin_init()
{
    global $pagenow, $post_type, $menu, $submenu, $wp_version;
    if (isset($_GET['post'])) {
        $post_id = (int) esc_attr($_GET['post']);
    } elseif (isset($_POST['post_ID'])) {
        $post_id = (int) esc_attr($_POST['post_ID']);
    } else {
        $post_id = 0;
    }
    $current_post_type = $post_type;
    if (!isset($current_post_type)) {
        $current_post_type = get_post_type($post_id);
    }
    if (!$current_post_type) {
        $current_post_type = str_replace('post_type=', '', esc_attr($_SERVER['QUERY_STRING']));
    }
    if (!$current_post_type) {
        // set hard to post
        $current_post_type = 'post';
    }
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    $SuperCustomCMSoptions = get_option('supercustom_cms');
    // pages for post type Post
    $def_post_pages = array('edit.php', 'post.php', 'post-new.php');
    $def_post_types = array('post');
    $disabled_metaboxes_post_all = array();
    // pages for post type Page
    $def_page_pages = array_merge($def_post_pages, array('page-new.php', 'page.php'));
    $def_page_types = array('page');
    $disabled_metaboxes_page_all = array();
    // pages for custom post types
    $def_custom_pages = $def_post_pages;
    $args = array('public' => TRUE, '_builtin' => FALSE);
    $def_custom_types = get_post_types($args);
    // pages for link pages
    $link_pages = array('link.php', 'link-manager.php', 'link-add.php', 'edit-link-categories.php');
    // pages for nav menu
    $nav_menu_pages = array('nav-menus.php');
    // get admin color for current user
    $_mw_admin_color = get_user_option('admin_color');
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_global_option_' . $role . '_items');
        $disabled_metaboxes_post_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_metaboxes_post_' . $role . '_items');
        $disabled_metaboxes_page_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_metaboxes_page_' . $role . '_items');
        foreach ($def_custom_types as $post_type) {
            $disabled_metaboxes_[$post_type . '_' . $role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_metaboxes_' . $post_type . '_' . $role . '_items');
        }
        $disabled_link_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_link_option_' . $role . '_items');
        $disabled_nav_menu_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_nav_menu_option_' . $role . '_items');
        array_push($disabled_metaboxes_post_all, $disabled_metaboxes_post_[$role]);
        array_push($disabled_metaboxes_page_all, $disabled_metaboxes_page_[$role]);
    }
    // global options
    // exclude super admin
    if (!__wp_supercustom_cms_exclude_super_admin()) {
        $__wp_supercustom_cms_footer = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_footer');
        switch ($__wp_supercustom_cms_footer) {
            case 1:
                wp_enqueue_script('__wp_supercustom_cms_remove_footer', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/js/remove_footer.js', array('jquery'));
                break;
        }
        $__wp_supercustom_cms_header = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_header');
        switch ($__wp_supercustom_cms_header) {
            case 1:
                wp_enqueue_script('__wp_supercustom_cms_remove_header', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/js/remove_header.js', array('jquery'));
                break;
        }
        //post-page options
        if (in_array($pagenow, $def_post_pages)) {
            $__wp_supercustom_cms_writescroll = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_writescroll');
            switch ($__wp_supercustom_cms_writescroll) {
                case 1:
                    wp_enqueue_script('__wp_supercustom_cms_writescroll', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/js/writescroll.js', array('jquery'));
                    break;
            }
            $__wp_supercustom_cms_tb_window = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_tb_window');
            switch ($__wp_supercustom_cms_tb_window) {
                case 1:
                    wp_deregister_script('media-upload');
                    wp_enqueue_script('media-upload', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/js/tb_window.js', array('thickbox'));
                    break;
            }
            $__wp_supercustom_cms_timestamp = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_timestamp');
            switch ($__wp_supercustom_cms_timestamp) {
                case 1:
                    wp_enqueue_script('__wp_supercustom_cms_timestamp', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/js/timestamp.js', array('jquery'));
                    break;
            }
            //category options
            $__wp_supercustom_cms_cat_full = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_cat_full');
            switch ($__wp_supercustom_cms_cat_full) {
                case 1:
                    wp_enqueue_style('SuperCustomCMS-ful-category', WP_PLUGIN_URL . '/' . FB_SUPERCUSTOM_CMS_BASEFOLDER . '/css/mw_cat_full.css');
                    break;
            }
            // set default editor tinymce
            if (__wp_supercustom_cms_recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags, #content-html', $disabled_metaboxes_page_all) || __wp_supercustom_cms_recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags, #content-html', $disabled_metaboxes_post_all)) {
                add_filter('wp_default_editor', create_function('', 'return "tinymce";'));
            }
            // remove media bottons
            if (__wp_supercustom_cms_recursive_in_array('media_buttons', $disabled_metaboxes_page_all) || __wp_supercustom_cms_recursive_in_array('media_buttons', $disabled_metaboxes_post_all)) {
                remove_action('media_buttons', 'media_buttons');
            }
            //add_filter( 'image_downsize', '__wp_supercustom_cms_image_downsize', 1, 3);
        }
        $__wp_supercustom_cms_control_flashloader = __wp_supercustom_cms_get_option_value('__wp_supercustom_cms_control_flashloader');
        switch ($__wp_supercustom_cms_control_flashloader) {
            case 1:
                add_filter('flash_uploader', '__wp_supercustom_cms_control_flashloader', 1);
                break;
        }
    }
    // change Admin Bar and user Info
    if (version_compare($wp_version, '3.3alpha', '>=')) {
        __wp_supercustom_cms_set_menu_option_33();
    } else {
        add_action('admin_head', '__wp_supercustom_cms_set_user_info');
        add_action('wp_head', '__wp_supercustom_cms_set_user_info');
    }
    // set menu option
    add_action('admin_head', '__wp_supercustom_cms_set_menu_option', 1);
    // global_options
    add_action('admin_head', '__wp_supercustom_cms_set_global_option', 1);
    // set metabox post option
    if (in_array($pagenow, $def_post_pages) && in_array($current_post_type, $def_post_types)) {
        add_action('admin_head', '__wp_supercustom_cms_set_metabox_post_option', 1);
    }
    // set metabox page option
    if (in_array($pagenow, $def_page_pages) && in_array($current_post_type, $def_page_types)) {
        add_action('admin_head', '__wp_supercustom_cms_set_metabox_page_option', 1);
    }
    // set custom post type options
    if (function_exists('get_post_types') && in_array($pagenow, $def_custom_pages) && in_array($current_post_type, $def_custom_types)) {
        add_action('admin_head', '__wp_supercustom_cms_set_metabox_cp_option', 1);
    }
    // set link option
    if (in_array($pagenow, $link_pages)) {
        add_action('admin_head', '__wp_supercustom_cms_set_link_option', 1);
    }
    // set wp nav menu options
    if (in_array($pagenow, $nav_menu_pages)) {
        add_action('admin_head', '__wp_supercustom_cms_set_nav_menu_option', 1);
    }
    add_action('in_admin_footer', '__wp_supercustom_cms_admin_footer');
    $SuperCustomCMSoptions['wp_supercustom_cms_default_menu'] = $menu;
    $SuperCustomCMSoptions['wp_supercustom_cms_default_submenu'] = $submenu;
    // if custom design of SuperCustomCMS; kill with version 1.7.18
    if ($_mw_admin_color == 'mw_fresh' || $_mw_admin_color == 'mw_classic' || $_mw_admin_color == 'mw_colorblind' || $_mw_admin_color == 'mw_grey' || $_mw_admin_color == 'mw_fresh_ozh_am' || $_mw_admin_color == 'mw_classic_ozh_am' || $_mw_admin_color == 'mw_fresh_lm' || $_mw_admin_color == 'mw_classic_lm' || $_mw_admin_color == 'mw_wp23') {
        // only posts
        if ('post-new.php' == $pagenow || 'post.php' == $pagenow || 'post' == $post_type) {
            if (version_compare(substr($wp_version, 0, 3), '2.7', '<')) {
                add_action('admin_head', '__wp_supercustom_cms_remove_box', 99);
            }
            // check for array empty
            if (!isset($disabled_metaboxes_post_['editor']['0'])) {
                $disabled_metaboxes_post_['editor']['0'] = '';
            }
            if (isset($disabled_metaboxes_post_['administrator']['0'])) {
                $disabled_metaboxes_post_['administrator']['0'] = '';
            }
            if (version_compare(substr($wp_version, 0, 3), '2.7', '<')) {
                if (!__wp_supercustom_cms_recursive_in_array('#categorydivsb', $disabled_metaboxes_post_all)) {
                    add_action('submitpost_box', '__wp_supercustom_cms_sidecat_list_category_box');
                }
                if (!__wp_supercustom_cms_recursive_in_array('#tagsdivsb', $disabled_metaboxes_post_all)) {
                    add_action('submitpost_box', '__wp_supercustom_cms_sidecat_list_tag_box');
                }
            }
        }
        // only pages
        if ('page-new.php' == $pagenow || 'page.php' == $pagenow || 'post_type=page' == esc_attr($_SERVER['QUERY_STRING']) || 'page' == $post_type) {
            // check for array empty
            if (!isset($disabled_metaboxes_page_['editor']['0'])) {
                $disabled_metaboxes_page_['editor']['0'] = '';
            }
            if (isset($disabled_metaboxes_page_['administrator']['0'])) {
                $disabled_metaboxes_page_['administrator']['0'] = '';
            }
        }
    }
}
/**
 * Remove Admin Bar
 */
function __wp_supercustom_cms_remove_admin_bar()
{
    // exclude super admin
    if (__wp_supercustom_cms_exclude_super_admin()) {
        return NULL;
    }
    global $wp_version;
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_global_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_global_option_[$role]['0'])) {
            $disabled_global_option_[$role]['0'] = '';
        }
    }
    $remove_adminbar = FALSE;
    // new 1.7.8
    foreach ($user_roles as $role) {
        $user = wp_get_current_user();
        if (is_array($user->roles) && in_array($role, $user->roles)) {
            if (current_user_can($role) && isset($disabled_global_option_[$role]) && is_array($disabled_global_option_[$role])) {
                $global_options = implode(', ', $disabled_global_option_[$role]);
                if (__wp_supercustom_cms_recursive_in_array('.show-admin-bar', $disabled_global_option_[$role])) {
                    $remove_adminbar = TRUE;
                }
            }
        }
    }
    if ($remove_adminbar) {
        // for deactivate admin bar in WP smaller WP 3.3
        if (version_compare($wp_version, '3.3alpha', '<=')) {
            add_filter('show_admin_bar', '__return_false');
            wp_deregister_script('admin-bar');
            wp_deregister_style('admin-bar');
            remove_action('wp_footer', 'wp_admin_bar_render', 1000);
            remove_action('wp_head', '_admin_bar_bump_cb');
        } else {
            if (!is_admin_bar_showing()) {
                return false;
            }
            wp_deregister_script('admin-bar');
            wp_deregister_style('admin-bar');
            remove_action('init', '_wp_admin_bar_init');
            remove_action('wp_footer', 'wp_admin_bar_render', 1000);
            remove_action('admin_footer', 'wp_admin_bar_render', 1000);
            // maybe also: 'wp_head'
            foreach (array('admin_head') as $hook) {
                add_action($hook, create_function('', "echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';"));
            }
            add_action('in_admin_header', '__wp_supercustom_cms_restore_links');
        }
        // end else version 3.3
    }
    // end if $remove_adminbar TRUE
}
/**
 * set metabox options from database an area post
 */
function __wp_supercustom_cms_set_metabox_cp_option()
{
    // exclude super admin
    if (__wp_supercustom_cms_exclude_super_admin()) {
        return NULL;
    }
    if (isset($_GET['post'])) {
        $post_id = (int) $_GET['post'];
    } elseif (isset($_POST['post_ID'])) {
        $post_id = (int) $_POST['post_ID'];
    } else {
        $post_id = 0;
    }
    $current_post_type = $GLOBALS['post_type'];
    if (!isset($current_post_type)) {
        $current_post_type = get_post_type($post_id);
    }
    if (!isset($current_post_type) || !$current_post_type) {
        $current_post_type = str_replace('post_type=', '', esc_attr($_SERVER['QUERY_STRING']));
    }
    if (!$current_post_type) {
        // set hard to post
        $current_post_type = 'post';
    }
    $user_roles = __wp_supercustom_cms_get_all_user_roles();
    $__wp_supercustom_cms_admin_head = '';
    // remove_action( 'admin_head', 'index_js' );
    foreach ($user_roles as $role) {
        $disabled_metaboxes_[$current_post_type . '_' . $role] = __wp_supercustom_cms_get_option_value('wp_supercustom_cms_disabled_metaboxes_' . $current_post_type . '_' . $role . '_items');
        if (!isset($disabled_metaboxes_[$current_post_type . '_' . $role]['0'])) {
            $disabled_metaboxes_[$current_post_type . '_' . $role]['0'] = '';
        }
        foreach ($user_roles as $role) {
            $user = wp_get_current_user();
            if (is_array($user->roles) && in_array($role, $user->roles)) {
                if (current_user_can($role) && isset($disabled_metaboxes_[$current_post_type . '_' . $role]) && is_array($disabled_metaboxes_[$current_post_type . '_' . $role])) {
                    $metaboxes = implode(',', $disabled_metaboxes_[$current_post_type . '_' . $role]);
                }
            }
        }
    }
    $__wp_supercustom_cms_admin_head .= '<style type="text/css">' . $metaboxes . ' {display: none !important;}</style>' . "\n";
    if ($metaboxes) {
        echo $__wp_supercustom_cms_admin_head;
    }
}