Passed
Push — master ( aa437c...805644 )
by Chris
08:50
created
includes/capabilities.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -35,54 +35,54 @@
 block discarded – undo
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36 36
  
37 37
     switch( $cap ) {
38
-        case 'monsterinsights_view_dashboard' :
39
-            $roles = monsterinsights_get_option( 'view_reports', array() );
38
+	case 'monsterinsights_view_dashboard' :
39
+	    $roles = monsterinsights_get_option( 'view_reports', array() );
40 40
 
41
-            $user_can_via_settings = false;
42
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
43
-                foreach ( $roles as $role ) {
44
-                    if ( is_string( $role ) ) {
45
-                        if ( user_can( $user_id, $role ) ) {
46
-                            $user_can_via_settings = true;
47
-                            break;
48
-                        }
49
-                    }
50
-                }
51
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
52
-                if ( user_can( $user_id, $roles ) ) {
53
-                    $user_can_via_settings = true;
54
-                }
55
-            }
41
+	    $user_can_via_settings = false;
42
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
43
+		foreach ( $roles as $role ) {
44
+		    if ( is_string( $role ) ) {
45
+			if ( user_can( $user_id, $role ) ) {
46
+			    $user_can_via_settings = true;
47
+			    break;
48
+			}
49
+		    }
50
+		}
51
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
52
+		if ( user_can( $user_id, $roles ) ) {
53
+		    $user_can_via_settings = true;
54
+		}
55
+	    }
56 56
 
57
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
58
-                $caps = array();
59
-            }
57
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
58
+		$caps = array();
59
+	    }
60 60
             
61
-            break;
62
-         case 'monsterinsights_save_settings' :
63
-            $roles = monsterinsights_get_option( 'save_settings', array() );
61
+	    break;
62
+	 case 'monsterinsights_save_settings' :
63
+	    $roles = monsterinsights_get_option( 'save_settings', array() );
64 64
 
65
-            $user_can_via_settings = false;
66
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
67
-                foreach ( $roles as $role ) {
68
-                    if ( is_string( $role ) ) {
69
-                        if ( user_can( $user_id, $role ) ) {
70
-                            $user_can_via_settings = true;
71
-                            break;
72
-                        }
73
-                    }
74
-                }
75
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
76
-                 if ( user_can( $user_id, $roles ) ) {
77
-                    $user_can_via_settings = true;
78
-                }
79
-            }
65
+	    $user_can_via_settings = false;
66
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
67
+		foreach ( $roles as $role ) {
68
+		    if ( is_string( $role ) ) {
69
+			if ( user_can( $user_id, $role ) ) {
70
+			    $user_can_via_settings = true;
71
+			    break;
72
+			}
73
+		    }
74
+		}
75
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
76
+		 if ( user_can( $user_id, $roles ) ) {
77
+		    $user_can_via_settings = true;
78
+		}
79
+	    }
80 80
 
81
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
82
-                $caps = array();
83
-            }
81
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
82
+		$caps = array();
83
+	    }
84 84
 
85
-            break;
85
+	    break;
86 86
     }
87 87
     return $caps;
88 88
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36 36
  
37
-    switch( $cap ) {
37
+    switch ( $cap ) {
38 38
         case 'monsterinsights_view_dashboard' :
39 39
             $roles = monsterinsights_get_option( 'view_reports', array() );
40 40
 
@@ -86,4 +86,4 @@  discard block
 block discarded – undo
86 86
     }
87 87
     return $caps;
88 88
 }
89
-add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 );
90 89
\ No newline at end of file
90
+add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 );
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
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.