当前位置: 首页>>代码示例>>PHP>>正文


PHP _mw_adminimize_get_all_user_roles函数代码示例

本文整理汇总了PHP中_mw_adminimize_get_all_user_roles函数的典型用法代码示例。如果您正苦于以下问题:PHP _mw_adminimize_get_all_user_roles函数的具体用法?PHP _mw_adminimize_get_all_user_roles怎么用?PHP _mw_adminimize_get_all_user_roles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_mw_adminimize_get_all_user_roles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _mw_adminimize_dashboard_setup

/**
 * Set dashboard widget options.
 */
function _mw_adminimize_dashboard_setup()
{
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    $disabled_dashboard_option_ = array();
    foreach ($user_roles as $role) {
        $disabled_dashboard_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_dashboard_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_dashboard_option_[$role]['0'])) {
            $disabled_dashboard_option_[$role]['0'] = '';
        }
    }
    // Get all widgets.
    $widgets = _mw_adminimize_get_dashboard_widgets();
    // Get current user data.
    $user = wp_get_current_user();
    foreach ($user_roles as $role) {
        if (is_array($user->roles) && is_array($disabled_dashboard_option_[$role]) && in_array($role, $user->roles) && _mw_adminimize_current_user_has_role($role)) {
            foreach ($disabled_dashboard_option_[$role] as $widget) {
                if (isset($widgets[$widget]['context'])) {
                    remove_meta_box($widget, 'dashboard', $widgets[$widget]['context']);
                }
            }
        }
    }
}
开发者ID:pixelswithin,项目名称:sbt,代码行数:33,代码来源:dashboard.php

示例2: _mw_adminimize_check_to_remove_admin_notices

/**
 * @return bool|null
 */
function _mw_adminimize_check_to_remove_admin_notices()
{
    // Exclude super admin.
    if (_mw_adminimize_exclude_super_admin()) {
        return;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_global_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_global_option_[$role]['0'])) {
            $disabled_global_option_[$role]['0'] = '';
        }
    }
    $remove_admin_notices = FALSE;
    foreach ($user_roles as $role) {
        $user = wp_get_current_user();
        if (is_array($user->roles) && in_array($role, $user->roles)) {
            if (_mw_adminimize_current_user_has_role($role) && isset($disabled_global_option_[$role]) && is_array($disabled_global_option_[$role])) {
                $remove_admin_notices = _mw_adminimize_recursive_in_array('.admin-notices', $disabled_global_option_[$role]);
            }
        }
    }
    return $remove_admin_notices;
}
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:29,代码来源:remove-admin-notices.php

示例3: _mw_adminimize_dashboard_setup

function _mw_adminimize_dashboard_setup()
{
    global $wp_meta_boxes;
    $adminimizeoptions = get_option('mw_adminimize');
    $widgets = _mw_adminimize_get_dashboard_widgets();
    $adminimizeoptions['mw_adminimize_dashboard_widgets'] = $widgets;
    if (current_user_can('manage_options')) {
        update_option('mw_adminimize', $adminimizeoptions);
    }
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_dashboard_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_dashboard_option_' . $role . '_items');
    }
    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']);
                    }
                }
            }
        }
    }
}
开发者ID:asmt3,项目名称:aec,代码行数:35,代码来源:dashboard.php

示例4: _mw_adminimize_change_admin_bar

/**
 * Remove items in Admin Bar for current role of current active user
 * Exclude Super Admin, if active
 * Exclude Settings page of Adminimize
 * 
 * @since   1.8.1  01/10/2013
 * @return  void
 */
function _mw_adminimize_change_admin_bar($wp_admin_bar)
{
    // Don't filter on settings page
    if (isset($GLOBALS['current_screen']->base) && 'settings_page_adminimize/adminimize' == $GLOBALS['current_screen']->base) {
        return NULL;
    }
    // Exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_admin_bar_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_admin_bar_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_admin_bar_option_[$role]['0'])) {
            $disabled_admin_bar_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_admin_bar_option_[$role])) {
                foreach ($disabled_admin_bar_option_[$role] as $admin_bar_item) {
                    $wp_admin_bar->remove_node($admin_bar_item);
                }
            }
            // end if
        }
        // end if user roles
    }
}
开发者ID:hram908,项目名称:albertos-project,代码行数:40,代码来源:admin-bar-items.php

示例5: _mw_adminimize_options

function _mw_adminimize_options()
{
    global $wpdb, $_wp_admin_css_colors, $wp_version, $wp_roles, $table_prefix;
    $_mw_adminimize_user_info = 0;
    // get array with userroles
    // also provide for the other files
    $user_roles = _mw_adminimize_get_all_user_roles();
    $user_roles_names = _mw_adminimize_get_all_user_roles_names();
    // update options
    if (array_key_exists('_mw_adminimize_action', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_insert' && $_POST['_mw_adminimize_save']) {
        if (function_exists('current_user_can') && current_user_can('manage_options')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_update();
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    // import options
    if (array_key_exists('_mw_adminimize_action', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_import' && $_POST['_mw_adminimize_save']) {
        _mw_adminimize_import_json();
    }
    // Uninstall options
    if (array_key_exists('_mw_adminimize_action', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_deinstall' && !array_key_exists('_mw_adminimize_deinstall_yes', $_POST)) {
        $myErrors = new _mw_adminimize_message_class();
        $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_deinstall_yes') . '</p></div>';
        wp_die($myErrors);
    }
    if (array_key_exists('_mw_adminimize_action', $_POST) && array_key_exists('_mw_adminimize_deinstall_yes', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_deinstall' && $_POST['_mw_adminimize_deinstall'] && $_POST['_mw_adminimize_deinstall_yes'] === '_mw_adminimize_deinstall') {
        if (function_exists('current_user_can') && current_user_can('manage_options')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_deinstall();
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_deinstall') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    // load theme user data
    if (array_key_exists('_mw_adminimize_action', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_load_theme' && $_POST['_mw_adminimize_load']) {
        if (function_exists('current_user_can') && current_user_can('edit_users')) {
            check_admin_referer('mw_adminimize_nonce');
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_load_theme') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    if (array_key_exists('_mw_adminimize_action', $_POST) && $_POST['_mw_adminimize_action'] === '_mw_adminimize_set_theme' && $_POST['_mw_adminimize_save']) {
        if (function_exists('current_user_can') && current_user_can('edit_users')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_set_theme();
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_set_theme') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    ?>
	<div class="wrap">
		<?php 
    do_action('mw_adminimize_before_settings_form');
    // Backend Options for all roles
    require_once 'inc-options/minimenu.php';
    ?>
		<form name="backend_option" method="post" id="_mw_adminimize_options" action="?page=<?php 
    echo esc_attr($_GET['page']);
    ?>
">
			<?php 
    // Admin Bar options
    require_once 'inc-options/admin_bar.php';
    // Admin Bar items frontend
    require_once 'inc-options/admin_bar_frontend.php';
    // Backend Options for all roles
    require_once 'inc-options/backend_options.php';
    // global options on all pages in backend for different roles
    require_once 'inc-options/global_options.php';
    // dashboard options for different roles
    require_once 'inc-options/dashboard_options.php';
    // Menu Sub-menu Options
    require_once 'inc-options/menu_options.php';
    // Write Page Options
    require_once 'inc-options/write_post_options.php';
    // Write Page Options
    require_once 'inc-options/write_page_options.php';
    // Custom Post Type
    if (function_exists('get_post_types')) {
        require_once 'inc-options/write_cp_options.php';
    }
//.........这里部分代码省略.........
开发者ID:brandonschlack,项目名称:lkwd10s,代码行数:101,代码来源:adminimize_page.php

示例6: die

/**
 * @package    Adminimize
 * @subpackage Admin Bar Options, settings page
 * @author     Frank Bültge
 * @since      1.8.1  01/10/2013
 */
if (!function_exists('add_action')) {
    die("Hi there!  I'm just a part of plugin, not much I can do when called directly.");
}
/** @var $wp_admin_bar WP_Admin_Bar */
if (!isset($wp_admin_bar)) {
    $wp_admin_bar = '';
}
if (!isset($user_roles)) {
    $user_roles = _mw_adminimize_get_all_user_roles();
}
if (!isset($user_roles_names)) {
    $user_roles_names = _mw_adminimize_get_all_user_roles_names();
}
?>
<div id="poststuff" class="ui-sortable meta-box-sortables">
	<div class="postbox">
		<div class="handlediv" title="<?php 
esc_attr_e('Click to toggle');
?>
"><br /></div>
		<h3 class="hndle" id="admin_bar_options" title="<?php 
esc_attr_e('Click to toggle');
?>
"><?php 
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:30,代码来源:admin_bar.php

示例7: _mw_adminimize_install

/**
 * Install options in database
 */
function _mw_adminimize_install()
{
    if (!is_admin()) {
        return NULL;
    }
    global $menu, $submenu;
    $user_roles = _mw_adminimize_get_all_user_roles();
    $adminimizeoptions = array();
    foreach ($user_roles as $role) {
        $adminimizeoptions['mw_adminimize_disabled_menu_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_submenu_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_admin_bar_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_global_option_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_' . $role . '_items'] = array();
        $args = array('public' => TRUE, '_builtin' => FALSE);
        foreach (get_post_types($args) as $post_type) {
            $adminimizeoptions['mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'] = array();
        }
    }
    $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
    $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
    if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
        add_site_option('mw_adminimize', $adminimizeoptions);
    } else {
        add_option('mw_adminimize', $adminimizeoptions);
    }
}
开发者ID:Kilbourne,项目名称:restart,代码行数:31,代码来源:adminimize.php

示例8: _mw_adminimize_unregister_sidebars

/**
 * Remove sidebars for different roles
 *
 * @return  void
 */
function _mw_adminimize_unregister_sidebars()
{
    // Get settings.
    $adminimizeoptions = _mw_adminimize_get_option_value();
    // Get settings.
    _mw_adminimize_update_option($adminimizeoptions);
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_widget_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_widget_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_widget_option_[$role]['0'])) {
            $disabled_widget_option_[$role]['0'] = '';
        }
    }
    foreach ($user_roles as $role) {
        $user = wp_get_current_user();
        if (is_array($user->roles) && in_array($role, $user->roles)) {
            if (_mw_adminimize_current_user_has_role($role) && is_array($disabled_widget_option_[$role])) {
                foreach ($disabled_widget_option_[$role] as $sidebar) {
                    unregister_sidebar($sidebar);
                }
            }
        }
        // end if user roles
    }
}
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:36,代码来源:widget.php

示例9: _mw_adminimize_remove_admin_bar

/**
 * Remove Admin Bar
 */
function _mw_adminimize_remove_admin_bar()
{
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    global $wp_version;
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_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 (_mw_adminimize_current_user_has_role($role) && isset($disabled_global_option_[$role]) && is_array($disabled_global_option_[$role])) {
                if (_mw_adminimize_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;
            }
            add_filter('show_admin_bar', '__return_false');
            add_filter('wp_admin_bar_class', '__return_false');
            add_filter('show_wp_pointer_admin_bar', '__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('wp_head', 'admin_head') as $hook) {
                add_action($hook, create_function('', "echo '<style>body.admin-bar, body.admin-bar #wpcontent, body.admin-bar #adminmenu {\n\t\t\t\t\t\t\t padding-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\thtml.wp-toolbar {\n\t\t\t\t\t\t\tpadding-top: 0 !important;\n\t\t\t\t\t\t}</style>';"));
            }
            add_action('in_admin_header', '_mw_adminimize_restore_links');
        }
        // end else version 3.3
    }
    // end if $remove_adminbar TRUE
    return NULL;
}
开发者ID:brandonschlack,项目名称:lkwd10s,代码行数:62,代码来源:remove-admin-bar.php

示例10: _mw_adminimize_options

function _mw_adminimize_options()
{
    global $wpdb, $_wp_admin_css_colors, $wp_version, $wp_roles, $table_prefix;
    $_mw_adminimize_user_info = '';
    //get array with userroles
    $user_roles = _mw_adminimize_get_all_user_roles();
    $user_roles_names = _mw_adminimize_get_all_user_roles_names();
    // update options
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_insert' && $_POST['_mw_adminimize_save']) {
        if (function_exists('current_user_can') && current_user_can('manage_options')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_update();
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    // import options
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_import' && $_POST['_mw_adminimize_save']) {
        if (function_exists('current_user_can') && current_user_can('manage_options')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_import();
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    // deinstall options
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_deinstall' && $_POST['_mw_adminimize_deinstall_yes'] != '_mw_adminimize_deinstall') {
        $myErrors = new _mw_adminimize_message_class();
        $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_deinstall_yes') . '</p></div>';
        wp_die($myErrors);
    }
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_deinstall' && $_POST['_mw_adminimize_deinstall'] && $_POST['_mw_adminimize_deinstall_yes'] == '_mw_adminimize_deinstall') {
        if (function_exists('current_user_can') && current_user_can('manage_options')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_deinstall();
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_deinstall') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    // load theme user data
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_load_theme' && $_POST['_mw_adminimize_load']) {
        if (function_exists('current_user_can') && current_user_can('edit_users')) {
            check_admin_referer('mw_adminimize_nonce');
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_load_theme') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    if (isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_set_theme' && $_POST['_mw_adminimize_save']) {
        if (function_exists('current_user_can') && current_user_can('edit_users')) {
            check_admin_referer('mw_adminimize_nonce');
            _mw_adminimize_set_theme();
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_set_theme') . '</p></div>';
            echo $myErrors;
        } else {
            $myErrors = new _mw_adminimize_message_class();
            $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error('_mw_adminimize_access_denied') . '</p></div>';
            wp_die($myErrors);
        }
    }
    ?>
	<div class="wrap">
		<?php 
    do_action('mw_adminimize_before_settings_form');
    // Backend Options for all roles
    require_once 'inc-options/minimenu.php';
    ?>
		<form name="backend_option" method="post" id="_mw_adminimize_options" action="?page=<?php 
    echo esc_attr($_GET['page']);
    ?>
" >
		<?php 
    // Admin Bar options
    require_once 'inc-options/admin_bar.php';
    // Backend Options for all roles
    require_once 'inc-options/backend_options.php';
    // global options on all pages in backend for diffferent roles
    require_once 'inc-options/global_options.php';
    // dashboard options for different roles
    require_once 'inc-options/dashboard_options.php';
    // Menu Submenu Options
    require_once 'inc-options/menu_options.php';
    // Write Page Options
    require_once 'inc-options/write_post_options.php';
    // Write Page Options
    require_once 'inc-options/write_page_options.php';
//.........这里部分代码省略.........
开发者ID:hram908,项目名称:albertos-project,代码行数:101,代码来源:adminimize_page.php

示例11: _mw_adminimize_change_admin_bar_frontend

/**
 * Remove items in Admin Bar for current role of current active user in front end area
 * Exclude Super Admin, if active
 * Exclude Settings page of Adminimize
 *
 * @since   1.8.1  01/10/2013
 *
 * @param $wp_admin_bar
 *
 * @return null
 */
function _mw_adminimize_change_admin_bar_frontend($wp_admin_bar)
{
    // works only for back end admin bar
    if (is_admin()) {
        return NULL;
    }
    // Exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    $disabled_admin_bar_frontend_option_ = '';
    foreach ($user_roles as $role) {
        $disabled_admin_bar_frontend_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_admin_bar_frontend_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_admin_bar_frontend_option_[$role]['0'])) {
            $disabled_admin_bar_frontend_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_admin_bar_frontend_option_[$role])) {
                foreach ($disabled_admin_bar_frontend_option_[$role] as $admin_bar_item) {
                    $wp_admin_bar->remove_node($admin_bar_item);
                }
            }
            // end if
        }
        // end if user roles
    }
}
开发者ID:Alinea-Interactive,项目名称:Adminimize,代码行数:44,代码来源:admin-bar-items.php

示例12: _mw_adminimize_unregister_sidebars

/**
 * Remove sidebars for different roles
 * 
 * @return  void
 */
function _mw_adminimize_unregister_sidebars()
{
    if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
        $adminimizeoptions = get_site_option('mw_adminimize');
    } else {
        $adminimizeoptions = get_option('mw_adminimize');
    }
    if (current_user_can('manage_options')) {
        if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
            update_site_option('mw_adminimize', $adminimizeoptions);
        } else {
            update_option('mw_adminimize', $adminimizeoptions);
        }
    }
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return NULL;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_widget_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_widget_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_widget_option_[$role]['0'])) {
            $disabled_widget_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_widget_option_[$role])) {
                foreach ($disabled_widget_option_[$role] as $sidebar) {
                    unregister_sidebar($sidebar);
                }
            }
        }
        // end if user roles
    }
}
开发者ID:Alinea-Interactive,项目名称:Adminimize,代码行数:44,代码来源:widget.php

示例13: _mw_adminimize_remove_admin_bar

/**
 * Remove Admin Bar
 *
 * @return null|void
 */
function _mw_adminimize_remove_admin_bar()
{
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return;
    }
    // Leave the settings screen from Adminimize to see all areas on settings.
    if (_mw_adminimize_exclude_settings_page()) {
        return;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_global_option_' . $role . '_items');
    }
    foreach ($user_roles as $role) {
        if (!isset($disabled_global_option_[$role]['0'])) {
            $disabled_global_option_[$role]['0'] = '';
        }
    }
    $user = wp_get_current_user();
    $remove_adminbar = FALSE;
    // new 1.7.8
    foreach ($user_roles as $role) {
        if (is_array($user->roles) && in_array($role, $user->roles, FALSE)) {
            if (_mw_adminimize_current_user_has_role($role) && isset($disabled_global_option_[$role]) && is_array($disabled_global_option_[$role]) && _mw_adminimize_recursive_in_array('.show-admin-bar', $disabled_global_option_[$role])) {
                $remove_adminbar = TRUE;
            }
        }
    }
    if ($remove_adminbar) {
        if (!is_admin_bar_showing()) {
            return FALSE;
        }
        add_filter('show_admin_bar', '__return_false');
        add_filter('wp_admin_bar_class', '__return_false');
        add_filter('show_wp_pointer_admin_bar', '__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('wp_head', 'admin_head') as $hook) {
            add_action($hook, create_function('', "echo '<style>body.admin-bar, body.admin-bar #wpcontent, body.admin-bar #adminmenu {\n\t\t\t\t\t\t\t padding-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\thtml.wp-toolbar {\n\t\t\t\t\t\t\tpadding-top: 0 !important;\n\t\t\t\t\t\t}</style>';"));
        }
        add_action('in_admin_header', '_mw_adminimize_restore_links');
    }
    // end if $remove_adminbar TRUE
}
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:54,代码来源:remove-admin-bar.php

示例14: _mw_adminimize_remove_admin_bar

/**
 * Remove Admin Bar
 *
 * @return null|void
 */
function _mw_adminimize_remove_admin_bar()
{
    // exclude super admin
    if (_mw_adminimize_exclude_super_admin()) {
        return;
    }
    // Leave the settings screen from Adminimize to see all areas on settings.
    if (_mw_adminimize_exclude_settings_page()) {
        return;
    }
    $user_roles = _mw_adminimize_get_all_user_roles();
    $disabled_global_option_ = array();
    foreach ($user_roles as $role) {
        $disabled_global_option_[$role] = (array) _mw_adminimize_get_option_value('mw_adminimize_disabled_global_option_' . $role . '_items');
    }
    $mw_global_options = array();
    $user = wp_get_current_user();
    foreach ($user_roles as $role) {
        if (in_array($role, $user->roles, FALSE) && _mw_adminimize_current_user_has_role($role)) {
            // Create array about all items with all affected roles, important for multiple roles.
            foreach ($disabled_global_option_[$role] as $global_item) {
                $mw_global_options[] = $global_item;
            }
        }
    }
    // Support Multiple Roles for users.
    if (_mw_adminimize_get_option_value('mw_adminimize_multiple_roles') && 1 < count($user->roles)) {
        $mw_global_options = _mw_adminimize_get_duplicate($mw_global_options);
    }
    $remove_adminbar = FALSE;
    // Check for admin bar selector to set to remove the Admin Bar.
    if (_mw_adminimize_recursive_in_array('.show-admin-bar', $mw_global_options)) {
        $remove_adminbar = TRUE;
    }
    if ($remove_adminbar) {
        if (!is_admin_bar_showing()) {
            return FALSE;
        }
        add_filter('show_admin_bar', '__return_false');
        add_filter('wp_admin_bar_class', '__return_false');
        add_filter('show_wp_pointer_admin_bar', '__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('wp_head', 'admin_head') as $hook) {
            add_action($hook, create_function('', "echo '<style>body.admin-bar, body.admin-bar #wpcontent, body.admin-bar #adminmenu {\n\t\t\t\t\t\t\t padding-top: 0 !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\thtml.wp-toolbar {\n\t\t\t\t\t\t\tpadding-top: 0 !important;\n\t\t\t\t\t\t}</style>';"));
        }
        add_action('in_admin_header', '_mw_adminimize_restore_links');
    }
    // end if $remove_adminbar TRUE
}
开发者ID:qhuit,项目名称:alejandra,代码行数:59,代码来源:remove-admin-bar.php

示例15: _mw_adminimize_install

/**
 * Install options in database
 */
function _mw_adminimize_install()
{
    global $menu, $submenu;
    $user_roles = _mw_adminimize_get_all_user_roles();
    $adminimizeoptions = array();
    foreach ($user_roles as $role) {
        $adminimizeoptions['mw_adminimize_disabled_menu_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_submenu_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_global_option_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_' . $role . '_items'] = array();
        $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_' . $role . '_items'] = array();
        $args = array('public' => TRUE, '_builtin' => FALSE);
        foreach (get_post_types($args) as $post_type) {
            $adminimizeoptions['mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'] = array();
        }
    }
    $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
    $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
    add_option('mw_adminimize', $adminimizeoptions);
}
开发者ID:asmt3,项目名称:aec,代码行数:23,代码来源:adminimize.php


注:本文中的_mw_adminimize_get_all_user_roles函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。