Passed
Push — master ( 82fe3a...5c0e99 )
by Chris
03:23
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/register-settings.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 			)
174 174
 		),
175 175
 		/** Demographics Settings */
176
-		'demographics' => apply_filters('monsterinsights_settings_demographics',
176
+		'demographics' => apply_filters( 'monsterinsights_settings_demographics',
177 177
 			array(
178 178
 				'demographics' => array(
179 179
 					'id'          => 'demographics',
180 180
 					'name'        => __( 'Enable Demographics and Interests Reports for Remarketing and Advertising', 'google-analytics-for-wordpress' ),
181 181
 					'desc'        => sprintf( esc_html__( 'Check this setting to add the Demographics and Remarketing features to your Google Analytics tracking code. Make sure to enable Demographics and Remarketing in your Google Analaytics account. We have a guide for how to do that in our %1$sknowledge base%2$s. For more information about Remarketing, we refer you to %3$sGoogle\'s documentation%2$s.', 'google-analytics-for-wordpress. Note that usage of this function is affected by privacy and cookie laws around the world. Be sure to follow the laws that affect your target audience.' ), '<a href="https://www.monsterinsights.com/docs/enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&amp;utm_source=gawp-config&amp;utm_campaign=wpgaplugin" target="_blank" rel="noopener noreferrer" referrer="no-referrer">',
182
-									'</a>','<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">'
182
+									'</a>', '<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">'
183 183
 					),
184 184
 					'type' 		  => 'checkbox',
185 185
 				),
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 			)
193 193
 		),
194 194
 		/** Enhanced Link Attribution Settings */
195
-		'links' => apply_filters('monsterinsights_settings_links',
195
+		'links' => apply_filters( 'monsterinsights_settings_links',
196 196
 			array(
197 197
 				'enhanced_link_attribution' => array(
198 198
 					'id'          => 'enhanced_link_attribution',
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			)
228 228
 		),
229 229
 		/** File Download Settings */
230
-		'files' => apply_filters('monsterinsights_settings_files',
230
+		'files' => apply_filters( 'monsterinsights_settings_files',
231 231
 			array(
232 232
 				'track_download_as' => array(
233 233
 					'id'          => 'track_download_as',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			)
250 250
 		),
251 251
 		/** Affiliate Tracking Settings */
252
-		'affiliates' => apply_filters('monsterinsights_settings_affiliates',
252
+		'affiliates' => apply_filters( 'monsterinsights_settings_affiliates',
253 253
 			array(
254 254
 				'track_internal_as_outbound' => array(
255 255
 					'id'          => 'track_internal_as_outbound',
@@ -266,68 +266,68 @@  discard block
 block discarded – undo
266 266
 			)
267 267
 		),
268 268
 		/** Social Tracking Settings */
269
-		'social' => apply_filters('monsterinsights_settings_social',
269
+		'social' => apply_filters( 'monsterinsights_settings_social',
270 270
 			array()
271 271
 		),
272 272
 		/** Ad Tracking Settings */
273
-		'ads' => apply_filters('monsterinsights_settings_ads',
273
+		'ads' => apply_filters( 'monsterinsights_settings_ads',
274 274
 			array()
275 275
 		),
276 276
 		/** Forms Tracking Settings */
277
-		'forms' => apply_filters('monsterinsights_settings_forms',
277
+		'forms' => apply_filters( 'monsterinsights_settings_forms',
278 278
 			array()
279 279
 		),
280 280
 		/** eCommerce Tracking Settings */
281
-		'ecommerce' => apply_filters('monsterinsights_settings_ecommerce',
281
+		'ecommerce' => apply_filters( 'monsterinsights_settings_ecommerce',
282 282
 			array()
283 283
 		),
284 284
 		/** Media Tracking Settings */
285
-		'media' => apply_filters('monsterinsights_settings_media',
285
+		'media' => apply_filters( 'monsterinsights_settings_media',
286 286
 			array()
287 287
 		),
288 288
 		/** Members Tracking Settings */
289
-		'memberships' => apply_filters('monsterinsights_settings_memberships',
289
+		'memberships' => apply_filters( 'monsterinsights_settings_memberships',
290 290
 			array()
291 291
 		),
292 292
 		/** Dimensions Tracking Settings */
293
-		'dimensions' => apply_filters('monsterinsights_settings_dimensions',
293
+		'dimensions' => apply_filters( 'monsterinsights_settings_dimensions',
294 294
 			array()
295 295
 		),
296 296
 		/** Performance Tracking Settings */
297
-		'performance' => apply_filters('monsterinsights_settings_performance',
297
+		'performance' => apply_filters( 'monsterinsights_settings_performance',
298 298
 			array()
299 299
 		),
300 300
 		/** AMP Tracking Settings */
301
-		'amp' => apply_filters('monsterinsights_settings_amp',
301
+		'amp' => apply_filters( 'monsterinsights_settings_amp',
302 302
 			array()
303 303
 		),
304 304
 		/** Google Optimize Tracking Settings */
305
-		'goptimize' => apply_filters('monsterinsights_settings_goptimize',
305
+		'goptimize' => apply_filters( 'monsterinsights_settings_goptimize',
306 306
 			array()
307 307
 		),
308 308
 		/** Facebook Instant Articles Tracking Settings */
309
-		'fbia' => apply_filters('monsterinsights_settings_fbia',
309
+		'fbia' => apply_filters( 'monsterinsights_settings_fbia',
310 310
 			array()
311 311
 		),
312 312
 		/** Bounce Reduction Settings */
313
-		'bounce' => apply_filters('monsterinsights_settings_bounce',
313
+		'bounce' => apply_filters( 'monsterinsights_settings_bounce',
314 314
 			array()
315 315
 		),
316 316
 		/** Reporting Tracking Settings */
317
-		'reporting' => apply_filters('monsterinsights_settings_reporting',
317
+		'reporting' => apply_filters( 'monsterinsights_settings_reporting',
318 318
 			array()
319 319
 		),
320 320
 		/** Notifications Tracking Settings */
321
-		'notifications' => apply_filters('monsterinsights_settings_notifications',
321
+		'notifications' => apply_filters( 'monsterinsights_settings_notifications',
322 322
 			array()
323 323
 		),
324 324
 		/** Compatibility Tracking Settings */
325
-		'compatibility' => apply_filters('monsterinsights_settings_compatibility',
325
+		'compatibility' => apply_filters( 'monsterinsights_settings_compatibility',
326 326
 			array(
327 327
 				'subdomain_tracking' => array(
328 328
 					'id'          => 'subdomain_tracking',
329 329
 					'name'        => __( 'Domain to track as:', 'google-analytics-for-wordpress' ),
330
-					'desc'        => sprintf( esc_html__( 'This allows you to %1$sset the domain%2$s that\'s used for tracking. Only is used if set to a value, else defaults to automatic determination. It is very rare that you would need to use this setting.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' ,'</a>' ),
330
+					'desc'        => sprintf( esc_html__( 'This allows you to %1$sset the domain%2$s that\'s used for tracking. Only is used if set to a value, else defaults to automatic determination. It is very rare that you would need to use this setting.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ),
331 331
 					'type' 		  => 'text',
332 332
 				),
333 333
 				'custom_code' => array(
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
 				'debug_mode' => array(
340 340
 					'id'          => 'debug_mode',
341 341
 					'name'        => __( 'Enable Debug Mode', 'google-analytics-for-wordpress' ),
342
-					'desc'        => __( 'Turns on debugging in JS events tracking, logging of eCommerce requests and enables debug settings.', 'google-analytics-for-wordpress'),
342
+					'desc'        => __( 'Turns on debugging in JS events tracking, logging of eCommerce requests and enables debug settings.', 'google-analytics-for-wordpress' ),
343 343
 					'type' 		  => 'checkbox',
344 344
 				),
345 345
 			)
346 346
 		),
347 347
 		/** Permissions Tracking Settings */
348
-		'permissions' => apply_filters('monsterinsights_settings_permissions',
348
+		'permissions' => apply_filters( 'monsterinsights_settings_permissions',
349 349
 			array(
350 350
 				'view_reports' => array(
351 351
 					'id'          => 'view_reports',
352 352
 					'name'        => __( 'Let these user roles see reports (and the dashboard):', 'google-analytics-for-wordpress' ),
353
-					'desc'        => sprintf( esc_html( 'Users that have at least one of these roles will be able to view the reports and dashboard, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>'),
353
+					'desc'        => sprintf( esc_html( 'Users that have at least one of these roles will be able to view the reports and dashboard, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>' ),
354 354
 					'type'        => 'select',
355 355
 					'options'     => monsterinsights_get_roles(),
356 356
 					'select2'     => true,
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 				'save_settings' => array(
361 361
 					'id'          => 'save_settings',
362 362
 					'name'        => __( 'Let these user roles save settings:', 'google-analytics-for-wordpress' ),
363
-					'desc'        => sprintf( esc_html__( 'Users that have at least one of these roles will be able to view and save the settings panel, along with any user with the %s capability.', 'google-analytics-for-wordpress'), '<code>manage_options</code>' ),
363
+					'desc'        => sprintf( esc_html__( 'Users that have at least one of these roles will be able to view and save the settings panel, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>' ),
364 364
 					'type'        => 'select',
365 365
 					'options'     => monsterinsights_get_roles(),
366 366
 					'select2'     => true,
Please login to merge, or discard this patch.
includes/admin/settings/tab-tracking.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,64 +29,64 @@  discard block
 block discarded – undo
29 29
         <!-- Tabs -->
30 30
         <h1 id="monsterinsights-settings-page-sub-nav" class="monsterinsights-sub-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-sub-pages">
31 31
             <?php 
32
-            $i      = 0;
33
-            $class  = '';
34
-            $is_pro = monsterinsights_is_pro_version();
35
-            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
36
-                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
37
-                    continue;
38
-                }
39
-                $class = ( 0 === $i ? 'monsterinsights-active' : '' );
40
-                ?>
32
+	    $i      = 0;
33
+	    $class  = '';
34
+	    $is_pro = monsterinsights_is_pro_version();
35
+	    foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
36
+		if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
37
+		    continue;
38
+		}
39
+		$class = ( 0 === $i ? 'monsterinsights-active' : '' );
40
+		?>
41 41
                 <a class="monsterinsights-sub-nav-item monsterinsights-nav-item monsterinsights-active monstericon-<?php echo esc_attr( $id ); ?> <?php echo esc_attr( $class ); ?>" href="#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" title="<?php echo esc_attr( $item['title'] ); ?>">
42 42
                     <?php echo esc_html( $item['title'] ); ?>
43 43
                 </a>
44 44
                 <?php 
45
-                $i++; 
46
-            }
47
-            ?>
45
+		$i++; 
46
+	    }
47
+	    ?>
48 48
         </h1>
49 49
 
50 50
         <h1 class="monsterinsights-hideme"></h1><!-- so wp notices are below the nav bar -->
51 51
 
52 52
         <?php 
53
-        // Output any notices now
54
-        /** 
55
-         * Developer Alert:
56
-         *
57
-         * Per the README, this is considered an internal hook and should
58
-         * not be used by other developers. This hook's behavior may be modified
59
-         * or the hook may be removed at any time, without warning.
60
-         */
61
-        do_action( 'monsterinsights_settings_tracking_tab_notice' );
62
-        ?>
53
+	// Output any notices now
54
+	/** 
55
+	 * Developer Alert:
56
+	 *
57
+	 * Per the README, this is considered an internal hook and should
58
+	 * not be used by other developers. This hook's behavior may be modified
59
+	 * or the hook may be removed at any time, without warning.
60
+	 */
61
+	do_action( 'monsterinsights_settings_tracking_tab_notice' );
62
+	?>
63 63
 
64 64
         <!-- Tab Panels -->
65 65
         <div id="monsterinsights-settings-sub-pages" class="monsterinsights-sub-nav-tabs monsterinsights-nav-tabs" data-navigation="#monsterinsights-settings-page-sub-nav">
66 66
             <?php 
67
-            $i = 0; 
68
-            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
69
-                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
70
-                    continue;
71
-                }
72
-                $class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
73
-                ?>
67
+	    $i = 0; 
68
+	    foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
69
+		if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
70
+		    continue;
71
+		}
72
+		$class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
73
+		?>
74 74
                  <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
75 75
                     <?php if ( $item['level'] === 'lite' ||  $is_pro ) { ?>
76 76
                     <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
77 77
                     <?php } ?>
78 78
                      <div class="monsterinsights-subtab-settings-notices">
79 79
                         <?php 
80
-                        // Output any notices now
81
-                        /** 
82
-                         * Developer Alert:
83
-                         *
84
-                         * Per the README, this is considered an internal hook and should
85
-                         * not be used by other developers. This hook's behavior may be modified
86
-                         * or the hook may be removed at any time, without warning.
87
-                         */
88
-                        do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
89
-                        ?>
80
+			// Output any notices now
81
+			/** 
82
+			 * Developer Alert:
83
+			 *
84
+			 * Per the README, this is considered an internal hook and should
85
+			 * not be used by other developers. This hook's behavior may be modified
86
+			 * or the hook may be removed at any time, without warning.
87
+			 */
88
+			do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
89
+			?>
90 90
                     </div>
91 91
                     <!-- Settings Form -->
92 92
                     <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
                         <table class="form-table">
95 95
                             <tbody>
96 96
                                 <?php
97
-                                //do_action( 'monsterinsights_settings_tab_top_' . $id  );
98
-                                echo monsterinsights_get_section_settings( $id, 'tracking' );
99
-                                //do_action( 'monsterinsights_settings_tab_bottom_' . $id  );
100
-                                ?>
97
+				//do_action( 'monsterinsights_settings_tab_top_' . $id  );
98
+				echo monsterinsights_get_section_settings( $id, 'tracking' );
99
+				//do_action( 'monsterinsights_settings_tab_bottom_' . $id  );
100
+				?>
101 101
                             </tbody>
102 102
                         </table>
103 103
                         <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
                     </form>
111 111
                 </div>
112 112
                 <?php
113
-                $i++;
114
-            }
115
-            ?>
113
+		$i++;
114
+	    }
115
+	    ?>
116 116
         </div>
117 117
     </div>
118 118
     <?php
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 $class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
73 73
                 ?>
74 74
                  <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
75
-                    <?php if ( $item['level'] === 'lite' ||  $is_pro ) { ?>
75
+                    <?php if ( $item['level'] === 'lite' || $is_pro ) { ?>
76 76
                     <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
77 77
                     <?php } ?>
78 78
                      <div class="monsterinsights-subtab-settings-notices">
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                     </div>
91 91
                     <!-- Settings Form -->
92 92
                     <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
93
-                    <form id="monsterinsights-tracking-<?php echo esc_attr( $id );?>-tab" class="<?php echo $class; ?>" method="post">
93
+                    <form id="monsterinsights-tracking-<?php echo esc_attr( $id ); ?>-tab" class="<?php echo $class; ?>" method="post">
94 94
                         <table class="form-table">
95 95
                             <tbody>
96 96
                                 <?php
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                             </tbody>
102 102
                         </table>
103 103
                         <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
104
-                        <?php if ( $item['level'] === 'lite' && !$is_pro ) { ?>
104
+                        <?php if ( $item['level'] === 'lite' && ! $is_pro ) { ?>
105 105
                             <div class="monsterinsights-upsell-under-box">
106 106
                                 <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2>
107 107
                                 <p class="monsterinsights-upsell-lite-text"><?php esc_html_e( "By upgrading to MonsterInsights Pro, you get access to numerous addons and tools that help you better understand what people are doing on your website, so you can keep doing more of what's working. Some of the features include: Ecommerce tracking, Author tracking, Post Type tracking, Ads tracking, Google AMP tracking, Performance optimization, and so much more!", 'google-analytics-for-wordpress' ); ?></p>
Please login to merge, or discard this patch.
includes/admin/settings/tab-general.php 3 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
     $network_license             = get_site_option( 'monsterinsights_license' );
34 34
     if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty ( $network_license ) ) ) {
35
-        $site_license                = get_option( 'monsterinsights_license' );
36
-        $license_key                 = ! empty( $site_license['key'] ) ? esc_attr( $site_license['key'] ) : '';
37
-        $license_key_type            = ! empty( $site_license['type'] ) ? esc_html( $site_license['type'] ) : '';
35
+	$site_license                = get_option( 'monsterinsights_license' );
36
+	$license_key                 = ! empty( $site_license['key'] ) ? esc_attr( $site_license['key'] ) : '';
37
+	$license_key_type            = ! empty( $site_license['type'] ) ? esc_html( $site_license['type'] ) : '';
38 38
     }
39 39
 
40 40
     $profile_name                = monsterinsights_get_option( 'analytics_profile_name', '' );
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
     <div id="monsterinsights-settings-general">
48 48
         <div class="monsterinsights-tab-settings-notices">
49 49
         <?php 
50
-        // Output any notices now
51
-        /** 
52
-         * Developer Alert:
53
-         *
54
-         * Per the README, this is considered an internal hook and should
55
-         * not be used by other developers. This hook's behavior may be modified
56
-         * or the hook may be removed at any time, without warning.
57
-         */
58
-        do_action( 'monsterinsights_settings_general_tab_notice' );
59
-        ?>
50
+	// Output any notices now
51
+	/** 
52
+	 * Developer Alert:
53
+	 *
54
+	 * Per the README, this is considered an internal hook and should
55
+	 * not be used by other developers. This hook's behavior may be modified
56
+	 * or the hook may be removed at any time, without warning.
57
+	 */
58
+	do_action( 'monsterinsights_settings_general_tab_notice' );
59
+	?>
60 60
         </div>
61 61
         <table class="form-table">
62 62
             <tbody>
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 
141 141
                     <!-- Disable Dashboard -->
142 142
                     <?php
143
-                    $title       = esc_html__( 'Disable Dashboard', 'google-analytics-for-wordpress' );
144
-                    $description = esc_html__( 'Hide the dashboard and reports pages.', 'google-analytics-for-wordpress' );
145
-                    echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
146
-                    ?>
143
+		    $title       = esc_html__( 'Disable Dashboard', 'google-analytics-for-wordpress' );
144
+		    $description = esc_html__( 'Hide the dashboard and reports pages.', 'google-analytics-for-wordpress' );
145
+		    echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
146
+		    ?>
147 147
 
148 148
                     <?php if ( $tracking_mode === 'ga' || monsterinsights_is_debug_mode() ){  ?>
149 149
                     <tr id="monsterinsights-tracking-mode">
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
                         </th>
153 153
                         <td>
154 154
                             <?php
155
-                            $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'general' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
156
-                            ?>
155
+			    $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'general' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
156
+			    ?>
157 157
                             <label><input type="radio" name="tracking_mode" value="ga" <?php checked( $tracking_mode, 'ga' ); ?> ><?php esc_html_e('GA.js (Deprecated)', 'google-analytics-for-wordpress'); ?> </label>
158 158
                             <label><input type="radio" name="tracking_mode" value="analytics" <?php checked( $tracking_mode, 'analytics' ); ?> ><?php esc_html_e( 'Analytics.js (Universal Analytics)', 'google-analytics-for-wordpress'); ?> </label>
159 159
                             <?php if ($tracking_mode === 'ga' ) { ?>
160 160
                             <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated ga.js tracking. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ) );
161
-                            ?>
161
+			    ?>
162 162
                             <?php } ?>
163 163
                         </td>
164 164
                     </tr>
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
                         </th>
172 172
                         <td>
173 173
                             <?php
174
-                            $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_jsevents', 'return' => 'general' ) ), 'monsterinsights-switch-to-jsevents-nonce' ) );
175
-                            ?>
174
+			    $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_jsevents', 'return' => 'general' ) ), 'monsterinsights-switch-to-jsevents-nonce' ) );
175
+			    ?>
176 176
                             <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated PHP based events tracking. We recommend switching to JS events tracking, as it is significantly more accurate than PHP based events tracking and we will eventually discontinue PHP based events tracking. To switch %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ) );
177
-                         ?>
177
+			 ?>
178 178
                         </td>
179 179
                     </tr>
180 180
                     <?php } ?>
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
 
196 196
                     <!-- Tracking -->
197 197
                     <?php
198
-                    $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
199
-                    $description = esc_html__( 'By allowing us to track usage data we can better help you, because we know with which WordPress configurations, themes and plugins we should test.', 'google-analytics-for-wordpress' );
200
-                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ){
201
-                        echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
202
-                    }
203
-                    ?>
198
+		    $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
199
+		    $description = esc_html__( 'By allowing us to track usage data we can better help you, because we know with which WordPress configurations, themes and plugins we should test.', 'google-analytics-for-wordpress' );
200
+		    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ){
201
+			echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
202
+		    }
203
+		    ?>
204 204
 
205 205
                     <?php 
206
-                    /** 
207
-                     * Developer Alert:
208
-                     *
209
-                     * Per the README, this is considered an internal hook and should
210
-                     * not be used by other developers. This hook's behavior may be modified
211
-                     * or the hook may be removed at any time, without warning.
212
-                     */
213
-                    do_action( 'monsterinsights_settings_general_box' ); 
214
-                    ?>
206
+		    /** 
207
+		     * Developer Alert:
208
+		     *
209
+		     * Per the README, this is considered an internal hook and should
210
+		     * not be used by other developers. This hook's behavior may be modified
211
+		     * or the hook may be removed at any time, without warning.
212
+		     */
213
+		    do_action( 'monsterinsights_settings_general_box' ); 
214
+		    ?>
215 215
                 </tbody>
216 216
             </table>
217 217
             <input type="hidden" name="monsterinsights_settings_tab" value="general"/>
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
     $manual_ua_code = monsterinsights_is_valid_ua( $manual_ua_code ); // also sanitizes the string
238 238
     
239 239
     if ( $manual_ua_code ) {
240
-        monsterinsights_update_option( 'manual_ua_code', $manual_ua_code );
240
+	monsterinsights_update_option( 'manual_ua_code', $manual_ua_code );
241 241
     } else {
242
-        if ( empty ( $manual_ua_code ) && ! empty( $_POST['manual_ua_code'] ) ) {
243
-             $throw_notice = true;
244
-        }
245
-        monsterinsights_update_option( 'manual_ua_code', '' );
242
+	if ( empty ( $manual_ua_code ) && ! empty( $_POST['manual_ua_code'] ) ) {
243
+	     $throw_notice = true;
244
+	}
245
+	monsterinsights_update_option( 'manual_ua_code', '' );
246 246
     }
247 247
 
248 248
     $dashboards_disabled = isset( $_POST['dashboards_disabled'] ) ? 1 : 0;
@@ -252,39 +252,39 @@  discard block
 block discarded – undo
252 252
     $tracking_mode     = isset( $_POST['tracking_mode'] ) ? $_POST['tracking_mode'] : 'analytics';
253 253
 
254 254
     if ( $old_tracking_mode === 'ga' || monsterinsights_is_debug_mode() ) {
255
-        if ( $tracking_mode !== 'analytics' && $tracking_mode !== 'ga' ) {
256
-            /** 
257
-             * Developer Alert:
258
-             *
259
-             * Per the README, this is considered an internal hook and should
260
-             * not be used by other developers. This hook's behavior may be modified
261
-             * or the hook may be removed at any time, without warning.
262
-             */
263
-            $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' );
264
-        }
265
-        monsterinsights_update_option( 'tracking_mode', $tracking_mode );
255
+	if ( $tracking_mode !== 'analytics' && $tracking_mode !== 'ga' ) {
256
+	    /** 
257
+	     * Developer Alert:
258
+	     *
259
+	     * Per the README, this is considered an internal hook and should
260
+	     * not be used by other developers. This hook's behavior may be modified
261
+	     * or the hook may be removed at any time, without warning.
262
+	     */
263
+	    $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' );
264
+	}
265
+	monsterinsights_update_option( 'tracking_mode', $tracking_mode );
266 266
     } else {
267
-        if ( $tracking_mode !== 'analytics' ) {
268
-            /** 
269
-             * Developer Alert:
270
-             *
271
-             * Per the README, this is considered an internal hook and should
272
-             * not be used by other developers. This hook's behavior may be modified
273
-             * or the hook may be removed at any time, without warning.
274
-             */
275
-            $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' );
276
-        }
277
-        monsterinsights_update_option( 'tracking_mode', $tracking_mode );
267
+	if ( $tracking_mode !== 'analytics' ) {
268
+	    /** 
269
+	     * Developer Alert:
270
+	     *
271
+	     * Per the README, this is considered an internal hook and should
272
+	     * not be used by other developers. This hook's behavior may be modified
273
+	     * or the hook may be removed at any time, without warning.
274
+	     */
275
+	    $tracking_mode = apply_filters( 'monsterinsights_settings_save_general_tracking_mode', 'analytics' );
276
+	}
277
+	monsterinsights_update_option( 'tracking_mode', $tracking_mode );
278 278
     }
279 279
 
280 280
     $automatic_updates = isset( $_POST['automatic_updates'] ) && in_array( $_POST['automatic_updates'], array( 'all', 'minor', 'none' ) ) ? $_POST['automatic_updates'] : false;
281 281
     if ( $automatic_updates ) {
282
-        monsterinsights_update_option( 'automatic_updates', $automatic_updates );
282
+	monsterinsights_update_option( 'automatic_updates', $automatic_updates );
283 283
     }
284 284
 
285 285
     $anonymous_data = isset( $_POST['anonymous_data'] ) ? 1 : 0;
286 286
     if ( $anonymous_data ) {
287
-        monsterinsights_update_option( 'anonymous_data', $anonymous_data );
287
+	monsterinsights_update_option( 'anonymous_data', $anonymous_data );
288 288
     }
289 289
 
290 290
     /** 
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 
299 299
     // Output an admin notice so the user knows what happened
300 300
     if ( $throw_notice ) {
301
-        add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' );
301
+	add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' );
302 302
     } else {
303
-        add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_updated_settings' );
303
+	add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_updated_settings' );
304 304
     }
305 305
 }
306 306
 add_action( 'monsterinsights_settings_save_general', 'monsterinsights_settings_save_general', 11 );
307 307
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 <tbody>
128 128
                     <?php if ( ! $profile_name ) { ?>
129 129
                     <!-- Manual UA -->
130
-                    <tr id="monsterinsights-google-ua-box" <?php echo ( ! $ua_code ? 'class="monsterinsights-hideme"' : ''); ?> >
130
+                    <tr id="monsterinsights-google-ua-box" <?php echo ( ! $ua_code ? 'class="monsterinsights-hideme"' : '' ); ?> >
131 131
                         <th scope="row">
132 132
                             <label for="monsterinsights-google-ua"><?php esc_html_e( 'Manually enter your UA code', 'google-analytics-for-wordpress' ); ?></label>
133 133
                         </th>
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                     echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
146 146
                     ?>
147 147
 
148
-                    <?php if ( $tracking_mode === 'ga' || monsterinsights_is_debug_mode() ){  ?>
148
+                    <?php if ( $tracking_mode === 'ga' || monsterinsights_is_debug_mode() ) {  ?>
149 149
                     <tr id="monsterinsights-tracking-mode">
150 150
                         <th scope="row">
151 151
                             <label for="monsterinsights-tracking-mode"><?php esc_html_e( 'Pick Tracking Mode', 'google-analytics-for-wordpress' ); ?></label>
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
                             <?php
155 155
                             $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'general' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
156 156
                             ?>
157
-                            <label><input type="radio" name="tracking_mode" value="ga" <?php checked( $tracking_mode, 'ga' ); ?> ><?php esc_html_e('GA.js (Deprecated)', 'google-analytics-for-wordpress'); ?> </label>
158
-                            <label><input type="radio" name="tracking_mode" value="analytics" <?php checked( $tracking_mode, 'analytics' ); ?> ><?php esc_html_e( 'Analytics.js (Universal Analytics)', 'google-analytics-for-wordpress'); ?> </label>
159
-                            <?php if ($tracking_mode === 'ga' ) { ?>
160
-                            <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated ga.js tracking. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ) );
157
+                            <label><input type="radio" name="tracking_mode" value="ga" <?php checked( $tracking_mode, 'ga' ); ?> ><?php esc_html_e( 'GA.js (Deprecated)', 'google-analytics-for-wordpress' ); ?> </label>
158
+                            <label><input type="radio" name="tracking_mode" value="analytics" <?php checked( $tracking_mode, 'analytics' ); ?> ><?php esc_html_e( 'Analytics.js (Universal Analytics)', 'google-analytics-for-wordpress' ); ?> </label>
159
+                            <?php if ( $tracking_mode === 'ga' ) { ?>
160
+                            <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated ga.js tracking. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ) );
161 161
                             ?>
162 162
                             <?php } ?>
163 163
                         </td>
164 164
                     </tr>
165 165
                     <?php } ?>
166 166
 
167
-                    <?php if ( $tracking_mode !== 'ga' && $events_mode === 'php' ){  ?>
167
+                    <?php if ( $tracking_mode !== 'ga' && $events_mode === 'php' ) {  ?>
168 168
                     <tr id="monsterinsights-tracking-mode">
169 169
                         <th scope="row">
170 170
                             <label for="monsterinsights-tracking-mode"><?php esc_html_e( 'Switch to JS events tracking', 'google-analytics-for-wordpress' ); ?></label>
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
                             <?php
174 174
                             $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_jsevents', 'return' => 'general' ) ), 'monsterinsights-switch-to-jsevents-nonce' ) );
175 175
                             ?>
176
-                            <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated PHP based events tracking. We recommend switching to JS events tracking, as it is significantly more accurate than PHP based events tracking and we will eventually discontinue PHP based events tracking. To switch %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ) );
176
+                            <?php echo monsterinsights_get_message( 'error', sprintf( esc_html__( 'Warning: You\'re currently using deprecated PHP based events tracking. We recommend switching to JS events tracking, as it is significantly more accurate than PHP based events tracking and we will eventually discontinue PHP based events tracking. To switch %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ) );
177 177
                          ?>
178 178
                         </td>
179 179
                     </tr>
180 180
                     <?php } ?>
181 181
 
182
-                    <?php if ( $automatic_updates !== 'all' && $automatic_updates !== 'minor' ){  ?>
182
+                    <?php if ( $automatic_updates !== 'all' && $automatic_updates !== 'minor' ) {  ?>
183 183
                     <?php $automatic_updates = $automatic_updates ? $automatic_updates : 'none'; ?>
184 184
                     <tr id="monsterinsights-automatic-updates-mode">
185 185
                         <th scope="row">
186 186
                             <label for="monsterinsights-tracking-mode"><?php esc_html_e( 'Automatic Updates', 'google-analytics-for-wordpress' ); ?></label>
187 187
                         </th>
188 188
                         <td>
189
-                            <label><input type="radio" name="automatic_updates" value="all" <?php checked( $automatic_updates, 'all' ); ?> ><?php esc_html_e('Yes (Recommended) - Get the latest features, bugfixes, and security updates as they are released.', 'google-analytics-for-wordpress'); ?> </label>
190
-                            <label><input type="radio" name="automatic_updates" value="minor" <?php checked( $automatic_updates, 'minor' ); ?> ><?php esc_html_e( 'Minor Only - Only get bugfixes and security updates, but not major features.', 'google-analytics-for-wordpress'); ?> </label>
191
-                            <label><input type="radio" name="automatic_updates" value="none" <?php checked( $automatic_updates, 'none' ); ?> ><?php esc_html_e( 'None - Manually update everything.', 'google-analytics-for-wordpress'); ?> </label>
189
+                            <label><input type="radio" name="automatic_updates" value="all" <?php checked( $automatic_updates, 'all' ); ?> ><?php esc_html_e( 'Yes (Recommended) - Get the latest features, bugfixes, and security updates as they are released.', 'google-analytics-for-wordpress' ); ?> </label>
190
+                            <label><input type="radio" name="automatic_updates" value="minor" <?php checked( $automatic_updates, 'minor' ); ?> ><?php esc_html_e( 'Minor Only - Only get bugfixes and security updates, but not major features.', 'google-analytics-for-wordpress' ); ?> </label>
191
+                            <label><input type="radio" name="automatic_updates" value="none" <?php checked( $automatic_updates, 'none' ); ?> ><?php esc_html_e( 'None - Manually update everything.', 'google-analytics-for-wordpress' ); ?> </label>
192 192
                         </td>
193 193
                     </tr>
194 194
                     <?php } ?>
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
                     <?php
198 198
                     $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
199 199
                     $description = esc_html__( 'By allowing us to track usage data we can better help you, because we know with which WordPress configurations, themes and plugins we should test.', 'google-analytics-for-wordpress' );
200
-                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ){
200
+                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ) {
201 201
                         echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
202 202
                     }
203 203
                     ?>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
  * @return void
233 233
  */
234 234
 function monsterinsights_settings_save_general() {
235
-    $throw_notice    = false;
235
+    $throw_notice = false;
236 236
     $manual_ua_code = isset( $_POST['manual_ua_code'] ) ? $_POST['manual_ua_code'] : '';
237 237
     $manual_ua_code = monsterinsights_is_valid_ua( $manual_ua_code ); // also sanitizes the string
238 238
     
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
                     <?php
198 198
                     $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
199 199
                     $description = esc_html__( 'By allowing us to track usage data we can better help you, because we know with which WordPress configurations, themes and plugins we should test.', 'google-analytics-for-wordpress' );
200
-                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ){
200
+                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ) {
201 201
                         echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
202 202
                     }
203 203
                     ?>
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/capabilities.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -34,54 +34,54 @@
 block discarded – undo
34 34
  */
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36 36
     switch( $cap ) {
37
-        case 'monsterinsights_view_dashboard' :
38
-            $roles = monsterinsights_get_option( 'view_reports', array() );
37
+	case 'monsterinsights_view_dashboard' :
38
+	    $roles = monsterinsights_get_option( 'view_reports', array() );
39 39
 
40
-            $user_can_via_settings = false;
41
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
42
-                foreach ( $roles as $role ) {
43
-                    if ( is_string( $role ) ) {
44
-                        if ( user_can( $user_id, $role ) ) {
45
-                            $user_can_via_settings = true;
46
-                            break;
47
-                        }
48
-                    }
49
-                }
50
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
51
-                if ( user_can( $user_id, $roles ) ) {
52
-                    $user_can_via_settings = true;
53
-                }
54
-            }
40
+	    $user_can_via_settings = false;
41
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
42
+		foreach ( $roles as $role ) {
43
+		    if ( is_string( $role ) ) {
44
+			if ( user_can( $user_id, $role ) ) {
45
+			    $user_can_via_settings = true;
46
+			    break;
47
+			}
48
+		    }
49
+		}
50
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
51
+		if ( user_can( $user_id, $roles ) ) {
52
+		    $user_can_via_settings = true;
53
+		}
54
+	    }
55 55
 
56
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
57
-                $caps = array();
58
-            }
56
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
57
+		$caps = array();
58
+	    }
59 59
             
60
-            break;
61
-         case 'monsterinsights_save_settings' :
62
-            $roles = monsterinsights_get_option( 'save_settings', array() );
60
+	    break;
61
+	 case 'monsterinsights_save_settings' :
62
+	    $roles = monsterinsights_get_option( 'save_settings', array() );
63 63
 
64
-            $user_can_via_settings = false;
65
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
66
-                foreach ( $roles as $role ) {
67
-                    if ( is_string( $role ) ) {
68
-                        if ( user_can( $user_id, $role ) ) {
69
-                            $user_can_via_settings = true;
70
-                            break;
71
-                        }
72
-                    }
73
-                }
74
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
75
-                 if ( user_can( $user_id, $roles ) ) {
76
-                    $user_can_via_settings = true;
77
-                }
78
-            }
64
+	    $user_can_via_settings = false;
65
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
66
+		foreach ( $roles as $role ) {
67
+		    if ( is_string( $role ) ) {
68
+			if ( user_can( $user_id, $role ) ) {
69
+			    $user_can_via_settings = true;
70
+			    break;
71
+			}
72
+		    }
73
+		}
74
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
75
+		 if ( user_can( $user_id, $roles ) ) {
76
+		    $user_can_via_settings = true;
77
+		}
78
+	    }
79 79
 
80
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
81
-                $caps = array();
82
-            }
80
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
81
+		$caps = array();
82
+	    }
83 83
 
84
-            break;
84
+	    break;
85 85
     }
86 86
     return $caps;
87 87
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @return array Array of caps needed to have this meta cap. If returned array is empty, user has the capability.
34 34
  */
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36
-    switch( $cap ) {
36
+    switch ( $cap ) {
37 37
         case 'monsterinsights_view_dashboard' :
38 38
             $roles = monsterinsights_get_option( 'view_reports', array() );
39 39
 
@@ -85,4 +85,4 @@  discard block
 block discarded – undo
85 85
     }
86 86
     return $caps;
87 87
 }
88
-add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 );
89 88
\ No newline at end of file
89
+add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 );
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reports/overview.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	// Adds/Refreshes the data
39
-	public function add_report_data( $client, $id ){
39
+	public function add_report_data( $client, $id ) {
40 40
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
41 41
 			return false;
42 42
 		}
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
44 44
 		$dates = $this->get_date_range();
45 45
 
46 46
 		// Pageviews
47
-		$pageviews = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start']  . '&end-date=' . $dates['end']  . '&metrics=ga%3Apageviews&dimensions=ga%3Adate&max-results=' . $this->get_api_max_limit() );
47
+		$pageviews = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start'] . '&end-date=' . $dates['end'] . '&metrics=ga%3Apageviews&dimensions=ga%3Adate&max-results=' . $this->get_api_max_limit() );
48 48
 		$pageviews = $this->parse_request( $pageviews );
49 49
 		update_option( 'monsterinsights_report_overview_pageviews', $pageviews );
50 50
 		
51 51
 		// Top posts and pages
52
-		$top_content = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start']  . '&end-date=' . $dates['end']  . '&metrics=ga%3Apageviews&dimensions=ga%3ApagePath&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
52
+		$top_content = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start'] . '&end-date=' . $dates['end'] . '&metrics=ga%3Apageviews&dimensions=ga%3ApagePath&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
53 53
 		$top_content = $this->parse_request( $top_content );
54 54
 		update_option( 'monsterinsights_report_overview_top_content', $top_content );
55 55
 
56 56
 		// Top sources
57
-		$top_sources = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start']  . '&end-date=' . $dates['end']  . '&metrics=ga%3Apageviews&dimensions=ga%3Asource&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
57
+		$top_sources = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start'] . '&end-date=' . $dates['end'] . '&metrics=ga%3Apageviews&dimensions=ga%3Asource&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
58 58
 		$top_sources = $this->parse_request( $top_sources );
59 59
 		update_option( 'monsterinsights_report_overview_top_sources', $top_sources );
60 60
 
61 61
 		// Top countries
62
-		$countries = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start']  . '&end-date=' . $dates['end']  . '&metrics=ga%3Apageviews&dimensions=ga%3AcountryIsoCode&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
62
+		$countries = $client->do_request( 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A' . $id . '&start-date=' . $dates['start'] . '&end-date=' . $dates['end'] . '&metrics=ga%3Apageviews&dimensions=ga%3AcountryIsoCode&sort=-ga%3Apageviews&max-results=' . $this->get_api_max_limit() );
63 63
 		$countries = $this->parse_request( $countries );
64 64
 		update_option( 'monsterinsights_report_overview_countries', $countries );
65 65
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	// Gets the data
70
-	public function get_report_data( ){
70
+	public function get_report_data( ) {
71 71
 		$data = array();
72 72
 		$data['pageviews'] = get_option( 'monsterinsights_report_overview_pageviews', array() );
73 73
 		$data['top-content'] = get_option( 'monsterinsights_report_overview_top_content', array() );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	// Removes report data
80
-	public function delete_report_data(){
80
+	public function delete_report_data() {
81 81
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
82 82
 			return false;
83 83
 		}
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	// Outputs the report.
93
-	public function show_report( ){
93
+	public function show_report( ) {
94 94
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
95 95
 			return false;
96 96
 		}
97 97
 		$data = $this->get_report_data();
98 98
 
99 99
 		$pageviews = ! empty( $data['pageviews'] ) ? $data['pageviews'] : false;
100
-		$top 	   = ! empty( $data['top-content'] ) ? $data['top-content'] : false;
100
+		$top = ! empty( $data['top-content'] ) ? $data['top-content'] : false;
101 101
 		$sources   = ! empty( $data['top-sources'] ) ? $data['top-sources'] : false;
102 102
 		$countries = ! empty( $data['countries'] ) ? $data['countries'] : false;
103 103
 		?>
104 104
 		<?php
105 105
 		if ( ( empty( $pageviews ) && empty( $top ) && empty( $sources ) && empty( $countries ) ) || ( empty( $top['total']['ga:pageviews'] ) ) || ( empty( $top['data'] ) ) ) {
106
-			echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'If you\'ve just installed MonsterInsights, data may take up to 24 hours to populate here. Check back soon!','google-analytics-for-wordpress'), 'info', false, array() );
106
+			echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'If you\'ve just installed MonsterInsights, data may take up to 24 hours to populate here. Check back soon!', 'google-analytics-for-wordpress' ), 'info', false, array() );
107 107
 			return;
108 108
 		}
109 109
 
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
 									$i++;
457 457
 								}
458 458
 								$title   = isset( $countries_values[0] ) ? esc_html( $countries_values[0] ) : __( 'Country not set', 'google-analytics-for-wordpress' );
459
-								$title   = isset( $list_of_countries[ $title ] ) ? esc_html( $list_of_countries[ $title ] )  : $title;
459
+								$title   = isset( $list_of_countries[$title] ) ? esc_html( $list_of_countries[$title] ) : $title;
460 460
 								$views   = isset( $countries_values[1] ) ? absint( $countries_values[1] ) : 0;
461
-								$percent = ! empty( $countries['total']['ga:pageviews'] ) &&  absint( $countries['total']['ga:pageviews'] ) > 0 ? $views / absint( $countries['total']['ga:pageviews'] ) : 0;
461
+								$percent = ! empty( $countries['total']['ga:pageviews'] ) && absint( $countries['total']['ga:pageviews'] ) > 0 ? $views / absint( $countries['total']['ga:pageviews'] ) : 0;
462 462
 								$percent = number_format( $percent * 100, 2 ) . '%';
463 463
 							?>
464 464
 							<div class="monsterinsights-data-row">
@@ -477,12 +477,12 @@  discard block
 block discarded – undo
477 477
 
478 478
 	public function parse_request( $request ) {
479 479
 		$to_save = array();
480
-		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ){
480
+		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ) {
481 481
 			$dates = $this->get_date_range();
482 482
 			$to_save['start-date'] = $dates['start'];
483 483
 			$to_save['end-date']   = $dates['end'];
484
-			$to_save['total'] 	   = isset( $request['body']['totalsForAllResults'] ) ? $request['body']['totalsForAllResults'] : 0 ;
485
-			$to_save['data'] 	   = isset( $request['body']['rows'] ) ? $request['body']['rows'] : array();
484
+			$to_save['total'] = isset( $request['body']['totalsForAllResults'] ) ? $request['body']['totalsForAllResults'] : 0;
485
+			$to_save['data'] = isset( $request['body']['rows'] ) ? $request['body']['rows'] : array();
486 486
 		} else {
487 487
 			monsterinsights_update_option( 'cron_failed', true );
488 488
 		}
@@ -692,17 +692,17 @@  discard block
 block discarded – undo
692 692
 		} else {
693 693
 			$list_of_countries = array_flip( monsterinsights_get_country_list() );
694 694
 			foreach ( $countries['data'] as $countries_index => $countries_values ) {
695
-				$title   = isset( $countries_values[0] ) ? esc_html( $countries_values[0] ) : false;
695
+				$title = isset( $countries_values[0] ) ? esc_html( $countries_values[0] ) : false;
696 696
 				if ( ! $title ) {
697 697
 					continue;
698 698
 				}
699 699
 
700
-				if ( isset( $js_countries[ $title ] ) ) {
700
+				if ( isset( $js_countries[$title] ) ) {
701 701
 					$views   = isset( $countries_values[1] ) ? absint( $countries_values[1] ) : 0;
702
-					$js_countries[ $title ] = $views;
703
-				} else if ( isset( $list_of_countries[ $title ] ) ) {
702
+					$js_countries[$title] = $views;
703
+				} else if ( isset( $list_of_countries[$title] ) ) {
704 704
 					$views   = isset( $countries_values[1] ) ? absint( $countries_values[1] ) : 0;
705
-					$js_countries[ $list_of_countries[ $title ] ] = $views;				
705
+					$js_countries[$list_of_countries[$title]] = $views;				
706 706
 				} else {
707 707
 					continue;
708 708
 				}
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 
712 712
 		$to_return = "{" . PHP_EOL;
713 713
 		foreach ( $js_countries as $country => $value ) {
714
-			$to_return .= '"' . esc_js( $country ) . '": ' . esc_js(  $value ) . "," . PHP_EOL;
714
+			$to_return .= '"' . esc_js( $country ) . '": ' . esc_js( $value ) . "," . PHP_EOL;
715 715
 		}
716 716
 		$to_return .= "}" . PHP_EOL;
717 717
 		return $to_return;
Please login to merge, or discard this patch.
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	// Adds/Refreshes the data
39
-	public function add_report_data( $client, $id ){
39
+	public function add_report_data( $client, $id ) {
40 40
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
41 41
 			return false;
42 42
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	// Gets the data
70
-	public function get_report_data( ){
70
+	public function get_report_data( ) {
71 71
 		$data = array();
72 72
 		$data['pageviews'] = get_option( 'monsterinsights_report_overview_pageviews', array() );
73 73
 		$data['top-content'] = get_option( 'monsterinsights_report_overview_top_content', array() );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	// Removes report data
80
-	public function delete_report_data(){
80
+	public function delete_report_data() {
81 81
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
82 82
 			return false;
83 83
 		}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	// Outputs the report.
93
-	public function show_report( ){
93
+	public function show_report( ) {
94 94
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
95 95
 			return false;
96 96
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				}
120 120
 			}
121 121
 
122
-			if ( $max >= 1 ) { 
122
+			if ( $max >= 1 ) {
123 123
 			?>
124 124
 			<div class="monsterinsights-grid">
125 125
 				<div class="monsterinsights-col-1-1 monsterinsights-grid-grey-bg monsterinsights-grid-border">
@@ -325,7 +325,8 @@  discard block
 block discarded – undo
325 325
 								$i = 0;
326 326
 								foreach ( $top['data'] as $top_index => $top_values ) { ?>
327 327
 								<?php
328
-									if ( $i === 10 ) { // Limit to 10 max
328
+									if ( $i === 10 ) {
329
+// Limit to 10 max
329 330
 										break;
330 331
 									} else {
331 332
 										$i++;
@@ -338,7 +339,8 @@  discard block
 block discarded – undo
338 339
 									<div class="monsterinsights-col-1-8"><?php echo $views ?></div>
339 340
 								</div>
340 341
 							<?php } 
341
-								for ( $i; $i < 10; $i++ ) { // if we have less than 10, make empty rows
342
+								for ( $i; $i < 10; $i++ ) {
343
+// if we have less than 10, make empty rows
342 344
 									?>
343 345
 									<div class="monsterinsights-data-row">
344 346
 										<div class="monsterinsights-col-7-8">&nbsp;</div>
@@ -370,7 +372,8 @@  discard block
 block discarded – undo
370 372
 								$i = 0;
371 373
 								foreach ( $sources['data'] as $sources_index => $sources_values ) { ?>
372 374
 								<?php
373
-									if ( $i === 10 ) { // Limit to 10 max
375
+									if ( $i === 10 ) {
376
+// Limit to 10 max
374 377
 										break;
375 378
 									} else {
376 379
 										$i++;
@@ -383,7 +386,8 @@  discard block
 block discarded – undo
383 386
 									<div class="monsterinsights-col-1-8"><?php echo $views ?></div>
384 387
 								</div>
385 388
 							<?php } 
386
-								for ( $i; $i < 10; $i++ ) { // if we have less than 10, make empty rows
389
+								for ( $i; $i < 10; $i++ ) {
390
+// if we have less than 10, make empty rows
387 391
 									?>
388 392
 									<div class="monsterinsights-data-row">
389 393
 										<div class="monsterinsights-col-7-8">&nbsp;</div>
@@ -450,7 +454,8 @@  discard block
 block discarded – undo
450 454
 							$list_of_countries = monsterinsights_get_country_list( true );
451 455
 							foreach ( $countries['data'] as $countries_index => $countries_values ) { ?>
452 456
 							<?php
453
-								if ( $i === 10 ) { // Limit to 10 max
457
+								if ( $i === 10 ) {
458
+// Limit to 10 max
454 459
 									break;
455 460
 								} else {
456 461
 									$i++;
@@ -477,7 +482,7 @@  discard block
 block discarded – undo
477 482
 
478 483
 	public function parse_request( $request ) {
479 484
 		$to_save = array();
480
-		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ){
485
+		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ) {
481 486
 			$dates = $this->get_date_range();
482 487
 			$to_save['start-date'] = $dates['start'];
483 488
 			$to_save['end-date']   = $dates['end'];
Please login to merge, or discard this patch.
includes/admin/reporting.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				// Clear data + last run + failed
99 99
 				$this->delete_aggregate_data();
100 100
 
101
-		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ){
101
+		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ) {
102 102
 			// The dashboards are now being enabled
103 103
 				// Refresh data + schedule cron
104 104
 				$this->refresh_aggregate_data();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$last_run = monsterinsights_get_option( 'cron_last_run', false );
122 122
 
123 123
 		// See if issue connecting or expired
124
-		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date('Ymd', time() ) ) { 
124
+		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date( 'Ymd', time() ) ) { 
125 125
 			$this->run_cron();
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				// Clear data + last run + failed
99 99
 				$this->delete_aggregate_data();
100 100
 
101
-		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ){
101
+		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ) {
102 102
 			// The dashboards are now being enabled
103 103
 				// Refresh data + schedule cron
104 104
 				$this->refresh_aggregate_data();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$last_run = monsterinsights_get_option( 'cron_last_run', false );
122 122
 
123 123
 		// See if issue connecting or expired
124
-		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date('Ymd', time() ) ) { 
124
+		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date('Ymd', time() ) ) {
125 125
 			$this->run_cron();
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.