Passed
Push — master ( 805644...e0709e )
by Chris
06:07
created
includes/frontend/tracking/class-tracking-analytics.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 		if ( $create && ! empty( $create ) && is_array( $create ) ) {
100 100
 			$create = json_encode( $create );
101
-			$create = str_replace( '"', "'",  $create );
102
-			$options['create'] = "'create', '" . esc_js( $ua_code ). "', '" . esc_js( $domain ) . "', " . $create;
101
+			$create = str_replace( '"', "'", $create );
102
+			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "', " . $create;
103 103
 		} else {
104 104
 			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "'";
105 105
 		}
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 	 * @return string Javascript to output.
192 192
 	 */
193 193
 	public function frontend_output( ) {
194
-		$options        = $this->frontend_tracking_options();
194
+		$options = $this->frontend_tracking_options();
195 195
 		$src     	    = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' );
196
-		$compat_mode     = monsterinsights_get_option( 'gatracker_compatibility_mode', false );
196
+		$compat_mode = monsterinsights_get_option( 'gatracker_compatibility_mode', false );
197 197
 		$compat    	 	= $compat_mode ? 'window.ga = __gaTracker;' : '';
198 198
 		$track_user 	= monsterinsights_track_user();
199 199
 		$ua         	= monsterinsights_get_ua();
200 200
 		$output     	= '';
201 201
 		$reason     	= '';
202
-		$attributes     = apply_filters( 'monsterinsights_tracking_analytics_script_attributes', array( 'type' => "text/javascript", 'data-cfasync' => 'false'  ) );
202
+		$attributes     = apply_filters( 'monsterinsights_tracking_analytics_script_attributes', array( 'type' => "text/javascript", 'data-cfasync' => 'false' ) );
203 203
 		$attr_string    = '';
204 204
 		if ( ! empty( $attributes ) ) {
205
-			foreach( $attributes as $attr_name => $attr_value ) {
205
+			foreach ( $attributes as $attr_name => $attr_value ) {
206 206
 	 			if ( ! empty( $attr_name ) ) {
207 207
 	 				$attr_string .= ' ' . sanitize_key( $attr_name ) . '="' . esc_attr( $attr_value ) . '"';
208 208
 	 			} else {
@@ -216,21 +216,21 @@  discard block
 block discarded – undo
216 216
 <?php if ( ! $track_user ) {
217 217
 	if ( empty( $ua ) ) {
218 218
 		$reason = __( 'Note: MonsterInsights is not currently configured on this site. The site owner needs to authenticate with Google Analytics in the MonsterInsights settings panel.', 'google-analytics-for-wordpress' );
219
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
219
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
220 220
 	} else if ( current_user_can( 'monsterinsights_save_settings' ) ) {
221
-		$reason = __( 'Note: MonsterInsights does not track you as a logged-in site administrator to prevent site owners from accidentally skewing their own Google Analytics data.'. PHP_EOL . 'If you are testing Google Analytics code, please do so either logged out or in the private browsing/incognito mode of your web browser.', 'google-analytics-for-wordpress' );
222
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
221
+		$reason = __( 'Note: MonsterInsights does not track you as a logged-in site administrator to prevent site owners from accidentally skewing their own Google Analytics data.' . PHP_EOL . 'If you are testing Google Analytics code, please do so either logged out or in the private browsing/incognito mode of your web browser.', 'google-analytics-for-wordpress' );
222
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
223 223
 	} else {
224 224
 		$reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' );
225
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
225
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
226 226
 	}
227 227
 	echo $output;
228 228
 } ?>
229 229
 <?php if ( $ua ) { ?>
230
-<script<?php echo $attr_string;?>>
230
+<script<?php echo $attr_string; ?>>
231 231
 	var mi_version         = '<?php echo MONSTERINSIGHTS_VERSION; ?>';
232 232
 	var mi_track_user      = <?php echo ( $track_user ? 'true' : 'false' ); ?>;
233
-	var mi_no_track_reason = <?php echo ( $reason ? "'" . esc_js( $reason)  . "'": "''" ); ?>;
233
+	var mi_no_track_reason = <?php echo ( $reason ? "'" . esc_js( $reason ) . "'" : "''" ); ?>;
234 234
 	<?php do_action( 'monsterinsights_tracking_analytics_frontend_output_after_mi_track_user' ); ?>
235 235
 
236 236
 <?php if ( $this->should_do_optout() ) { ?>
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	?>
279 279
 	} else {
280 280
 <?php if ( $this->should_do_optout() ) { ?>
281
-		console.log( "<?php echo esc_js( $reason );?>" );
281
+		console.log( "<?php echo esc_js( $reason ); ?>" );
282 282
 		(function() {
283 283
 			/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
284 284
 			var noopfn = function() {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 				}
302 302
 				var f = arguments[len-1];
303 303
 				if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
304
-					console.log( '<?php echo esc_js( __("Not running function", "google-analytics-for-wordpress" ) );?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( __( "because you are not being tracked.", 'google-analytics-for-wordpress' ) );?> " + mi_no_track_reason );
304
+					console.log( '<?php echo esc_js( __( "Not running function", "google-analytics-for-wordpress" ) ); ?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( __( "because you are not being tracked.", 'google-analytics-for-wordpress' ) ); ?> " + mi_no_track_reason );
305 305
 					return;
306 306
 				}
307 307
 				try {
Please login to merge, or discard this patch.
includes/admin/routes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			return;
43 43
 		}
44 44
 
45
-		$site_license    = array(
45
+		$site_license = array(
46 46
 			'key'         => MonsterInsights()->license->get_site_license_key(),
47 47
 			'type'        => MonsterInsights()->license->get_site_license_type(),
48 48
 			'is_disabled' => MonsterInsights()->license->site_license_disabled(),
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		// Array fields are needed even if empty.
103 103
 		$array_fields = array( 'view_reports', 'save_settings', 'ignore_users' );
104 104
 		foreach ( $array_fields as $array_field ) {
105
-			if ( ! isset( $options[ $array_field ] ) ) {
106
-				$options[ $array_field ] = array();
105
+			if ( ! isset( $options[$array_field] ) ) {
106
+				$options[$array_field] = array();
107 107
 			}
108 108
 		}
109 109
 		if ( isset( $options['custom_code'] ) ) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 						}
178 178
 					}
179 179
 					if ( $empty ) {
180
-						unset( $value[ $key ] );
180
+						unset( $value[$key] );
181 181
 					}
182 182
 				}
183 183
 			}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 				} else {
228 228
 					$addon = $this->get_addon( $installed_plugins, $addons_type, $addon, $slug );
229 229
 				}
230
-				$parsed_addons[ $addon->slug ] = $addon;
230
+				$parsed_addons[$addon->slug] = $addon;
231 231
 			}
232 232
 		}
233 233
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		$installed       = false;
317 317
 		$plugin_basename = monsterinsights_get_plugin_basename_from_slug( $slug );
318 318
 
319
-		if ( isset( $installed_plugins[ $plugin_basename ] ) ) {
319
+		if ( isset( $installed_plugins[$plugin_basename] ) ) {
320 320
 			$installed = true;
321 321
 
322 322
 			if ( is_multisite() && is_network_admin() ) {
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 		);
460 460
 
461 461
 		foreach ( $exclude as $e ) {
462
-			if ( ! empty( $new_settings[ $e ] ) ) {
463
-				unset( $new_settings[ $e ] );
462
+			if ( ! empty( $new_settings[$e] ) ) {
463
+				unset( $new_settings[$e] );
464 464
 			}
465 465
 		}
466 466
 
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 
473 473
 		foreach ( $exclude as $e ) {
474
-			if ( ! empty( $settings[ $e ] ) ) {
475
-				$new_settings = $settings[ $e ];
474
+			if ( ! empty( $settings[$e] ) ) {
475
+				$new_settings = $settings[$e];
476 476
 			}
477 477
 		}
478 478
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 
535 535
 		$isnetwork = ! empty( $_REQUEST['isnetwork'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['isnetwork'] ) ) : '';
536 536
 		$start     = ! empty( $_POST['start'] ) ? sanitize_text_field( wp_unslash( $_POST['start'] ) ) : date( 'Y-m-d', strtotime( '-30 days' ) );
537
-		$end       = ! empty( $_POST['end'] ) ? sanitize_text_field( wp_unslash( $_POST['end'] ) ) : date( 'Y-m-d', strtotime( '-1 day' ) );;
537
+		$end       = ! empty( $_POST['end'] ) ? sanitize_text_field( wp_unslash( $_POST['end'] ) ) : date( 'Y-m-d', strtotime( '-1 day' ) ); ;
538 538
 		$args      = array(
539 539
 			'start' => $start,
540 540
 			'end'   => $end,
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			),
631 631
 			admin_url( 'admin.php' )
632 632
 		);
633
-		$url    = esc_url( $url );
633
+		$url = esc_url( $url );
634 634
 
635 635
 		ob_start();
636 636
 		if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
Please login to merge, or discard this patch.