| Server IP : 213.186.33.2 / Your IP : 216.73.216.39 Web Server : Apache System : Linux webm005.cluster102.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : symetry ( 21728) PHP Version : 8.2.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/symetry/www/ARCHIVES/web/wp-content/plugins/adminimize/inc-setup/ |
Upload File : |
<?php
/**
* @package Adminimize
* @subpackage Dashboard Setup
* @author Frank Bültge
*/
if ( ! function_exists( 'add_action' ) ) {
echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
exit;
}
if ( ! is_admin() )
return NULL;
// retrun registered widgets; only on page index/dashboard :(
add_action( 'wp_dashboard_setup', '_mw_adminimize_dashboard_setup', 99 );
function _mw_adminimize_dashboard_setup() {
global $wp_meta_boxes;
if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
$adminimizeoptions = get_site_option( 'mw_adminimize' );
else
$adminimizeoptions = get_option( 'mw_adminimize' );
$widgets = _mw_adminimize_get_dashboard_widgets();
$adminimizeoptions['mw_adminimize_dashboard_widgets'] = $widgets;
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_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'] );
}
}
}
}
}
function _mw_adminimize_get_dashboard_widgets () {
global $wp_meta_boxes;
$widgets = array();
if ( isset($wp_meta_boxes['dashboard']) ) {
foreach( $wp_meta_boxes['dashboard'] as $context => $data ) {
foreach( $data as $priority => $data ) {
foreach( $data as $widget => $data ) {
$widgets[$widget] = array(
'id' => $widget,
'title' => strip_tags(
preg_replace( '/( |)<span.*span>/im', '', $data['title'] )
),
'context' => $context,
'priority' => $priority
);
}
}
}
}
return $widgets;
}