@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Helper method for deleting a setting's value. |
|
199 | - * |
|
200 | - * @since 6.0.0 |
|
201 | - * @access public |
|
202 | - * |
|
203 | - * @param string $key The setting key. |
|
204 | - * @return boolean True if removed, false if not. |
|
205 | - */ |
|
198 | + * Helper method for deleting a setting's value. |
|
199 | + * |
|
200 | + * @since 6.0.0 |
|
201 | + * @access public |
|
202 | + * |
|
203 | + * @param string $key The setting key. |
|
204 | + * @return boolean True if removed, false if not. |
|
205 | + */ |
|
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | 208 | if ( empty( $key ) ){ |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * Helper method for deleting multiple settings value. |
|
249 | - * |
|
250 | - * @since 6.0.0 |
|
251 | - * @access public |
|
252 | - * |
|
253 | - * @param string $key The setting key. |
|
254 | - * @return boolean True if removed, false if not. |
|
255 | - */ |
|
248 | + * Helper method for deleting multiple settings value. |
|
249 | + * |
|
250 | + * @since 6.0.0 |
|
251 | + * @access public |
|
252 | + * |
|
253 | + * @param string $key The setting key. |
|
254 | + * @return boolean True if removed, false if not. |
|
255 | + */ |
|
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | 258 | if ( empty( $keys ) || ! is_array( $keys ) ){ |
@@ -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 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_update_option( $key = '', $value = false ) { |
147 | 147 | |
148 | 148 | // If no key, exit |
149 | - if ( empty( $key ) ){ |
|
149 | + if ( empty( $key ) ) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $value = apply_filters( 'monsterinsights_update_option', $value, $key ); |
178 | 178 | |
179 | 179 | // Next let's try to update the value |
180 | - $settings[ $key ] = $value; |
|
180 | + $settings[$key] = $value; |
|
181 | 181 | $did_update = false; |
182 | 182 | //if ( $update_network_option ) { |
183 | 183 | // $did_update = update_site_option( $option_name, $settings ); |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | //} |
187 | 187 | |
188 | 188 | // If it updated, let's update the global variable |
189 | - if ( $did_update ){ |
|
189 | + if ( $did_update ) { |
|
190 | 190 | global $monsterinsights_settings; |
191 | - $monsterinsights_settings[ $key ] = $value; |
|
191 | + $monsterinsights_settings[$key] = $value; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $did_update; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | - if ( empty( $key ) ){ |
|
208 | + if ( empty( $key ) ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | //} |
225 | 225 | |
226 | 226 | // Next let's try to remove the key |
227 | - if( isset( $settings[ $key ] ) ) { |
|
228 | - unset( $settings[ $key ] ); |
|
227 | + if ( isset( $settings[$key] ) ) { |
|
228 | + unset( $settings[$key] ); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | $did_update = false; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | //} |
237 | 237 | |
238 | 238 | // If it updated, let's update the global variable |
239 | - if ( $did_update ){ |
|
239 | + if ( $did_update ) { |
|
240 | 240 | global $monsterinsights_settings; |
241 | 241 | $monsterinsights_settings = $settings; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
258 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | |
276 | 276 | // Next let's try to remove the keys |
277 | 277 | foreach ( $keys as $key ) { |
278 | - if( isset( $settings[ $key ] ) ) { |
|
279 | - unset( $settings[ $key ] ); |
|
278 | + if ( isset( $settings[$key] ) ) { |
|
279 | + unset( $settings[$key] ); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //} |
289 | 289 | |
290 | 290 | // If it updated, let's update the global variable |
291 | - if ( $did_update ){ |
|
291 | + if ( $did_update ) { |
|
292 | 292 | global $monsterinsights_settings; |
293 | 293 | $monsterinsights_settings = $settings; |
294 | 294 | } |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | ); |
380 | 380 | |
381 | 381 | foreach ( $exclude as $e ) { |
382 | - if ( ! empty( $settings[ $e ] ) ) { |
|
383 | - unset( $settings[ $e ] ); |
|
382 | + if ( ! empty( $settings[$e] ) ) { |
|
383 | + unset( $settings[$e] ); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | return wp_json_encode( $settings ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return string The UA to use. |
95 | 95 | */ |
96 | 96 | function monsterinsights_get_network_ua() { |
97 | - if ( is_multisite() ) { |
|
97 | + if ( is_multisite() ) { |
|
98 | 98 | return ''; |
99 | 99 | } |
100 | 100 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | function monsterinsights_update_option( $key = '', $value = false ) { |
147 | 147 | |
148 | 148 | // If no key, exit |
149 | - if ( empty( $key ) ){ |
|
149 | + if ( empty( $key ) ) { |
|
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | //} |
187 | 187 | |
188 | 188 | // If it updated, let's update the global variable |
189 | - if ( $did_update ){ |
|
189 | + if ( $did_update ) { |
|
190 | 190 | global $monsterinsights_settings; |
191 | 191 | $monsterinsights_settings[ $key ] = $value; |
192 | 192 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function monsterinsights_delete_option( $key = '' ) { |
207 | 207 | // If no key, exit |
208 | - if ( empty( $key ) ){ |
|
208 | + if ( empty( $key ) ) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | //} |
237 | 237 | |
238 | 238 | // If it updated, let's update the global variable |
239 | - if ( $did_update ){ |
|
239 | + if ( $did_update ) { |
|
240 | 240 | global $monsterinsights_settings; |
241 | 241 | $monsterinsights_settings = $settings; |
242 | 242 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | function monsterinsights_delete_options( $keys = array() ) { |
257 | 257 | // If no keys, exit |
258 | - if ( empty( $keys ) || ! is_array( $keys ) ){ |
|
258 | + if ( empty( $keys ) || ! is_array( $keys ) ) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //} |
289 | 289 | |
290 | 290 | // If it updated, let's update the global variable |
291 | - if ( $did_update ){ |
|
291 | + if ( $did_update ) { |
|
292 | 292 | global $monsterinsights_settings; |
293 | 293 | $monsterinsights_settings = $settings; |
294 | 294 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | if ( ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
125 | 125 | $message = empty( $message ) ? '' : ' ' . $message; |
126 | - trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html ( $message ) ); |
|
126 | + trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s!', 'google-analytics-for-wordpress' ), $hook, $version, '<strong>', '</strong>' ) . esc_html( $message ) ); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | if ( ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) || monsterinsights_is_debug_mode() ) { |
179 | 179 | trigger_error( sprintf( esc_html__( '%1$s is %3$sdeprecated%4$s since MonsterInsights version %2$s.', 'google-analytics-for-wordpress' ), $function, $version, '<strong>', '</strong>' ) ); |
180 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
180 | + trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
181 | 181 | // Alternatively we could dump this to a file. |
182 | 182 | } |
183 | 183 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $license_key = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key(); |
88 | 88 | return $license_key; |
89 | 89 | } |
90 | - public function get_site_license_key(){ |
|
90 | + public function get_site_license_key() { |
|
91 | 91 | return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : ''; |
92 | 92 | } |
93 | - public function get_network_license_key(){ |
|
93 | + public function get_network_license_key() { |
|
94 | 94 | return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : ''; |
95 | 95 | } |
96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return $this->licensed; |
99 | 99 | } |
100 | 100 | |
101 | - public function is_site_licensed(){ |
|
101 | + public function is_site_licensed() { |
|
102 | 102 | return ! empty( $this->site['key'] ) // has key |
103 | 103 | && $this->get_site_license_type() // has type |
104 | 104 | && ! $this->site_license_expired() // isn't expired |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - public function get_site_license_updates(){ |
|
120 | + public function get_site_license_updates() { |
|
121 | 121 | return get_option( 'monsterinsights_license_updates', '' ); |
122 | 122 | } |
123 | - public function get_network_license_updates(){ |
|
123 | + public function get_network_license_updates() { |
|
124 | 124 | return get_site_option( 'monsterinsights_network_license_updates', '' ); |
125 | 125 | } |
126 | 126 | |
127 | - public function set_site_license_updates(){ |
|
127 | + public function set_site_license_updates() { |
|
128 | 128 | update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) ); |
129 | 129 | } |
130 | 130 | public function set_network_license_updates() { |
131 | 131 | update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) ); |
132 | 132 | } |
133 | 133 | |
134 | - public function delete_site_license_updates(){ |
|
134 | + public function delete_site_license_updates() { |
|
135 | 135 | delete_option( 'monsterinsights_license_updates' ); |
136 | 136 | } |
137 | - public function delete_network_license_updates(){ |
|
137 | + public function delete_network_license_updates() { |
|
138 | 138 | delete_site_option( 'monsterinsights_license_updates' ); |
139 | 139 | } |
140 | 140 | |
141 | - public function time_to_check_site_license(){ |
|
141 | + public function time_to_check_site_license() { |
|
142 | 142 | $timestamp = get_option( 'monsterinsights_license_updates' ); |
143 | 143 | if ( ! $timestamp ) { |
144 | 144 | return true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | - public function time_to_check_network_license(){ |
|
154 | + public function time_to_check_network_license() { |
|
155 | 155 | $timestamp = get_site_option( 'monsterinsights_network_license_updates' ); |
156 | 156 | if ( ! $timestamp ) { |
157 | 157 | return true; |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - public function set_site_license( $data = array() ){ |
|
168 | + public function set_site_license( $data = array() ) { |
|
169 | 169 | update_option( 'monsterinsights_license', $data ); |
170 | 170 | $this->set_site_license_updates(); |
171 | - $this->site = $data; |
|
171 | + $this->site = $data; |
|
172 | 172 | } |
173 | - public function set_network_license( $data = array() ){ |
|
173 | + public function set_network_license( $data = array() ) { |
|
174 | 174 | update_site_option( 'monsterinsights_network_license', $data ); |
175 | 175 | $this->set_network_license_updates(); |
176 | - $this->network = $data; |
|
176 | + $this->network = $data; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | public function delete_site_license() { |
180 | 180 | delete_option( 'monsterinsights_license' ); |
181 | 181 | $this->delete_site_license_updates(); |
182 | - $this->site = array(); |
|
182 | + $this->site = array(); |
|
183 | 183 | } |
184 | 184 | public function delete_network_license() { |
185 | 185 | delete_site_option( 'monsterinsights_network_license' ); |
@@ -187,21 +187,21 @@ discard block |
||
187 | 187 | $this->network = array(); |
188 | 188 | } |
189 | 189 | |
190 | - public function get_license_type(){ |
|
190 | + public function get_license_type() { |
|
191 | 191 | if ( ! $this->has_license() ) { |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
195 | 195 | return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type(); |
196 | 196 | } |
197 | - public function get_site_license_type(){ |
|
197 | + public function get_site_license_type() { |
|
198 | 198 | return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : ''; |
199 | 199 | } |
200 | - public function get_network_license_type(){ |
|
200 | + public function get_network_license_type() { |
|
201 | 201 | return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : ''; |
202 | 202 | } |
203 | 203 | |
204 | - public function license_has_error(){ |
|
204 | + public function license_has_error() { |
|
205 | 205 | if ( ! $this->has_license() ) { |
206 | 206 | return false; |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | || $this->site_license_invalid() // is invalid |
216 | 216 | ; |
217 | 217 | } |
218 | - public function network_license_has_error(){ |
|
218 | + public function network_license_has_error() { |
|
219 | 219 | return |
220 | 220 | $this->network_license_expired() // is expired |
221 | 221 | || $this->network_license_disabled() // is disabled |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | ; |
224 | 224 | } |
225 | 225 | |
226 | - public function license_expired(){ |
|
226 | + public function license_expired() { |
|
227 | 227 | if ( ! $this->has_license() ) { |
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | 231 | return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired(); |
232 | 232 | } |
233 | - public function site_license_expired(){ |
|
233 | + public function site_license_expired() { |
|
234 | 234 | return ! empty( $this->site['is_expired'] ); |
235 | 235 | } |
236 | - public function network_license_expired(){ |
|
236 | + public function network_license_expired() { |
|
237 | 237 | return ! empty( $this->network['is_expired'] ); |
238 | 238 | } |
239 | 239 | |
240 | - public function license_disabled(){ |
|
240 | + public function license_disabled() { |
|
241 | 241 | if ( ! $this->has_license() ) { |
242 | 242 | return false; |
243 | 243 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | public function site_license_disabled() { |
248 | 248 | return ! empty( $this->site['is_disabled'] ); |
249 | 249 | } |
250 | - public function network_license_disabled(){ |
|
250 | + public function network_license_disabled() { |
|
251 | 251 | return ! empty( $this->network['is_disabled'] ); |
252 | 252 | } |
253 | 253 | |
254 | - public function license_invalid(){ |
|
254 | + public function license_invalid() { |
|
255 | 255 | if ( ! $this->has_license() ) { |
256 | 256 | return false; |
257 | 257 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | public function site_license_invalid() { |
262 | 262 | return ! empty( $this->site['is_invalid'] ); |
263 | 263 | } |
264 | - public function network_license_invalid(){ |
|
264 | + public function network_license_invalid() { |
|
265 | 265 | return ! empty( $this->network['is_invalid'] ); |
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | - public function get_license_error(){ |
|
269 | + public function get_license_error() { |
|
270 | 270 | if ( ! $this->has_license() ) { |
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | |
274 | 274 | return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error(); |
275 | 275 | } |
276 | - public function get_site_license_error(){ |
|
276 | + public function get_site_license_error() { |
|
277 | 277 | if ( $this->site_license_expired() ) { |
278 | 278 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
279 | 279 | } else if ( $this->site_license_disabled() ) { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | return ''; |
285 | 285 | } |
286 | 286 | |
287 | - public function get_network_license_error(){ |
|
287 | + public function get_network_license_error() { |
|
288 | 288 | if ( $this->site_license_expired() ) { |
289 | 289 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
290 | 290 | } else if ( $this->site_license_disabled() ) { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return $can_access; |
363 | 363 | } |
364 | 364 | |
365 | - public function get_default_license_key(){ |
|
365 | + public function get_default_license_key() { |
|
366 | 366 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
367 | 367 | return MONSTERINSIGHTS_LICENSE_KEY; |
368 | 368 | } |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | $license_key = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key(); |
88 | 88 | return $license_key; |
89 | 89 | } |
90 | - public function get_site_license_key(){ |
|
90 | + public function get_site_license_key() { |
|
91 | 91 | return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : ''; |
92 | 92 | } |
93 | - public function get_network_license_key(){ |
|
93 | + public function get_network_license_key() { |
|
94 | 94 | return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : ''; |
95 | 95 | } |
96 | 96 | |
97 | - public function has_license() { |
|
97 | + public function has_license() { |
|
98 | 98 | return $this->licensed; |
99 | 99 | } |
100 | 100 | |
101 | - public function is_site_licensed(){ |
|
101 | + public function is_site_licensed() { |
|
102 | 102 | return ! empty( $this->site['key'] ) // has key |
103 | 103 | && $this->get_site_license_type() // has type |
104 | 104 | && ! $this->site_license_expired() // isn't expired |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | |
120 | - public function get_site_license_updates(){ |
|
120 | + public function get_site_license_updates() { |
|
121 | 121 | return get_option( 'monsterinsights_license_updates', '' ); |
122 | 122 | } |
123 | - public function get_network_license_updates(){ |
|
123 | + public function get_network_license_updates() { |
|
124 | 124 | return get_site_option( 'monsterinsights_network_license_updates', '' ); |
125 | 125 | } |
126 | 126 | |
127 | - public function set_site_license_updates(){ |
|
127 | + public function set_site_license_updates() { |
|
128 | 128 | update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) ); |
129 | 129 | } |
130 | 130 | public function set_network_license_updates() { |
131 | 131 | update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) ); |
132 | 132 | } |
133 | 133 | |
134 | - public function delete_site_license_updates(){ |
|
134 | + public function delete_site_license_updates() { |
|
135 | 135 | delete_option( 'monsterinsights_license_updates' ); |
136 | 136 | } |
137 | - public function delete_network_license_updates(){ |
|
137 | + public function delete_network_license_updates() { |
|
138 | 138 | delete_site_option( 'monsterinsights_license_updates' ); |
139 | 139 | } |
140 | 140 | |
141 | - public function time_to_check_site_license(){ |
|
141 | + public function time_to_check_site_license() { |
|
142 | 142 | $timestamp = get_option( 'monsterinsights_license_updates' ); |
143 | 143 | if ( ! $timestamp ) { |
144 | 144 | return true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | - public function time_to_check_network_license(){ |
|
154 | + public function time_to_check_network_license() { |
|
155 | 155 | $timestamp = get_site_option( 'monsterinsights_network_license_updates' ); |
156 | 156 | if ( ! $timestamp ) { |
157 | 157 | return true; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - public function set_site_license( $data = array() ){ |
|
168 | + public function set_site_license( $data = array() ) { |
|
169 | 169 | update_option( 'monsterinsights_license', $data ); |
170 | 170 | $this->set_site_license_updates(); |
171 | 171 | $this->site = $data; |
172 | 172 | } |
173 | - public function set_network_license( $data = array() ){ |
|
173 | + public function set_network_license( $data = array() ) { |
|
174 | 174 | update_site_option( 'monsterinsights_network_license', $data ); |
175 | 175 | $this->set_network_license_updates(); |
176 | 176 | $this->network = $data; |
@@ -187,21 +187,21 @@ discard block |
||
187 | 187 | $this->network = array(); |
188 | 188 | } |
189 | 189 | |
190 | - public function get_license_type(){ |
|
190 | + public function get_license_type() { |
|
191 | 191 | if ( ! $this->has_license() ) { |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
195 | 195 | return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type(); |
196 | 196 | } |
197 | - public function get_site_license_type(){ |
|
197 | + public function get_site_license_type() { |
|
198 | 198 | return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : ''; |
199 | 199 | } |
200 | - public function get_network_license_type(){ |
|
200 | + public function get_network_license_type() { |
|
201 | 201 | return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : ''; |
202 | 202 | } |
203 | 203 | |
204 | - public function license_has_error(){ |
|
204 | + public function license_has_error() { |
|
205 | 205 | if ( ! $this->has_license() ) { |
206 | 206 | return false; |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | || $this->site_license_invalid() // is invalid |
216 | 216 | ; |
217 | 217 | } |
218 | - public function network_license_has_error(){ |
|
218 | + public function network_license_has_error() { |
|
219 | 219 | return |
220 | 220 | $this->network_license_expired() // is expired |
221 | 221 | || $this->network_license_disabled() // is disabled |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | ; |
224 | 224 | } |
225 | 225 | |
226 | - public function license_expired(){ |
|
226 | + public function license_expired() { |
|
227 | 227 | if ( ! $this->has_license() ) { |
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | 231 | return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired(); |
232 | 232 | } |
233 | - public function site_license_expired(){ |
|
233 | + public function site_license_expired() { |
|
234 | 234 | return ! empty( $this->site['is_expired'] ); |
235 | 235 | } |
236 | - public function network_license_expired(){ |
|
236 | + public function network_license_expired() { |
|
237 | 237 | return ! empty( $this->network['is_expired'] ); |
238 | 238 | } |
239 | 239 | |
240 | - public function license_disabled(){ |
|
240 | + public function license_disabled() { |
|
241 | 241 | if ( ! $this->has_license() ) { |
242 | 242 | return false; |
243 | 243 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | public function site_license_disabled() { |
248 | 248 | return ! empty( $this->site['is_disabled'] ); |
249 | 249 | } |
250 | - public function network_license_disabled(){ |
|
250 | + public function network_license_disabled() { |
|
251 | 251 | return ! empty( $this->network['is_disabled'] ); |
252 | 252 | } |
253 | 253 | |
254 | - public function license_invalid(){ |
|
254 | + public function license_invalid() { |
|
255 | 255 | if ( ! $this->has_license() ) { |
256 | 256 | return false; |
257 | 257 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | public function site_license_invalid() { |
262 | 262 | return ! empty( $this->site['is_invalid'] ); |
263 | 263 | } |
264 | - public function network_license_invalid(){ |
|
264 | + public function network_license_invalid() { |
|
265 | 265 | return ! empty( $this->network['is_invalid'] ); |
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | - public function get_license_error(){ |
|
269 | + public function get_license_error() { |
|
270 | 270 | if ( ! $this->has_license() ) { |
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | |
274 | 274 | return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error(); |
275 | 275 | } |
276 | - public function get_site_license_error(){ |
|
276 | + public function get_site_license_error() { |
|
277 | 277 | if ( $this->site_license_expired() ) { |
278 | 278 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
279 | 279 | } else if ( $this->site_license_disabled() ) { |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | return ''; |
285 | 285 | } |
286 | 286 | |
287 | - public function get_network_license_error(){ |
|
287 | + public function get_network_license_error() { |
|
288 | 288 | if ( $this->site_license_expired() ) { |
289 | 289 | return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ); |
290 | 290 | } else if ( $this->site_license_disabled() ) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | return ''; |
296 | 296 | } |
297 | 297 | |
298 | - public function license_can( $requires = 'lite' ) { |
|
298 | + public function license_can( $requires = 'lite' ) { |
|
299 | 299 | if ( ! monsterinsights_is_pro_version() || ! $this->has_license() ) { |
300 | 300 | return $requires === 'lite'; |
301 | 301 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | return $can_access; |
363 | 363 | } |
364 | 364 | |
365 | - public function get_default_license_key(){ |
|
365 | + public function get_default_license_key() { |
|
366 | 366 | if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) { |
367 | 367 | return MONSTERINSIGHTS_LICENSE_KEY; |
368 | 368 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $internal_label = esc_js( $internal_label ); |
91 | 91 | |
92 | 92 | // Get inbound as outbound to track |
93 | - $inbound_paths = monsterinsights_get_option( 'track_internal_as_outbound','' ); |
|
93 | + $inbound_paths = monsterinsights_get_option( 'track_internal_as_outbound', '' ); |
|
94 | 94 | $inbound_paths = explode( ',', $inbound_paths ); |
95 | 95 | if ( ! is_array( $inbound_paths ) ) { |
96 | 96 | $inbound_paths = array( $inbound_paths ); |
97 | 97 | } |
98 | 98 | $i = 0; |
99 | - foreach ( $inbound_paths as $path ){ |
|
100 | - $inbound_paths[ $i ] = esc_js( trim( $path ) ); |
|
99 | + foreach ( $inbound_paths as $path ) { |
|
100 | + $inbound_paths[$i] = esc_js( trim( $path ) ); |
|
101 | 101 | $i++; |
102 | 102 | } |
103 | 103 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | $download_extensions = array( $download_extensions ); |
111 | 111 | } |
112 | 112 | $i = 0; |
113 | - foreach( $download_extensions as $extension ){ |
|
114 | - $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
|
113 | + foreach ( $download_extensions as $extension ) { |
|
114 | + $download_extensions[$i] = esc_js( trim( $extension ) ); |
|
115 | 115 | $i++; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $download_extensions = implode( ",", $download_extensions ); |
119 | 119 | |
120 | - $is_debug_mode = monsterinsights_is_debug_mode(); |
|
120 | + $is_debug_mode = monsterinsights_is_debug_mode(); |
|
121 | 121 | if ( current_user_can( 'manage_options' ) && $is_debug_mode ) { |
122 | 122 | $is_debug_mode = 'true'; |
123 | 123 | } else { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $inbound_paths = array( $inbound_paths ); |
97 | 97 | } |
98 | 98 | $i = 0; |
99 | - foreach ( $inbound_paths as $path ){ |
|
99 | + foreach ( $inbound_paths as $path ) { |
|
100 | 100 | $inbound_paths[ $i ] = esc_js( trim( $path ) ); |
101 | 101 | $i++; |
102 | 102 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $download_extensions = array( $download_extensions ); |
111 | 111 | } |
112 | 112 | $i = 0; |
113 | - foreach( $download_extensions as $extension ){ |
|
113 | + foreach( $download_extensions as $extension ) { |
|
114 | 114 | $download_extensions[ $i ] = esc_js( trim( $extension ) ); |
115 | 115 | $i++; |
116 | 116 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return array Array of the options to use. |
59 | 59 | */ |
60 | 60 | public function frontend_tracking_options( ) { |
61 | - return array(); |
|
61 | + return array(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -74,6 +74,6 @@ discard block |
||
74 | 74 | * @return string Javascript to output. |
75 | 75 | */ |
76 | 76 | public function frontend_output( ) { |
77 | - return "<!-- MonsterInsights Abstract Tracking class -->"; |
|
77 | + return "<!-- MonsterInsights Abstract Tracking class -->"; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * not be used by other developers. This hook's behavior may be modified |
39 | 39 | * or the hook may be removed at any time, without warning. |
40 | 40 | */ |
41 | - $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
41 | + $reports = apply_filters( 'monsterinsights_get_reports', array() ); |
|
42 | 42 | return $reports; |
43 | 43 | } |
44 | 44 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | <div id="monsterinsights-main-tab-<?php echo esc_attr( $report->name ); ?>" class="monsterinsights-main-nav-tab monsterinsights-nav-tab"> |
91 | 91 | <div class="monsterinsights-reports-action-bar monsterinsights-clear"> |
92 | 92 | <div class="monsterinsights-reports-action-bar-title"> |
93 | - <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
93 | + <?php echo esc_html( sprintf( __( '%s Report', 'google-analytics-for-wordpress' ), $report->title ) ); ?> |
|
94 | 94 | </div> |
95 | 95 | <div class="monsterinsights-reports-action-bar-actions"><?php |
96 | 96 | /** |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | check_ajax_referer( 'mi-admin-nonce', 'security' ); |
133 | 133 | |
134 | 134 | // Get variables |
135 | - $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | - $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | - $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | - $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
135 | + $start = ! empty( $_REQUEST['start'] ) ? $_REQUEST['start'] : ''; |
|
136 | + $end = ! empty( $_REQUEST['end'] ) ? $_REQUEST['end'] : ''; |
|
137 | + $name = ! empty( $_REQUEST['report'] ) ? $_REQUEST['report'] : ''; |
|
138 | + $isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? $_REQUEST['isnetwork'] : ''; |
|
139 | 139 | |
140 | 140 | |
141 | 141 | // Current user can authenticate |
142 | 142 | if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) { |
143 | - wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
143 | + wp_send_json_error( array( 'message' => __( "You don't have permission to view MonsterInsights reports.", 'google-analytics-for-wordpress' ) ) ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) { |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // Only for Pro users, require a license key to be entered first so we can link to things. |
151 | - if ( monsterinsights_is_pro_version() ) { |
|
151 | + if ( monsterinsights_is_pro_version() ) { |
|
152 | 152 | if ( ! MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->is_network_licensed() ) { |
153 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
153 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports because you are not licensed.", 'google-analytics-for-wordpress' ) ) ); |
|
154 | 154 | } else if ( MonsterInsights()->license->is_site_licensed() && ! MonsterInsights()->license->site_license_has_error() ) { |
155 | 155 | // good to go: site licensed |
156 | 156 | } else if ( MonsterInsights()->license->is_network_licensed() && ! MonsterInsights()->license->network_license_has_error() ) { |
157 | 157 | // good to go: network licensed |
158 | 158 | } else { |
159 | - wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
159 | + wp_send_json_error( array( 'message' => __( "You can't view MonsterInsights reports due to license key errors.", 'google-analytics-for-wordpress' ) ) ); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | $site_auth = MonsterInsights()->auth->get_viewname(); |
165 | 165 | $ms_auth = is_multisite() && MonsterInsights()->auth->get_network_viewname(); |
166 | 166 | if ( ! $site_auth && ! $ms_auth ) { |
167 | - wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
167 | + wp_send_json_error( array( 'message' => __( "You must authenticate with MonsterInsights before you can view reports.", 'google-analytics-for-wordpress' ) ) ); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | if ( empty( $name ) ) { |
171 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
171 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $report = MonsterInsights()->reporting->get_report( $name ); |
175 | 175 | |
176 | 176 | if ( empty( $report ) ) { |
177 | - wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
177 | + wp_send_json_error( array( 'message' => __( "Unknown report. Try refreshing and retrying. Contact support if this issue persists.", 'google-analytics-for-wordpress' ) ) ); |
|
178 | 178 | } |
179 | 179 | |
180 | - $args = array( 'start' => $start, 'end' => $end ); |
|
180 | + $args = array( 'start' => $start, 'end' => $end ); |
|
181 | 181 | if ( $isnetwork ) { |
182 | 182 | $args['network'] = true; |
183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | 'success' => true |
192 | 192 | ) |
193 | 193 | ); |
194 | - wp_send_json_success( array( 'html' => $data ) ); |
|
194 | + wp_send_json_success( array( 'html' => $data ) ); |
|
195 | 195 | } else { |
196 | 196 | wp_send_json_error( array( 'message' => $data['error'] ) ); |
197 | 197 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
50 | 50 | ?> |
51 | - <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
|
52 | - <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> |
|
51 | + <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress' ); ?></h1> |
|
52 | + <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> |
|
53 | 53 | <table class="form-table"> |
54 | 54 | <tbody> |
55 | 55 | <?php if ( monsterinsights_is_pro_version() ) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | <form id="monsterinsights-google-authenticate" method="post"> |
113 | 113 | <?php if ( MonsterInsights()->auth->get_network_viewname() && MonsterInsights()->auth->get_network_ua() ) { ?> |
114 | 114 | <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_network_licensed() ) { ?> |
115 | - <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p> |
|
115 | + <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p> |
|
116 | 116 | <?php } else { ?> |
117 | 117 | <p><?php echo esc_html__( 'Profile Active: ', 'google-analytics-for-wordpress' ) . MonsterInsights()->auth->get_network_viewname(); ?></p> |
118 | 118 | <p><?php wp_nonce_field( 'monsterinsights-google-authenticated-nonce', 'monsterinsights-google-authenticated-nonce' ); ?> |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <?php } ?> |
123 | 123 | <?php } else { ?> |
124 | 124 | <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_network_licensed() ) { ?> |
125 | - <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p> |
|
125 | + <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p> |
|
126 | 126 | <?php } else { ?> |
127 | 127 | <?php wp_nonce_field( 'monsterinsights-google-authenticate-nonce', 'monsterinsights-google-authenticate-nonce' ); ?> |
128 | 128 | <?php submit_button( esc_html__( 'Authenticate with your Google account', 'google-analytics-for-wordpress' ), 'button-action', 'monsterinsights-google-authenticate-submit', false ); ?> |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | <?php if ( ! MonsterInsights()->auth->get_network_viewname() ) { |
137 | 137 | $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
138 | 138 | ?> |
139 | - <tr id="monsterinsights-google-ua-box" <?php echo (empty( $network_ua ) ? 'class="monsterinsights-hideme"' : ''); ?> > |
|
139 | + <tr id="monsterinsights-google-ua-box" <?php echo ( empty( $network_ua ) ? 'class="monsterinsights-hideme"' : '' ); ?> > |
|
140 | 140 | <form id="monsterinsights-network-general-tab" method="post"> |
141 | 141 | <th scope="row"> |
142 | 142 | <label for="monsterinsights-google-ua"><?php esc_html_e( 'Network UA code', 'google-analytics-for-wordpress' ); ?></label> |
@@ -52,7 +52,7 @@ |
||
52 | 52 | <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> |
53 | 53 | <table class="form-table"> |
54 | 54 | <tbody> |
55 | - <?php if ( monsterinsights_is_pro_version() ) { |
|
55 | + <?php if ( monsterinsights_is_pro_version() ) { |
|
56 | 56 | |
57 | 57 | $license_key = MonsterInsights()->license->get_network_license_key(); |
58 | 58 | $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
@@ -38,28 +38,28 @@ discard block |
||
38 | 38 | <div id="monsterinsights-main-tab-general" class="monsterinsights-main-nav-tab monsterinsights-nav-tab monsterinsights-active"> |
39 | 39 | <div id="monsterinsights-network-settings-general"> |
40 | 40 | <?php |
41 | - // Output any notices now |
|
42 | - /** |
|
43 | - * Developer Alert: |
|
44 | - * |
|
45 | - * Per the README, this is considered an internal hook and should |
|
46 | - * not be used by other developers. This hook's behavior may be modified |
|
47 | - * or the hook may be removed at any time, without warning. |
|
48 | - */ |
|
49 | - do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
50 | - ?> |
|
41 | + // Output any notices now |
|
42 | + /** |
|
43 | + * Developer Alert: |
|
44 | + * |
|
45 | + * Per the README, this is considered an internal hook and should |
|
46 | + * not be used by other developers. This hook's behavior may be modified |
|
47 | + * or the hook may be removed at any time, without warning. |
|
48 | + */ |
|
49 | + do_action( 'monsterinsights_network_settings_general_tab_notice' ); |
|
50 | + ?> |
|
51 | 51 | <h1><?php esc_html_e( 'Network Settings', 'google-analytics-for-wordpress'); ?></h1> |
52 | 52 | <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> |
53 | 53 | <table class="form-table"> |
54 | 54 | <tbody> |
55 | 55 | <?php if ( monsterinsights_is_pro_version() ) { |
56 | 56 | |
57 | - $license_key = MonsterInsights()->license->get_network_license_key(); |
|
58 | - $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
|
57 | + $license_key = MonsterInsights()->license->get_network_license_key(); |
|
58 | + $license_key = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key(); |
|
59 | 59 | |
60 | - $license_type = MonsterInsights()->license->get_network_license_type(); |
|
60 | + $license_type = MonsterInsights()->license->get_network_license_type(); |
|
61 | 61 | |
62 | - ?> |
|
62 | + ?> |
|
63 | 63 | <tr id="monsterinsights-settings-key-box"> |
64 | 64 | <th scope="row"> |
65 | 65 | <label for="monsterinsights-settings-key"><?php esc_html_e( 'License Key', 'google-analytics-for-wordpress' ); ?></label> |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </tr> |
135 | 135 | |
136 | 136 | <?php if ( ! MonsterInsights()->auth->get_network_viewname() ) { |
137 | - $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
|
138 | - ?> |
|
137 | + $network_ua = MonsterInsights()->auth->get_network_manual_ua(); |
|
138 | + ?> |
|
139 | 139 | <tr id="monsterinsights-google-ua-box" <?php echo (empty( $network_ua ) ? 'class="monsterinsights-hideme"' : ''); ?> > |
140 | 140 | <form id="monsterinsights-network-general-tab" method="post"> |
141 | 141 | <th scope="row"> |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | </tr> |
167 | 167 | <?php } ?> |
168 | 168 | <?php |
169 | - $title = esc_html__( 'Hide Announcements', 'google-analytics-for-wordpress' ); |
|
170 | - $description = esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.', 'google-analytics-for-wordpress' ); |
|
171 | - echo monsterinsights_make_checkbox( 'network_hide_am_notices', $title, $description ); |
|
172 | - ?> |
|
169 | + $title = esc_html__( 'Hide Announcements', 'google-analytics-for-wordpress' ); |
|
170 | + $description = esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.', 'google-analytics-for-wordpress' ); |
|
171 | + echo monsterinsights_make_checkbox( 'network_hide_am_notices', $title, $description ); |
|
172 | + ?> |
|
173 | 173 | </tbody> |
174 | 174 | </table> |
175 | 175 | </div> |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | |
192 | 192 | // Check if user pressed the 'Update' button and nonce is valid |
193 | 193 | if ( ! isset( $_POST['monsterinsights-network-settings-submit'] ) ) { |
194 | - return; |
|
194 | + return; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | if ( ! wp_verify_nonce( $_POST['monsterinsights-network-settings-nonce'], 'monsterinsights-network-settings-nonce' ) ) { |
198 | - return; |
|
198 | + return; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
202 | - return; |
|
202 | + return; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $throw_notice = false; |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | $manual_ua_code_old = MonsterInsights()->auth->get_network_manual_ua(); |
209 | 209 | |
210 | 210 | if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old === $manual_ua_code ) { |
211 | - // Same code we had before |
|
212 | - // Do nothing |
|
211 | + // Same code we had before |
|
212 | + // Do nothing |
|
213 | 213 | } else if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old !== $manual_ua_code ) { |
214 | - // Different UA code |
|
215 | - MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
214 | + // Different UA code |
|
215 | + MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
216 | 216 | } else if ( $manual_ua_code && empty( $manual_ua_code_old ) ) { |
217 | - // Move to manual |
|
218 | - MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
217 | + // Move to manual |
|
218 | + MonsterInsights()->auth->set_network_manual_ua( $manual_ua_code ); |
|
219 | 219 | } else if ( empty( $manual_ua_code ) && $manual_ua_code_old ) { |
220 | - // Deleted manual |
|
221 | - MonsterInsights()->auth->delete_network_manual_ua(); |
|
220 | + // Deleted manual |
|
221 | + MonsterInsights()->auth->delete_network_manual_ua(); |
|
222 | 222 | } else if ( isset( $_POST['network_manual_ua_code'] ) && empty( $manual_ua_code ) ) { |
223 | - $throw_notice = true; |
|
223 | + $throw_notice = true; |
|
224 | 224 | } else { |
225 | - // Not UA before or after |
|
226 | - // Do nothing |
|
225 | + // Not UA before or after |
|
226 | + // Do nothing |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $network_hide_am_notices = isset( $_POST['network_hide_am_notices'] ) ? 1 : 0; |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | |
236 | 236 | // Output an admin notice so the user knows what happened |
237 | 237 | if ( $throw_notice ) { |
238 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
238 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' ); |
|
239 | 239 | } else { |
240 | - add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
240 | + add_action( 'monsterinsights_network_settings_general_tab_notice', 'monsterinsights_updated_settings' ); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | add_action( 'admin_init', 'monsterinsights_network_settings_save_general', 11 ); |
244 | 244 | \ No newline at end of file |
@@ -19,32 +19,32 @@ 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_settings'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_settings'] ) { |
27 | - $settings_page = true; |
|
27 | + $settings_page = true; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ( ! empty( $admin_page_hooks['monsterinsights_reports'] ) && $current_screen->id === $admin_page_hooks['monsterinsights_reports'] ) { |
31 | - $settings_page = true; |
|
31 | + $settings_page = true; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | if ( $current_screen->id === 'toplevel_page_monsterinsights_settings' ) { |
35 | - $settings_page = true; |
|
35 | + $settings_page = true; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if ( $current_screen->id === 'insights_page_monsterinsights_settings' ) { |
39 | - $settings_page = true; |
|
39 | + $settings_page = true; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if ( $current_screen->id === 'insights_page_monsterinsights_tracking' ) { |
43 | - $settings_page = true; |
|
43 | + $settings_page = true; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'monsterinsights_network' ) !== false ) { |
47 | - $settings_page = true; |
|
47 | + $settings_page = true; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $settings_page; |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | function monsterinsights_save_general_settings_page() { |
107 | 107 | |
108 | 108 | if ( ! monsterinsights_is_settings_page() ) { |
109 | - return; |
|
109 | + return; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Check if user pressed the 'Update' button and nonce is valid |
113 | 113 | if ( ! isset( $_POST['monsterinsights-settings-submit'] ) ) { |
114 | - return; |
|
114 | + return; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | if ( ! wp_verify_nonce( $_POST['monsterinsights-settings-nonce'], 'monsterinsights-settings-nonce' ) ) { |
118 | - return; |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if ( ! current_user_can( 'monsterinsights_save_settings' ) ) { |
122 | - return; |
|
122 | + return; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if ( ! empty( $_POST['monsterinsights_settings_tab'] ) && $_POST['monsterinsights_settings_tab'] === 'general' ) { |
126 | - /** |
|
127 | - * Developer Alert: |
|
128 | - * |
|
129 | - * Per the README, this is considered an internal hook and should |
|
130 | - * not be used by other developers. This hook's behavior may be modified |
|
131 | - * or the hook may be removed at any time, without warning. |
|
132 | - */ |
|
133 | - do_action( 'monsterinsights_settings_save_general' ); |
|
126 | + /** |
|
127 | + * Developer Alert: |
|
128 | + * |
|
129 | + * Per the README, this is considered an internal hook and should |
|
130 | + * not be used by other developers. This hook's behavior may be modified |
|
131 | + * or the hook may be removed at any time, without warning. |
|
132 | + */ |
|
133 | + do_action( 'monsterinsights_settings_save_general' ); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | add_action( 'current_screen', 'monsterinsights_save_general_settings_page' ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | <?php echo esc_html__( 'General', 'google-analytics-for-wordpress' ); ?> |
80 | 80 | </a> |
81 | 81 | |
82 | - <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url('admin.php?page=monsterinsights_tracking#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-engagement');?>" title="<?php echo esc_attr( __( 'Tracking', 'google-analytics-for-wordpress' ) ); ?>"> |
|
82 | + <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url( 'admin.php?page=monsterinsights_tracking#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-engagement' ); ?>" title="<?php echo esc_attr( __( 'Tracking', 'google-analytics-for-wordpress' ) ); ?>"> |
|
83 | 83 | <?php echo esc_html__( 'Tracking', 'google-analytics-for-wordpress' ); ?> |
84 | 84 | </a> |
85 | 85 | </h1> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ob_start(); |
179 | 179 | ?> |
180 | 180 | <tr id="monsterinsights-input-<?php echo esc_attr( $option_class ); ?>"> |
181 | - <?php if ( !empty ( $title ) ) { ?> |
|
181 | + <?php if ( ! empty ( $title ) ) { ?> |
|
182 | 182 | <th scope="row"> |
183 | 183 | <label for="monsterinsights-<?php echo esc_attr( $option_class ); ?>"><?php echo $title; ?></label> |
184 | 184 | </th> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | <h1 id="monsterinsights-settings-page-main-nav" class="monsterinsights-main-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-pages"> |
39 | 39 | <a class="monsterinsights-main-nav-item monsterinsights-nav-item monsterinsights-spacing-item" href="#"> </a> |
40 | 40 | |
41 | - <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url('admin.php?page=monsterinsights_settings');?>" title="<?php echo esc_attr( __( 'General', 'google-analytics-for-wordpress' ) ); ?>"> |
|
41 | + <a class="monsterinsights-main-nav-item monsterinsights-nav-item" href="<?php echo admin_url( 'admin.php?page=monsterinsights_settings' ); ?>" title="<?php echo esc_attr( __( 'General', 'google-analytics-for-wordpress' ) ); ?>"> |
|
42 | 42 | <?php echo esc_html__( 'General', 'google-analytics-for-wordpress' ); ?> |
43 | 43 | </a> |
44 | 44 |