@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - $site_license = array( |
|
45 | + $site_license = array( |
|
46 | 46 | 'key' => MonsterInsights()->license->get_site_license_key(), |
47 | 47 | 'type' => MonsterInsights()->license->get_site_license_type(), |
48 | 48 | 'is_disabled' => MonsterInsights()->license->site_license_disabled(), |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | // Array fields are needed even if empty. |
103 | 103 | $array_fields = array( 'view_reports', 'save_settings', 'ignore_users' ); |
104 | 104 | foreach ( $array_fields as $array_field ) { |
105 | - if ( ! isset( $options[ $array_field ] ) ) { |
|
106 | - $options[ $array_field ] = array(); |
|
105 | + if ( ! isset( $options[$array_field] ) ) { |
|
106 | + $options[$array_field] = array(); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | if ( isset( $options['custom_code'] ) ) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | } |
179 | 179 | if ( $empty ) { |
180 | - unset( $value[ $key ] ); |
|
180 | + unset( $value[$key] ); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } else { |
228 | 228 | $addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug ); |
229 | 229 | } |
230 | - $parsed_addons[ $addon->slug ] = $addon; |
|
230 | + $parsed_addons[$addon->slug] = $addon; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $installed = false; |
317 | 317 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
318 | 318 | |
319 | - if ( isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
319 | + if ( isset( $installed_plugins[$plugin_basename] ) ) { |
|
320 | 320 | $installed = true; |
321 | 321 | |
322 | 322 | if ( is_multisite() && is_network_admin() ) { |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | ); |
460 | 460 | |
461 | 461 | foreach ( $exclude as $e ) { |
462 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
463 | - unset( $new_settings[ $e ] ); |
|
462 | + if ( ! empty( $new_settings[$e] ) ) { |
|
463 | + unset( $new_settings[$e] ); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | foreach ( $exclude as $e ) { |
474 | - if ( ! empty( $settings[ $e ] ) ) { |
|
475 | - $new_settings = $settings[ $e ]; |
|
474 | + if ( ! empty( $settings[$e] ) ) { |
|
475 | + $new_settings = $settings[$e]; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | ), |
631 | 631 | admin_url( 'admin.php' ) |
632 | 632 | ); |
633 | - $url = esc_url( $url ); |
|
633 | + $url = esc_url( $url ); |
|
634 | 634 | |
635 | 635 | ob_start(); |
636 | 636 | if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) { |
@@ -35,54 +35,54 @@ |
||
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | 37 | switch( $cap ) { |
38 | - case 'monsterinsights_view_dashboard' : |
|
39 | - $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
38 | + case 'monsterinsights_view_dashboard' : |
|
39 | + $roles = monsterinsights_get_option( 'view_reports', array() ); |
|
40 | 40 | |
41 | - $user_can_via_settings = false; |
|
42 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | - foreach ( $roles as $role ) { |
|
44 | - if ( is_string( $role ) ) { |
|
45 | - if ( user_can( $user_id, $role ) ) { |
|
46 | - $user_can_via_settings = true; |
|
47 | - break; |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | - if ( user_can( $user_id, $roles ) ) { |
|
53 | - $user_can_via_settings = true; |
|
54 | - } |
|
55 | - } |
|
41 | + $user_can_via_settings = false; |
|
42 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
43 | + foreach ( $roles as $role ) { |
|
44 | + if ( is_string( $role ) ) { |
|
45 | + if ( user_can( $user_id, $role ) ) { |
|
46 | + $user_can_via_settings = true; |
|
47 | + break; |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
52 | + if ( user_can( $user_id, $roles ) ) { |
|
53 | + $user_can_via_settings = true; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | - $caps = array(); |
|
59 | - } |
|
57 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
58 | + $caps = array(); |
|
59 | + } |
|
60 | 60 | |
61 | - break; |
|
62 | - case 'monsterinsights_save_settings' : |
|
63 | - $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
61 | + break; |
|
62 | + case 'monsterinsights_save_settings' : |
|
63 | + $roles = monsterinsights_get_option( 'save_settings', array() ); |
|
64 | 64 | |
65 | - $user_can_via_settings = false; |
|
66 | - if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | - foreach ( $roles as $role ) { |
|
68 | - if ( is_string( $role ) ) { |
|
69 | - if ( user_can( $user_id, $role ) ) { |
|
70 | - $user_can_via_settings = true; |
|
71 | - break; |
|
72 | - } |
|
73 | - } |
|
74 | - } |
|
75 | - } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | - if ( user_can( $user_id, $roles ) ) { |
|
77 | - $user_can_via_settings = true; |
|
78 | - } |
|
79 | - } |
|
65 | + $user_can_via_settings = false; |
|
66 | + if ( ! empty( $roles ) && is_array( $roles ) ) { |
|
67 | + foreach ( $roles as $role ) { |
|
68 | + if ( is_string( $role ) ) { |
|
69 | + if ( user_can( $user_id, $role ) ) { |
|
70 | + $user_can_via_settings = true; |
|
71 | + break; |
|
72 | + } |
|
73 | + } |
|
74 | + } |
|
75 | + } else if ( ! empty( $roles ) && is_string( $roles ) ) { |
|
76 | + if ( user_can( $user_id, $roles ) ) { |
|
77 | + $user_can_via_settings = true; |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | - $caps = array(); |
|
83 | - } |
|
81 | + if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) { |
|
82 | + $caps = array(); |
|
83 | + } |
|
84 | 84 | |
85 | - break; |
|
85 | + break; |
|
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) { |
36 | 36 | |
37 | - switch( $cap ) { |
|
37 | + switch ( $cap ) { |
|
38 | 38 | case 'monsterinsights_view_dashboard' : |
39 | 39 | $roles = monsterinsights_get_option( 'view_reports', array() ); |
40 | 40 | |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | } |
87 | 87 | return $caps; |
88 | 88 | } |
89 | -add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 ); |
|
90 | 89 | \ No newline at end of file |
90 | +add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 ); |
|
91 | 91 | \ No newline at end of file |