@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | function monsterinsights_get_dashboard_report() { |
11 | 11 | $reports = monsterinsights_get_reports(); |
12 | 12 | $picked = monsterinsights_get_option( 'dashboard_report', 'overview' ); |
13 | - if ( ! empty( $reports ) && is_array( $reports ) && array_key_exists ( $picked, $reports ) ) { |
|
14 | - return array( 'id' => $picked, 'title' => $reports[ $picked ] ); |
|
13 | + if ( ! empty( $reports ) && is_array( $reports ) && array_key_exists( $picked, $reports ) ) { |
|
14 | + return array( 'id' => $picked, 'title' => $reports[$picked] ); |
|
15 | 15 | } else { |
16 | 16 | return array(); |
17 | 17 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | do_action( 'monsterinsights_head' ); |
37 | 37 | |
38 | 38 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
39 | - wp_die( esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); |
|
39 | + wp_die( esc_html__( 'Access denied', 'google-analytics-for-wordpress' ) ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $dashboard_disabled = monsterinsights_get_option( 'dashboard_disabled', false ); |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | $failed = monsterinsights_get_option( 'cron_failed', false ); |
47 | 47 | $pro_access_key = get_option( 'monsterinsights_pro_access_token', false ); |
48 | 48 | $lite_access_key = get_option( 'monsterinsights_lite_access_token', false ); |
49 | - $needs_re_auth = ( ( $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) || ( empty( $pro_access_key ) && empty( $lite_access_key ) ) || ( version_compare( $oauth_version, '1.0', '<' ) ) ) ? true : false; |
|
49 | + $needs_re_auth = ( ( $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) || ( empty( $pro_access_key ) && empty( $lite_access_key ) ) || ( version_compare( $oauth_version, '1.0', '<' ) ) ) ? true : false; |
|
50 | 50 | ?> |
51 | 51 | <?php echo monsterinsights_ublock_notice(); ?> |
52 | 52 | <div id="monsterinsights-reports" class="wrap"> |
53 | 53 | <div class="monsterinsights-clear"> |
54 | 54 | <div class="monsterinsights-reports-action-bar"> |
55 | 55 | <div class="monsterinsights-reports-action-bar-title"> |
56 | - <?php esc_html_e( 'Dashboard', 'google-analytics-for-wordpress' );?> |
|
56 | + <?php esc_html_e( 'Dashboard', 'google-analytics-for-wordpress' ); ?> |
|
57 | 57 | </div> |
58 | 58 | <div class="monsterinsights-reports-action-bar-actions"><?php |
59 | 59 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * not be used by other developers. This hook's behavior may be modified |
31 | 31 | * or the hook may be removed at any time, without warning. |
32 | 32 | */ |
33 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
33 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
34 | 34 | return $reports; |
35 | 35 | } |
36 | 36 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | do_action( 'monsterinsights_head' ); |
54 | 54 | |
55 | 55 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
56 | - wp_die( esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) ); |
|
56 | + wp_die( esc_html__( 'Access denied', 'google-analytics-for-wordpress' ) ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $dashboard_disabled = monsterinsights_get_option( 'dashboard_disabled', false ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $failed = monsterinsights_get_option( 'cron_failed', false ); |
64 | 64 | $pro_access_key = get_option( 'monsterinsights_pro_access_token', false ); |
65 | 65 | $lite_access_key = get_option( 'monsterinsights_lite_access_token', false ); |
66 | - $needs_re_auth = ( ( $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) || ( empty( $pro_access_key ) && empty( $lite_access_key ) ) || ( version_compare( $oauth_version, '1.0', '<' ) ) ) ? true : false; |
|
66 | + $needs_re_auth = ( ( $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) || ( empty( $pro_access_key ) && empty( $lite_access_key ) ) || ( version_compare( $oauth_version, '1.0', '<' ) ) ) ? true : false; |
|
67 | 67 | ?> |
68 | 68 | <?php echo monsterinsights_ublock_notice(); ?> |
69 | 69 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | <div class="monsterinsights-clear"> |
91 | 91 | <div class="monsterinsights-reports-action-bar"> |
92 | 92 | <div class="monsterinsights-reports-action-bar-title"> |
93 | - <?php esc_html_e( 'Reports', 'google-analytics-for-wordpress' );?> |
|
93 | + <?php esc_html_e( 'Reports', 'google-analytics-for-wordpress' ); ?> |
|
94 | 94 | </div> |
95 | 95 | <div class="monsterinsights-reports-action-bar-actions"><?php |
96 | 96 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | <div id="monsterinsights-main-tab-general" class="monsterinsights-main-nav-tab monsterinsights-nav-tab monsterinsights-active"> |
43 | 43 | <div id="monsterinsights-network-settings-general"> |
44 | 44 | <?php |
45 | - // Output any notices now |
|
46 | - /** |
|
47 | - * Developer Alert: |
|
48 | - * |
|
49 | - * Per the README, this is considered an internal hook and should |
|
50 | - * not be used by other developers. This hook's behavior may be modified |
|
51 | - * or the hook may be removed at any time, without warning. |
|
52 | - */ |
|
53 | - do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
54 | - ?> |
|
45 | + // Output any notices now |
|
46 | + /** |
|
47 | + * Developer Alert: |
|
48 | + * |
|
49 | + * Per the README, this is considered an internal hook and should |
|
50 | + * not be used by other developers. This hook's behavior may be modified |
|
51 | + * or the hook may be removed at any time, without warning. |
|
52 | + */ |
|
53 | + do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
54 | + ?> |
|
55 | 55 | <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
56 | 56 | <p><?php esc_html_e( 'Activate your MonsterInsights license key on this panel to hide the license key settings and addon pages for subsites.', 'google-analytics-for-wordpress'); ?></p> |
57 | 57 | <table class="form-table"> |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | |
123 | 123 | // Check if user pressed the 'Update' button and nonce is valid |
124 | 124 | if ( ! isset( $_POST['monsterinsights-network-settings-submit'] ) ) { |
125 | - return; |
|
125 | + return; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | if ( ! wp_verify_nonce( $_POST['monsterinsights-network-settings-nonce'], 'monsterinsights-network-settings-nonce' ) ) { |
129 | - return; |
|
129 | + return; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
133 | - return; |
|
133 | + return; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $throw_notice = false; |
@@ -138,19 +138,19 @@ discard block |
||
138 | 138 | $network_manual_ua_code = monsterinsights_is_valid_ua( $network_manual_ua_code ); // also sanitizes the string |
139 | 139 | |
140 | 140 | if ( $network_manual_ua_code ) { |
141 | - update_site_option( 'monsterinsights_network_manual_ua_code', $network_manual_ua_code ); |
|
141 | + update_site_option( 'monsterinsights_network_manual_ua_code', $network_manual_ua_code ); |
|
142 | 142 | } else { |
143 | - if ( empty ( $network_manual_ua_code ) && isset( $_POST['network_manual_ua_code'] ) ) { |
|
144 | - $throw_notice = true; |
|
145 | - } |
|
146 | - update_site_option( 'monsterinsights_network_manual_ua_code', '' ); |
|
143 | + if ( empty ( $network_manual_ua_code ) && isset( $_POST['network_manual_ua_code'] ) ) { |
|
144 | + $throw_notice = true; |
|
145 | + } |
|
146 | + update_site_option( 'monsterinsights_network_manual_ua_code', '' ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Output an admin notice so the user knows what happened |
150 | 150 | if ( $throw_notice ) { |
151 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
151 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
152 | 152 | } else { |
153 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
153 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | add_action( 'admin_init', 'monsterinsights_network_settings_save_general', 11 ); |
157 | 157 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $network_license = get_site_option( 'monsterinsights_license' ); |
35 | 35 | $license_key = ! empty( $network_license['key'] ) ? esc_attr( $network_license['key'] ) : ''; |
36 | 36 | $license_key_type = ! empty( $network_license['type'] ) ? esc_html( $network_license['type'] ) : ''; |
37 | - $network_ua_code = get_site_option('monsterinsights_network_manual_ua_code', false ); |
|
37 | + $network_ua_code = get_site_option( 'monsterinsights_network_manual_ua_code', false ); |
|
38 | 38 | ?> |
39 | 39 | <?php echo monsterinsights_ublock_notice(); ?> |
40 | 40 | <div id="monsterinsights-settings" class="wrap"> |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
54 | 54 | ?> |
55 | - <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
|
56 | - <p><?php esc_html_e( 'Activate your MonsterInsights license key on this panel to hide the license key settings and addon pages for subsites.', 'google-analytics-for-wordpress'); ?></p> |
|
55 | + <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress' ); ?></h1> |
|
56 | + <p><?php esc_html_e( 'Activate your MonsterInsights license key on this panel to hide the license key settings and addon pages for subsites.', 'google-analytics-for-wordpress' ); ?></p> |
|
57 | 57 | <table class="form-table"> |
58 | 58 | <tbody> |
59 | 59 | <?php if ( monsterinsights_is_pro_version() ) : ?> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | - $throw_notice = false; |
|
136 | + $throw_notice = false; |
|
137 | 137 | $network_manual_ua_code = isset( $_POST['network_manual_ua_code'] ) ? $_POST['network_manual_ua_code'] : ''; |
138 | 138 | $network_manual_ua_code = monsterinsights_is_valid_ua( $network_manual_ua_code ); // also sanitizes the string |
139 | 139 |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | <?php |
52 | 52 | } |
53 | 53 | |
54 | -function monsterinsights_tools_url_builder_tab(){ |
|
54 | +function monsterinsights_tools_url_builder_tab() { |
|
55 | 55 | do_action( 'monsterinsights_tools_url_builder_tab' ); |
56 | 56 | } |
57 | 57 | |
58 | 58 | function monsterinsights_tools_settings_tab() { |
59 | - ob_start();?> |
|
60 | - <h2><?php echo esc_html__( 'Setting Tools', 'google-analytics-for-wordpress' );?></h2> |
|
59 | + ob_start(); ?> |
|
60 | + <h2><?php echo esc_html__( 'Setting Tools', 'google-analytics-for-wordpress' ); ?></h2> |
|
61 | 61 | <p><?php echo esc_html__( 'You can use the below tools to import settings from other MonsterInsights websites or export settings to import into another MonsterInsights install.', 'google-analytics-for-wordpress' ); ?> </p> |
62 | 62 | <br /> |
63 | 63 | <table class="form-table"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <tr> |
66 | 66 | <th scope="row"> |
67 | 67 | <label for="monsterinsights-import-settings"> |
68 | - <?php echo esc_html__( 'Import Settings', 'google-analytics-for-wordpress' );?> |
|
68 | + <?php echo esc_html__( 'Import Settings', 'google-analytics-for-wordpress' ); ?> |
|
69 | 69 | </label> |
70 | 70 | </th> |
71 | 71 | <td> |
72 | 72 | <?php |
73 | - if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){ |
|
74 | - echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() ); |
|
73 | + if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) { |
|
74 | + echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!', 'google-analytics-for-wordpress' ), 'success', false, array() ); |
|
75 | 75 | } |
76 | 76 | ?> |
77 | 77 | <form method="post" enctype="multipart/form-data"> |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | <input type="file" name="import_file"/> |
80 | 80 | <input type="hidden" name="monsterinsights_action" value="monsterinsights_import_settings" /> |
81 | 81 | </p> |
82 | - <p class="description"><?php echo esc_html__( 'Paste the import field content from another MonsterInsights site in above.', 'google-analytics-for-wordpress' );?></p> |
|
82 | + <p class="description"><?php echo esc_html__( 'Paste the import field content from another MonsterInsights site in above.', 'google-analytics-for-wordpress' ); ?></p> |
|
83 | 83 | <p> |
84 | 84 | <?php wp_nonce_field( 'monsterinsights_import_settings', 'monsterinsights_import_settings' ); ?> |
85 | 85 | </p> |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | <tr> |
93 | 93 | <th scope="row"> |
94 | 94 | <label for="monsterinsights-export-settings"> |
95 | - <?php echo esc_html__( 'Export Settings:', 'google-analytics-for-wordpress' );?> |
|
95 | + <?php echo esc_html__( 'Export Settings:', 'google-analytics-for-wordpress' ); ?> |
|
96 | 96 | </label> |
97 | 97 | </th> |
98 | 98 | <td> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | function monsterinsights_process_export_settings() { |
128 | - if ( !isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) { |
|
128 | + if ( ! isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){ |
|
136 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | function monsterinsights_import_settings() { |
158 | 158 | |
159 | - if ( !isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) { |
|
159 | + if ( ! isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){ |
|
167 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - if ( !wp_verify_nonce( $_POST['monsterinsights_import_settings'], 'monsterinsights_import_settings' ) ) { |
|
171 | + if ( ! wp_verify_nonce( $_POST['monsterinsights_import_settings'], 'monsterinsights_import_settings' ) ) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | wp_die( __( 'Please upload a file to import', 'google-analytics-for-wordpress' ) ); |
186 | 186 | } |
187 | 187 | |
188 | - $file = file_get_contents( $import_file ); |
|
188 | + $file = file_get_contents( $import_file ); |
|
189 | 189 | if ( empty( $file ) ) { |
190 | 190 | wp_die( __( 'Please upload a real settings export file to import', 'google-analytics-for-wordpress' ) ); |
191 | 191 | } |
@@ -203,20 +203,20 @@ discard block |
||
203 | 203 | ); |
204 | 204 | |
205 | 205 | foreach ( $exclude as $e ) { |
206 | - if ( ! empty( $new_settings[ $e ] ) ) { |
|
207 | - unset( $new_settings[ $e ] ); |
|
206 | + if ( ! empty( $new_settings[$e] ) ) { |
|
207 | + unset( $new_settings[$e] ); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( ! is_super_admin() ) { |
212 | - if ( ! empty( $new_settings[ 'custom_code' ] ) ) { |
|
213 | - unset( $new_settings[ 'custom_code' ] ); |
|
212 | + if ( ! empty( $new_settings['custom_code'] ) ) { |
|
213 | + unset( $new_settings['custom_code'] ); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | foreach ( $exclude as $e ) { |
218 | - if ( ! empty( $settings[ $e ] ) ) { |
|
219 | - $new_settings = $settings[ $e ]; |
|
218 | + if ( ! empty( $settings[$e] ) ) { |
|
219 | + $new_settings = $settings[$e]; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | <?php |
52 | 52 | } |
53 | 53 | |
54 | -function monsterinsights_tools_url_builder_tab(){ |
|
54 | +function monsterinsights_tools_url_builder_tab() { |
|
55 | 55 | do_action( 'monsterinsights_tools_url_builder_tab' ); |
56 | 56 | } |
57 | 57 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | </th> |
71 | 71 | <td> |
72 | 72 | <?php |
73 | - if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){ |
|
73 | + if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) { |
|
74 | 74 | echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() ); |
75 | 75 | } |
76 | 76 | ?> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){ |
|
136 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){ |
|
167 | + if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 |
@@ -18,20 +18,20 @@ discard block |
||
18 | 18 | global $admin_page_hooks; |
19 | 19 | |
20 | 20 | if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) { |
21 | - return false; |
|
21 | + return false; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $settings_page = false; |
25 | 25 | if ( ! empty( $admin_page_hooks['monsterinsights_dashboard'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_dashboard'] . '_page_monsterinsights_addons' ) { |
26 | - $settings_page = true; |
|
26 | + $settings_page = true; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | if ( ! empty( $admin_page_hooks['monsterinsights_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] . '_page_monsterinsights_addons' ) { |
30 | - $settings_page = true; |
|
30 | + $settings_page = true; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if ( ! empty( $admin_page_hooks['monsterinsights_network'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_network'] . '_page_monsterinsights_addons-network' ) { |
34 | - $settings_page = true; |
|
34 | + $settings_page = true; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return $settings_page; |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function monsterinsights_maybe_refresh_addons() { |
48 | 48 | if ( ! monsterinsights_is_addons_page() ) { |
49 | - return; |
|
49 | + return; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | if ( ! monsterinsights_is_refreshing_addons() ) { |
54 | - return; |
|
54 | + return; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ( ! monsterinsights_refresh_addons_action() ) { |
58 | - return; |
|
58 | + return; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | monsterinsights_get_addons_data( monsterinsights_get_license_key() ); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | <div id="monsterinsights-addons" class="wrap"> |
94 | 94 | <div class="monsterinsights-clear"> |
95 | 95 | <?php |
96 | - /** |
|
97 | - * Developer Alert: |
|
98 | - * |
|
99 | - * Per the README, this is considered an internal hook and should |
|
100 | - * not be used by other developers. This hook's behavior may be modified |
|
101 | - * or the hook may be removed at any time, without warning. |
|
102 | - */ |
|
103 | - ?> |
|
96 | + /** |
|
97 | + * Developer Alert: |
|
98 | + * |
|
99 | + * Per the README, this is considered an internal hook and should |
|
100 | + * not be used by other developers. This hook's behavior may be modified |
|
101 | + * or the hook may be removed at any time, without warning. |
|
102 | + */ |
|
103 | + ?> |
|
104 | 104 | <?php do_action( 'monsterinsights_addons_section' ); ?> |
105 | 105 | </div> |
106 | 106 | </div> |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | |
118 | 118 | // If error(s) occured during license key verification, display them and exit now. |
119 | 119 | if ( false !== monsterinsights_get_license_key_errors() ) { |
120 | - ?> |
|
120 | + ?> |
|
121 | 121 | <div class="error below-h2"> |
122 | 122 | <p> |
123 | 123 | <?php esc_html_e( 'In order to get access to Addons, you need to resolve your license key errors.', 'google-analytics-for-wordpress' ); ?> |
124 | 124 | </p> |
125 | 125 | </div> |
126 | 126 | <?php |
127 | - return; |
|
127 | + return; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // Get Addons |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // If no Addon(s) were returned, our API call returned an error. |
134 | 134 | // Show an error message with a button to reload the page, which will trigger another API call. |
135 | 135 | if ( ! $addons ) { |
136 | - ?> |
|
136 | + ?> |
|
137 | 137 | <form id="monsterinsights-addons-refresh-addons-form" method="post"> |
138 | 138 | <p> |
139 | 139 | <?php esc_html_e( 'There was an issue retrieving the addons for this site. Please click on the button below the refresh the addons data.', 'google-analytics-for-wordpress' ); ?> |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | </p> |
144 | 144 | </form> |
145 | 145 | <?php |
146 | - return; |
|
146 | + return; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // If here, we have Addons to display, so let's output them now. |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | ?> |
154 | 154 | <div id="monsterinsights-addons"> |
155 | 155 | <?php |
156 | - // Output Addons the User is licensed to use. |
|
157 | - if ( count( $addons['licensed'] )> 0 ) { |
|
158 | - ?> |
|
156 | + // Output Addons the User is licensed to use. |
|
157 | + if ( count( $addons['licensed'] )> 0 ) { |
|
158 | + ?> |
|
159 | 159 | <div class="monsterinsights-addons-area licensed" class="monsterinsights-clear"> |
160 | 160 | <h3><?php esc_html_e( 'Available Addons:', 'google-analytics-for-wordpress' ); ?></h3> |
161 | 161 | |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | <!-- list container class required for list.js --> |
164 | 164 | <div class="list"> |
165 | 165 | <?php |
166 | - foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | - monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | - } |
|
169 | - ?> |
|
166 | + foreach ( (array) $addons['licensed'] as $i => $addon ) { |
|
167 | + monsterinsights_get_addon_card( $addon, $i, true, $installed_plugins ); |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </div> |
171 | 171 | </div> |
172 | 172 | </div> |
173 | 173 | <?php |
174 | - } // Close licensed addons |
|
174 | + } // Close licensed addons |
|
175 | 175 | |
176 | - // Output Addons the User isn't licensed to use. |
|
177 | - if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | - ?> |
|
176 | + // Output Addons the User isn't licensed to use. |
|
177 | + if ( count( $addons['unlicensed'] ) > 0 ) { |
|
178 | + ?> |
|
179 | 179 | <div class="monsterinsights-addons-area unlicensed" class="monsterinsights-clear"> |
180 | 180 | <h3><?php esc_html_e( 'Unlock More Addons', 'google-analytics-for-wordpress' ); ?></h3> |
181 | 181 | <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url. '">', '</a>' ); ?></p> |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | <!-- list container class required for list.js --> |
185 | 185 | <div class="list"> |
186 | 186 | <?php |
187 | - foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | - monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | - } |
|
190 | - ?> |
|
187 | + foreach ( (array) $addons['unlicensed'] as $i => $addon ) { |
|
188 | + monsterinsights_get_addon_card( $addon, $i, false, $installed_plugins ); |
|
189 | + } |
|
190 | + ?> |
|
191 | 191 | </div> |
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <?php |
195 | - } // Close unlicensed addons |
|
196 | - ?> |
|
195 | + } // Close unlicensed addons |
|
196 | + ?> |
|
197 | 197 | </div> |
198 | 198 | <?php |
199 | 199 | |
@@ -215,37 +215,37 @@ discard block |
||
215 | 215 | |
216 | 216 | // Get addons data from transient or perform API query if no transient. |
217 | 217 | if ( false === ( $addons = get_transient( '_monsterinsights_addons' ) ) ) { |
218 | - $addons = monsterinsights_get_addons_data( $key ); |
|
218 | + $addons = monsterinsights_get_addons_data( $key ); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // If no Addons exist, return false |
222 | 222 | if ( ! $addons ) { |
223 | - return false; |
|
223 | + return false; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // Iterate through Addons, to build two arrays: |
227 | 227 | // - Addons the user is licensed to use, |
228 | 228 | // - Addons the user isn't licensed to use. |
229 | 229 | $results = array( |
230 | - 'licensed' => array(), |
|
231 | - 'unlicensed'=> array(), |
|
230 | + 'licensed' => array(), |
|
231 | + 'unlicensed'=> array(), |
|
232 | 232 | ); |
233 | 233 | foreach ( (array) $addons as $i => $addon ) { |
234 | 234 | |
235 | - // Determine whether the user is licensed to use this Addon or not. |
|
236 | - if ( |
|
237 | - empty( $type ) || |
|
238 | - ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | - ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | - ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | - ) { |
|
242 | - // Unlicensed |
|
243 | - $results['unlicensed'][] = $addon; |
|
244 | - continue; |
|
245 | - } |
|
246 | - |
|
247 | - // Licensed |
|
248 | - $results['licensed'][] = $addon; |
|
235 | + // Determine whether the user is licensed to use this Addon or not. |
|
236 | + if ( |
|
237 | + empty( $type ) || |
|
238 | + ( in_array( 'Pro', $addon->categories ) && ( $type != 'pro' && $type != 'master' ) ) || |
|
239 | + ( in_array( 'Plus', $addon->categories ) && $type != 'plus' && $type != 'pro' && $type != 'master' ) || |
|
240 | + ( in_array( 'Basic', $addon->categories ) && ( $type != 'basic' && $type != 'plus' && $type != 'pro' && $type != 'master' ) ) |
|
241 | + ) { |
|
242 | + // Unlicensed |
|
243 | + $results['unlicensed'][] = $addon; |
|
244 | + continue; |
|
245 | + } |
|
246 | + |
|
247 | + // Licensed |
|
248 | + $results['licensed'][] = $addon; |
|
249 | 249 | |
250 | 250 | } |
251 | 251 | |
@@ -270,21 +270,21 @@ discard block |
||
270 | 270 | // Get Addons |
271 | 271 | // If the key is valid, we'll get personalised upgrade URLs for each Addon (if necessary) and plugin update information. |
272 | 272 | if ( $key ) { |
273 | - $addons = $base->license->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
273 | + $addons = $base->license->perform_remote_request( 'get-addons-data-v600', array( 'tgm-updater-key' => $key ) ); |
|
274 | 274 | } else { |
275 | - $addons = $base->license->perform_remote_request( 'get-all-addons-data', array() ); |
|
275 | + $addons = $base->license->perform_remote_request( 'get-all-addons-data', array() ); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | // If there was an API error, set transient for only 10 minutes. |
279 | 279 | if ( ! $addons ) { |
280 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
281 | - return false; |
|
280 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
281 | + return false; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | // If there was an error retrieving the addons, set the error. |
285 | 285 | if ( isset( $addons->error ) ) { |
286 | - set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
287 | - return false; |
|
286 | + set_transient( '_monsterinsights_addons', false, 10 * MINUTE_IN_SECONDS ); |
|
287 | + return false; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Otherwise, our request worked. Save the data and return it. |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | $keys = array_keys( get_plugins() ); |
328 | 328 | |
329 | 329 | foreach ( $keys as $key ) { |
330 | - if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
331 | - return $key; |
|
332 | - } |
|
330 | + if ( preg_match( '|^' . $slug . '|', $key ) ) { |
|
331 | + return $key; |
|
332 | + } |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | return $slug; |
@@ -352,24 +352,24 @@ discard block |
||
352 | 352 | $slug = str_replace( 'monsterinsights-', '', $addon->slug ); |
353 | 353 | $slug = 'monsterinsights-' . $addon->slug; |
354 | 354 | if ( $slug === 'monsterinsights-ecommerce' ) { |
355 | - $slug = 'ga-ecommerce'; |
|
355 | + $slug = 'ga-ecommerce'; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
359 | 359 | $categories = implode( ',', $addon->categories ); |
360 | 360 | if ( ! $installed_plugins ) { |
361 | - $installed_plugins = get_plugins(); |
|
361 | + $installed_plugins = get_plugins(); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // If the Addon doesn't supply an upgrade_url key, it's because the user hasn't provided a license |
365 | 365 | // get_upgrade_link() will return the Lite or Pro link as necessary for us. |
366 | 366 | if ( ! isset( $addon->upgrade_url ) ) { |
367 | - $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
367 | + $addon->upgrade_url = monsterinsights_get_upgrade_link(); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | // Link user to doc to install MI pro to install addons |
371 | 371 | if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
372 | - $addon->url = 'https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons'; |
|
372 | + $addon->url = 'https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons'; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | // Output the card |
@@ -377,19 +377,19 @@ discard block |
||
377 | 377 | <div class="monsterinsights-addon"> |
378 | 378 | <h3 class="monsterinsights-addon-title"><?php echo esc_html( $addon->title ); ?></h3> |
379 | 379 | <?php |
380 | - if ( ! empty( $addon->image ) ) { |
|
381 | - ?> |
|
380 | + if ( ! empty( $addon->image ) ) { |
|
381 | + ?> |
|
382 | 382 | <img class="monsterinsights-addon-thumb" src="<?php echo esc_attr( esc_url( $addon->image ) ); ?>" alt="<?php echo esc_attr( $addon->title ); ?>" /> |
383 | 383 | <?php |
384 | - } |
|
385 | - ?> |
|
384 | + } |
|
385 | + ?> |
|
386 | 386 | |
387 | 387 | <p class="monsterinsights-addon-excerpt"><?php echo esc_html( $addon->excerpt ); ?></p> |
388 | 388 | |
389 | 389 | <?php |
390 | - // If the Addon is unlicensed, show the upgrade button |
|
391 | - if ( ! $is_licensed ) { |
|
392 | - ?> |
|
390 | + // If the Addon is unlicensed, show the upgrade button |
|
391 | + if ( ! $is_licensed ) { |
|
392 | + ?> |
|
393 | 393 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
394 | 394 | <div class="interior"> |
395 | 395 | <div class="monsterinsights-addon-upgrade"> |
@@ -401,15 +401,15 @@ discard block |
||
401 | 401 | </div> |
402 | 402 | </div> |
403 | 403 | <?php |
404 | - } else { |
|
405 | - // Addon is licensed |
|
406 | - |
|
407 | - // If the plugin is not installed, display an install message and button. |
|
408 | - if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
409 | - if ( empty( $addon->url ) ) { |
|
410 | - $addon->url = ''; |
|
411 | - } |
|
412 | - ?> |
|
404 | + } else { |
|
405 | + // Addon is licensed |
|
406 | + |
|
407 | + // If the plugin is not installed, display an install message and button. |
|
408 | + if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
409 | + if ( empty( $addon->url ) ) { |
|
410 | + $addon->url = ''; |
|
411 | + } |
|
412 | + ?> |
|
413 | 413 | <div class="monsterinsights-addon-not-installed monsterinsights-addon-message"> |
414 | 414 | <div class="interior"> |
415 | 415 | <?php if ( monsterinsights_is_pro_version() ) { ?> |
@@ -432,22 +432,22 @@ discard block |
||
432 | 432 | </div> |
433 | 433 | </div> |
434 | 434 | <?php |
435 | - } else { |
|
436 | - // Plugin is installed. |
|
435 | + } else { |
|
436 | + // Plugin is installed. |
|
437 | 437 | |
438 | - $active = false; |
|
439 | - $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
440 | - $ss_active = is_plugin_active( $plugin_basename ); |
|
441 | - |
|
442 | - if ( is_multisite() && is_network_admin() ) { |
|
443 | - $active = is_plugin_active_for_network( $plugin_basename ); |
|
444 | - } else { |
|
445 | - $active = is_plugin_active( $plugin_basename ); |
|
446 | - } |
|
447 | - |
|
448 | - if ( $active ) { |
|
449 | - // Plugin is active. Display the active message and deactivate button. |
|
450 | - ?> |
|
438 | + $active = false; |
|
439 | + $ms_active = is_plugin_active_for_network( $plugin_basename ); |
|
440 | + $ss_active = is_plugin_active( $plugin_basename ); |
|
441 | + |
|
442 | + if ( is_multisite() && is_network_admin() ) { |
|
443 | + $active = is_plugin_active_for_network( $plugin_basename ); |
|
444 | + } else { |
|
445 | + $active = is_plugin_active( $plugin_basename ); |
|
446 | + } |
|
447 | + |
|
448 | + if ( $active ) { |
|
449 | + // Plugin is active. Display the active message and deactivate button. |
|
450 | + ?> |
|
451 | 451 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
452 | 452 | <div class="interior"> |
453 | 453 | <?php if ( $ms_active ) { ?> |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | </div> |
474 | 474 | </div> |
475 | 475 | <?php |
476 | - } else { |
|
477 | - // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
478 | - ?> |
|
476 | + } else { |
|
477 | + // Plugin is inactivate. Display the inactivate mesage and activate button. |
|
478 | + ?> |
|
479 | 479 | <div class="monsterinsights-addon-inactive monsterinsights-addon-message"> |
480 | 480 | <div class="interior"> |
481 | 481 | <?php if ( $ms_active ) { ?> |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | </div> |
499 | 499 | </div> |
500 | 500 | <?php |
501 | - } |
|
502 | - } |
|
503 | - } |
|
504 | - ?> |
|
501 | + } |
|
502 | + } |
|
503 | + } |
|
504 | + ?> |
|
505 | 505 | </div> |
506 | 506 | <?php |
507 | 507 | } |
508 | 508 | \ No newline at end of file |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * not be used by other developers. This hook's behavior may be modified |
77 | 77 | * or the hook may be removed at any time, without warning. |
78 | 78 | */ |
79 | - do_action('monsterinsights_head'); |
|
79 | + do_action( 'monsterinsights_head' ); |
|
80 | 80 | ?> |
81 | 81 | <?php echo monsterinsights_ublock_notice(); ?> |
82 | 82 | <div id="monsterinsights-addon-heading" class="monsterinsights-addons-subheading monsterinsights-clearfix-after"> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | <div id="monsterinsights-addons"> |
155 | 155 | <?php |
156 | 156 | // Output Addons the User is licensed to use. |
157 | - if ( count( $addons['licensed'] )> 0 ) { |
|
157 | + if ( count( $addons['licensed'] ) > 0 ) { |
|
158 | 158 | ?> |
159 | 159 | <div class="monsterinsights-addons-area licensed" class="monsterinsights-clear"> |
160 | 160 | <h3><?php esc_html_e( 'Available Addons:', 'google-analytics-for-wordpress' ); ?></h3> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ?> |
179 | 179 | <div class="monsterinsights-addons-area unlicensed" class="monsterinsights-clear"> |
180 | 180 | <h3><?php esc_html_e( 'Unlock More Addons', 'google-analytics-for-wordpress' ); ?></h3> |
181 | - <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url. '">', '</a>' ); ?></p> |
|
181 | + <p><?php echo sprintf( esc_html__( '%1$sWant even more addons?%2$sUpgrade your MonsterInsights account%3$s and unlock the following addons:', 'google-analytics-for-wordpress' ), '<strong>', '</strong> <a href="' . $upgrade_url . '">', '</a>' ); ?></p> |
|
182 | 182 | |
183 | 183 | <div id="monsterinsights-addons-unlicensed" class="monsterinsights-addons"> |
184 | 184 | <!-- list container class required for list.js --> |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $slug = 'ga-ecommerce'; |
356 | 356 | } |
357 | 357 | |
358 | - $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
|
358 | + $plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug ); |
|
359 | 359 | $categories = implode( ',', $addon->categories ); |
360 | 360 | if ( ! $installed_plugins ) { |
361 | 361 | $installed_plugins = get_plugins(); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | // Link user to doc to install MI pro to install addons |
371 | - if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
371 | + if ( ! monsterinsights_is_pro_version() && $is_licensed && ! isset( $installed_plugins[$plugin_basename] ) ) { |
|
372 | 372 | $addon->url = 'https://www.monsterinsights.com/docs/install-monsterinsights-pro-to-use-addons'; |
373 | 373 | } |
374 | 374 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | // Addon is licensed |
406 | 406 | |
407 | 407 | // If the plugin is not installed, display an install message and button. |
408 | - if ( ! isset( $installed_plugins[ $plugin_basename ] ) ) { |
|
408 | + if ( ! isset( $installed_plugins[$plugin_basename] ) ) { |
|
409 | 409 | if ( empty( $addon->url ) ) { |
410 | 410 | $addon->url = ''; |
411 | 411 | } |
@@ -451,17 +451,17 @@ discard block |
||
451 | 451 | <div class="monsterinsights-addon-active monsterinsights-addon-message"> |
452 | 452 | <div class="interior"> |
453 | 453 | <?php if ( $ms_active ) { ?> |
454 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Active%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
454 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Active%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
455 | 455 | <?php } else { ?> |
456 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sActive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
456 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sActive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
457 | 457 | <?php } ?> |
458 | - <?php if ( ( is_multisite() && is_network_admin() && $ms_active ) || ! is_multisite() || ( is_multisite() && !is_network_admin() && !$ms_active && $ss_active ) ) { ?> |
|
458 | + <?php if ( ( is_multisite() && is_network_admin() && $ms_active ) || ! is_multisite() || ( is_multisite() && ! is_network_admin() && ! $ms_active && $ss_active ) ) { ?> |
|
459 | 459 | <div class="monsterinsights-addon-action"> |
460 | 460 | <a class="button button-primary monsterinsights-addon-action-button monsterinsights-deactivate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>"> |
461 | 461 | <i class="monsterinsights-toggle-on"></i> |
462 | 462 | <?php if ( is_multisite() && is_network_admin() && $ms_active ) { ?> |
463 | 463 | <?php esc_html_e( 'Network deactivate', 'google-analytics-for-wordpress' ); ?> |
464 | - <?php } else if ( is_multisite() && !is_network_admin() && !$ms_active && $ss_active ) { ?> |
|
464 | + <?php } else if ( is_multisite() && ! is_network_admin() && ! $ms_active && $ss_active ) { ?> |
|
465 | 465 | <?php esc_html_e( 'Deactivate', 'google-analytics-for-wordpress' ); ?> |
466 | 466 | <?php } else { ?> |
467 | 467 | <?php esc_html_e( 'Deactivate', 'google-analytics-for-wordpress' ); ?> |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | <div class="monsterinsights-addon-inactive monsterinsights-addon-message"> |
480 | 480 | <div class="interior"> |
481 | 481 | <?php if ( $ms_active ) { ?> |
482 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Inactive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
482 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sNetwork Inactive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
483 | 483 | <?php } else { ?> |
484 | - <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sInactive%2$s', 'google-analytics-for-wordpress'), '<span>', '</span>' ); ?></span> |
|
484 | + <span class="addon-status"><?php echo sprintf( esc_html__( 'Status: %1$sInactive%2$s', 'google-analytics-for-wordpress' ), '<span>', '</span>' ); ?></span> |
|
485 | 485 | <?php } ?> |
486 | 486 | <div class="monsterinsights-addon-action"> |
487 | 487 | <a class="button button-primary monsterinsights-addon-action-button monsterinsights-activate-addon" href="#" rel="<?php echo esc_attr( $plugin_basename ); ?>"> |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | global $admin_page_hooks; |
20 | 20 | |
21 | 21 | if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) { |
22 | - return false; |
|
22 | + return false; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $settings_page = false; |
26 | 26 | if ( ! empty( $admin_page_hooks['monsterinsights_dashboard'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_dashboard'] . '_page_monsterinsights_settings' ) { |
27 | - $settings_page = true; |
|
27 | + $settings_page = true; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( $current_screen->id === 'toplevel_page_monsterinsights_settings' ) { |
31 | - $settings_page = true; |
|
31 | + $settings_page = true; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $settings_page; |
@@ -110,31 +110,31 @@ discard block |
||
110 | 110 | function monsterinsights_save_general_settings_page() { |
111 | 111 | |
112 | 112 | if ( ! monsterinsights_is_settings_page() ) { |
113 | - return; |
|
113 | + return; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // Check if user pressed the 'Update' button and nonce is valid |
117 | 117 | if ( ! isset( $_POST['monsterinsights-settings-submit'] ) ) { |
118 | - return; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if ( ! wp_verify_nonce( $_POST['monsterinsights-settings-nonce'], 'monsterinsights-settings-nonce' ) ) { |
122 | - return; |
|
122 | + return; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
126 | - return; |
|
126 | + return; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ( ! empty( $_POST['monsterinsights_settings_tab'] ) && $_POST['monsterinsights_settings_tab'] === 'general' ) { |
130 | - /** |
|
131 | - * Developer Alert: |
|
132 | - * |
|
133 | - * Per the README, this is considered an internal hook and should |
|
134 | - * not be used by other developers. This hook's behavior may be modified |
|
135 | - * or the hook may be removed at any time, without warning. |
|
136 | - */ |
|
137 | - do_action( 'monsterinsights_settings_save_general' ); |
|
130 | + /** |
|
131 | + * Developer Alert: |
|
132 | + * |
|
133 | + * Per the README, this is considered an internal hook and should |
|
134 | + * not be used by other developers. This hook's behavior may be modified |
|
135 | + * or the hook may be removed at any time, without warning. |
|
136 | + */ |
|
137 | + do_action( 'monsterinsights_settings_save_general' ); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | add_action( 'current_screen', 'monsterinsights_save_general_settings_page' ); |
@@ -205,33 +205,33 @@ discard block |
||
205 | 205 | function monsterinsights_switch_to_analyticsjs() { |
206 | 206 | $nonce = ''; |
207 | 207 | if ( ! empty( $_REQUEST['monsterinsights-switch-to-analyticsjs-nonce'] ) ) { |
208 | - $nonce = 'monsterinsights-switch-to-analyticsjs-nonce'; |
|
208 | + $nonce = 'monsterinsights-switch-to-analyticsjs-nonce'; |
|
209 | 209 | } else if ( ! empty( $_REQUEST['_wpnonce'] ) ) { |
210 | - $nonce = '_wpnonce'; |
|
210 | + $nonce = '_wpnonce'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if ( empty( $nonce ) ) { |
214 | - return; |
|
214 | + return; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if ( ! wp_verify_nonce( $_REQUEST[$nonce], 'monsterinsights-switch-to-analyticsjs-nonce' ) ) { |
218 | - return; |
|
218 | + return; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ( empty( $_REQUEST['monsterinsights-action'] ) || $_REQUEST['monsterinsights-action'] !== 'switch_to_analyticsjs' ) { |
222 | - return; |
|
222 | + return; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
226 | - wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
|
226 | + wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $return = ''; |
230 | 230 | if ( ! empty( $_REQUEST['return'] ) && monsterinsights_is_settings_tab( $_REQUEST['return'] ) ) { |
231 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
232 | - $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
|
231 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
232 | + $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
|
233 | 233 | } else { |
234 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched'); |
|
234 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched'); |
|
235 | 235 | } |
236 | 236 | monsterinsights_update_option( 'tracking_mode', 'analytics' ); |
237 | 237 | wp_safe_redirect( $return );exit; |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | |
245 | 245 | function monsterinsights_switch_to_analyticsjs_show_notice() { |
246 | 246 | if ( empty( $_REQUEST['monsterinsights-message'] ) || $_REQUEST['monsterinsights-message'] !== 'tracking_mode_switched' ) { |
247 | - return; |
|
247 | + return; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | if ( ! empty( $_REQUEST['return'] ) && monsterinsights_is_settings_tab( $_REQUEST['return'] ) ) { |
251 | - add_action( 'monsterinsights_tracking_' . $_REQUEST['return'] . '_tab_notice', 'monsterinsights_switched_to_analyticsjs' ); |
|
251 | + add_action( 'monsterinsights_tracking_' . $_REQUEST['return'] . '_tab_notice', 'monsterinsights_switched_to_analyticsjs' ); |
|
252 | 252 | } else { |
253 | - add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_switched_to_analyticsjs' ); |
|
253 | + add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_switched_to_analyticsjs' ); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | add_action( 'admin_init', 'monsterinsights_switch_to_analyticsjs_show_notice', 11 ); |
@@ -260,33 +260,33 @@ discard block |
||
260 | 260 | function monsterinsights_switch_to_jsevents() { |
261 | 261 | $nonce = ''; |
262 | 262 | if ( ! empty( $_REQUEST['monsterinsights-switch-to-jsevents-nonce'] ) ) { |
263 | - $nonce = 'monsterinsights-switch-to-jsevents-nonce'; |
|
263 | + $nonce = 'monsterinsights-switch-to-jsevents-nonce'; |
|
264 | 264 | } else if ( ! empty( $_REQUEST['_wpnonce'] ) ) { |
265 | - $nonce = '_wpnonce'; |
|
265 | + $nonce = '_wpnonce'; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | if ( empty( $nonce ) ) { |
269 | - return; |
|
269 | + return; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if ( ! wp_verify_nonce( $_REQUEST[$nonce], 'monsterinsights-switch-to-jsevents-nonce' ) ) { |
273 | - return; |
|
273 | + return; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | if ( empty( $_REQUEST['monsterinsights-action'] ) || $_REQUEST['monsterinsights-action'] !== 'switch_to_jsevents' ) { |
277 | - return; |
|
277 | + return; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
281 | - wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
|
281 | + wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | $return = ''; |
285 | 285 | if ( ! empty( $_REQUEST['return'] ) && monsterinsights_is_settings_tab( $_REQUEST['return'] ) ) { |
286 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
287 | - $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
|
286 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
287 | + $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
|
288 | 288 | } else { |
289 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched'); |
|
289 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched'); |
|
290 | 290 | } |
291 | 291 | monsterinsights_update_option( 'events_mode', 'js' ); |
292 | 292 | wp_safe_redirect( $return );exit; |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | |
300 | 300 | function monsterinsights_switch_to_jsevents_show_notice() { |
301 | 301 | if ( empty( $_REQUEST['monsterinsights-message'] ) || $_REQUEST['monsterinsights-message'] !== 'jsvents_mode_switched' ) { |
302 | - return; |
|
302 | + return; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $allowed_tabs = array( 'engagement', 'performance', 'ecommerce', 'demographics', 'dimensions', 'goptimize' ); |
306 | 306 | if ( ! empty( $_REQUEST['return'] ) && in_array( $_REQUEST['return'], $allowed_tabs ) ) { |
307 | - add_action( 'monsterinsights_tracking_' . $_REQUEST['return'] . '_tab_notice', 'monsterinsights_switched_to_jsevents' ); |
|
307 | + add_action( 'monsterinsights_tracking_' . $_REQUEST['return'] . '_tab_notice', 'monsterinsights_switched_to_jsevents' ); |
|
308 | 308 | } else { |
309 | - add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_switched_to_jsevents' ); |
|
309 | + add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_switched_to_jsevents' ); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | add_action( 'admin_init', 'monsterinsights_switch_to_jsevents_show_notice', 11 ); |
313 | 313 | \ No newline at end of file |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | ob_start(); |
183 | 183 | ?> |
184 | 184 | <tr id="monsterinsights-input-<?php echo esc_attr( $option_class ); ?>"> |
185 | - <?php if ( !empty ( $title ) ) { ?> |
|
185 | + <?php if ( ! empty ( $title ) ) { ?> |
|
186 | 186 | <th scope="row"> |
187 | 187 | <label for="monsterinsights-<?php echo esc_attr( $option_class ); ?>"><?php echo $title; ?></label> |
188 | 188 | </th> |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
227 | 227 | } |
228 | 228 | |
229 | - $return = ''; |
|
229 | + $return = ''; |
|
230 | 230 | if ( ! empty( $_REQUEST['return'] ) && monsterinsights_is_settings_tab( $_REQUEST['return'] ) ) { |
231 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
231 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-' ) . $_REQUEST['return']; |
|
232 | 232 | $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
233 | 233 | } else { |
234 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched'); |
|
234 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=tracking_mode_switched' ); |
|
235 | 235 | } |
236 | 236 | monsterinsights_update_option( 'tracking_mode', 'analytics' ); |
237 | - wp_safe_redirect( $return );exit; |
|
237 | + wp_safe_redirect( $return ); exit; |
|
238 | 238 | } |
239 | -add_action( 'admin_init', 'monsterinsights_switch_to_analyticsjs',9 ); |
|
239 | +add_action( 'admin_init', 'monsterinsights_switch_to_analyticsjs', 9 ); |
|
240 | 240 | |
241 | 241 | function monsterinsights_switched_to_analyticsjs() { |
242 | 242 | echo monsterinsights_get_message( 'success', esc_html__( 'Successfully migrated to Universal Analytics (analytics.js)!', 'google-analytics-for-wordpress' ) ); |
@@ -281,17 +281,17 @@ discard block |
||
281 | 281 | wp_die( esc_html__( 'You do not have permission to manage MonsterInsights settings', 'google-analytics-for-wordpress' ), esc_html__( 'Error', 'google-analytics-for-wordpress' ), array( 'response' => 403 ) ); |
282 | 282 | } |
283 | 283 | |
284 | - $return = ''; |
|
284 | + $return = ''; |
|
285 | 285 | if ( ! empty( $_REQUEST['return'] ) && monsterinsights_is_settings_tab( $_REQUEST['return'] ) ) { |
286 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-') . $_REQUEST['return']; |
|
286 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-' ) . $_REQUEST['return']; |
|
287 | 287 | $return = add_query_arg( 'return', $_REQUEST['return'], $return ); |
288 | 288 | } else { |
289 | - $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched'); |
|
289 | + $return = admin_url( 'admin.php?page=monsterinsights_settings&monsterinsights-message=jsvents_mode_switched' ); |
|
290 | 290 | } |
291 | 291 | monsterinsights_update_option( 'events_mode', 'js' ); |
292 | - wp_safe_redirect( $return );exit; |
|
292 | + wp_safe_redirect( $return ); exit; |
|
293 | 293 | } |
294 | -add_action( 'admin_init', 'monsterinsights_switch_to_jsevents',9 ); |
|
294 | +add_action( 'admin_init', 'monsterinsights_switch_to_jsevents', 9 ); |
|
295 | 295 | |
296 | 296 | function monsterinsights_switched_to_jsevents() { |
297 | 297 | echo monsterinsights_get_message( 'success', esc_html__( 'Successfully migrated to JS events tracking!', 'google-analytics-for-wordpress' ) ); |
@@ -334,24 +334,24 @@ |
||
334 | 334 | |
335 | 335 | /** |
336 | 336 | * Future: |
337 | - * // Accounts |
|
338 | - * // Properties |
|
339 | - * // Views |
|
340 | - * $items = array( |
|
341 | - * {account_id} => array( |
|
342 | - * {property_id} => array( |
|
343 | - * {view_id} => array( |
|
344 | - * 'account_id' => '', |
|
345 | - * 'property_id' => '', |
|
346 | - * 'view_id' => '', |
|
347 | - * 'url' => '', |
|
348 | - * 'view_name' => '', |
|
349 | - * 'ua_code' => '', |
|
350 | - * ), |
|
351 | - * ), |
|
352 | - * ), |
|
353 | - * ), |
|
354 | - **/ |
|
337 | + * // Accounts |
|
338 | + * // Properties |
|
339 | + * // Views |
|
340 | + * $items = array( |
|
341 | + * {account_id} => array( |
|
342 | + * {property_id} => array( |
|
343 | + * {view_id} => array( |
|
344 | + * 'account_id' => '', |
|
345 | + * 'property_id' => '', |
|
346 | + * 'view_id' => '', |
|
347 | + * 'url' => '', |
|
348 | + * 'view_name' => '', |
|
349 | + * 'ua_code' => '', |
|
350 | + * ), |
|
351 | + * ), |
|
352 | + * ), |
|
353 | + * ), |
|
354 | + **/ |
|
355 | 355 | /* |
356 | 356 | CurrenT: |
357 | 357 | $accounts[ $item['accountId'] ] = array( |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | $this->name = $this->get_name(); |
97 | 97 | $this->oauth_version = $this->get_oauth_version(); |
98 | 98 | $this->status = $this->get_status(); |
99 | - $this->base = MonsterInsights(); |
|
99 | + $this->base = MonsterInsights(); |
|
100 | 100 | |
101 | 101 | |
102 | 102 | // Show any info/error notices |
103 | 103 | $this->get_notices(); |
104 | 104 | |
105 | 105 | // Authentication Actions |
106 | - add_action( 'wp_ajax_monsterinsights_google_view', array( $this, 'google_auth_view' ) ); |
|
107 | - add_action( 'wp_ajax_monsterinsights_google_cancel', array( $this, 'google_cancel' ) ); |
|
106 | + add_action( 'wp_ajax_monsterinsights_google_view', array( $this, 'google_auth_view' ) ); |
|
107 | + add_action( 'wp_ajax_monsterinsights_google_cancel', array( $this, 'google_cancel' ) ); |
|
108 | 108 | |
109 | 109 | add_action( 'admin_init', array( $this, 'deactivate_google' ) ); // Deactivate |
110 | 110 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $dash_dis = monsterinsights_get_option( 'dashboards_disabled', false ); |
153 | 153 | |
154 | 154 | // See if issue connecting or expired |
155 | - if ( ! $dash_dis && $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) { |
|
155 | + if ( ! $dash_dis && $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) { |
|
156 | 156 | $status = 'blocked'; |
157 | 157 | } |
158 | 158 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | private function get_notices() { |
184 | 184 | // Notice for no manual or profile GA |
185 | 185 | if ( $this->status === 'empty' ) { |
186 | - add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_empty_notice' ),6 ); |
|
186 | + add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_empty_notice' ), 6 ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $current_page = filter_input( INPUT_GET, 'page' ); |
@@ -196,17 +196,17 @@ discard block |
||
196 | 196 | |
197 | 197 | // Notice for GA Access token expired (needs re-authenticate) |
198 | 198 | if ( $this->status === 'expired' ) { |
199 | - add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_expired_notice' ),6 ); |
|
199 | + add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_expired_notice' ), 6 ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Notice for Needs Permissions |
203 | 203 | if ( $this->status === 'needs-permissions' ) { |
204 | - add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_needs_permissions_notice' ),6 ); |
|
204 | + add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_needs_permissions_notice' ), 6 ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Notice for trouble connecting to Google |
208 | 208 | if ( $this->status === 'blocked' ) { |
209 | - add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_blocked_notice' ),6 ); |
|
209 | + add_action( 'admin_notices', array( $this, 'monsterinsights_show_admin_config_blocked_notice' ), 6 ); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | public function find_selected_profile( $profile_id ) { |
258 | 258 | $profiles = $this->get_profiles(); |
259 | - $found = array(); |
|
259 | + $found = array(); |
|
260 | 260 | foreach ( $profiles as $account ) { |
261 | 261 | foreach ( $account['items'] as $profile ) { |
262 | 262 | foreach ( $profile['items'] as $subprofile ) { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $paginate = false; |
299 | 299 | $continue = true; |
300 | 300 | while ( $continue ) { |
301 | - $body = array( |
|
301 | + $body = array( |
|
302 | 302 | 'max-results' => 1000, |
303 | 303 | 'start-index' => $paginate ? $start_index + 1000 : $start_index, |
304 | 304 | ); |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | */ |
376 | 376 | |
377 | 377 | |
378 | - if ( empty( $accounts[ $item['accountId'] ] ) ) { |
|
379 | - $accounts[ $item['accountId'] ] = array( |
|
378 | + if ( empty( $accounts[$item['accountId']] ) ) { |
|
379 | + $accounts[$item['accountId']] = array( |
|
380 | 380 | 'id' => $item['accountId'], |
381 | 381 | 'ua_code' => $item['webPropertyId'], |
382 | 382 | 'parent_name' => $item['websiteUrl'], |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | ); |
385 | 385 | } |
386 | 386 | |
387 | - if ( empty( $accounts[ $item['accountId'] ]['items'][ $item['internalWebPropertyId'] ] ) ) { |
|
388 | - $accounts[ $item['accountId'] ]['items'][ $item['internalWebPropertyId'] ]= array( |
|
387 | + if ( empty( $accounts[$item['accountId']]['items'][$item['internalWebPropertyId']] ) ) { |
|
388 | + $accounts[$item['accountId']]['items'][$item['internalWebPropertyId']] = array( |
|
389 | 389 | 'id' => $item['webPropertyId'], |
390 | 390 | 'name' => $item['websiteUrl'], |
391 | 391 | 'items' => array(), |
392 | 392 | ); |
393 | 393 | } |
394 | 394 | |
395 | - if ( empty( $accounts[ $item['accountId'] ]['items'][ $item['internalWebPropertyId'] ]['items'][ $item['id'] ] ) ) { |
|
396 | - $accounts[ $item['accountId'] ]['items'][ $item['internalWebPropertyId'] ]['items'][ $item['id'] ] = array( |
|
395 | + if ( empty( $accounts[$item['accountId']]['items'][$item['internalWebPropertyId']]['items'][$item['id']] ) ) { |
|
396 | + $accounts[$item['accountId']]['items'][$item['internalWebPropertyId']]['items'][$item['id']] = array( |
|
397 | 397 | 'name' => $item['name'] . ' (' . $item['webPropertyId'] . ')', |
398 | 398 | 'ua_code' => $item['webPropertyId'], |
399 | 399 | 'id' => $item['id'], |
@@ -533,10 +533,10 @@ discard block |
||
533 | 533 | |
534 | 534 | public function google_auth_view() { |
535 | 535 | $view = isset( $_POST['view'] ) && in_array( $_POST['view'], array( 'prestart', 'start', 'enterkey', 'selectprofile', 'done' ) ) ? $_POST['view'] : ''; |
536 | - $reauth = isset( $_POST['reauth'] ) && $_POST['reauth'] && $_POST['reauth'] !== 'false' ? true : false; |
|
536 | + $reauth = isset( $_POST['reauth'] ) && $_POST['reauth'] && $_POST['reauth'] !== 'false' ? true : false; |
|
537 | 537 | |
538 | 538 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
539 | - echo esc_html__( 'Permission Denied', 'google-analytics-for-wordpress'); |
|
539 | + echo esc_html__( 'Permission Denied', 'google-analytics-for-wordpress' ); |
|
540 | 540 | wp_die(); |
541 | 541 | } |
542 | 542 | |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | |
641 | 641 | public function google_cancel() { |
642 | 642 | $view = isset( $_POST['view'] ) && in_array( $_POST['view'], array( 'prestart', 'start', 'enterkey', 'selectprofile', 'done' ) ) ? $_POST['view'] : ''; |
643 | - $reauth = isset( $_POST['reauth'] ) && $_POST['reauth'] && $_POST['reauth'] !== 'false' ? true : false; |
|
643 | + $reauth = isset( $_POST['reauth'] ) && $_POST['reauth'] && $_POST['reauth'] !== 'false' ? true : false; |
|
644 | 644 | |
645 | 645 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
646 | - echo esc_html__( 'Permission Denied', 'google-analytics-for-wordpress'); |
|
646 | + echo esc_html__( 'Permission Denied', 'google-analytics-for-wordpress' ); |
|
647 | 647 | wp_die(); |
648 | 648 | } |
649 | 649 | |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | $optgroups = array(); |
675 | 675 | foreach ( $profiles as $key => $value ) { |
676 | 676 | foreach ( $value['items'] as $subitem ) { |
677 | - if ( empty( $optgroups[ $subitem['name'] ]['items'] ) ) { |
|
678 | - $optgroups[ $subitem['name'] ]['items'] = $subitem['items']; |
|
677 | + if ( empty( $optgroups[$subitem['name']]['items'] ) ) { |
|
678 | + $optgroups[$subitem['name']]['items'] = $subitem['items']; |
|
679 | 679 | } else { |
680 | - $optgroups[ $subitem['name'] ]['items'] = array_merge( $optgroups[ $subitem['name'] ]['items'], $subitem['items'] ); |
|
680 | + $optgroups[$subitem['name']]['items'] = array_merge( $optgroups[$subitem['name']]['items'], $subitem['items'] ); |
|
681 | 681 | } |
682 | 682 | } |
683 | 683 | } |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | 'body' => '' |
751 | 751 | ); |
752 | 752 | $response = wp_remote_get( 'https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest', $params ); |
753 | - if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
753 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
754 | 754 | return false; |
755 | 755 | } else { |
756 | 756 | return true; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | ); |
769 | 769 | $response = wp_remote_get( 'https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest', $params ); |
770 | 770 | |
771 | - if( !is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
771 | + if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
772 | 772 | return false; |
773 | 773 | } else { |
774 | 774 | return true; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | return ! empty( $this->client ) ? $this->client : monsterinsights_create_client(); |
114 | 114 | } |
115 | 115 | |
116 | - private function set_test_client() { |
|
116 | + private function set_test_client() { |
|
117 | 117 | $this->client = monsterinsights_create_test_client(); |
118 | 118 | } |
119 | 119 | |
120 | - private function set_client() { |
|
120 | + private function set_client() { |
|
121 | 121 | $this->client = monsterinsights_create_client(); |
122 | 122 | } |
123 | 123 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $dash_dis = monsterinsights_get_option( 'dashboards_disabled', false ); |
153 | 153 | |
154 | 154 | // See if issue connecting or expired |
155 | - if ( ! $dash_dis && $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) { |
|
155 | + if ( ! $dash_dis && $failed && ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 48 ) ) { |
|
156 | 156 | $status = 'blocked'; |
157 | 157 | } |
158 | 158 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // See if needs permissions |
168 | - if ( version_compare( $this->oauth_version, '1.0', '<' ) ) { |
|
168 | + if ( version_compare( $this->oauth_version, '1.0', '<' ) ) { |
|
169 | 169 | $status = 'needs-permissions'; |
170 | 170 | } |
171 | 171 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return null |
220 | 220 | */ |
221 | - private function reinitialize() { |
|
221 | + private function reinitialize() { |
|
222 | 222 | // Get object |
223 | 223 | $this->client = $this->get_client(); |
224 | 224 | $this->profile = $this->get_profile(); |
@@ -245,7 +245,8 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return array |
247 | 247 | */ |
248 | - public function get_profiles() { // @todo: this needs exception handling for a 401 login required |
|
248 | + public function get_profiles() { |
|
249 | +// @todo: this needs exception handling for a 401 login required |
|
249 | 250 | $accounts = $this->get_profiles_request(); |
250 | 251 | if ( is_array( $accounts ) ) { |
251 | 252 | return $accounts; |
@@ -617,7 +618,7 @@ discard block |
||
617 | 618 | $select = $this->ga_select( $profiles ); |
618 | 619 | $nextview = monsterinsights_google_auth_selectprofile_view( $reauth, $select, esc_html__( 'Invalid profile selected.', 'google-analytics-for-wordpress' ) ); |
619 | 620 | } |
620 | - } else { |
|
621 | + } else { |
|
621 | 622 | // No profile selected |
622 | 623 | $profiles = get_option( 'monsterinsights_get_profiles', array() ); |
623 | 624 | $select = $this->ga_select( $profiles ); |
@@ -667,7 +668,7 @@ discard block |
||
667 | 668 | * @return null|string |
668 | 669 | */ |
669 | 670 | private function ga_select( $profiles = array() ) { |
670 | - if ( empty( $profiles ) || ! is_array( $profiles ) ) { |
|
671 | + if ( empty( $profiles ) || ! is_array( $profiles ) ) { |
|
671 | 672 | $profiles = $this->get_profiles(); |
672 | 673 | } |
673 | 674 | |
@@ -693,8 +694,7 @@ discard block |
||
693 | 694 | foreach ( $values as $optgroup => $value ) { |
694 | 695 | if ( ! empty( $value['items'] ) ) { |
695 | 696 | $select .= $this->create_optgroup( $optgroup, $value ); |
696 | - } |
|
697 | - else { |
|
697 | + } else { |
|
698 | 698 | $select .= '<option value="' . esc_attr( $value['id'] ) . '">' . esc_attr( stripslashes( $value['name'] ) ) . '</option>'; |
699 | 699 | } |
700 | 700 | } |
@@ -720,8 +720,7 @@ discard block |
||
720 | 720 | if ( ! empty( $option['items'] ) ) { |
721 | 721 | |
722 | 722 | $optgroup .= $this->create_optgroup( esc_attr( $option['name'] ), $option ); |
723 | - } |
|
724 | - else { |
|
723 | + } else { |
|
725 | 724 | $optgroup .= '<option value="' . esc_attr( $option['id'] ) . '">' . esc_attr( stripslashes( $option['name'] ) ) . '</option>'; |
726 | 725 | } |
727 | 726 | } |
@@ -737,7 +736,8 @@ discard block |
||
737 | 736 | * @return bool |
738 | 737 | */ |
739 | 738 | private function is_wp_blocking_google() { |
740 | - if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { // @todo: put this in sysinfo |
|
739 | + if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) { |
|
740 | +// @todo: put this in sysinfo |
|
741 | 741 | if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) { |
742 | 742 | $on_blacklist = $this->is_google_on_blacklist(); |
743 | 743 | if ( $on_blacklist ) { |
@@ -781,7 +781,8 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return bool |
783 | 783 | */ |
784 | - private function is_google_on_blacklist() { // @todo: put this in sysinfo |
|
784 | + private function is_google_on_blacklist() { |
|
785 | +// @todo: put this in sysinfo |
|
785 | 786 | $wp_http = new WP_Http(); |
786 | 787 | if ( $wp_http->block_request( 'https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest' ) ) { |
787 | 788 | return true; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function monsterinsights_track_user() { |
33 | 33 | $user = wp_get_current_user(); |
34 | 34 | $track_user = true; |
35 | - $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
35 | + $roles = monsterinsights_get_option( 'ignore_users', array() ); |
|
36 | 36 | |
37 | 37 | if ( ! empty( $roles ) && is_array( $roles ) ) { |
38 | 38 | foreach ( $roles as $role ) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | |
100 | 100 | $ga_cookie = $_COOKIE['_ga']; |
101 | - $cookie_parts = explode('.', $ga_cookie ); |
|
101 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
102 | 102 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
103 | 103 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
104 | 104 | if ( is_string( $uuid ) ) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | $ga_cookie = $_COOKIE['_ga']; |
160 | - $cookie_parts = explode('.', $ga_cookie ); |
|
160 | + $cookie_parts = explode( '.', $ga_cookie ); |
|
161 | 161 | if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) { |
162 | 162 | $uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3]; |
163 | 163 | if ( is_string( $uuid ) ) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | function monsterinsights_generate_ga_client_id() { |
175 | - return rand(100000000,999999999) . '.' . time(); |
|
175 | + return rand( 100000000, 999999999 ) . '.' . time(); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $stop = time(); |
193 | 193 | } |
194 | 194 | |
195 | - $diff = (int) abs( $stop - $start ); |
|
195 | + $diff = (int) abs( $stop - $start ); |
|
196 | 196 | $hours = round( $diff / HOUR_IN_SECONDS ); |
197 | 197 | return $hours; |
198 | 198 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
251 | 251 | |
252 | 252 | foreach ( $editable_roles as $id => $name ) { |
253 | - $roles[ $id ] = translate_user_role( $name['name'] ); |
|
253 | + $roles[$id] = translate_user_role( $name['name'] ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $roles; |
@@ -269,16 +269,16 @@ discard block |
||
269 | 269 | |
270 | 270 | // Set cookie to expire in 2 years |
271 | 271 | function monsterinsights_get_cookie_expiration_date( $time ) { |
272 | - return date('D, j F Y H:i:s', time() + $time ); |
|
272 | + return date( 'D, j F Y H:i:s', time() + $time ); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | function monsterinsights_string_ends_with( $string, $ending ) { |
276 | - $strlen = strlen($string); |
|
277 | - $endinglen = strlen($ending); |
|
276 | + $strlen = strlen( $string ); |
|
277 | + $endinglen = strlen( $ending ); |
|
278 | 278 | if ( $endinglen > $strlen ) { |
279 | 279 | return false; |
280 | 280 | } |
281 | - return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0; |
|
281 | + return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | function monsterinsights_string_starts_with( $string, $start ) { |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | } |
847 | 847 | } |
848 | 848 | |
849 | -if ( ! function_exists ( 'remove_class_filter' ) ) { |
|
849 | +if ( ! function_exists( 'remove_class_filter' ) ) { |
|
850 | 850 | /** |
851 | 851 | * Remove Class Filter Without Access to Class Object |
852 | 852 | * |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
868 | 868 | global $wp_filter; |
869 | 869 | // Check that filter actually exists first |
870 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
870 | + if ( ! isset( $wp_filter[$tag] ) ) return FALSE; |
|
871 | 871 | /** |
872 | 872 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
873 | 873 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -876,33 +876,33 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/ |
878 | 878 | */ |
879 | - if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) { |
|
880 | - $callbacks = &$wp_filter[ $tag ]->callbacks; |
|
879 | + if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) { |
|
880 | + $callbacks = &$wp_filter[$tag]->callbacks; |
|
881 | 881 | } else { |
882 | - $callbacks = &$wp_filter[ $tag ]; |
|
882 | + $callbacks = &$wp_filter[$tag]; |
|
883 | 883 | } |
884 | 884 | // Exit if there aren't any callbacks for specified priority |
885 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
885 | + if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE; |
|
886 | 886 | // Loop through each filter for the specified priority, looking for our class & method |
887 | - foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
|
887 | + foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) { |
|
888 | 888 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
889 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
889 | + if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue; |
|
890 | 890 | // If first value in array is not an object, it can't be a class |
891 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
891 | + if ( ! is_object( $filter['function'][0] ) ) continue; |
|
892 | 892 | // Method doesn't match the one we're looking for, goto next |
893 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
893 | + if ( $filter['function'][1] !== $method_name ) continue; |
|
894 | 894 | // Method matched, now let's check the Class |
895 | - if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
|
895 | + if ( get_class( $filter['function'][0] ) === $class_name ) { |
|
896 | 896 | // Now let's remove it from the array |
897 | - unset( $callbacks[ $priority ][ $filter_id ] ); |
|
897 | + unset( $callbacks[$priority][$filter_id] ); |
|
898 | 898 | // and if it was the only filter in that priority, unset that priority |
899 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
899 | + if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] ); |
|
900 | 900 | // and if the only filter for that tag, set the tag to an empty array |
901 | 901 | if ( empty( $callbacks ) ) $callbacks = array(); |
902 | 902 | // If using WordPress older than 4.7 |
903 | - if ( ! is_object( $wp_filter[ $tag ] ) ) { |
|
903 | + if ( ! is_object( $wp_filter[$tag] ) ) { |
|
904 | 904 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
905 | - unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
|
905 | + unset( $GLOBALS['merged_filters'][$tag] ); |
|
906 | 906 | } |
907 | 907 | return TRUE; |
908 | 908 | } |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | } |
912 | 912 | } // End function exists |
913 | 913 | |
914 | -if ( ! function_exists ( 'remove_class_action' ) ) { |
|
914 | +if ( ! function_exists( 'remove_class_action' ) ) { |
|
915 | 915 | /** |
916 | 916 | * Remove Class Action Without Access to Class Object |
917 | 917 | * |
@@ -867,7 +867,9 @@ discard block |
||
867 | 867 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
868 | 868 | global $wp_filter; |
869 | 869 | // Check that filter actually exists first |
870 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
870 | + if ( ! isset( $wp_filter[ $tag ] ) ) { |
|
871 | + return FALSE; |
|
872 | + } |
|
871 | 873 | /** |
872 | 874 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
873 | 875 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -882,23 +884,35 @@ discard block |
||
882 | 884 | $callbacks = &$wp_filter[ $tag ]; |
883 | 885 | } |
884 | 886 | // Exit if there aren't any callbacks for specified priority |
885 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
887 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) { |
|
888 | + return FALSE; |
|
889 | + } |
|
886 | 890 | // Loop through each filter for the specified priority, looking for our class & method |
887 | 891 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
888 | 892 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
889 | - if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue; |
|
893 | + if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) { |
|
894 | + continue; |
|
895 | + } |
|
890 | 896 | // If first value in array is not an object, it can't be a class |
891 | - if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue; |
|
897 | + if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) { |
|
898 | + continue; |
|
899 | + } |
|
892 | 900 | // Method doesn't match the one we're looking for, goto next |
893 | - if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue; |
|
901 | + if ( $filter[ 'function' ][ 1 ] !== $method_name ) { |
|
902 | + continue; |
|
903 | + } |
|
894 | 904 | // Method matched, now let's check the Class |
895 | 905 | if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) { |
896 | 906 | // Now let's remove it from the array |
897 | 907 | unset( $callbacks[ $priority ][ $filter_id ] ); |
898 | 908 | // and if it was the only filter in that priority, unset that priority |
899 | - if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] ); |
|
909 | + if ( empty( $callbacks[ $priority ] ) ) { |
|
910 | + unset( $callbacks[ $priority ] ); |
|
911 | + } |
|
900 | 912 | // and if the only filter for that tag, set the tag to an empty array |
901 | - if ( empty( $callbacks ) ) $callbacks = array(); |
|
913 | + if ( empty( $callbacks ) ) { |
|
914 | + $callbacks = array(); |
|
915 | + } |
|
902 | 916 | // If using WordPress older than 4.7 |
903 | 917 | if ( ! is_object( $wp_filter[ $tag ] ) ) { |
904 | 918 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) { |
868 | 868 | global $wp_filter; |
869 | 869 | // Check that filter actually exists first |
870 | - if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE; |
|
870 | + if ( ! isset( $wp_filter[ $tag ] ) ) return false; |
|
871 | 871 | /** |
872 | 872 | * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer |
873 | 873 | * a simple array, rather it is an object that implements the ArrayAccess interface. |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $callbacks = &$wp_filter[ $tag ]; |
883 | 883 | } |
884 | 884 | // Exit if there aren't any callbacks for specified priority |
885 | - if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE; |
|
885 | + if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return false; |
|
886 | 886 | // Loop through each filter for the specified priority, looking for our class & method |
887 | 887 | foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) { |
888 | 888 | // Filter should always be an array - array( $this, 'method' ), if not goto next |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | // Remove this filter from merged_filters, which specifies if filters have been sorted |
905 | 905 | unset( $GLOBALS[ 'merged_filters' ][ $tag ] ); |
906 | 906 | } |
907 | - return TRUE; |
|
907 | + return true; |
|
908 | 908 | } |
909 | 909 | } |
910 | - return FALSE; |
|
910 | + return false; |
|
911 | 911 | } |
912 | 912 | } // End function exists |
913 | 913 |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | - * Helper method for deleting a setting's value. |
|
177 | - * |
|
178 | - * @since 6.0.0 |
|
179 | - * @access public |
|
180 | - * |
|
181 | - * @param string $key The setting key. |
|
182 | - * @return boolean True if removed, false if not. |
|
183 | - */ |
|
176 | + * Helper method for deleting a setting's value. |
|
177 | + * |
|
178 | + * @since 6.0.0 |
|
179 | + * @access public |
|
180 | + * |
|
181 | + * @param string $key The setting key. |
|
182 | + * @return boolean True if removed, false if not. |
|
183 | + */ |
|
184 | 184 | function monsterinsights_delete_option( $key = '' ) { |
185 | 185 | // If no key, exit |
186 | 186 | if ( empty( $key ) ){ |
@@ -223,14 +223,14 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
226 | - * Helper method for deleting multiple settings value. |
|
227 | - * |
|
228 | - * @since 6.0.0 |
|
229 | - * @access public |
|
230 | - * |
|
231 | - * @param string $key The setting key. |
|
232 | - * @return boolean True if removed, false if not. |
|
233 | - */ |
|
226 | + * Helper method for deleting multiple settings value. |
|
227 | + * |
|
228 | + * @since 6.0.0 |
|
229 | + * @access public |
|
230 | + * |
|
231 | + * @param string $key The setting key. |
|
232 | + * @return boolean True if removed, false if not. |
|
233 | + */ |
|
234 | 234 | function monsterinsights_delete_options( $keys = array() ) { |
235 | 235 | // If no keys, exit |
236 | 236 | if ( empty( $keys ) || ! is_array( $keys ) ){ |
@@ -359,14 +359,14 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
362 | - * Helper method for deleting the license key. |
|
363 | - * |
|
364 | - * @since 6.0.0 |
|
365 | - * @access public |
|
366 | - * |
|
367 | - * @param string $key The setting key. |
|
368 | - * @return boolean True if removed, false if not. |
|
369 | - */ |
|
362 | + * Helper method for deleting the license key. |
|
363 | + * |
|
364 | + * @since 6.0.0 |
|
365 | + * @access public |
|
366 | + * |
|
367 | + * @param string $key The setting key. |
|
368 | + * @return boolean True if removed, false if not. |
|
369 | + */ |
|
370 | 370 | function monsterinsights_delete_license_key( $network = false, $override = false ) { |
371 | 371 | if ( $network && is_multisite() && ( is_network_admin() || $override ) ) { |
372 | 372 | delete_site_option( 'monsterinsights_license' ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function monsterinsights_get_option( $key = '', $default = false ) { |
49 | 49 | global $monsterinsights_settings; |
50 | - $value = ! empty( $monsterinsights_settings[ $key ] ) ? $monsterinsights_settings[ $key ] : $default; |
|
50 | + $value = ! empty( $monsterinsights_settings[$key] ) ? $monsterinsights_settings[$key] : $default; |
|
51 | 51 | $value = apply_filters( 'monsterinsights_get_option', $value, $key, $default ); |
52 | 52 | return apply_filters( 'monsterinsights_get_option_' . $key, $value, $key, $default ); |
53 | 53 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | function monsterinsights_update_option( $key = '', $value = false ) { |
125 | 125 | |
126 | 126 | // If no key, exit |
127 | - if ( empty( $key ) ){ |
|
127 | + if ( empty( $key ) ) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $value = apply_filters( 'monsterinsights_update_option', $value, $key ); |
156 | 156 | |
157 | 157 | // Next let's try to update the value |
158 | - $settings[ $key ] = $value; |
|
158 | + $settings[$key] = $value; |
|
159 | 159 | $did_update = false; |
160 | 160 | //if ( $update_network_option ) { |
161 | 161 | // $did_update = update_site_option( $option_name, $settings ); |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | //} |
165 | 165 | |
166 | 166 | // If it updated, let's update the global variable |
167 | - if ( $did_update ){ |
|
167 | + if ( $did_update ) { |
|
168 | 168 | global $monsterinsights_settings; |
169 | - $monsterinsights_settings[ $key ] = $value; |
|
169 | + $monsterinsights_settings[$key] = $value; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $did_update; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function monsterinsights_delete_option( $key = '' ) { |
185 | 185 | // If no key, exit |
186 | - if ( empty( $key ) ){ |
|
186 | + if ( empty( $key ) ) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | //} |
203 | 203 | |
204 | 204 | // Next let's try to remove the key |
205 | - if( isset( $settings[ $key ] ) ) { |
|
206 | - unset( $settings[ $key ] ); |
|
205 | + if ( isset( $settings[$key] ) ) { |
|
206 | + unset( $settings[$key] ); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | $did_update = false; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | //} |
215 | 215 | |
216 | 216 | // If it updated, let's update the global variable |
217 | - if ( $did_update ){ |
|
217 | + if ( $did_update ) { |
|
218 | 218 | global $monsterinsights_settings; |
219 | 219 | $monsterinsights_settings = $settings; |
220 | 220 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function monsterinsights_delete_options( $keys = array() ) { |
235 | 235 | // If no keys, exit |
236 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
236 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | |
254 | 254 | // Next let's try to remove the keys |
255 | 255 | foreach ( $keys as $key ) { |
256 | - if( isset( $settings[ $key ] ) ) { |
|
257 | - unset( $settings[ $key ] ); |
|
256 | + if ( isset( $settings[$key] ) ) { |
|
257 | + unset( $settings[$key] ); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | //} |
267 | 267 | |
268 | 268 | // If it updated, let's update the global variable |
269 | - if ( $did_update ){ |
|
269 | + if ( $did_update ) { |
|
270 | 270 | global $monsterinsights_settings; |
271 | 271 | $monsterinsights_settings = $settings; |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $license = false; |
289 | 289 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
290 | 290 | $license = array( 'key' => MONSTERINSIGHTS_LICENSE_KEY ); |
291 | - } else if ( is_multisite() && monsterinsights_is_network_active() ){ |
|
291 | + } else if ( is_multisite() && monsterinsights_is_network_active() ) { |
|
292 | 292 | $network_license = get_site_option( 'monsterinsights_license' ); |
293 | 293 | if ( ! empty( $network_license['key'] ) && is_string( $network_license['key'] ) && strlen( $network_license['key'] ) > 10 ) { |
294 | 294 | $license = $network_license; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @return boolean True if updated, false if not. |
346 | 346 | */ |
347 | 347 | function monsterinsights_update_license_key( $license_key = false, $network = false, $override = false ) { |
348 | - if ( ! $license_key || ! is_string( $license_key ) || ! strlen( $license_key ) > 10 ) { |
|
348 | + if ( ! $license_key || ! is_string( $license_key ) || ! strlen( $license_key ) > 10 ) { |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | $errors = false; |
410 | 410 | $license = monsterinsights_get_license(); |
411 | 411 | if ( ! empty( $license['type'] ) && is_string( $license['type'] ) && strlen( $license['type'] ) > 3 ) { |
412 | - if ( ( isset( $license['is_expired'] ) && $license['is_expired'] ) |
|
412 | + if ( ( isset( $license['is_expired'] ) && $license['is_expired'] ) |
|
413 | 413 | || ( isset( $license['is_disabled'] ) && $license['is_disabled'] ) |
414 | - || ( isset( $license['is_invalid'] ) && $license['is_invalid'] ) ) { |
|
414 | + || ( isset( $license['is_invalid'] ) && $license['is_invalid'] ) ) { |
|
415 | 415 | $errors = true; |
416 | 416 | } |
417 | 417 | } |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | ); |
467 | 467 | |
468 | 468 | foreach ( $exclude as $e ) { |
469 | - if ( ! empty( $settings[ $e ] ) ) { |
|
470 | - unset( $settings[ $e ] ); |
|
469 | + if ( ! empty( $settings[$e] ) ) { |
|
470 | + unset( $settings[$e] ); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | return wp_json_encode( $settings ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | function monsterinsights_update_option( $key = '', $value = false ) { |
125 | 125 | |
126 | 126 | // If no key, exit |
127 | - if ( empty( $key ) ){ |
|
127 | + if ( empty( $key ) ) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | //} |
165 | 165 | |
166 | 166 | // If it updated, let's update the global variable |
167 | - if ( $did_update ){ |
|
167 | + if ( $did_update ) { |
|
168 | 168 | global $monsterinsights_settings; |
169 | 169 | $monsterinsights_settings[ $key ] = $value; |
170 | 170 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function monsterinsights_delete_option( $key = '' ) { |
185 | 185 | // If no key, exit |
186 | - if ( empty( $key ) ){ |
|
186 | + if ( empty( $key ) ) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | //} |
215 | 215 | |
216 | 216 | // If it updated, let's update the global variable |
217 | - if ( $did_update ){ |
|
217 | + if ( $did_update ) { |
|
218 | 218 | global $monsterinsights_settings; |
219 | 219 | $monsterinsights_settings = $settings; |
220 | 220 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function monsterinsights_delete_options( $keys = array() ) { |
235 | 235 | // If no keys, exit |
236 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
236 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | //} |
267 | 267 | |
268 | 268 | // If it updated, let's update the global variable |
269 | - if ( $did_update ){ |
|
269 | + if ( $did_update ) { |
|
270 | 270 | global $monsterinsights_settings; |
271 | 271 | $monsterinsights_settings = $settings; |
272 | 272 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $license = false; |
289 | 289 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
290 | 290 | $license = array( 'key' => MONSTERINSIGHTS_LICENSE_KEY ); |
291 | - } else if ( is_multisite() && monsterinsights_is_network_active() ){ |
|
291 | + } else if ( is_multisite() && monsterinsights_is_network_active() ) { |
|
292 | 292 | $network_license = get_site_option( 'monsterinsights_license' ); |
293 | 293 | if ( ! empty( $network_license['key'] ) && is_string( $network_license['key'] ) && strlen( $network_license['key'] ) > 10 ) { |
294 | 294 | $license = $network_license; |