Passed
Pull Request — master (#492)
by
unknown
02:42
created
includes/measurement-protocol.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 
27 27
 	$defaults = array(
28 28
 		't'  => 'event', // Required: Hit type
29
-		'ec' => '',      // Optional: Event category
30
-		'ea' => '', 	 // Optional: Event Action
31
-		'el' => '', 	 // Optional: Event Label
32
-		'ev' => null, 	 // Optional: Event Value
29
+		'ec' => '', // Optional: Event category
30
+		'ea' => '', // Optional: Event Action
31
+		'el' => '', // Optional: Event Label
32
+		'ev' => null, // Optional: Event Value
33 33
 	);
34 34
 
35
-	$body  = array_merge( $defaults , $args );
35
+	$body = array_merge( $defaults, $args );
36 36
 
37 37
 	// We want to get the user's IP address when possible
38
-	$ip     = '';
38
+	$ip = '';
39 39
 	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) && ! filter_var( $_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP ) === false ) {
40 40
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
41 41
 	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! filter_var( $_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP ) === false ) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		'uip' => $ip,
82 82
 
83 83
 		// Optional: User Agent
84
-		'ua'  => ! empty( $user_agent ) ?  $user_agent : $_SERVER['HTTP_USER_AGENT'],
84
+		'ua'  => ! empty( $user_agent ) ? $user_agent : $_SERVER['HTTP_USER_AGENT'],
85 85
 
86 86
 		// Optional: Time of the event
87 87
 		'z'   => time()
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	// Unset empty values to reduce request size
100 100
 	foreach ( $body as $key => $value ) {
101 101
 		if ( empty( $value ) ) {
102
-			unset( $body[ $key ] );
102
+			unset( $body[$key] );
103 103
 		}
104 104
 	}
105 105
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		// Optional: Event Value
143 143
 		'ev' => null,
144 144
 	);
145
-	$args  = wp_parse_args( $args, $default_args );
145
+	$args = wp_parse_args( $args, $default_args );
146 146
 	//$args = apply_filters( 'monsterinsights_mp_track_event_call', $args );
147 147
 
148 148
 	return monsterinsights_mp_api_call( $args );
Please login to merge, or discard this patch.
includes/admin/settings/settings-api.php 3 patches
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) exit;
14 14
 
15 15
 /**
16 16
  * Get the settings for a section
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 	// get subtab
83 83
 	$settings = monsterinsights_get_registered_settings();
84 84
 	$tab      = $_POST['monsterinsights_settings_sub_tab'];
85
-	if ( empty( $settings ) || !is_array( $settings ) || empty( $settings[ $tab ] ) || ! is_array( $settings[ $tab ] ) ) {
85
+	if ( empty( $settings ) || ! is_array( $settings ) || empty( $settings[$tab] ) || ! is_array( $settings[$tab] ) ) {
86 86
 		return;
87 87
 	}
88 88
 
89 89
 	// Okay we're good to sanitize, validate, and save this section's settings
90 90
 
91 91
 	// We only care about this sections's settings
92
-	$settings = $settings[ $tab ]; 
92
+	$settings = $settings[$tab]; 
93 93
 
94 94
 	// Run a general sanitization for the tab for special fields
95 95
 	$input    = ! empty( $_POST['monsterinsights_settings'] ) ? $_POST['monsterinsights_settings'] : array();
96 96
 	$input    = apply_filters( 'monsterinsights_settings_' . $tab . '_sanitize', $input );
97 97
 
98
-	foreach( $settings as $id => $setting ) {
98
+	foreach ( $settings as $id => $setting ) {
99 99
 
100 100
 		// If the value wasn't passed in, set to false, which will delete the option
101
-		$value          = isset( $input[ $id ] ) ? $input[ $id ] : false;
101
+		$value          = isset( $input[$id] ) ? $input[$id] : false;
102 102
 		$previous_value = monsterinsights_get_option( $id, false );
103 103
 
104 104
 		// Sanitize/Validate
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 		) );
139 139
 
140 140
 		// Sanitize settings
141
-		$value = apply_filters( 'monsterinsights_settings_sanitize_' . $id  , $value, $id, $args, $previous_value );
141
+		$value = apply_filters( 'monsterinsights_settings_sanitize_' . $id, $value, $id, $args, $previous_value );
142 142
 		$value = apply_filters( 'monsterinsights_settings_sanitize_' . $type, $value, $id, $args, $previous_value );
143
-		$value = apply_filters( 'monsterinsights_settings_sanitize'         , $value, $id, $args, $previous_value );
143
+		$value = apply_filters( 'monsterinsights_settings_sanitize', $value, $id, $args, $previous_value );
144 144
 
145 145
 		// Save
146 146
 		if ( ! has_action( 'monsterinsights_settings_save_' . $args['type'] ) ) {
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 }
154 154
 add_action( 'current_screen', 'monsterinsights_save_settings' );
155 155
 
156
-function monsterinsights_is_settings_tab( $tab = '' ){
156
+function monsterinsights_is_settings_tab( $tab = '' ) {
157 157
 	$tabs = monsterinsights_get_settings_tabs();
158 158
 	if ( empty( $tab ) || empty( $tabs ) || ! is_string( $tab ) || ! is_array( $tabs ) ) {
159 159
 		return false;
160 160
 	}
161 161
 
162
-	return !empty( $tabs[$tab]);
162
+	return ! empty( $tabs[$tab] );
163 163
 }
164 164
 
165 165
 /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		if ( ! empty( $settings[$section] ) ) {
177 177
 			foreach ( $settings[$section] as $setting ) {
178 178
 				if ( is_array( $setting ) && array_key_exists( 'type', $setting ) ) {
179
-					$setting_types[ $setting['id'] ] = $setting['type'];
179
+					$setting_types[$setting['id']] = $setting['type'];
180 180
 				}
181 181
 			}
182 182
 		}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		foreach ( $settings as $tab ) {
185 185
 			foreach ( $tab as $setting ) {
186 186
 				if ( is_array( $setting ) && array_key_exists( 'type', $setting ) ) {
187
-					$setting_types[ $setting['id'] ] = $setting['type'];
187
+					$setting_types[$setting['id']] = $setting['type'];
188 188
 				}
189 189
 			}
190 190
 		}
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 	function _sanitize_text_fields( $str, $keep_newlines = false ) {
257 257
 		$filtered = wp_check_invalid_utf8( $str );
258 258
 	 
259
-		if ( strpos($filtered, '<') !== false ) {
259
+		if ( strpos( $filtered, '<' ) !== false ) {
260 260
 			$filtered = wp_pre_kses_less_than( $filtered );
261 261
 			// This will strip extra whitespace for us.
262 262
 			$filtered = wp_strip_all_tags( $filtered, false );
263 263
 	 
264 264
 			// Use html entities in a special case to make sure no later
265 265
 			// newline stripping stage could lead to a functional tag
266
-			$filtered = str_replace("<\n", "&lt;\n", $filtered);
266
+			$filtered = str_replace( "<\n", "&lt;\n", $filtered );
267 267
 		}
268 268
 	 
269 269
 		if ( ! $keep_newlines ) {
@@ -272,14 +272,14 @@  discard block
 block discarded – undo
272 272
 		$filtered = trim( $filtered );
273 273
 	 
274 274
 		$found = false;
275
-		while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
276
-			$filtered = str_replace($match[0], '', $filtered);
275
+		while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
276
+			$filtered = str_replace( $match[0], '', $filtered );
277 277
 			$found = true;
278 278
 		}
279 279
 	 
280 280
 		if ( $found ) {
281 281
 			// Strip out the whitespace that may now exist after removing the octets.
282
-			$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
282
+			$filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
283 283
 		}
284 284
 	 
285 285
 		return $filtered;
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 function monsterinsights_sanitize_multicheck_field( $value, $id, $setting, $previous_value ) {
318 318
 	$save_value = array();
319 319
 	if ( ! empty( $value ) && is_array( $value ) ) {
320
-		foreach( $setting['options'] as $key => $option ){
320
+		foreach ( $setting['options'] as $key => $option ) {
321 321
 			if ( in_array( $key, $value ) ) {
322 322
 				$save_value[] = $key;
323 323
 			}
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	if ( ! empty( $value ) && is_array( $value ) ) {
343 343
 		if ( $setting['multiple'] ) {
344 344
 			foreach ( $value as $vid => $vname ) {
345
-				foreach( $setting['options'] as $key => $option ){
345
+				foreach ( $setting['options'] as $key => $option ) {
346 346
 					if ( $key === $vname ) {
347 347
 						$save_value[] = $key;
348 348
 						break;
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 				}
351 351
 			}
352 352
 		} else {
353
-			foreach( $setting['options'] as $key => $option ){
353
+			foreach ( $setting['options'] as $key => $option ) {
354 354
 				if ( is_array( $value ) && in_array( $key, $value ) ) {
355 355
 					$save_value = $key;
356 356
 					break;
357
-				} else if ( is_string( $value ) && $key === $value ){
357
+				} else if ( is_string( $value ) && $key === $value ) {
358 358
 					$save_value = $key;
359 359
 					break;
360 360
 				}
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 function monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ) {
376 376
 	$save_value = '';
377 377
 	if ( ! empty( $value ) ) {
378
-		foreach( $setting['options'] as $key => $option ){
378
+		foreach ( $setting['options'] as $key => $option ) {
379 379
 			if ( $key === $value ) {
380 380
 				$save_value = $key;
381 381
 			}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
  */
493 493
 function monsterinsights_get_pages( $force = false ) {
494 494
 	$pages_options = array( '' => '' ); // Blank option
495
-	if( ( ! isset( $_GET['page'] ) || 'monsterinsights_settings' != $_GET['page'] ) && ! $force ) {
495
+	if ( ( ! isset( $_GET['page'] ) || 'monsterinsights_settings' != $_GET['page'] ) && ! $force ) {
496 496
 		return $pages_options;
497 497
 	}
498 498
 
499 499
 	$pages = get_pages();
500 500
 	if ( $pages ) {
501 501
 		foreach ( $pages as $page ) {
502
-			$pages_options[ $page->ID ] = $page->post_title;
502
+			$pages_options[$page->ID] = $page->post_title;
503 503
 		}
504 504
 	}
505 505
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	}
541 541
 
542 542
 	$html     = '<input type="checkbox" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']"' . $name . ' value="1" ' . $checked . ' class="' . $class . '" ' . $disabled . ' />';
543
-	$html    .= '<p class="description">'  . wp_kses_post( $args['desc'] ) . '</p>';
543
+	$html    .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
544 544
 
545 545
 	return apply_filters( 'monsterinsights_after_setting_output', $html, $args );
546 546
 }
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
 
563 563
 	$html = '';
564 564
 	if ( ! empty( $args['options'] ) ) {
565
-		foreach( $args['options'] as $key => $option ):
566
-			if( isset( $monsterinsights_option[ $key ] ) ) { $enabled = $option; } else { $enabled = NULL; }
567
-			$html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
565
+		foreach ( $args['options'] as $key => $option ):
566
+			if ( isset( $monsterinsights_option[$key] ) ) { $enabled = $option; } else { $enabled = NULL; }
567
+			$html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
568 568
 			$html .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']">' . wp_kses_post( $option ) . '</label><br/>';
569 569
 		endforeach;
570 570
 		$html .= '<p class="description">' . $args['desc'] . '</p>';
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 
597 597
 		if ( $monsterinsights_options && $monsterinsights_options == $key ) {
598 598
 			$checked = true;
599
-		} else if( isset( $args['std'] ) && $args['std'] == $key && ! $monsterinsights_options ) {
599
+		} else if ( isset( $args['std'] ) && $args['std'] == $key && ! $monsterinsights_options ) {
600 600
 			$checked = true;
601 601
 		}
602 602
 
603 603
 		$html .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']">';
604
-		$html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="radio" value="' . monsterinsights_sanitize_key( $key ) . '" ' . checked(true, $checked, false) . '/>&nbsp;';
604
+		$html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="radio" value="' . monsterinsights_sanitize_key( $key ) . '" ' . checked( true, $checked, false ) . '/>&nbsp;';
605 605
 		$html .= esc_html( $option ) . '</label>';
606 606
 	endforeach;
607 607
 
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
 	if ( $monsterinsights_option ) {
627 627
 		$value = $monsterinsights_option;
628
-	} elseif( ! empty( $args['allow_blank'] ) && empty( $monsterinsights_option ) ) {
628
+	} elseif ( ! empty( $args['allow_blank'] ) && empty( $monsterinsights_option ) ) {
629 629
 		$value = '';
630 630
 	} else {
631 631
 		$value = isset( $args['std'] ) ? $args['std'] : '';
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
646 646
 	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
647 647
 	$html     = '<input type="text" class="' . $class . ' ' . sanitize_html_class( $size ) . '-text" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . $disabled . ' placeholder="' . esc_attr( $args['placeholder'] ) . '"/>';
648
-	$html    .= '<p class="description"> '  . wp_kses_post( $args['desc'] ) . '</p>';
648
+	$html    .= '<p class="description"> ' . wp_kses_post( $args['desc'] ) . '</p>';
649 649
 
650 650
 	return apply_filters( 'monsterinsights_after_setting_output', $html, $args );
651 651
 }
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 
680 680
 	$class = monsterinsights_sanitize_html_class( $args['field_class'] );
681 681
 
682
-	$max  = isset( $args['max'] )  ? $args['max']   : 999999;
683
-	$min  = isset( $args['min'] )  ? $args['min']   : 0;
682
+	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
683
+	$min  = isset( $args['min'] ) ? $args['min'] : 0;
684 684
 	$step = isset( $args['step'] ) ? $args['step'] : 1;
685 685
 
686 686
 	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
687 687
 	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . $class . ' ' . sanitize_html_class( $size ) . '-text" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
688
-	$html .= '<p class="description"> '  . wp_kses_post( $args['desc'] ) . '</p>';
688
+	$html .= '<p class="description"> ' . wp_kses_post( $args['desc'] ) . '</p>';
689 689
 
690 690
 	return apply_filters( 'monsterinsights_after_setting_output', $html, $args );
691 691
 }
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	$class = monsterinsights_sanitize_html_class( $args['field_class'] );
713 713
 
714 714
 	$html = '<textarea class="' . $class . ' large-text" cols="50" rows="5" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" name="monsterinsights_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
715
-	$html .= '<p class="description"> '  . wp_kses_post( $args['desc'] ) . '</p>';
715
+	$html .= '<p class="description"> ' . wp_kses_post( $args['desc'] ) . '</p>';
716 716
 
717 717
 	return apply_filters( 'monsterinsights_after_setting_output', $html, $args );
718 718
 }
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 		$class = monsterinsights_sanitize_html_class( $args['field_class'] );
743 743
 
744 744
 		$html = '<textarea class="' . $class . ' large-text" cols="50" rows="5" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" name="monsterinsights_settings[' . esc_attr( $args['id'] ) . ']">' . stripslashes( $value ) . '</textarea>';
745
-		$html .= '<p class="description"> '  . wp_kses_post( $args['desc'] ) . '</p>';
745
+		$html .= '<p class="description"> ' . wp_kses_post( $args['desc'] ) . '</p>';
746 746
 	} else {
747 747
 		$html .= sprintf( esc_html__( 'You must have the %s capability to view/edit this setting', 'google-analytics-for-wordpress' ), '"unfiltered_html"' );
748 748
 	}
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
  *
789 789
  * @return void
790 790
  */
791
-function monsterinsights_select_callback($args) {
791
+function monsterinsights_select_callback( $args ) {
792 792
 	$monsterinsights_option = monsterinsights_get_option( $args['id'] );
793 793
 
794 794
 	if ( $monsterinsights_option ) {
@@ -810,14 +810,14 @@  discard block
 block discarded – undo
810 810
 	}
811 811
 
812 812
 	$allowclear   = isset( $args['allowclear'] ) ? (bool) $args['allowclear'] : false;
813
-	$multiple     = isset( $args['multiple'] )   ? (bool) $args['multiple'] : false;
813
+	$multiple     = isset( $args['multiple'] ) ? (bool) $args['multiple'] : false;
814 814
 	$multiple     = $multiple ? 'multiple="multiple"' : '';
815 815
 	$multiple_arg = $multiple ? '[]' : '';
816 816
 
817
-	$html = '<select id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" name="monsterinsights_settings[' . esc_attr( $args['id'] ) . ']' . $multiple_arg .'" class="' . $class . '" data-placeholder="' . esc_html( $placeholder ) . '" data-allow-clear="' . $allowclear . '" ' . $multiple . ' />';
817
+	$html = '<select id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" name="monsterinsights_settings[' . esc_attr( $args['id'] ) . ']' . $multiple_arg . '" class="' . $class . '" data-placeholder="' . esc_html( $placeholder ) . '" data-allow-clear="' . $allowclear . '" ' . $multiple . ' />';
818 818
 
819 819
 	foreach ( $args['options'] as $option => $name ) {
820
-		$selected = ! empty( $value ) && is_array( $value ) ? in_array( $option, $value ) :  $value === $option;
820
+		$selected = ! empty( $value ) && is_array( $value ) ? in_array( $option, $value ) : $value === $option;
821 821
 		$selected = selected( true, $selected, false );
822 822
 		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
823 823
 	}
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 	if ( $monsterinsights_option ) {
843 843
 		$value = $monsterinsights_option;
844 844
 	} else {
845
-		if( ! empty( $args['allow_blank'] ) && empty( $monsterinsights_option ) ) {
845
+		if ( ! empty( $args['allow_blank'] ) && empty( $monsterinsights_option ) ) {
846 846
 			$value = '';
847 847
 		} else {
848 848
 			$value = isset( $args['std'] ) ? $args['std'] : '';
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
  * @return void
903 903
  */
904 904
 function monsterinsights_upgrade_notice_callback( $args ) {
905
-	$html =   '<div class="monsterinsights-upsell-box"><h2>' . esc_html( $args['name' ] ) . '</h2>'
905
+	$html = '<div class="monsterinsights-upsell-box"><h2>' . esc_html( $args['name'] ) . '</h2>'
906 906
 			. '<p class="monsterinsights-upsell-lite-text">' . $args['desc'] . '</p>'
907 907
 			. '<p class="monsterinsights-upsell-button-par"><a href="https://www.monsterinsights.com/lite/" class="monsterinsights-upsell-box-button button button-primary">' . __( 'Click here to Upgrade', 'google-analytics-for-wordpress' ) . '</a></p>'
908 908
 			. '</div>';
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
  * @param array $args Arguments passed by the setting
933 933
  * @return void
934 934
  */
935
-function monsterinsights_missing_callback($args) {
935
+function monsterinsights_missing_callback( $args ) {
936 936
 	return sprintf(
937 937
 		__( 'The callback function used for the %s setting is missing.', 'google-analytics-for-wordpress' ),
938 938
 		'<strong>' . $args['id'] . '</strong>'
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 			}
964 964
 		}
965 965
 		if ( $submit_button ) {
966
-			$html .= '<input type="hidden" name="monsterinsights_settings_tab" value="' . esc_attr( $page ). '"/>';
967
-			$html .= '<input type="hidden" name="monsterinsights_settings_sub_tab" value="' .  esc_attr( $section ) . '"/>';
966
+			$html .= '<input type="hidden" name="monsterinsights_settings_tab" value="' . esc_attr( $page ) . '"/>';
967
+			$html .= '<input type="hidden" name="monsterinsights_settings_sub_tab" value="' . esc_attr( $section ) . '"/>';
968 968
 			$html .= wp_nonce_field( 'monsterinsights-settings-nonce', 'monsterinsights-settings-nonce', true, false );
969 969
 			$html .= get_submit_button( esc_html__( 'Save Changes', 'google-analytics-for-wordpress' ), 'primary', 'monsterinsights-settings-submit', false );
970 970
 		}
971
-		$html      = apply_filters( 'monsterinsights_html_after_submit_field', $html, $page, $section );
971
+		$html = apply_filters( 'monsterinsights_html_after_submit_field', $html, $page, $section );
972 972
 	}
973 973
 	return $html;
974 974
 }
@@ -978,10 +978,10 @@  discard block
 block discarded – undo
978 978
  */
979 979
 function monsterinsights_render_field( $args ) {
980 980
 	$output = '';
981
-	$output .='<tr id="monsterinsights-input-' . monsterinsights_sanitize_key( $args['id'] ) .'">';
981
+	$output .= '<tr id="monsterinsights-input-' . monsterinsights_sanitize_key( $args['id'] ) . '">';
982 982
 		if ( ! empty( $args['name'] ) && empty( $args['no_label'] ) ) {
983 983
 			$output .= '<th scope="row">';
984
-				$output .='<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']">' . esc_html( $args["name"] ) . '</label>';
984
+				$output .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']">' . esc_html( $args["name"] ) . '</label>';
985 985
 			$output .= '</th>';
986 986
 		}
987 987
 		$output .= '<td>';
@@ -1024,9 +1024,9 @@  discard block
 block discarded – undo
1024 1024
 	$notices = get_transient( 'monsterinsights_settings_notices' );
1025 1025
 	if ( empty( $notices ) ) {
1026 1026
 		$notices          = array();
1027
-		$notices[ $name ] = array( "type" => $type, "message" => $message );
1027
+		$notices[$name] = array( "type" => $type, "message" => $message );
1028 1028
 	} else {
1029
-		$notices[ $name ] = array( "type" => $type, "message" => $message );
1029
+		$notices[$name] = array( "type" => $type, "message" => $message );
1030 1030
 	}
1031 1031
 	set_transient( 'monsterinsights_settings_notices', $notices );
1032 1032
 }
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
 	$notices = get_transient( 'monsterinsights_settings_notices' );
1039 1039
 	$found   = false;
1040 1040
 	if ( ! empty( $notices ) ) {
1041
-		if ( isset( $notices[ $name] ) ) {
1042
-			unset( $notices[ $name] );
1041
+		if ( isset( $notices[$name] ) ) {
1042
+			unset( $notices[$name] );
1043 1043
 			set_transient( 'monsterinsights_settings_notices', $notices );
1044 1044
 			$found = true;
1045 1045
 		} else {
@@ -1052,6 +1052,6 @@  discard block
 block discarded – undo
1052 1052
 /** 
1053 1053
  * @todo  docbloc
1054 1054
  */
1055
-function monsterinsights_get_non_setting_types(){
1056
-	return apply_filters( 'monsterinsights_non_setting_types', array(  'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1055
+function monsterinsights_get_non_setting_types() {
1056
+	return apply_filters( 'monsterinsights_non_setting_types', array( 'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1057 1057
 }
1058 1058
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( !defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Get the settings for a section
@@ -153,7 +155,7 @@  discard block
 block discarded – undo
153 155
 }
154 156
 add_action( 'current_screen', 'monsterinsights_save_settings' );
155 157
 
156
-function monsterinsights_is_settings_tab( $tab = '' ){
158
+function monsterinsights_is_settings_tab( $tab = '' ) {
157 159
 	$tabs = monsterinsights_get_settings_tabs();
158 160
 	if ( empty( $tab ) || empty( $tabs ) || ! is_string( $tab ) || ! is_array( $tabs ) ) {
159 161
 		return false;
@@ -317,7 +319,7 @@  discard block
 block discarded – undo
317 319
 function monsterinsights_sanitize_multicheck_field( $value, $id, $setting, $previous_value ) {
318 320
 	$save_value = array();
319 321
 	if ( ! empty( $value ) && is_array( $value ) ) {
320
-		foreach( $setting['options'] as $key => $option ){
322
+		foreach( $setting['options'] as $key => $option ) {
321 323
 			if ( in_array( $key, $value ) ) {
322 324
 				$save_value[] = $key;
323 325
 			}
@@ -342,7 +344,7 @@  discard block
 block discarded – undo
342 344
 	if ( ! empty( $value ) && is_array( $value ) ) {
343 345
 		if ( $setting['multiple'] ) {
344 346
 			foreach ( $value as $vid => $vname ) {
345
-				foreach( $setting['options'] as $key => $option ){
347
+				foreach( $setting['options'] as $key => $option ) {
346 348
 					if ( $key === $vname ) {
347 349
 						$save_value[] = $key;
348 350
 						break;
@@ -350,11 +352,11 @@  discard block
 block discarded – undo
350 352
 				}
351 353
 			}
352 354
 		} else {
353
-			foreach( $setting['options'] as $key => $option ){
355
+			foreach( $setting['options'] as $key => $option ) {
354 356
 				if ( is_array( $value ) && in_array( $key, $value ) ) {
355 357
 					$save_value = $key;
356 358
 					break;
357
-				} else if ( is_string( $value ) && $key === $value ){
359
+				} else if ( is_string( $value ) && $key === $value ) {
358 360
 					$save_value = $key;
359 361
 					break;
360 362
 				}
@@ -375,7 +377,7 @@  discard block
 block discarded – undo
375 377
 function monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ) {
376 378
 	$save_value = '';
377 379
 	if ( ! empty( $value ) ) {
378
-		foreach( $setting['options'] as $key => $option ){
380
+		foreach( $setting['options'] as $key => $option ) {
379 381
 			if ( $key === $value ) {
380 382
 				$save_value = $key;
381 383
 			}
@@ -995,7 +997,8 @@  discard block
 block discarded – undo
995 997
 /** 
996 998
  * @todo  docbloc
997 999
  */
998
-function monsterinsights_add_setting_tooltip( $html, $args ) { // @todo: enqueue tooltips
1000
+function monsterinsights_add_setting_tooltip( $html, $args ) {
1001
+// @todo: enqueue tooltips
999 1002
 
1000 1003
 	if ( ! empty( $args['tooltip_title'] ) && ! empty( $args['tooltip_desc'] ) ) {
1001 1004
 		$tooltip = '<span alt="f223" class="monsterinsights-help-tip dashicons dashicons-editor-help" title="<strong>' . $args['tooltip_title'] . '</strong>: ' . $args['tooltip_desc'] . '"></span>';
@@ -1052,6 +1055,6 @@  discard block
 block discarded – undo
1052 1055
 /** 
1053 1056
  * @todo  docbloc
1054 1057
  */
1055
-function monsterinsights_get_non_setting_types(){
1058
+function monsterinsights_get_non_setting_types() {
1056 1059
 	return apply_filters( 'monsterinsights_non_setting_types', array(  'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1057 1060
 }
1058 1061
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -563,7 +563,7 @@
 block discarded – undo
563 563
 	$html = '';
564 564
 	if ( ! empty( $args['options'] ) ) {
565 565
 		foreach( $args['options'] as $key => $option ):
566
-			if( isset( $monsterinsights_option[ $key ] ) ) { $enabled = $option; } else { $enabled = NULL; }
566
+			if( isset( $monsterinsights_option[ $key ] ) ) { $enabled = $option; } else { $enabled = null; }
567 567
 			$html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
568 568
 			$html .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']">' . wp_kses_post( $option ) . '</label><br/>';
569 569
 		endforeach;
Please login to merge, or discard this patch.
includes/admin/settings/tab-status.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     ?>
27 27
     <div id="monsterinsights-settings-general">
28 28
         <?php 
29
-        ?>
29
+	?>
30 30
         <?php //Status page coming soon. ?>
31 31
         <!-- <hr /> -->
32 32
     </div>
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function monsterinsights_system_info() {
42 42
     if ( ! empty( $_REQUEST['monsterinsights-action'] ) && $_REQUEST['monsterinsights-action'] === 'download_sysinfo' ) {
43
-        if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
44
-            return;
45
-        }
46
-        nocache_headers();
47
-        header( 'Content-Type: text/plain' );
48
-        header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' );
49
-        echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] );
50
-        die();
43
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
44
+	    return;
45
+	}
46
+	nocache_headers();
47
+	header( 'Content-Type: text/plain' );
48
+	header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' );
49
+	echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] );
50
+	die();
51 51
     }
52 52
 }
53 53
 //add_action( 'admin_init',  'monsterinsights_system_info'  );
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/notice.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct() {
38 38
 
39
-        // Populate $notices
40
-        $this->notices = get_option( 'monsterinsights_notices' );
41
-        if ( ! is_array( $this->notices ) ) {
42
-            $this->notices = array();
43
-        }
39
+	// Populate $notices
40
+	$this->notices = get_option( 'monsterinsights_notices' );
41
+	if ( ! is_array( $this->notices ) ) {
42
+	    $this->notices = array();
43
+	}
44 44
 
45 45
     }
46 46
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
      */
56 56
 
57 57
     public function is_dismissed( $notice ) {
58
-        if ( ! isset( $this->notices[ $notice ] ) ) {
59
-            return false;
60
-        }
61
-        return true;
58
+	if ( ! isset( $this->notices[ $notice ] ) ) {
59
+	    return false;
60
+	}
61
+	return true;
62 62
 
63 63
     }
64 64
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
      * @return null
73 73
      */
74 74
     public function dismiss( $notice ) {
75
-        $this->notices[ $notice ] = true;
76
-        update_option( 'monsterinsights_notices', $this->notices );
75
+	$this->notices[ $notice ] = true;
76
+	update_option( 'monsterinsights_notices', $this->notices );
77 77
 
78 78
     }
79 79
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      * @return null
89 89
      */
90 90
     public function undismiss( $notice ) {
91
-        unset( $this->notices[ $notice ] );
92
-        update_option( 'monsterinsights_notices', $this->notices );
91
+	unset( $this->notices[ $notice ] );
92
+	update_option( 'monsterinsights_notices', $this->notices );
93 93
 
94 94
     }
95 95
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param bool      $is_dismissible     User can Dismiss Message (default: false)
109 109
      */ 
110 110
     public function display_inline_notice( $name, $title, $message, $type = 'success', $is_dismissible = false, $args = array() ) {
111
-        /* Available/Planned $args options
111
+	/* Available/Planned $args options
112 112
          * $args = array(
113 113
          *  'primary'    => array(
114 114
          *      'text'   => '',
@@ -127,110 +127,110 @@  discard block
 block discarded – undo
127 127
          */
128 128
 
129 129
 
130
-        // Check if the notice is dismissible, and if so has been dismissed.
131
-        if ( $is_dismissible && $this->is_dismissed( $name ) ) {
132
-            // Nothing to show here, return!
133
-            return '';
134
-        }
130
+	// Check if the notice is dismissible, and if so has been dismissed.
131
+	if ( $is_dismissible && $this->is_dismissed( $name ) ) {
132
+	    // Nothing to show here, return!
133
+	    return '';
134
+	}
135 135
 
136
-        $dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
136
+	$dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
137 137
 
138
-        // Display inline notice
139
-        ob_start();
140
-        ?>
138
+	// Display inline notice
139
+	ob_start();
140
+	?>
141 141
         <div class="monsterinsights-notice <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice' . $dismissible; ?>" data-notice="<?php echo esc_attr( $name ); ?>">
142 142
             <div class="monsterinsights-notice-icon <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-icon'?>">
143 143
             </div>
144 144
             <div class="monsterinsights-notice-text <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-text'?>">
145 145
                 <?php
146
-                // Title
147
-                if ( ! empty ( $title ) ) {
148
-                    ?>
146
+		// Title
147
+		if ( ! empty ( $title ) ) {
148
+		    ?>
149 149
                     <p class="monsterinsights-notice-title"><?php echo esc_html( $title ); ?></p>
150 150
                     <?php
151
-                }
151
+		}
152 152
 
153
-                // Message
154
-                if ( ! empty( $message ) ) {
155
-                    if ( empty( $args['skip_message_escape'] ) ) {
156
-                        ?>
153
+		// Message
154
+		if ( ! empty( $message ) ) {
155
+		    if ( empty( $args['skip_message_escape'] ) ) {
156
+			?>
157 157
                         <p class="monsterinsights-notice-message"><?php echo esc_html( $message ); ?></p>
158 158
                         <?php
159
-                    } else {
160
-                        ?>
159
+		    } else {
160
+			?>
161 161
                         <p class="monsterinsights-notice-message"><?php echo $message; ?></p>
162 162
                         <?php
163
-                    }
164
-                }
163
+		    }
164
+		}
165 165
                 
166
-                // Primary Button
167
-                if ( ! empty( $args['primary']['text'] ) ) {
166
+		// Primary Button
167
+		if ( ! empty( $args['primary']['text'] ) ) {
168 168
                     
169
-                    $text = '';
170
-                    if ( ! empty( $args['primary']['text'] ) ) {
171
-                        $text = $args['primary']['text'];
172
-                    }
173
-
174
-                    $url = '#';
175
-                    if ( ! empty( $args['primary']['url'] ) ) {
176
-                        $url = $args['primary']['url'];
177
-                    }
178
-
179
-                    $target = '';
180
-                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
181
-                        $target = ' target="_blank" rel="noopener noreferrer"';
182
-                    }
183
-
184
-                    $class = 'button button-primary';
185
-                    if ( ! empty( $args['primary']['class'] ) ) {
186
-                        $class = ' class="'. $args['primary']['class'] . '"';
187
-                    }
188
-                    ?>
169
+		    $text = '';
170
+		    if ( ! empty( $args['primary']['text'] ) ) {
171
+			$text = $args['primary']['text'];
172
+		    }
173
+
174
+		    $url = '#';
175
+		    if ( ! empty( $args['primary']['url'] ) ) {
176
+			$url = $args['primary']['url'];
177
+		    }
178
+
179
+		    $target = '';
180
+		    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
181
+			$target = ' target="_blank" rel="noopener noreferrer"';
182
+		    }
183
+
184
+		    $class = 'button button-primary';
185
+		    if ( ! empty( $args['primary']['class'] ) ) {
186
+			$class = ' class="'. $args['primary']['class'] . '"';
187
+		    }
188
+		    ?>
189 189
                     <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
190 190
                     <?php
191
-                }
191
+		}
192 192
 
193
-                // Secondary Button
194
-                if ( ! empty( $args['secondary']['text'] ) ) {
193
+		// Secondary Button
194
+		if ( ! empty( $args['secondary']['text'] ) ) {
195 195
                     
196
-                    $text = '';
197
-                    if ( ! empty( $args['secondary']['text'] ) ) {
198
-                        $text = $args['secondary']['text'];
199
-                    }
200
-
201
-                    $url = '#';
202
-                    if ( ! empty( $args['secondary']['url'] ) ) {
203
-                        $url = $args['secondary']['url'];
204
-                    }           
205
-
206
-                    $target = '';
207
-                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
208
-                        $target = ' target="_blank" rel="noopener noreferrer"';
209
-                    }
210
-
211
-                    $class = 'button button-secondary';
212
-                    if ( ! empty( $args['secondary']['class'] ) ) {
213
-                        $class = ' class="'. $args['secondary']['class'] . '"';
214
-                    }
215
-                    ?>
196
+		    $text = '';
197
+		    if ( ! empty( $args['secondary']['text'] ) ) {
198
+			$text = $args['secondary']['text'];
199
+		    }
200
+
201
+		    $url = '#';
202
+		    if ( ! empty( $args['secondary']['url'] ) ) {
203
+			$url = $args['secondary']['url'];
204
+		    }           
205
+
206
+		    $target = '';
207
+		    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
208
+			$target = ' target="_blank" rel="noopener noreferrer"';
209
+		    }
210
+
211
+		    $class = 'button button-secondary';
212
+		    if ( ! empty( $args['secondary']['class'] ) ) {
213
+			$class = ' class="'. $args['secondary']['class'] . '"';
214
+		    }
215
+		    ?>
216 216
                     <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
217 217
                     <?php
218
-                }
218
+		}
219 219
 
220
-                // Dismiss Button
221
-                if ( $is_dismissible ) {
222
-                    ?>
220
+		// Dismiss Button
221
+		if ( $is_dismissible ) {
222
+		    ?>
223 223
                     <button type="button" class="notice-dismiss<?php echo $dismissible; ?>">
224 224
                         <span class="screen-reader-text">
225 225
                             <?php esc_html_e( 'Dismiss this notice', 'google-analytics-for-wordpress' ); ?>
226 226
                         </span>
227 227
                     </button>
228 228
                     <?php
229
-                }
230
-                ?>
229
+		}
230
+		?>
231 231
             </div>
232 232
         </div>
233 233
         <?php
234
-        return ob_get_clean();
234
+	return ob_get_clean();
235 235
     }
236 236
 }
237 237
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
 
57 57
     public function is_dismissed( $notice ) {
58
-        if ( ! isset( $this->notices[ $notice ] ) ) {
58
+        if ( ! isset( $this->notices[$notice] ) ) {
59 59
             return false;
60 60
         }
61 61
         return true;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @return null
73 73
      */
74 74
     public function dismiss( $notice ) {
75
-        $this->notices[ $notice ] = true;
75
+        $this->notices[$notice] = true;
76 76
         update_option( 'monsterinsights_notices', $this->notices );
77 77
 
78 78
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @return null
89 89
      */
90 90
     public function undismiss( $notice ) {
91
-        unset( $this->notices[ $notice ] );
91
+        unset( $this->notices[$notice] );
92 92
         update_option( 'monsterinsights_notices', $this->notices );
93 93
 
94 94
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             return '';
134 134
         }
135 135
 
136
-        $dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
136
+        $dismissible = ( $is_dismissible ) ? ' is-dismissible' : '';
137 137
 
138 138
         // Display inline notice
139 139
         ob_start();
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
                     }
178 178
 
179 179
                     $target = '';
180
-                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
180
+                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank' ) {
181 181
                         $target = ' target="_blank" rel="noopener noreferrer"';
182 182
                     }
183 183
 
184 184
                     $class = 'button button-primary';
185 185
                     if ( ! empty( $args['primary']['class'] ) ) {
186
-                        $class = ' class="'. $args['primary']['class'] . '"';
186
+                        $class = ' class="' . $args['primary']['class'] . '"';
187 187
                     }
188 188
                     ?>
189
-                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
189
+                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a>
190 190
                     <?php
191 191
                 }
192 192
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
                     }           
205 205
 
206 206
                     $target = '';
207
-                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
207
+                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank' ) {
208 208
                         $target = ' target="_blank" rel="noopener noreferrer"';
209 209
                     }
210 210
 
211 211
                     $class = 'button button-secondary';
212 212
                     if ( ! empty( $args['secondary']['class'] ) ) {
213
-                        $class = ' class="'. $args['secondary']['class'] . '"';
213
+                        $class = ' class="' . $args['secondary']['class'] . '"';
214 214
                     }
215 215
                     ?>
216
-                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
216
+                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a>
217 217
                     <?php
218 218
                 }
219 219
 
Please login to merge, or discard this patch.
includes/admin/licensing/skin.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct( $args = array() ) {
27 27
 
28
-        parent::__construct();
28
+	parent::__construct();
29 29
 
30 30
     }
31 31
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function set_upgrader( &$upgrader ) {
40 40
 
41
-        if ( is_object( $upgrader ) ) {
42
-            $this->upgrader =& $upgrader;
43
-        }
41
+	if ( is_object( $upgrader ) ) {
42
+	    $this->upgrader =& $upgrader;
43
+	}
44 44
 
45 45
     }
46 46
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function set_result( $result ) {
55 55
 
56
-        $this->result = $result;
56
+	$this->result = $result;
57 57
 
58 58
     }
59 59
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      */
83 83
     function error( $errors ) {
84 84
 
85
-        if ( ! empty( $errors ) ) {
86
-            echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) );
87
-            die;
88
-        }
85
+	if ( ! empty( $errors ) ) {
86
+	    echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) );
87
+	    die;
88
+	}
89 89
 
90 90
     }
91 91
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     public function set_upgrader( &$upgrader ) {
40 40
 
41 41
         if ( is_object( $upgrader ) ) {
42
-            $this->upgrader =& $upgrader;
42
+            $this->upgrader = & $upgrader;
43 43
         }
44 44
 
45 45
     }
Please login to merge, or discard this patch.
includes/admin/licensing/updater.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 
254 254
         // Create a new stdClass object and populate it with our plugin information.
255 255
         $api                        = new stdClass;
256
-        $api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
257
-        $api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
258
-        $api->version               = isset( $this->info->version )        ? $this->info->version        : '';
259
-        $api->author                = isset( $this->info->author )         ? $this->info->author         : '';
256
+        $api->name                  = isset( $this->info->name ) ? $this->info->name : '';
257
+        $api->slug                  = isset( $this->info->slug ) ? $this->info->slug : '';
258
+        $api->version               = isset( $this->info->version ) ? $this->info->version : '';
259
+        $api->author                = isset( $this->info->author ) ? $this->info->author : '';
260 260
         $api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
261
-        $api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
262
-        $api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
263
-        $api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
264
-        $api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
261
+        $api->requires              = isset( $this->info->requires ) ? $this->info->requires : '';
262
+        $api->tested                = isset( $this->info->tested ) ? $this->info->tested : '';
263
+        $api->last_updated          = isset( $this->info->last_updated ) ? $this->info->last_updated : '';
264
+        $api->homepage              = isset( $this->info->homepage ) ? $this->info->homepage : '';
265 265
 
266
-        $changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
267
-        $description                = isset( $this->info->description )    ? $this->info->description     : '';
266
+        $changelog                  = isset( $this->info->changelog ) ? $this->info->changelog : '';
267
+        $description                = isset( $this->info->description ) ? $this->info->description : '';
268 268
 
269 269
         if ( ! empty( $changelog ) ) {
270 270
              if ( ! empty( $description ) ) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $api->sections = array();
280 280
         }     
281 281
 
282
-        $api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
282
+        $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : '';
283 283
 
284 284
         // Return the new API object with our custom data.
285 285
         return $api;
Please login to merge, or discard this patch.
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -105,39 +105,39 @@  discard block
 block discarded – undo
105 105
      * @param array $config Array of updater config args.
106 106
      */
107 107
     public function __construct( array $config ) {
108
-        // Set class properties.
109
-        $accepted_args = array(
110
-            'plugin_name',
111
-            'plugin_slug',
112
-            'plugin_path',
113
-            'plugin_url',
114
-            'remote_url',
115
-            'version',
116
-            'key'
117
-        );
118
-        foreach ( $accepted_args as $arg ) {
119
-            $this->$arg = $config[$arg];
120
-        }
121
-
122
-        // If the user cannot update plugins, stop processing here.
123
-        if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) {
124
-            return;
125
-        }
126
-
127
-        // If it's our site, then return so we don't redirect loop.
128
-        if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) {
129
-            return;
130
-        }
131
-
132
-        // Load the updater hooks and filters.
133
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) );
134
-
135
-        add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
136
-        add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
137
-
138
-        // ManageWP premium update filters
139
-        //add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) );
140
-        //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) );
108
+	// Set class properties.
109
+	$accepted_args = array(
110
+	    'plugin_name',
111
+	    'plugin_slug',
112
+	    'plugin_path',
113
+	    'plugin_url',
114
+	    'remote_url',
115
+	    'version',
116
+	    'key'
117
+	);
118
+	foreach ( $accepted_args as $arg ) {
119
+	    $this->$arg = $config[$arg];
120
+	}
121
+
122
+	// If the user cannot update plugins, stop processing here.
123
+	if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) {
124
+	    return;
125
+	}
126
+
127
+	// If it's our site, then return so we don't redirect loop.
128
+	if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) {
129
+	    return;
130
+	}
131
+
132
+	// Load the updater hooks and filters.
133
+	add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) );
134
+
135
+	add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
136
+	add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
137
+
138
+	// ManageWP premium update filters
139
+	//add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) );
140
+	//add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) );
141 141
     }
142 142
 
143 143
     /**
@@ -150,33 +150,33 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function update_plugins_filter( $value ) {
152 152
 
153
-        // If no update object exists, return early.
154
-        if ( empty( $value ) ) {
155
-            return $value;
156
-        }
157
-
158
-        // Run update check by pinging the external API. If it fails, return the default update object.
159
-        if ( ! $this->update ) {
160
-            $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
161
-            if ( ! $this->update || ! empty( $this->update->error ) ) {
162
-                $this->update = false;
163
-                return $value;
164
-            }
165
-        }
166
-
167
-        // Infuse the update object with our data if the version from the remote API is newer.
168
-        if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) {
169
-            // The $plugin_update object contains new_version, package, slug and last_update keys.
170
-            //$this->update->full_slug             = $this->plugin_slug;
171
-            //$this->update->name                  = $this->plugin_name;
172
-            $this->update->monsterinsights_plugin  = true;
173
-            $this->update->old_version             = $this->version;
174
-            $this->update->plugin                  = $this->plugin_path;
175
-            $value->response[$this->plugin_path]   = $this->update;
176
-        }
177
-
178
-        // Return the update object.
179
-        return $value;
153
+	// If no update object exists, return early.
154
+	if ( empty( $value ) ) {
155
+	    return $value;
156
+	}
157
+
158
+	// Run update check by pinging the external API. If it fails, return the default update object.
159
+	if ( ! $this->update ) {
160
+	    $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
161
+	    if ( ! $this->update || ! empty( $this->update->error ) ) {
162
+		$this->update = false;
163
+		return $value;
164
+	    }
165
+	}
166
+
167
+	// Infuse the update object with our data if the version from the remote API is newer.
168
+	if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) {
169
+	    // The $plugin_update object contains new_version, package, slug and last_update keys.
170
+	    //$this->update->full_slug             = $this->plugin_slug;
171
+	    //$this->update->name                  = $this->plugin_name;
172
+	    $this->update->monsterinsights_plugin  = true;
173
+	    $this->update->old_version             = $this->version;
174
+	    $this->update->plugin                  = $this->plugin_path;
175
+	    $value->response[$this->plugin_path]   = $this->update;
176
+	}
177
+
178
+	// Return the update object.
179
+	return $value;
180 180
 
181 181
     }
182 182
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function http_request_args( $args, $url ) {
193 193
 
194
-        // If this is an SSL request and we are performing an upgrade routine, disable SSL verification.
195
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) {
196
-            $args['sslverify'] = false;
197
-        }
194
+	// If this is an SSL request and we are performing an upgrade routine, disable SSL verification.
195
+	if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) {
196
+	    $args['sslverify'] = false;
197
+	}
198 198
 
199
-        return $args;
199
+	return $args;
200 200
 
201 201
     }
202 202
 
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function plugins_api( $api, $action = '', $args = null ) {
215 215
 
216
-        $plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug );
216
+	$plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug );
217 217
 
218
-        // If our plugin matches the request, set our own plugin data, else return the default response.
219
-        if ( $plugin ) {
220
-            return $this->set_plugins_api( $api );
221
-        } else {
222
-            return $api;
223
-        }
218
+	// If our plugin matches the request, set our own plugin data, else return the default response.
219
+	if ( $plugin ) {
220
+	    return $this->set_plugins_api( $api );
221
+	} else {
222
+	    return $api;
223
+	}
224 224
 
225 225
     }
226 226
 
@@ -234,82 +234,82 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public function set_plugins_api( $default_api ) {
236 236
 
237
-        // Perform the remote request to retrieve our plugin information. If it fails, return the default object.
238
-        if ( ! $this->info ) {
239
-            $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
240
-            if ( ! $this->info || ! empty( $this->info->error ) ) {
241
-                $this->info = false;
242
-                return $default_api;
243
-            }
244
-        }
245
-
246
-        // Create a new stdClass object and populate it with our plugin information.
247
-        $api                        = new stdClass;
248
-        $api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
249
-        $api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
250
-        $api->version               = isset( $this->info->version )        ? $this->info->version        : '';
251
-        $api->author                = isset( $this->info->author )         ? $this->info->author         : '';
252
-        $api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
253
-        $api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
254
-        $api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
255
-        $api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
256
-        $api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
257
-
258
-        $changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
259
-        $description                = isset( $this->info->description )    ? $this->info->description     : '';
260
-
261
-        if ( ! empty( $changelog ) ) {
262
-             if ( ! empty( $description ) ) {
263
-                $api->sections['description'] = $description;
264
-                $api->sections['changelog']   = $changelog;
265
-             } else {
266
-                $api->sections['changelog']   = $changelog;
267
-             }
268
-        } else if ( ! empty( $description ) ) {
269
-            $api->sections['description'] = $description;
270
-        } else {
271
-            $api->sections = array();
272
-        }     
273
-
274
-        $api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
275
-
276
-        // Return the new API object with our custom data.
277
-        return $api;
237
+	// Perform the remote request to retrieve our plugin information. If it fails, return the default object.
238
+	if ( ! $this->info ) {
239
+	    $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
240
+	    if ( ! $this->info || ! empty( $this->info->error ) ) {
241
+		$this->info = false;
242
+		return $default_api;
243
+	    }
244
+	}
245
+
246
+	// Create a new stdClass object and populate it with our plugin information.
247
+	$api                        = new stdClass;
248
+	$api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
249
+	$api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
250
+	$api->version               = isset( $this->info->version )        ? $this->info->version        : '';
251
+	$api->author                = isset( $this->info->author )         ? $this->info->author         : '';
252
+	$api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
253
+	$api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
254
+	$api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
255
+	$api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
256
+	$api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
257
+
258
+	$changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
259
+	$description                = isset( $this->info->description )    ? $this->info->description     : '';
260
+
261
+	if ( ! empty( $changelog ) ) {
262
+	     if ( ! empty( $description ) ) {
263
+		$api->sections['description'] = $description;
264
+		$api->sections['changelog']   = $changelog;
265
+	     } else {
266
+		$api->sections['changelog']   = $changelog;
267
+	     }
268
+	} else if ( ! empty( $description ) ) {
269
+	    $api->sections['description'] = $description;
270
+	} else {
271
+	    $api->sections = array();
272
+	}     
273
+
274
+	$api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
275
+
276
+	// Return the new API object with our custom data.
277
+	return $api;
278 278
 
279 279
     }
280 280
 
281 281
     // Integration with ManageWP
282 282
     public function premium_update_push( $premium_update ) {
283
-        if ( ! function_exists( 'get_plugin_data' ) ) {
284
-            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
285
-        }
286
-
287
-        $update = $this->set_plugins_api( array() );
288
-        if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
289
-            $plugin_data                = get_plugin_data( $update->slug );
290
-            $plugin_data['type']        = 'plugin';
291
-            $plugin_data['slug']        = $update->slug;
292
-            $plugin_data['new_version'] = $update->version;
293
-            $premium_update[]           = $plugin_data;
294
-        }
295
-        return $premium_update;
283
+	if ( ! function_exists( 'get_plugin_data' ) ) {
284
+	    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
285
+	}
286
+
287
+	$update = $this->set_plugins_api( array() );
288
+	if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
289
+	    $plugin_data                = get_plugin_data( $update->slug );
290
+	    $plugin_data['type']        = 'plugin';
291
+	    $plugin_data['slug']        = $update->slug;
292
+	    $plugin_data['new_version'] = $update->version;
293
+	    $premium_update[]           = $plugin_data;
294
+	}
295
+	return $premium_update;
296 296
     }
297 297
 
298 298
     // Integration with ManageWP
299 299
     public function premium_update( $premium_update ) {
300
-        if ( ! function_exists( 'get_plugin_data' ) ) {
301
-            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
302
-        }
303
-
304
-        $update = $this->set_plugins_api( array() );
305
-        if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
306
-            $plugin_data                = get_plugin_data( $update->slug );
307
-            $plugin_data['type']        = 'plugin';
308
-            $plugin_data['slug']        = $update->slug;
309
-            $plugin_data['url']         = $update->download_link; // OR provide your own callback function for managing the update
310
-            array_push( $premium_update, $plugin_data );
311
-        }
312
-        return $premium_update;
300
+	if ( ! function_exists( 'get_plugin_data' ) ) {
301
+	    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
302
+	}
303
+
304
+	$update = $this->set_plugins_api( array() );
305
+	if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
306
+	    $plugin_data                = get_plugin_data( $update->slug );
307
+	    $plugin_data['type']        = 'plugin';
308
+	    $plugin_data['slug']        = $update->slug;
309
+	    $plugin_data['url']         = $update->download_link; // OR provide your own callback function for managing the update
310
+	    array_push( $premium_update, $plugin_data );
311
+	}
312
+	return $premium_update;
313 313
     }
314 314
 
315 315
     /**
@@ -325,47 +325,47 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public function perform_remote_request( $action, $body = array(), $headers = array(), $return_format = 'json' ) {
327 327
 
328
-        // Build the body of the request.
329
-        $body = wp_parse_args(
330
-            $body,
331
-            array(
332
-                'tgm-updater-action'     => $action,
333
-                'tgm-updater-key'        => $this->key,
334
-                'tgm-updater-wp-version' => get_bloginfo( 'version' ),
335
-                'tgm-updater-referer'    => site_url(),
336
-                'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
337
-                'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
338
-            )
339
-        );
340
-        $body = http_build_query( $body, '', '&' );
341
-
342
-        // Build the headers of the request.
343
-        $headers = wp_parse_args(
344
-            $headers,
345
-            array(
346
-                'Content-Type'   => 'application/x-www-form-urlencoded',
347
-                'Content-Length' => strlen( $body )
348
-            )
349
-        );
350
-
351
-        // Setup variable for wp_remote_post.
352
-        $post = array(
353
-            'headers' => $headers,
354
-            'body'    => $body
355
-        );
356
-
357
-        // Perform the query and retrieve the response.
358
-        $response      = wp_remote_post( esc_url_raw( $this->remote_url ), $post );
359
-        $response_code = wp_remote_retrieve_response_code( $response );
360
-        $response_body = wp_remote_retrieve_body( $response );
361
-
362
-        // Bail out early if there are any errors.
363
-        if ( 200 != $response_code || is_wp_error( $response_body ) ) {
364
-            return false;
365
-        }
366
-
367
-        // Return the json decoded content.
368
-        return json_decode( $response_body );
328
+	// Build the body of the request.
329
+	$body = wp_parse_args(
330
+	    $body,
331
+	    array(
332
+		'tgm-updater-action'     => $action,
333
+		'tgm-updater-key'        => $this->key,
334
+		'tgm-updater-wp-version' => get_bloginfo( 'version' ),
335
+		'tgm-updater-referer'    => site_url(),
336
+		'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
337
+		'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
338
+	    )
339
+	);
340
+	$body = http_build_query( $body, '', '&' );
341
+
342
+	// Build the headers of the request.
343
+	$headers = wp_parse_args(
344
+	    $headers,
345
+	    array(
346
+		'Content-Type'   => 'application/x-www-form-urlencoded',
347
+		'Content-Length' => strlen( $body )
348
+	    )
349
+	);
350
+
351
+	// Setup variable for wp_remote_post.
352
+	$post = array(
353
+	    'headers' => $headers,
354
+	    'body'    => $body
355
+	);
356
+
357
+	// Perform the query and retrieve the response.
358
+	$response      = wp_remote_post( esc_url_raw( $this->remote_url ), $post );
359
+	$response_code = wp_remote_retrieve_response_code( $response );
360
+	$response_body = wp_remote_retrieve_body( $response );
361
+
362
+	// Bail out early if there are any errors.
363
+	if ( 200 != $response_code || is_wp_error( $response_body ) ) {
364
+	    return false;
365
+	}
366
+
367
+	// Return the json decoded content.
368
+	return json_decode( $response_body );
369 369
 
370 370
     }
371 371
 }
372 372
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/licensing/autoupdate.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
 
14 14
     // If this is multisite and is not on the main site, return early.
15 15
     if ( is_multisite() && ! is_main_site() ) {
16
-        return $update;
16
+	return $update;
17 17
     }
18 18
     
19 19
     // If we don't have everything we need, return early.
20 20
     $item = (array) $item;
21 21
     if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
22
-        return $update;
22
+	return $update;
23 23
     }
24 24
 
25 25
     // If the plugin isn't ours, return early.
26 26
     $is_free = 'google-analytics-for-wordpress' === $item['slug'];
27 27
     $is_paid = isset( $item['monsterinsights_plugin'] ); // see updater class
28 28
     if ( ! $is_free && ! $is_paid ) {
29
-        return $update;
29
+	return $update;
30 30
     }
31 31
 
32 32
     $version           = $is_free ? MONSTERINSIGHTS_LITE_VERSION : $item['old_version'];
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
     
37 37
     // If the opt in update allows major updates but there is no major version update, return early.
38 38
     if ( $current_major < $new_major ) {
39
-        if ( $automatic_updates === 'all' ) {
40
-            return true;
41
-        } else {
42
-            return $update;
43
-        }
39
+	if ( $automatic_updates === 'all' ) {
40
+	    return true;
41
+	} else {
42
+	    return $update;
43
+	}
44 44
     }
45 45
     
46 46
     // If the opt in update allows minor updates but there is no minor version update, return early.
47 47
     if ( $current_major == $new_major ) {
48
-        if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
49
-            return true;
50
-        } else {
51
-            return $update;
52
-        }
48
+	if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
49
+	    return true;
50
+	} else {
51
+	    return $update;
52
+	}
53 53
     }
54 54
 
55 55
     // All our checks have passed - this plugin can be updated!
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 function monsterinsights_get_major_version( $version ) {
88 88
     $exploded_version = explode( '.', $version );
89 89
     if ( isset( $exploded_version[2] ) ) {
90
-        return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
90
+	return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
91 91
     } else {
92
-        return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
92
+	return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
93 93
     }
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/ajax.php 4 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134
-        if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
134
+        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
135 135
             $activate = activate_plugin( $_POST['plugin'], NULL, true );
136 136
         } else {
137 137
             $activate = activate_plugin( $_POST['plugin'] );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         wp_die();
220 220
     }
221 221
 
222
-    $url     = 'https://www.googleapis.com/urlshortener/v1/url';
222
+    $url = 'https://www.googleapis.com/urlshortener/v1/url';
223 223
 
224 224
     // If no url passed die
225 225
     if ( ! $shorten ) {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     }
229 229
 
230 230
     // if the url is already shortened, don't re-run
231
-    if ( strpos( $shorten, 'goo.g') !== false ) {
231
+    if ( strpos( $shorten, 'goo.g' ) !== false ) {
232 232
         echo $shorten;
233 233
         wp_die();
234 234
     }
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
             'https://www.googleapis.com/urlshortener/v1/url'
241 241
         ), 
242 242
         array(
243
-            'body' => json_encode( array('longUrl' => esc_url_raw( $shorten ) ) ),
244
-            'headers' => array( 'Content-Type' => 'application/json')
243
+            'body' => json_encode( array( 'longUrl' => esc_url_raw( $shorten ) ) ),
244
+            'headers' => array( 'Content-Type' => 'application/json' )
245 245
         )
246 246
     );
247 247
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 
167 167
     // Deactivate the addon.
168 168
     if ( isset( $_POST['plugin'] ) ) {
169
-        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
169
+        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
170 170
             $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171 171
         } else {
172 172
             $deactivate = deactivate_plugins( $_POST['plugin'] );
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134 134
         if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
-            $activate = activate_plugin( $_POST['plugin'], NULL, true );
135
+            $activate = activate_plugin( $_POST['plugin'], null, true );
136 136
         } else {
137 137
             $activate = activate_plugin( $_POST['plugin'] );
138 138
         }
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -51,60 +51,60 @@  discard block
 block discarded – undo
51 51
     check_ajax_referer( 'monsterinsights-install', 'nonce' );
52 52
 
53 53
     if ( ! current_user_can( 'install_plugins' ) ) {
54
-        echo json_encode( true );
54
+	echo json_encode( true );
55 55
     }
56 56
 
57 57
     // Install the addon.
58 58
     if ( isset( $_POST['plugin'] ) ) {
59
-        $download_url = $_POST['plugin'];
60
-        global $hook_suffix;
61
-
62
-        // Set the current screen to avoid undefined notices.
63
-        set_current_screen();
64
-
65
-        // Prepare variables.
66
-        $method = '';
67
-        $url    = add_query_arg(
68
-            array(
69
-                'page' => 'monsterinsights-settings'
70
-            ),
71
-            admin_url( 'admin.php' )
72
-        );
73
-        $url = esc_url( $url );
74
-
75
-        // Start output bufferring to catch the filesystem form if credentials are needed.
76
-        ob_start();
77
-        if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
78
-            $form = ob_get_clean();
79
-            echo json_encode( array( 'form' => $form ) );
80
-            wp_die();
81
-        }
82
-
83
-        // If we are not authenticated, make it happen now.
84
-        if ( ! WP_Filesystem( $creds ) ) {
85
-            ob_start();
86
-            request_filesystem_credentials( $url, $method, true, false, null );
87
-            $form = ob_get_clean();
88
-            echo json_encode( array( 'form' => $form ) );
89
-            wp_die();
90
-        }
91
-
92
-        // We do not need any extra credentials if we have gotten this far, so let's install the plugin.
93
-        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
-        $base = MonsterInsights();
95
-        require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php';
59
+	$download_url = $_POST['plugin'];
60
+	global $hook_suffix;
61
+
62
+	// Set the current screen to avoid undefined notices.
63
+	set_current_screen();
64
+
65
+	// Prepare variables.
66
+	$method = '';
67
+	$url    = add_query_arg(
68
+	    array(
69
+		'page' => 'monsterinsights-settings'
70
+	    ),
71
+	    admin_url( 'admin.php' )
72
+	);
73
+	$url = esc_url( $url );
74
+
75
+	// Start output bufferring to catch the filesystem form if credentials are needed.
76
+	ob_start();
77
+	if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
78
+	    $form = ob_get_clean();
79
+	    echo json_encode( array( 'form' => $form ) );
80
+	    wp_die();
81
+	}
82
+
83
+	// If we are not authenticated, make it happen now.
84
+	if ( ! WP_Filesystem( $creds ) ) {
85
+	    ob_start();
86
+	    request_filesystem_credentials( $url, $method, true, false, null );
87
+	    $form = ob_get_clean();
88
+	    echo json_encode( array( 'form' => $form ) );
89
+	    wp_die();
90
+	}
91
+
92
+	// We do not need any extra credentials if we have gotten this far, so let's install the plugin.
93
+	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
+	$base = MonsterInsights();
95
+	require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php';
96 96
         
97
-        // Create the plugin upgrader with our custom skin.
98
-        $installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() );
99
-        $installer->install( $download_url );
100
-
101
-        // Flush the cache and return the newly installed plugin basename.
102
-        wp_cache_flush();
103
-        if ( $installer->plugin_info() ) {
104
-            $plugin_basename = $installer->plugin_info();
105
-            echo json_encode( array( 'plugin' => $plugin_basename ) );
106
-            wp_die();
107
-        }
97
+	// Create the plugin upgrader with our custom skin.
98
+	$installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() );
99
+	$installer->install( $download_url );
100
+
101
+	// Flush the cache and return the newly installed plugin basename.
102
+	wp_cache_flush();
103
+	if ( $installer->plugin_info() ) {
104
+	    $plugin_basename = $installer->plugin_info();
105
+	    echo json_encode( array( 'plugin' => $plugin_basename ) );
106
+	    wp_die();
107
+	}
108 108
     }
109 109
 
110 110
     // Send back a response.
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
     check_ajax_referer( 'monsterinsights-activate', 'nonce' );
127 127
 
128 128
     if ( ! current_user_can( 'activate_plugins' ) ) {
129
-        echo json_encode( true );
129
+	echo json_encode( true );
130 130
     }
131 131
 
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134
-        if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
-            $activate = activate_plugin( $_POST['plugin'], NULL, true );
136
-        } else {
137
-            $activate = activate_plugin( $_POST['plugin'] );
138
-        }
139
-
140
-        if ( is_wp_error( $activate ) ) {
141
-            echo json_encode( array( 'error' => $activate->get_error_message() ) );
142
-            wp_die();
143
-        }
134
+	if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
+	    $activate = activate_plugin( $_POST['plugin'], NULL, true );
136
+	} else {
137
+	    $activate = activate_plugin( $_POST['plugin'] );
138
+	}
139
+
140
+	if ( is_wp_error( $activate ) ) {
141
+	    echo json_encode( array( 'error' => $activate->get_error_message() ) );
142
+	    wp_die();
143
+	}
144 144
     }
145 145
 
146 146
     echo json_encode( true );
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
     check_ajax_referer( 'monsterinsights-deactivate', 'nonce' );
162 162
 
163 163
     if ( ! current_user_can( 'activate_plugins' ) ) {
164
-        echo json_encode( true );
164
+	echo json_encode( true );
165 165
     }
166 166
 
167 167
     // Deactivate the addon.
168 168
     if ( isset( $_POST['plugin'] ) ) {
169
-        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
170
-            $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171
-        } else {
172
-            $deactivate = deactivate_plugins( $_POST['plugin'] );
173
-        }
169
+	if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
170
+	    $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171
+	} else {
172
+	    $deactivate = deactivate_plugins( $_POST['plugin'] );
173
+	}
174 174
     }
175 175
 
176 176
     echo json_encode( true );
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
     // Deactivate the notice
195 195
     if ( isset( $_POST['notice'] ) ) {
196
-        // Init the notice class and mark notice as deactivated
197
-        MonsterInsights()->notices->dismiss( $_POST['notice'] );
196
+	// Init the notice class and mark notice as deactivated
197
+	MonsterInsights()->notices->dismiss( $_POST['notice'] );
198 198
 
199
-        // Return true
200
-        echo json_encode( true );
201
-        wp_die();
199
+	// Return true
200
+	echo json_encode( true );
201
+	wp_die();
202 202
     }
203 203
 
204 204
     // If here, an error occurred
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 
216 216
     $shorten = ! empty( $_POST['url'] ) ? esc_url_raw( $_POST['url'] ) : '';
217 217
     if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
218
-        echo $shorten;
219
-        wp_die();
218
+	echo $shorten;
219
+	wp_die();
220 220
     }
221 221
 
222 222
     $url     = 'https://www.googleapis.com/urlshortener/v1/url';
223 223
 
224 224
     // If no url passed die
225 225
     if ( ! $shorten ) {
226
-        echo $shorten;
227
-        wp_die();
226
+	echo $shorten;
227
+	wp_die();
228 228
     }
229 229
 
230 230
     // if the url is already shortened, don't re-run
231 231
     if ( strpos( $shorten, 'goo.g') !== false ) {
232
-        echo $shorten;
233
-        wp_die();
232
+	echo $shorten;
233
+	wp_die();
234 234
     }
235 235
     
236 236
     $result = wp_remote_post(
237
-        add_query_arg(
238
-            'key', 
239
-            'AIzaSyCfHOlx8NbBVSpmHPqxophzULWSAzWDyio', 
240
-            'https://www.googleapis.com/urlshortener/v1/url'
241
-        ), 
242
-        array(
243
-            'body' => json_encode( array('longUrl' => esc_url_raw( $shorten ) ) ),
244
-            'headers' => array( 'Content-Type' => 'application/json')
245
-        )
237
+	add_query_arg(
238
+	    'key', 
239
+	    'AIzaSyCfHOlx8NbBVSpmHPqxophzULWSAzWDyio', 
240
+	    'https://www.googleapis.com/urlshortener/v1/url'
241
+	), 
242
+	array(
243
+	    'body' => json_encode( array('longUrl' => esc_url_raw( $shorten ) ) ),
244
+	    'headers' => array( 'Content-Type' => 'application/json')
245
+	)
246 246
     );
247 247
 
248 248
     if ( is_wp_error( $result ) ) {
249
-        echo $shorten;
250
-        wp_die();
249
+	echo $shorten;
250
+	wp_die();
251 251
     }
252 252
     $result = json_decode( $result['body'] );
253 253
     $shortlink = $result->id;
Please login to merge, or discard this patch.
includes/admin/common.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -390,7 +390,7 @@
 block discarded – undo
390 390
 	return $shareasale_id;
391 391
 }
392 392
 
393
-function monsterinsights_settings_ublock_error_js(){
393
+function monsterinsights_settings_ublock_error_js() {
394 394
 	echo "<script type='text/javascript'>\n";
395 395
 	echo "jQuery( document ).ready( function( $ ) {
396 396
 			if ( window.uorigindetected == null){
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -151,26 +151,26 @@  discard block
 block discarded – undo
151 151
 				'copytoclip'       				=> esc_html__( 'Copy to Clipboard', 'google-analytics-for-wordpress' ),
152 152
 				'failed'           				=> esc_html__( 'Failed!', 'google-analytics-for-wordpress' ),
153 153
 				'admin_nonce'      				=> wp_create_nonce( 'mi-admin-nonce' ),
154
-				'shorten'         				=> esc_html__( 'Shorten URL' ,'google-analytics-for-wordpress'),
155
-				'shortened'        				=> esc_html__( 'Shortened!' ,'google-analytics-for-wordpress'),
156
-				'working'          				=> esc_html__( 'Working...' ,'google-analytics-for-wordpress'),
157
-				'importtext'       				=> esc_html__( 'Import' ,'google-analytics-for-wordpress'),
158
-				'imported'         				=> esc_html__( 'Imported!' ,'google-analytics-for-wordpress'),
159
-				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:' ,'google-analytics-for-wordpress'),
160
-				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds." ,'google-analytics-for-wordpress'),
161
-				'redirect_loading_error_title'  => esc_html__( "Authentication Error:" ,'google-analytics-for-wordpress'),
162
-				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....' ,'google-analytics-for-wordpress'),
163
-				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
164
-				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:" ,'google-analytics-for-wordpress'),
165
-				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!' ,'google-analytics-for-wordpress'),
166
-				'deauth_success_text_text'   	=> esc_html__( "You've disconnected your site from MonsterInsights. Your site is no longer being tracked by Google Analytics and you won't see reports anymore." ,'google-analytics-for-wordpress'),
167
-				'verify_loading_title_text'  	=> esc_html__( 'Verifying....' ,'google-analytics-for-wordpress'),
168
-				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
169
-				'verify_loading_error_title' 	=> esc_html__( "Verification Error:" ,'google-analytics-for-wordpress'),
170
-				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!' ,'google-analytics-for-wordpress'),
171
-				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!" ,'google-analytics-for-wordpress'),
172
-				'ok_text' 						=> esc_html__( "OK" ,'google-analytics-for-wordpress'),
173
-				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate" ,'google-analytics-for-wordpress'),
154
+				'shorten'         				=> esc_html__( 'Shorten URL', 'google-analytics-for-wordpress' ),
155
+				'shortened'        				=> esc_html__( 'Shortened!', 'google-analytics-for-wordpress' ),
156
+				'working'          				=> esc_html__( 'Working...', 'google-analytics-for-wordpress' ),
157
+				'importtext'       				=> esc_html__( 'Import', 'google-analytics-for-wordpress' ),
158
+				'imported'         				=> esc_html__( 'Imported!', 'google-analytics-for-wordpress' ),
159
+				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:', 'google-analytics-for-wordpress' ),
160
+				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
161
+				'redirect_loading_error_title'  => esc_html__( "Authentication Error:", 'google-analytics-for-wordpress' ),
162
+				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....', 'google-analytics-for-wordpress' ),
163
+				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
164
+				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:", 'google-analytics-for-wordpress' ),
165
+				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!', 'google-analytics-for-wordpress' ),
166
+				'deauth_success_text_text'   	=> esc_html__( "You've disconnected your site from MonsterInsights. Your site is no longer being tracked by Google Analytics and you won't see reports anymore.", 'google-analytics-for-wordpress' ),
167
+				'verify_loading_title_text'  	=> esc_html__( 'Verifying....', 'google-analytics-for-wordpress' ),
168
+				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
169
+				'verify_loading_error_title' 	=> esc_html__( "Verification Error:", 'google-analytics-for-wordpress' ),
170
+				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!', 'google-analytics-for-wordpress' ),
171
+				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!", 'google-analytics-for-wordpress' ),
172
+				'ok_text' 						=> esc_html__( "OK", 'google-analytics-for-wordpress' ),
173
+				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate", 'google-analytics-for-wordpress' ),
174 174
 				'refresh_report_title'          => esc_html__( 'Refreshing Report', 'ga-premium' ),
175 175
 				'refresh_report_text'           => esc_html__( 'Loading new report data...', 'ga-premium' ),
176 176
 				'refresh_report_success_text'   => esc_html__( 'Success', 'ga-premium' ),
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		'kad_admin_js', // Pinnacle theme
224 224
 		'dt-chart', // DesignThemes core features plugin
225 225
 		'tweeetshare_font_script', // TweetShare - Click To Tweet
226
-		'tweeetshare_jquery_script',  // TweetShare - Click To Tweet
226
+		'tweeetshare_jquery_script', // TweetShare - Click To Tweet
227 227
 		'tweeetshare_jqueryui_script', // TweetShare - Click To Tweet
228 228
 		'tweeetshare_custom_script', // TweetShare - Click To Tweet
229 229
 		'imagify-promise-polyfill', // Imagify 
@@ -262,15 +262,15 @@  discard block
 block discarded – undo
262 262
 
263 263
 	global $wp_styles;
264 264
 	foreach ( $wp_styles->queue as $handle ) {
265
-		if ( strpos( $wp_styles->registered[$handle]->src, 'wp-content') === false ) {
265
+		if ( strpos( $wp_styles->registered[$handle]->src, 'wp-content' ) === false ) {
266 266
 			return;
267 267
 		}
268 268
 		
269
-		if ( strpos( $wp_styles->registered[$handle]->handle, 'monsterinsights') !== false ) {
269
+		if ( strpos( $wp_styles->registered[$handle]->handle, 'monsterinsights' ) !== false ) {
270 270
 			return;
271 271
 		}
272 272
 
273
-		foreach( $third_party as $partial ) {
273
+		foreach ( $third_party as $partial ) {
274 274
 			if ( strpos( $wp_styles->registered[$handle]->handle, $partial ) !== false ) {
275 275
 				wp_dequeue_style( $handle ); // Remove css file from MI screen
276 276
 				wp_deregister_style( $handle );
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 
286 286
 	global $wp_scripts;
287 287
 	foreach ( $wp_scripts->queue as $handle ) {
288
-		if ( strpos( $wp_scripts->registered[$handle]->src, 'wp-content') === false ) {
288
+		if ( strpos( $wp_scripts->registered[$handle]->src, 'wp-content' ) === false ) {
289 289
 			return;
290 290
 		}
291 291
 		
292
-		if ( strpos( $wp_scripts->registered[$handle]->handle, 'monsterinsights') !== false ) {
292
+		if ( strpos( $wp_scripts->registered[$handle]->handle, 'monsterinsights' ) !== false ) {
293 293
 			return;
294 294
 		}
295 295
 
296
-		foreach( $third_party as $partial ) {
296
+		foreach ( $third_party as $partial ) {
297 297
 			if ( strpos( $wp_scripts->registered[$handle]->handle, $partial ) !== false ) {
298 298
 				wp_dequeue_script( $handle ); // Remove JS file from MI screen
299 299
 				wp_deregister_script( $handle );
@@ -316,65 +316,65 @@  discard block
 block discarded – undo
316 316
  *
317 317
  * @return null Return early if not on the proper screen.
318 318
  */
319
-function hide_non_monsterinsights_warnings () {
319
+function hide_non_monsterinsights_warnings() {
320 320
 	// Bail if we're not on a MonsterInsights screen.
321 321
 	if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'monsterinsights' ) === false ) {
322 322
 		return;
323 323
 	}
324 324
 
325 325
 	global $wp_filter;
326
-	if ( !empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
327
-		foreach( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
326
+	if ( ! empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
327
+		foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
328 328
 			foreach ( $hooks as $name => $arr ) {
329 329
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
330
-					unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
330
+					unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] );
331 331
 					continue;
332 332
 				}
333 333
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
334 334
 					continue;
335 335
 				}
336
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
336
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
337 337
 					unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] );
338 338
 				}
339 339
 			}
340 340
 		}
341 341
 	}
342 342
 
343
-	if ( !empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
344
-		foreach( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
343
+	if ( ! empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
344
+		foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
345 345
 			foreach ( $hooks as $name => $arr ) {
346 346
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
347
-					unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
347
+					unset( $wp_filter['admin_notices']->callbacks[$priority][$name] );
348 348
 					continue;
349 349
 				}
350 350
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
351 351
 					continue;
352 352
 				}
353
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
353
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
354 354
 					unset( $wp_filter['admin_notices']->callbacks[$priority][$name] );
355 355
 				}
356 356
 			}
357 357
 		}
358 358
 	}
359 359
 
360
-	if ( !empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
361
-		foreach( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
360
+	if ( ! empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
361
+		foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
362 362
 			foreach ( $hooks as $name => $arr ) {
363 363
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
364
-					unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
364
+					unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] );
365 365
 					continue;
366 366
 				}
367 367
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
368 368
 					continue;
369 369
 				}
370
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
370
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
371 371
 					unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] );
372 372
 				}
373 373
 			}
374 374
 		}
375 375
 	}
376 376
 }
377
-add_action('admin_print_scripts', 'hide_non_monsterinsights_warnings');  
377
+add_action( 'admin_print_scripts', 'hide_non_monsterinsights_warnings' );  
378 378
 
379 379
 /**
380 380
  * Called whenever an upgrade button / link is displayed in Lite, this function will
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	return $shareasale_id;
436 436
 }
437 437
 
438
-function monsterinsights_settings_ublock_error_js(){
438
+function monsterinsights_settings_ublock_error_js() {
439 439
 	echo "<script type='text/javascript'>\n";
440 440
 	echo "jQuery( document ).ready( function( $ ) {
441 441
 			if ( window.uorigindetected == null){
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 }
452 452
 
453 453
 function monsterinsights_ublock_notice() {
454
-	ob_start();?>
454
+	ob_start(); ?>
455 455
 	<div id="monsterinsights-ublock-origin-error" class="error inline" style="display:none;">
456
-		<?php echo sprintf( esc_html__( 'MonsterInsights has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of MonsterInsights. To solve this, ensure MonsterInsights is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/docs/monsterinsights-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://monsterinsights.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">');
456
+		<?php echo sprintf( esc_html__( 'MonsterInsights has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of MonsterInsights. To solve this, ensure MonsterInsights is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/docs/monsterinsights-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://monsterinsights.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' );
457 457
 		?>
458 458
 	</div>
459 459
 	<?php
Please login to merge, or discard this patch.