Passed
Push — master ( e64af5...ad1bda )
by Chris
03:25
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
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.
Spacing   +55 added lines, -55 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,9 +902,9 @@  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
-			. '<p class="monsterinsights-upsell-button-par"><a href="'. monsterinsights_get_upgrade_link( 'settings-page', 'settings-page-upgrade-cta' ) .'" class="monsterinsights-upsell-box-button button button-primary">' . __( 'Click here to Upgrade', 'google-analytics-for-wordpress' ) . '</a></p>'
907
+			. '<p class="monsterinsights-upsell-button-par"><a href="' . monsterinsights_get_upgrade_link( 'settings-page', 'settings-page-upgrade-cta' ) . '" class="monsterinsights-upsell-box-button button button-primary">' . __( 'Click here to Upgrade', 'google-analytics-for-wordpress' ) . '</a></p>'
908 908
 			. '</div>';
909 909
 	return apply_filters( 'monsterinsights_after_setting_output', $html, $args ); 
910 910
 }
@@ -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
 
@@ -1029,9 +1029,9 @@  discard block
 block discarded – undo
1029 1029
 	$notices = get_transient( 'monsterinsights_settings_notices' );
1030 1030
 	if ( empty( $notices ) ) {
1031 1031
 		$notices          = array();
1032
-		$notices[ $name ] = array( "type" => $type, "message" => $message );
1032
+		$notices[$name] = array( "type" => $type, "message" => $message );
1033 1033
 	} else {
1034
-		$notices[ $name ] = array( "type" => $type, "message" => $message );
1034
+		$notices[$name] = array( "type" => $type, "message" => $message );
1035 1035
 	}
1036 1036
 	set_transient( 'monsterinsights_settings_notices', $notices );
1037 1037
 }
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
 	$notices = get_transient( 'monsterinsights_settings_notices' );
1044 1044
 	$found   = false;
1045 1045
 	if ( ! empty( $notices ) ) {
1046
-		if ( isset( $notices[ $name] ) ) {
1047
-			unset( $notices[ $name] );
1046
+		if ( isset( $notices[$name] ) ) {
1047
+			unset( $notices[$name] );
1048 1048
 			set_transient( 'monsterinsights_settings_notices', $notices );
1049 1049
 			$found = true;
1050 1050
 		} else {
@@ -1057,6 +1057,6 @@  discard block
 block discarded – undo
1057 1057
 /** 
1058 1058
  * @todo  docbloc
1059 1059
  */
1060
-function monsterinsights_get_non_setting_types(){
1061
-	return apply_filters( 'monsterinsights_non_setting_types', array(  'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1060
+function monsterinsights_get_non_setting_types() {
1061
+	return apply_filters( 'monsterinsights_non_setting_types', array( 'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1062 1062
 }
1063 1063
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/settings/tab-status.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     ?>
27 27
     <div id="monsterinsights-settings-general">
28 28
         <?php 
29
-        ?>
29
+	?>
30 30
         <?php //Status page coming soon. ?>
31 31
         <!-- <hr /> -->
32 32
     </div>
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function monsterinsights_system_info() {
42 42
     if ( ! empty( $_REQUEST['monsterinsights-action'] ) && $_REQUEST['monsterinsights-action'] === 'download_sysinfo' ) {
43
-        if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
44
-            return;
45
-        }
46
-        nocache_headers();
47
-        header( 'Content-Type: text/plain' );
48
-        header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' );
49
-        echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] );
50
-        die();
43
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
44
+	    return;
45
+	}
46
+	nocache_headers();
47
+	header( 'Content-Type: text/plain' );
48
+	header( 'Content-Disposition: attachment; filename="monsterinsights-system-info.txt"' );
49
+	echo wp_strip_all_tags( $_POST['monsterinsights-sysinfo'] );
50
+	die();
51 51
     }
52 52
 }
53 53
 //add_action( 'admin_init',  'monsterinsights_system_info'  );
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/notice.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct() {
38 38
 
39
-        // Populate $notices
40
-        $this->notices = get_option( 'monsterinsights_notices' );
41
-        if ( ! is_array( $this->notices ) ) {
42
-            $this->notices = array();
43
-        }
39
+	// Populate $notices
40
+	$this->notices = get_option( 'monsterinsights_notices' );
41
+	if ( ! is_array( $this->notices ) ) {
42
+	    $this->notices = array();
43
+	}
44 44
 
45 45
     }
46 46
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
      */
56 56
 
57 57
     public function is_dismissed( $notice ) {
58
-        if ( ! isset( $this->notices[ $notice ] ) ) {
59
-            return false;
60
-        }
61
-        return true;
58
+	if ( ! isset( $this->notices[ $notice ] ) ) {
59
+	    return false;
60
+	}
61
+	return true;
62 62
 
63 63
     }
64 64
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
      * @return null
73 73
      */
74 74
     public function dismiss( $notice ) {
75
-        $this->notices[ $notice ] = true;
76
-        update_option( 'monsterinsights_notices', $this->notices );
75
+	$this->notices[ $notice ] = true;
76
+	update_option( 'monsterinsights_notices', $this->notices );
77 77
 
78 78
     }
79 79
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      * @return null
89 89
      */
90 90
     public function undismiss( $notice ) {
91
-        unset( $this->notices[ $notice ] );
92
-        update_option( 'monsterinsights_notices', $this->notices );
91
+	unset( $this->notices[ $notice ] );
92
+	update_option( 'monsterinsights_notices', $this->notices );
93 93
 
94 94
     }
95 95
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param bool      $is_dismissible     User can Dismiss Message (default: false)
109 109
      */ 
110 110
     public function display_inline_notice( $name, $title, $message, $type = 'success', $is_dismissible = false, $args = array() ) {
111
-        /* Available/Planned $args options
111
+	/* Available/Planned $args options
112 112
          * $args = array(
113 113
          *  'primary'    => array(
114 114
          *      'text'   => '',
@@ -127,110 +127,110 @@  discard block
 block discarded – undo
127 127
          */
128 128
 
129 129
 
130
-        // Check if the notice is dismissible, and if so has been dismissed.
131
-        if ( $is_dismissible && $this->is_dismissed( $name ) ) {
132
-            // Nothing to show here, return!
133
-            return '';
134
-        }
130
+	// Check if the notice is dismissible, and if so has been dismissed.
131
+	if ( $is_dismissible && $this->is_dismissed( $name ) ) {
132
+	    // Nothing to show here, return!
133
+	    return '';
134
+	}
135 135
 
136
-        $dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
136
+	$dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
137 137
 
138
-        // Display inline notice
139
-        ob_start();
140
-        ?>
138
+	// Display inline notice
139
+	ob_start();
140
+	?>
141 141
         <div class="monsterinsights-notice <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice' . $dismissible; ?>" data-notice="<?php echo esc_attr( $name ); ?>">
142 142
             <div class="monsterinsights-notice-icon <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-icon'?>">
143 143
             </div>
144 144
             <div class="monsterinsights-notice-text <?php echo 'monsterinsights-' . esc_attr( $type ) . '-notice-text'?>">
145 145
                 <?php
146
-                // Title
147
-                if ( ! empty ( $title ) ) {
148
-                    ?>
146
+		// Title
147
+		if ( ! empty ( $title ) ) {
148
+		    ?>
149 149
                     <p class="monsterinsights-notice-title"><?php echo esc_html( $title ); ?></p>
150 150
                     <?php
151
-                }
151
+		}
152 152
 
153
-                // Message
154
-                if ( ! empty( $message ) ) {
155
-                    if ( empty( $args['skip_message_escape'] ) ) {
156
-                        ?>
153
+		// Message
154
+		if ( ! empty( $message ) ) {
155
+		    if ( empty( $args['skip_message_escape'] ) ) {
156
+			?>
157 157
                         <p class="monsterinsights-notice-message"><?php echo esc_html( $message ); ?></p>
158 158
                         <?php
159
-                    } else {
160
-                        ?>
159
+		    } else {
160
+			?>
161 161
                         <p class="monsterinsights-notice-message"><?php echo $message; ?></p>
162 162
                         <?php
163
-                    }
164
-                }
163
+		    }
164
+		}
165 165
                 
166
-                // Primary Button
167
-                if ( ! empty( $args['primary']['text'] ) ) {
166
+		// Primary Button
167
+		if ( ! empty( $args['primary']['text'] ) ) {
168 168
                     
169
-                    $text = '';
170
-                    if ( ! empty( $args['primary']['text'] ) ) {
171
-                        $text = $args['primary']['text'];
172
-                    }
173
-
174
-                    $url = '#';
175
-                    if ( ! empty( $args['primary']['url'] ) ) {
176
-                        $url = $args['primary']['url'];
177
-                    }
178
-
179
-                    $target = '';
180
-                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
181
-                        $target = ' target="_blank" rel="noopener noreferrer"';
182
-                    }
183
-
184
-                    $class = 'button button-primary';
185
-                    if ( ! empty( $args['primary']['class'] ) ) {
186
-                        $class = ' class="'. $args['primary']['class'] . '"';
187
-                    }
188
-                    ?>
169
+		    $text = '';
170
+		    if ( ! empty( $args['primary']['text'] ) ) {
171
+			$text = $args['primary']['text'];
172
+		    }
173
+
174
+		    $url = '#';
175
+		    if ( ! empty( $args['primary']['url'] ) ) {
176
+			$url = $args['primary']['url'];
177
+		    }
178
+
179
+		    $target = '';
180
+		    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
181
+			$target = ' target="_blank" rel="noopener noreferrer"';
182
+		    }
183
+
184
+		    $class = 'button button-primary';
185
+		    if ( ! empty( $args['primary']['class'] ) ) {
186
+			$class = ' class="'. $args['primary']['class'] . '"';
187
+		    }
188
+		    ?>
189 189
                     <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
190 190
                     <?php
191
-                }
191
+		}
192 192
 
193
-                // Secondary Button
194
-                if ( ! empty( $args['secondary']['text'] ) ) {
193
+		// Secondary Button
194
+		if ( ! empty( $args['secondary']['text'] ) ) {
195 195
                     
196
-                    $text = '';
197
-                    if ( ! empty( $args['secondary']['text'] ) ) {
198
-                        $text = $args['secondary']['text'];
199
-                    }
200
-
201
-                    $url = '#';
202
-                    if ( ! empty( $args['secondary']['url'] ) ) {
203
-                        $url = $args['secondary']['url'];
204
-                    }           
205
-
206
-                    $target = '';
207
-                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
208
-                        $target = ' target="_blank" rel="noopener noreferrer"';
209
-                    }
210
-
211
-                    $class = 'button button-secondary';
212
-                    if ( ! empty( $args['secondary']['class'] ) ) {
213
-                        $class = ' class="'. $args['secondary']['class'] . '"';
214
-                    }
215
-                    ?>
196
+		    $text = '';
197
+		    if ( ! empty( $args['secondary']['text'] ) ) {
198
+			$text = $args['secondary']['text'];
199
+		    }
200
+
201
+		    $url = '#';
202
+		    if ( ! empty( $args['secondary']['url'] ) ) {
203
+			$url = $args['secondary']['url'];
204
+		    }           
205
+
206
+		    $target = '';
207
+		    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
208
+			$target = ' target="_blank" rel="noopener noreferrer"';
209
+		    }
210
+
211
+		    $class = 'button button-secondary';
212
+		    if ( ! empty( $args['secondary']['class'] ) ) {
213
+			$class = ' class="'. $args['secondary']['class'] . '"';
214
+		    }
215
+		    ?>
216 216
                     <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
217 217
                     <?php
218
-                }
218
+		}
219 219
 
220
-                // Dismiss Button
221
-                if ( $is_dismissible ) {
222
-                    ?>
220
+		// Dismiss Button
221
+		if ( $is_dismissible ) {
222
+		    ?>
223 223
                     <button type="button" class="notice-dismiss<?php echo $dismissible; ?>">
224 224
                         <span class="screen-reader-text">
225 225
                             <?php esc_html_e( 'Dismiss this notice', 'google-analytics-for-wordpress' ); ?>
226 226
                         </span>
227 227
                     </button>
228 228
                     <?php
229
-                }
230
-                ?>
229
+		}
230
+		?>
231 231
             </div>
232 232
         </div>
233 233
         <?php
234
-        return ob_get_clean();
234
+	return ob_get_clean();
235 235
     }
236 236
 }
237 237
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
 
57 57
     public function is_dismissed( $notice ) {
58
-        if ( ! isset( $this->notices[ $notice ] ) ) {
58
+        if ( ! isset( $this->notices[$notice] ) ) {
59 59
             return false;
60 60
         }
61 61
         return true;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @return null
73 73
      */
74 74
     public function dismiss( $notice ) {
75
-        $this->notices[ $notice ] = true;
75
+        $this->notices[$notice] = true;
76 76
         update_option( 'monsterinsights_notices', $this->notices );
77 77
 
78 78
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @return null
89 89
      */
90 90
     public function undismiss( $notice ) {
91
-        unset( $this->notices[ $notice ] );
91
+        unset( $this->notices[$notice] );
92 92
         update_option( 'monsterinsights_notices', $this->notices );
93 93
 
94 94
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             return '';
134 134
         }
135 135
 
136
-        $dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
136
+        $dismissible = ( $is_dismissible ) ? ' is-dismissible' : '';
137 137
 
138 138
         // Display inline notice
139 139
         ob_start();
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
                     }
178 178
 
179 179
                     $target = '';
180
-                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
180
+                    if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank' ) {
181 181
                         $target = ' target="_blank" rel="noopener noreferrer"';
182 182
                     }
183 183
 
184 184
                     $class = 'button button-primary';
185 185
                     if ( ! empty( $args['primary']['class'] ) ) {
186
-                        $class = ' class="'. $args['primary']['class'] . '"';
186
+                        $class = ' class="' . $args['primary']['class'] . '"';
187 187
                     }
188 188
                     ?>
189
-                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
189
+                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a>
190 190
                     <?php
191 191
                 }
192 192
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
                     }           
205 205
 
206 206
                     $target = '';
207
-                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
207
+                    if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank' ) {
208 208
                         $target = ' target="_blank" rel="noopener noreferrer"';
209 209
                     }
210 210
 
211 211
                     $class = 'button button-secondary';
212 212
                     if ( ! empty( $args['secondary']['class'] ) ) {
213
-                        $class = ' class="'. $args['secondary']['class'] . '"';
213
+                        $class = ' class="' . $args['secondary']['class'] . '"';
214 214
                     }
215 215
                     ?>
216
-                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
216
+                    <a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class; ?>><?php echo esc_html( $text ); ?></a>
217 217
                     <?php
218 218
                 }
219 219
 
Please login to merge, or discard this patch.
includes/admin/licensing/skin.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function __construct( $args = array() ) {
27 27
 
28
-        parent::__construct();
28
+	parent::__construct();
29 29
 
30 30
     }
31 31
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function set_upgrader( &$upgrader ) {
40 40
 
41
-        if ( is_object( $upgrader ) ) {
42
-            $this->upgrader =& $upgrader;
43
-        }
41
+	if ( is_object( $upgrader ) ) {
42
+	    $this->upgrader =& $upgrader;
43
+	}
44 44
 
45 45
     }
46 46
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function set_result( $result ) {
55 55
 
56
-        $this->result = $result;
56
+	$this->result = $result;
57 57
 
58 58
     }
59 59
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      */
83 83
     function error( $errors ) {
84 84
 
85
-        if ( ! empty( $errors ) ) {
86
-            echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) );
87
-            die;
88
-        }
85
+	if ( ! empty( $errors ) ) {
86
+	    echo json_encode( array( 'error' => esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-for-wordpress' ) ) );
87
+	    die;
88
+	}
89 89
 
90 90
     }
91 91
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     public function set_upgrader( &$upgrader ) {
40 40
 
41 41
         if ( is_object( $upgrader ) ) {
42
-            $this->upgrader =& $upgrader;
42
+            $this->upgrader = & $upgrader;
43 43
         }
44 44
 
45 45
     }
Please login to merge, or discard this patch.
includes/admin/licensing/autoupdate.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
 
14 14
     // If this is multisite and is not on the main site, return early.
15 15
     if ( is_multisite() && ! is_main_site() ) {
16
-        return $update;
16
+	return $update;
17 17
     }
18 18
     
19 19
     // If we don't have everything we need, return early.
20 20
     $item = (array) $item;
21 21
     if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
22
-        return $update;
22
+	return $update;
23 23
     }
24 24
 
25 25
     // If the plugin isn't ours, return early.
26 26
     $is_free = 'google-analytics-for-wordpress' === $item['slug'];
27 27
     $is_paid = isset( $item['monsterinsights_plugin'] ); // see updater class
28 28
     if ( ! $is_free && ! $is_paid ) {
29
-        return $update;
29
+	return $update;
30 30
     }
31 31
 
32 32
     $version           = $is_free ? MONSTERINSIGHTS_LITE_VERSION : $item['old_version'];
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
     
37 37
     // If the opt in update allows major updates but there is no major version update, return early.
38 38
     if ( $current_major < $new_major ) {
39
-        if ( $automatic_updates === 'all' ) {
40
-            return true;
41
-        } else {
42
-            return $update;
43
-        }
39
+	if ( $automatic_updates === 'all' ) {
40
+	    return true;
41
+	} else {
42
+	    return $update;
43
+	}
44 44
     }
45 45
     
46 46
     // If the opt in update allows minor updates but there is no minor version update, return early.
47 47
     if ( $current_major == $new_major ) {
48
-        if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
49
-            return true;
50
-        } else {
51
-            return $update;
52
-        }
48
+	if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
49
+	    return true;
50
+	} else {
51
+	    return $update;
52
+	}
53 53
     }
54 54
 
55 55
     // All our checks have passed - this plugin can be updated!
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 function monsterinsights_get_major_version( $version ) {
88 88
     $exploded_version = explode( '.', $version );
89 89
     if ( isset( $exploded_version[2] ) ) {
90
-        return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
90
+	return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
91 91
     } else {
92
-        return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
92
+	return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
93 93
     }
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/ajax.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 
167 167
     // Deactivate the addon.
168 168
     if ( isset( $_POST['plugin'] ) ) {
169
-        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
169
+        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
170 170
             $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171 171
         } else {
172 172
             $deactivate = deactivate_plugins( $_POST['plugin'] );
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134 134
         if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
-            $activate = activate_plugin( $_POST['plugin'], NULL, true );
135
+            $activate = activate_plugin( $_POST['plugin'], null, true );
136 136
         } else {
137 137
             $activate = activate_plugin( $_POST['plugin'] );
138 138
         }
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -51,60 +51,60 @@  discard block
 block discarded – undo
51 51
     check_ajax_referer( 'monsterinsights-install', 'nonce' );
52 52
 
53 53
     if ( ! current_user_can( 'install_plugins' ) ) {
54
-        echo json_encode( true );
54
+	echo json_encode( true );
55 55
     }
56 56
 
57 57
     // Install the addon.
58 58
     if ( isset( $_POST['plugin'] ) ) {
59
-        $download_url = $_POST['plugin'];
60
-        global $hook_suffix;
61
-
62
-        // Set the current screen to avoid undefined notices.
63
-        set_current_screen();
64
-
65
-        // Prepare variables.
66
-        $method = '';
67
-        $url    = add_query_arg(
68
-            array(
69
-                'page' => 'monsterinsights-settings'
70
-            ),
71
-            admin_url( 'admin.php' )
72
-        );
73
-        $url = esc_url( $url );
74
-
75
-        // Start output bufferring to catch the filesystem form if credentials are needed.
76
-        ob_start();
77
-        if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
78
-            $form = ob_get_clean();
79
-            echo json_encode( array( 'form' => $form ) );
80
-            wp_die();
81
-        }
82
-
83
-        // If we are not authenticated, make it happen now.
84
-        if ( ! WP_Filesystem( $creds ) ) {
85
-            ob_start();
86
-            request_filesystem_credentials( $url, $method, true, false, null );
87
-            $form = ob_get_clean();
88
-            echo json_encode( array( 'form' => $form ) );
89
-            wp_die();
90
-        }
91
-
92
-        // We do not need any extra credentials if we have gotten this far, so let's install the plugin.
93
-        require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
-        $base = MonsterInsights();
95
-        require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php';
59
+	$download_url = $_POST['plugin'];
60
+	global $hook_suffix;
61
+
62
+	// Set the current screen to avoid undefined notices.
63
+	set_current_screen();
64
+
65
+	// Prepare variables.
66
+	$method = '';
67
+	$url    = add_query_arg(
68
+	    array(
69
+		'page' => 'monsterinsights-settings'
70
+	    ),
71
+	    admin_url( 'admin.php' )
72
+	);
73
+	$url = esc_url( $url );
74
+
75
+	// Start output bufferring to catch the filesystem form if credentials are needed.
76
+	ob_start();
77
+	if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
78
+	    $form = ob_get_clean();
79
+	    echo json_encode( array( 'form' => $form ) );
80
+	    wp_die();
81
+	}
82
+
83
+	// If we are not authenticated, make it happen now.
84
+	if ( ! WP_Filesystem( $creds ) ) {
85
+	    ob_start();
86
+	    request_filesystem_credentials( $url, $method, true, false, null );
87
+	    $form = ob_get_clean();
88
+	    echo json_encode( array( 'form' => $form ) );
89
+	    wp_die();
90
+	}
91
+
92
+	// We do not need any extra credentials if we have gotten this far, so let's install the plugin.
93
+	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
+	$base = MonsterInsights();
95
+	require_once plugin_dir_path( $base->file ) . '/includes/admin/licensing/skin.php';
96 96
         
97
-        // Create the plugin upgrader with our custom skin.
98
-        $installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() );
99
-        $installer->install( $download_url );
100
-
101
-        // Flush the cache and return the newly installed plugin basename.
102
-        wp_cache_flush();
103
-        if ( $installer->plugin_info() ) {
104
-            $plugin_basename = $installer->plugin_info();
105
-            echo json_encode( array( 'plugin' => $plugin_basename ) );
106
-            wp_die();
107
-        }
97
+	// Create the plugin upgrader with our custom skin.
98
+	$installer = new Plugin_Upgrader( $skin = new MonsterInsights_Skin() );
99
+	$installer->install( $download_url );
100
+
101
+	// Flush the cache and return the newly installed plugin basename.
102
+	wp_cache_flush();
103
+	if ( $installer->plugin_info() ) {
104
+	    $plugin_basename = $installer->plugin_info();
105
+	    echo json_encode( array( 'plugin' => $plugin_basename ) );
106
+	    wp_die();
107
+	}
108 108
     }
109 109
 
110 110
     // Send back a response.
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
     check_ajax_referer( 'monsterinsights-activate', 'nonce' );
127 127
 
128 128
     if ( ! current_user_can( 'activate_plugins' ) ) {
129
-        echo json_encode( true );
129
+	echo json_encode( true );
130 130
     }
131 131
 
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134
-        if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
-            $activate = activate_plugin( $_POST['plugin'], NULL, true );
136
-        } else {
137
-            $activate = activate_plugin( $_POST['plugin'] );
138
-        }
139
-
140
-        if ( is_wp_error( $activate ) ) {
141
-            echo json_encode( array( 'error' => $activate->get_error_message() ) );
142
-            wp_die();
143
-        }
134
+	if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
135
+	    $activate = activate_plugin( $_POST['plugin'], NULL, true );
136
+	} else {
137
+	    $activate = activate_plugin( $_POST['plugin'] );
138
+	}
139
+
140
+	if ( is_wp_error( $activate ) ) {
141
+	    echo json_encode( array( 'error' => $activate->get_error_message() ) );
142
+	    wp_die();
143
+	}
144 144
     }
145 145
 
146 146
     echo json_encode( true );
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
     check_ajax_referer( 'monsterinsights-deactivate', 'nonce' );
162 162
 
163 163
     if ( ! current_user_can( 'activate_plugins' ) ) {
164
-        echo json_encode( true );
164
+	echo json_encode( true );
165 165
     }
166 166
 
167 167
     // Deactivate the addon.
168 168
     if ( isset( $_POST['plugin'] ) ) {
169
-        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
170
-            $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171
-        } else {
172
-            $deactivate = deactivate_plugins( $_POST['plugin'] );
173
-        }
169
+	if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
170
+	    $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171
+	} else {
172
+	    $deactivate = deactivate_plugins( $_POST['plugin'] );
173
+	}
174 174
     }
175 175
 
176 176
     echo json_encode( true );
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
     // Deactivate the notice
195 195
     if ( isset( $_POST['notice'] ) ) {
196
-        // Init the notice class and mark notice as deactivated
197
-        MonsterInsights()->notices->dismiss( $_POST['notice'] );
196
+	// Init the notice class and mark notice as deactivated
197
+	MonsterInsights()->notices->dismiss( $_POST['notice'] );
198 198
 
199
-        // Return true
200
-        echo json_encode( true );
201
-        wp_die();
199
+	// Return true
200
+	echo json_encode( true );
201
+	wp_die();
202 202
     }
203 203
 
204 204
     // If here, an error occurred
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
 
132 132
     // Activate the addon.
133 133
     if ( isset( $_POST['plugin'] ) ) {
134
-        if ( isset( $_POST['isnetwork'] ) &&  $_POST['isnetwork'] ) {
134
+        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
135 135
             $activate = activate_plugin( $_POST['plugin'], NULL, true );
136 136
         } else {
137 137
             $activate = activate_plugin( $_POST['plugin'] );
Please login to merge, or discard this patch.
includes/admin/pages/tools.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 	<?php
52 52
 }
53 53
 
54
-function monsterinsights_tools_url_builder_tab(){
54
+function monsterinsights_tools_url_builder_tab() {
55 55
 	do_action( 'monsterinsights_tools_url_builder_tab' );
56 56
 }
57 57
 
58 58
 function monsterinsights_tools_settings_tab() {
59
-	ob_start();?>
60
-	<h2><?php echo esc_html__( 'Setting Tools', 'google-analytics-for-wordpress' );?></h2>
59
+	ob_start(); ?>
60
+	<h2><?php echo esc_html__( 'Setting Tools', 'google-analytics-for-wordpress' ); ?></h2>
61 61
 	<p><?php echo esc_html__( 'You can use the below tools to import settings from other MonsterInsights websites or export settings to import into another MonsterInsights install.', 'google-analytics-for-wordpress' ); ?> </p>
62 62
 	<br />
63 63
 	<table class="form-table">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 			<tr>
66 66
 				<th scope="row">
67 67
 					<label for="monsterinsights-import-settings">
68
-						<?php echo esc_html__( 'Import Settings', 'google-analytics-for-wordpress' );?>
68
+						<?php echo esc_html__( 'Import Settings', 'google-analytics-for-wordpress' ); ?>
69 69
 					</label>
70 70
 				</th>
71 71
 				<td>
72 72
 					<?php 
73
-					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){
74
-						echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() );
73
+					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) {
74
+						echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!', 'google-analytics-for-wordpress' ), 'success', false, array() );
75 75
 					}
76 76
 					?>
77 77
 					<form method="post" enctype="multipart/form-data">
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 							<input type="file" name="import_file"/>
80 80
 							<input type="hidden" name="monsterinsights_action" value="monsterinsights_import_settings" />
81 81
 						</p>
82
-						<p class="description"><?php echo esc_html__( 'Paste the import field content from another MonsterInsights site in above.', 'google-analytics-for-wordpress' );?></p>
82
+						<p class="description"><?php echo esc_html__( 'Paste the import field content from another MonsterInsights site in above.', 'google-analytics-for-wordpress' ); ?></p>
83 83
 						<p>
84 84
 							<?php wp_nonce_field( 'monsterinsights_import_settings', 'monsterinsights_import_settings' ); ?>
85 85
 						</p>
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 			<tr>
93 93
 				<th scope="row">
94 94
 					<label for="monsterinsights-export-settings">
95
-						<?php echo esc_html__( 'Export Settings:', 'google-analytics-for-wordpress' );?>
95
+						<?php echo esc_html__( 'Export Settings:', 'google-analytics-for-wordpress' ); ?>
96 96
 					</label>
97 97
 				</th>
98 98
 				<td>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
  * @return void
126 126
  */
127 127
 function monsterinsights_process_export_settings() {
128
-	if ( !isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) {
128
+	if ( ! isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) {
129 129
 		return;
130 130
 	}
131 131
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		return;
134 134
 	}
135 135
 
136
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){
136
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) {
137 137
 		return;
138 138
 	}
139 139
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 function monsterinsights_import_settings() {
158 158
 
159
-	if ( !isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) {
159
+	if ( ! isset( $_POST['monsterinsights_action'] ) || empty( $_POST['monsterinsights_action'] ) ) {
160 160
 		return;
161 161
 	}
162 162
 
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 		return;
165 165
 	}
166 166
 
167
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){
167
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) {
168 168
 		return;
169 169
 	}
170 170
 
171
-	if ( !wp_verify_nonce( $_POST['monsterinsights_import_settings'], 'monsterinsights_import_settings' ) ) {
171
+	if ( ! wp_verify_nonce( $_POST['monsterinsights_import_settings'], 'monsterinsights_import_settings' ) ) {
172 172
 		return;
173 173
 	}
174 174
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		wp_die( __( 'Please upload a file to import', 'google-analytics-for-wordpress' ) );
186 186
 	}
187 187
 
188
-	$file     = file_get_contents( $import_file );
188
+	$file = file_get_contents( $import_file );
189 189
 	if ( empty( $file ) ) {
190 190
 		wp_die( __( 'Please upload a real settings export file to import', 'google-analytics-for-wordpress' ) );
191 191
 	}
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
 	);
204 204
 
205 205
 	foreach ( $exclude as $e ) {
206
-		if ( ! empty( $new_settings[ $e ] ) ) {
207
-			unset( $new_settings[ $e ] );
206
+		if ( ! empty( $new_settings[$e] ) ) {
207
+			unset( $new_settings[$e] );
208 208
 		}
209 209
 	}
210 210
 
211 211
 	if ( ! is_super_admin() ) {
212
-		if ( ! empty( $new_settings[ 'custom_code' ] ) ) {
213
-			unset( $new_settings[ 'custom_code' ] );
212
+		if ( ! empty( $new_settings['custom_code'] ) ) {
213
+			unset( $new_settings['custom_code'] );
214 214
 		}
215 215
 	}
216 216
 
217 217
 	foreach ( $exclude as $e ) {
218
-		if ( ! empty( $settings[ $e ] ) ) {
219
-			$new_settings = $settings[ $e ];
218
+		if ( ! empty( $settings[$e] ) ) {
219
+			$new_settings = $settings[$e];
220 220
 		}
221 221
 	}
222 222
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	<?php
52 52
 }
53 53
 
54
-function monsterinsights_tools_url_builder_tab(){
54
+function monsterinsights_tools_url_builder_tab() {
55 55
 	do_action( 'monsterinsights_tools_url_builder_tab' );
56 56
 }
57 57
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 				</th>
71 71
 				<td>
72 72
 					<?php 
73
-					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){
73
+					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) {
74 74
 						echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() );
75 75
 					}
76 76
 					?>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		return;
134 134
 	}
135 135
 
136
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){
136
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) {
137 137
 		return;
138 138
 	}
139 139
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		return;
165 165
 	}
166 166
 
167
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){
167
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) {
168 168
 		return;
169 169
 	}
170 170
 
Please login to merge, or discard this patch.
includes/helpers.php 3 patches
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 	function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
868 868
 		global $wp_filter;
869 869
 		// Check that filter actually exists first
870
-		if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE;
870
+		if ( ! isset( $wp_filter[ $tag ] ) ) return false;
871 871
 		/**
872 872
 		 * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer
873 873
 		 * a simple array, rather it is an object that implements the ArrayAccess interface.
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			$callbacks = &$wp_filter[ $tag ];
883 883
 		}
884 884
 		// Exit if there aren't any callbacks for specified priority
885
-		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE;
885
+		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return false;
886 886
 		// Loop through each filter for the specified priority, looking for our class & method
887 887
 		foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) {
888 888
 			// Filter should always be an array - array( $this, 'method' ), if not goto next
@@ -904,10 +904,10 @@  discard block
 block discarded – undo
904 904
 					// Remove this filter from merged_filters, which specifies if filters have been sorted
905 905
 					unset( $GLOBALS[ 'merged_filters' ][ $tag ] );
906 906
 				}
907
-				return TRUE;
907
+				return true;
908 908
 			}
909 909
 		}
910
-		return FALSE;
910
+		return false;
911 911
 	}
912 912
 } // End function exists
913 913
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 function monsterinsights_track_user() {
33 33
 	$user        = wp_get_current_user();
34 34
 	$track_user  = true;
35
-	$roles     = monsterinsights_get_option( 'ignore_users', array() );
35
+	$roles = monsterinsights_get_option( 'ignore_users', array() );
36 36
 
37 37
 	if ( ! empty( $roles ) && is_array( $roles ) ) {
38 38
 		foreach ( $roles as $role ) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 
100 100
 	$ga_cookie    = $_COOKIE['_ga'];
101
-	$cookie_parts = explode('.', $ga_cookie );
101
+	$cookie_parts = explode( '.', $ga_cookie );
102 102
 	if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) {
103 103
 		$uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3];
104 104
 		if ( is_string( $uuid ) ) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 	
159 159
 	$ga_cookie    = $_COOKIE['_ga'];
160
-	$cookie_parts = explode('.', $ga_cookie );
160
+	$cookie_parts = explode( '.', $ga_cookie );
161 161
 	if ( is_array( $cookie_parts ) && ! empty( $cookie_parts[2] ) && ! empty( $cookie_parts[3] ) ) {
162 162
 		$uuid = (string) $cookie_parts[2] . '.' . (string) $cookie_parts[3];
163 163
 		if ( is_string( $uuid ) ) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 
174 174
 function monsterinsights_generate_ga_client_id() {
175
-	return rand(100000000,999999999) . '.' . time();
175
+	return rand( 100000000, 999999999 ) . '.' . time();
176 176
 }
177 177
  
178 178
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$stop = time();
193 193
 	}
194 194
 
195
-	$diff = (int) abs( $stop -  $start );
195
+	$diff = (int) abs( $stop - $start );
196 196
 	$hours = round( $diff / HOUR_IN_SECONDS );
197 197
 	return $hours;
198 198
 }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	$editable_roles = apply_filters( 'editable_roles', $all_roles );
251 251
 
252 252
 	foreach ( $editable_roles as $id => $name ) {
253
-		$roles[ $id ] = translate_user_role( $name['name'] );
253
+		$roles[$id] = translate_user_role( $name['name'] );
254 254
 	}
255 255
 
256 256
 	return $roles;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			
296 296
 		}
297 297
 		if ( substr_count( $host, '.' ) > 1 ) {
298
-			$subdomains_to_check =  array( 'dev.', '*.staging.', 'beta.', 'test.' );
298
+			$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
299 299
 			foreach ( $subdomains_to_check as $subdomain ) {
300 300
 				$subdomain = str_replace( '.', '(.)', $subdomain );
301 301
 				$subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain );
@@ -311,16 +311,16 @@  discard block
 block discarded – undo
311 311
 
312 312
 // Set cookie to expire in 2 years
313 313
 function monsterinsights_get_cookie_expiration_date( $time ) {
314
-	return date('D, j F Y H:i:s', time() + $time );
314
+	return date( 'D, j F Y H:i:s', time() + $time );
315 315
 }
316 316
 
317 317
 function monsterinsights_string_ends_with( $string, $ending ) {
318
-	$strlen = strlen($string);
319
-	$endinglen = strlen($ending);
318
+	$strlen = strlen( $string );
319
+	$endinglen = strlen( $ending );
320 320
 	if ( $endinglen > $strlen ) {
321 321
 		return false;
322 322
 	}
323
-	return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0;
323
+	return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen ) === 0;
324 324
 }
325 325
 
326 326
 function monsterinsights_string_starts_with( $string, $start ) {
@@ -844,11 +844,11 @@  discard block
 block discarded – undo
844 844
 	return $countries;
845 845
 }
846 846
 
847
-function monsterinsights_get_api_url(){
847
+function monsterinsights_get_api_url() {
848 848
 	return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' );
849 849
 }
850 850
 
851
-function monsterinsights_get_licensing_url(){
851
+function monsterinsights_get_licensing_url() {
852 852
 	return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' );
853 853
 }
854 854
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	}
897 897
 }
898 898
 
899
-if ( ! function_exists ( 'remove_class_filter' ) ) {
899
+if ( ! function_exists( 'remove_class_filter' ) ) {
900 900
 	/**
901 901
 	 * Remove Class Filter Without Access to Class Object
902 902
 	 *
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
918 918
 		global $wp_filter;
919 919
 		// Check that filter actually exists first
920
-		if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE;
920
+		if ( ! isset( $wp_filter[$tag] ) ) return FALSE;
921 921
 		/**
922 922
 		 * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer
923 923
 		 * a simple array, rather it is an object that implements the ArrayAccess interface.
@@ -926,33 +926,33 @@  discard block
 block discarded – undo
926 926
 		 *
927 927
 		 * @see https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/
928 928
 		 */
929
-		if ( is_object( $wp_filter[ $tag ] ) && isset( $wp_filter[ $tag ]->callbacks ) ) {
930
-			$callbacks = &$wp_filter[ $tag ]->callbacks;
929
+		if ( is_object( $wp_filter[$tag] ) && isset( $wp_filter[$tag]->callbacks ) ) {
930
+			$callbacks = &$wp_filter[$tag]->callbacks;
931 931
 		} else {
932
-			$callbacks = &$wp_filter[ $tag ];
932
+			$callbacks = &$wp_filter[$tag];
933 933
 		}
934 934
 		// Exit if there aren't any callbacks for specified priority
935
-		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE;
935
+		if ( ! isset( $callbacks[$priority] ) || empty( $callbacks[$priority] ) ) return FALSE;
936 936
 		// Loop through each filter for the specified priority, looking for our class & method
937
-		foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) {
937
+		foreach ( (array) $callbacks[$priority] as $filter_id => $filter ) {
938 938
 			// Filter should always be an array - array( $this, 'method' ), if not goto next
939
-			if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue;
939
+			if ( ! isset( $filter['function'] ) || ! is_array( $filter['function'] ) ) continue;
940 940
 			// If first value in array is not an object, it can't be a class
941
-			if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue;
941
+			if ( ! is_object( $filter['function'][0] ) ) continue;
942 942
 			// Method doesn't match the one we're looking for, goto next
943
-			if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue;
943
+			if ( $filter['function'][1] !== $method_name ) continue;
944 944
 			// Method matched, now let's check the Class
945
-			if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) {
945
+			if ( get_class( $filter['function'][0] ) === $class_name ) {
946 946
 				// Now let's remove it from the array
947
-				unset( $callbacks[ $priority ][ $filter_id ] );
947
+				unset( $callbacks[$priority][$filter_id] );
948 948
 				// and if it was the only filter in that priority, unset that priority
949
-				if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] );
949
+				if ( empty( $callbacks[$priority] ) ) unset( $callbacks[$priority] );
950 950
 				// and if the only filter for that tag, set the tag to an empty array
951 951
 				if ( empty( $callbacks ) ) $callbacks = array();
952 952
 				// If using WordPress older than 4.7
953
-				if ( ! is_object( $wp_filter[ $tag ] ) ) {
953
+				if ( ! is_object( $wp_filter[$tag] ) ) {
954 954
 					// Remove this filter from merged_filters, which specifies if filters have been sorted
955
-					unset( $GLOBALS[ 'merged_filters' ][ $tag ] );
955
+					unset( $GLOBALS['merged_filters'][$tag] );
956 956
 				}
957 957
 				return TRUE;
958 958
 			}
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	}
962 962
 } // End function exists
963 963
 
964
-if ( ! function_exists ( 'remove_class_action' ) ) {
964
+if ( ! function_exists( 'remove_class_action' ) ) {
965 965
 	/**
966 966
 	 * Remove Class Action Without Access to Class Object
967 967
 	 *
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -844,11 +844,11 @@  discard block
 block discarded – undo
844 844
 	return $countries;
845 845
 }
846 846
 
847
-function monsterinsights_get_api_url(){
847
+function monsterinsights_get_api_url() {
848 848
 	return apply_filters( 'monsterinsights_get_api_url', 'api.monsterinsights.com/v2/' );
849 849
 }
850 850
 
851
-function monsterinsights_get_licensing_url(){
851
+function monsterinsights_get_licensing_url() {
852 852
 	return apply_filters( 'monsterinsights_get_licensing_url', 'https://www.monsterinsights.com' );
853 853
 }
854 854
 
@@ -917,7 +917,9 @@  discard block
 block discarded – undo
917 917
 	function remove_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
918 918
 		global $wp_filter;
919 919
 		// Check that filter actually exists first
920
-		if ( ! isset( $wp_filter[ $tag ] ) ) return FALSE;
920
+		if ( ! isset( $wp_filter[ $tag ] ) ) {
921
+			return FALSE;
922
+		}
921 923
 		/**
922 924
 		 * If filter config is an object, means we're using WordPress 4.7+ and the config is no longer
923 925
 		 * a simple array, rather it is an object that implements the ArrayAccess interface.
@@ -932,23 +934,35 @@  discard block
 block discarded – undo
932 934
 			$callbacks = &$wp_filter[ $tag ];
933 935
 		}
934 936
 		// Exit if there aren't any callbacks for specified priority
935
-		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) return FALSE;
937
+		if ( ! isset( $callbacks[ $priority ] ) || empty( $callbacks[ $priority ] ) ) {
938
+			return FALSE;
939
+		}
936 940
 		// Loop through each filter for the specified priority, looking for our class & method
937 941
 		foreach( (array) $callbacks[ $priority ] as $filter_id => $filter ) {
938 942
 			// Filter should always be an array - array( $this, 'method' ), if not goto next
939
-			if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) continue;
943
+			if ( ! isset( $filter[ 'function' ] ) || ! is_array( $filter[ 'function' ] ) ) {
944
+				continue;
945
+			}
940 946
 			// If first value in array is not an object, it can't be a class
941
-			if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) continue;
947
+			if ( ! is_object( $filter[ 'function' ][ 0 ] ) ) {
948
+				continue;
949
+			}
942 950
 			// Method doesn't match the one we're looking for, goto next
943
-			if ( $filter[ 'function' ][ 1 ] !== $method_name ) continue;
951
+			if ( $filter[ 'function' ][ 1 ] !== $method_name ) {
952
+				continue;
953
+			}
944 954
 			// Method matched, now let's check the Class
945 955
 			if ( get_class( $filter[ 'function' ][ 0 ] ) === $class_name ) {
946 956
 				// Now let's remove it from the array
947 957
 				unset( $callbacks[ $priority ][ $filter_id ] );
948 958
 				// and if it was the only filter in that priority, unset that priority
949
-				if ( empty( $callbacks[ $priority ] ) ) unset( $callbacks[ $priority ] );
959
+				if ( empty( $callbacks[ $priority ] ) ) {
960
+					unset( $callbacks[ $priority ] );
961
+				}
950 962
 				// and if the only filter for that tag, set the tag to an empty array
951
-				if ( empty( $callbacks ) ) $callbacks = array();
963
+				if ( empty( $callbacks ) ) {
964
+					$callbacks = array();
965
+				}
952 966
 				// If using WordPress older than 4.7
953 967
 				if ( ! is_object( $wp_filter[ $tag ] ) ) {
954 968
 					// Remove this filter from merged_filters, which specifies if filters have been sorted
Please login to merge, or discard this patch.