PluginProbe
Adminimize / 1.9.1
Adminimize v1.9.1
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
← All changes | inc-setup/remove-admin-notices.php +6 -36 1.11.9 → 1.9.1 View file →
@@ -9,21 +9,11 @@
9 9 }
10 10
11 11 // Need only on admin area
12 12 if ( ! is_admin() ) {
13 - return;
13 + return NULL;
14 14 }
15 15
16 -// If is AJAX Call.
17 -if ( defined('DOING_AJAX') && DOING_AJAX ) {
18 - return;
19 -}
20 -
21 -// If is AJAX Call.
22 -if ( defined('DOING_AJAX') && DOING_AJAX ) {
23 - return;
24 -}
25 -
26 16 add_action( 'admin_init', '_mw_adminimize_init_to_remove_admin_notices' );
27 17 /**
28 18 * Fire all hooks to remove admin notices.
29 19 */
@@ -29,22 +19,20 @@
29 19 */
30 20 function _mw_adminimize_init_to_remove_admin_notices() {
31 21
32 22 if ( _mw_adminimize_check_to_remove_admin_notices() ) {
33 - add_action( 'admin_head', '_mw_adminimize_remove_admin_notices', PHP_INT_MAX + 1 );
23 + add_action( 'admin_head', '_mw_adminimize_remove_admin_notices' );
34 24 }
35 25 }
36 26
37 27 /**
38 - * Remove Admin Notices.
39 - *
40 - * @return boolean
28 + * @return bool|null
41 29 */
42 30 function _mw_adminimize_check_to_remove_admin_notices() {
43 31
44 32 // Exclude super admin.
45 33 if ( _mw_adminimize_exclude_super_admin() ) {
46 - return false;
34 + return;
47 35 }
48 36
49 37 $user_roles = _mw_adminimize_get_all_user_roles();
50 38
@@ -59,9 +47,9 @@
59 47 $disabled_global_option_[ $role ][ '0' ] = '';
60 48 }
61 49 }
62 50
63 - $remove_admin_notices = false;
51 + $remove_admin_notices = FALSE;
64 52 foreach ( $user_roles as $role ) {
65 53
66 54 $user = wp_get_current_user();
67 55
@@ -76,13 +64,9 @@
76 64 }
77 65 }
78 66 }
79 67
80 - if ( $remove_admin_notices ) {
81 - return true;
82 - }
83 -
84 - return false;
68 + return $remove_admin_notices;
85 69 }
86 70
87 71 /**
88 72 * Remove different admin notices.
@@ -92,19 +76,5 @@
92 76 remove_action( 'admin_notices', 'update_nag', 3 );
93 77 remove_action( 'admin_notices', 'maintenance_nag', 10 );
94 78 remove_action( 'admin_notices', 'new_user_email_admin_notice' );
95 79 remove_action( 'admin_notices', 'site_admin_notice' );
96 -
97 - // @ToDo, if we will use this.
98 - // Catch all admin notices.
99 - /*
100 - add_action( 'admin_notices', function () {
101 - ob_start();
102 - }, PHP_INT_MAX + 1 );
103 - $adm_notices = trim( ob_get_clean() );
104 - $adm_notices = preg_replace(
105 - '/(\sclass=["\'][^"\']*?notice)(["\'\s])/',
106 - '$1 inline$2',
107 - $adm_notices
108 - );
109 - */
110 80 }