Passed
Push — master ( 30ea04...96a0ff )
by Chris
04:13
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
 		}
@@ -175,34 +175,34 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function frontend_output( ) {
177 177
 		$options        = $this->frontend_tracking_options();
178
-		$is_debug_mode  =  monsterinsights_is_debug_mode();
179
-		$src     	    = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' );
178
+		$is_debug_mode  = monsterinsights_is_debug_mode();
179
+		$src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' );
180 180
 		if ( current_user_can( 'manage_options' ) && $is_debug_mode ) {
181
-			$src       = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics_debug.js' );
181
+			$src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics_debug.js' );
182 182
 		}
183 183
 		$compat     	= monsterinsights_get_option( 'gatracker_compatibility_mode', false );
184
-		$compat    	 	= $compat ? 'window.ga = __gaTracker;' : '';
184
+		$compat = $compat ? 'window.ga = __gaTracker;' : '';
185 185
 		$track_user 	= monsterinsights_track_user();
186 186
 		$ua         	= monsterinsights_get_ua();
187 187
 		$output     	= '';
188 188
 		$reason     	= '';
189
-		$cookie_notice  = class_exists( 'Cookie_Notice' ) && monsterinsights_get_option( 'cookie_notice', false );
189
+		$cookie_notice = class_exists( 'Cookie_Notice' ) && monsterinsights_get_option( 'cookie_notice', false );
190 190
 		ob_start();
191 191
 		?>
192 192
 <!-- This site uses the Google Analytics by MonsterInsights plugin v<?php echo MONSTERINSIGHTS_VERSION; ?> - Using Analytics tracking - https://www.monsterinsights.com/ -->
193 193
 <?php if ( ! $track_user ) {
194 194
 	if ( empty( $ua ) ) {
195 195
 		$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' );
196
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
196
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
197 197
 	} else if ( current_user_can( 'monsterinsights_save_settings' ) ) {
198
-		$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' );
199
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
198
+		$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' );
199
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
200 200
 	} else if ( class_exist( 'Cookie_Notice' ) ) {
201 201
 		$reason = __( 'Note: You have not accepted the Cookie Notice.', 'google-analytics-for-wordpress' );
202
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
202
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
203 203
 	} else {
204 204
 		$reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' );
205
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
205
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
206 206
 	}
207 207
 	echo $output;
208 208
 } ?>
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	?>
266 266
 	} else {
267 267
 <?php if ( $this->should_do_optout() ) { ?>
268
-		console.log( "<?php echo esc_js( $reason );?>" );
268
+		console.log( "<?php echo esc_js( $reason ); ?>" );
269 269
 		(function() {
270 270
 			/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
271 271
 			var noopfn = function() {
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 				}
289 289
 				var f = arguments[len-1];
290 290
 				if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
291
-					console.log( '<?php echo esc_js( __('Not running function', 'google-analytics-for-wordpress' ) );?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( sprintf( __( "because you're not being tracked. %s", 'google-analytics-for-wordpress' ), $reason ) );?>");
291
+					console.log( '<?php echo esc_js( __( 'Not running function', 'google-analytics-for-wordpress' ) ); ?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( sprintf( __( "because you're not being tracked. %s", 'google-analytics-for-wordpress' ), $reason ) ); ?>");
292 292
 					return;
293 293
 				}
294 294
 				try {
Please login to merge, or discard this patch.
includes/api-request.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 		$this->method    = $method;
137 137
 
138 138
 		$default_token   = ! empty( $args['network'] ) && $args['network'] ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token();
139
-		$default_key     = ! empty( $args['network'] ) && $args['network'] ? MonsterInsights()->auth->get_network_key()   : MonsterInsights()->auth->get_key();
139
+		$default_key     = ! empty( $args['network'] ) && $args['network'] ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key();
140 140
 		
141 141
 		
142
-		$this->token     = ! empty( $args['token'] )     ? $args['token']  : $default_token;
143
-		$this->key       = ! empty( $args['key'] ) 	     ? $args['key']    : $default_key;
144
-		$this->tt        = ! empty( $args['tt'] ) 		 ? $args['tt']     : '';
145
-		$this->return    = ! empty( $args['return'] )    ? $args['return'] : '';
146
-		$this->start     = ! empty( $args['start'] )	 ? $args['start']  : '';
147
-		$this->end       = ! empty( $args['end'] )  	 ? $args['end']    : '';
142
+		$this->token     = ! empty( $args['token'] ) ? $args['token'] : $default_token;
143
+		$this->key       = ! empty( $args['key'] ) ? $args['key'] : $default_key;
144
+		$this->tt        = ! empty( $args['tt'] ) ? $args['tt'] : '';
145
+		$this->return    = ! empty( $args['return'] ) ? $args['return'] : '';
146
+		$this->start     = ! empty( $args['start'] ) ? $args['start'] : '';
147
+		$this->end       = ! empty( $args['end'] ) ? $args['end'] : '';
148 148
 
149 149
 		// We need to do this hack so that the network panel + the site_url of the main site are distinct
150 150
 		$this->site_url  = is_network_admin() ? network_admin_url() : site_url();
151 151
 
152 152
 		if ( monsterinsights_is_pro_version() ) {
153
-			$this->license   = is_network_admin() || ( ! empty( $args['network'] ) && $args['network'] ) ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
153
+			$this->license = is_network_admin() || ( ! empty( $args['network'] ) && $args['network'] ) ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
154 154
 		}
155 155
 		$this->plugin    = MonsterInsights()->plugin_slug;
156 156
 		$this->miversion = MONSTERINSIGHTS_VERSION;
@@ -220,12 +220,12 @@  discard block
 block discarded – undo
220 220
 		}
221 221
 
222 222
 		if ( 'GET' == $this->method ) {
223
-			$body['time']   = time(); // just to avoid caching
223
+			$body['time'] = time(); // just to avoid caching
224 224
 		}
225 225
 
226
-		$body['timezone'] = date('e');
226
+		$body['timezone'] = date( 'e' );
227 227
 
228
-		$body['ip']   = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '';
228
+		$body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '';
229 229
 
230 230
 		// This filter will be removed in the future.
231 231
 		$body   = apply_filters( 'monsterinsights_api_request_body', $body );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
 		// If not a 200 status header, send back error.
271 271
 		if ( 200 != $response_code ) {
272
-			$type  = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error';
272
+			$type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error';
273 273
 			
274 274
 			if ( empty( $response_code ) ) {
275 275
 				return new WP_Error( $type, __( 'The API was unreachable.', 'google-analytics-for-wordpress' ) );
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 						'body'          => ''
375 375
 					);
376 376
 					$response = wp_remote_get( $testurl, $params );
377
-					if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
377
+					if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
378 378
 						return false;
379 379
 					} else {
380 380
 						return true;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 			);
393 393
 			$response = wp_remote_get( $testurl, $params );
394 394
 			
395
-			if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
395
+			if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
396 396
 				return false;
397 397
 			} else {
398 398
 				return true;
Please login to merge, or discard this patch.
includes/admin/common.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -150,32 +150,32 @@  discard block
 block discarded – undo
150 150
 				'copytoclip'       				=> esc_html__( 'Copy to Clipboard', 'google-analytics-for-wordpress' ),
151 151
 				'failed'           				=> esc_html__( 'Failed!', 'google-analytics-for-wordpress' ),
152 152
 				'admin_nonce'      				=> wp_create_nonce( 'mi-admin-nonce' ),
153
-				'shorten'         				=> esc_html__( 'Shorten URL' ,'google-analytics-for-wordpress'),
154
-				'shortened'        				=> esc_html__( 'Shortened!' ,'google-analytics-for-wordpress'),
155
-				'working'          				=> esc_html__( 'Working...' ,'google-analytics-for-wordpress'),
156
-				'importtext'       				=> esc_html__( 'Import' ,'google-analytics-for-wordpress'),
157
-				'imported'         				=> esc_html__( 'Imported!' ,'google-analytics-for-wordpress'),
158
-				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:' ,'google-analytics-for-wordpress'),
159
-				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds." ,'google-analytics-for-wordpress'),
160
-				'redirect_loading_error_title'  => esc_html__( "Authentication Error:" ,'google-analytics-for-wordpress'),
161
-				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....' ,'google-analytics-for-wordpress'),
162
-				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
163
-				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:" ,'google-analytics-for-wordpress'),
164
-				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!' ,'google-analytics-for-wordpress'),
165
-				'deauth_success_text_text'   	=> esc_html__( "You've disconnected your site from MonsterInsights. Your site is no longer being tracked by Google Analytics and you won't see reports anymore." ,'google-analytics-for-wordpress'),
166
-				'verify_loading_title_text'  	=> esc_html__( 'Verifying....' ,'google-analytics-for-wordpress'),
167
-				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
168
-				'verify_loading_error_title' 	=> esc_html__( "Verification Error:" ,'google-analytics-for-wordpress'),
169
-				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!' ,'google-analytics-for-wordpress'),
170
-				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!" ,'google-analytics-for-wordpress'),
171
-				'ok_text' 						=> esc_html__( "OK" ,'google-analytics-for-wordpress'),
172
-				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate" ,'google-analytics-for-wordpress'),
153
+				'shorten'         				=> esc_html__( 'Shorten URL', 'google-analytics-for-wordpress' ),
154
+				'shortened'        				=> esc_html__( 'Shortened!', 'google-analytics-for-wordpress' ),
155
+				'working'          				=> esc_html__( 'Working...', 'google-analytics-for-wordpress' ),
156
+				'importtext'       				=> esc_html__( 'Import', 'google-analytics-for-wordpress' ),
157
+				'imported'         				=> esc_html__( 'Imported!', 'google-analytics-for-wordpress' ),
158
+				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:', 'google-analytics-for-wordpress' ),
159
+				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
160
+				'redirect_loading_error_title'  => esc_html__( "Authentication Error:", 'google-analytics-for-wordpress' ),
161
+				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....', 'google-analytics-for-wordpress' ),
162
+				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
163
+				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:", 'google-analytics-for-wordpress' ),
164
+				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!', 'google-analytics-for-wordpress' ),
165
+				'deauth_success_text_text'   	=> esc_html__( "You've disconnected your site from MonsterInsights. Your site is no longer being tracked by Google Analytics and you won't see reports anymore.", 'google-analytics-for-wordpress' ),
166
+				'verify_loading_title_text'  	=> esc_html__( 'Verifying....', 'google-analytics-for-wordpress' ),
167
+				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
168
+				'verify_loading_error_title' 	=> esc_html__( "Verification Error:", 'google-analytics-for-wordpress' ),
169
+				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!', 'google-analytics-for-wordpress' ),
170
+				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!", 'google-analytics-for-wordpress' ),
171
+				'ok_text' 						=> esc_html__( "OK", 'google-analytics-for-wordpress' ),
172
+				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate", 'google-analytics-for-wordpress' ),
173 173
 				'refresh_report_title'          => esc_html__( 'Refreshing Report', 'google-analytics-for-wordpress' ),
174 174
 				'refresh_report_text'           => esc_html__( 'Loading new report data...', 'google-analytics-for-wordpress' ),
175 175
 				'refresh_report_success_text'   => esc_html__( 'Success', 'google-analytics-for-wordpress' ),
176 176
 				'refresh_report_success_text'   => esc_html__( 'Retrieved the new report data successfully', 'google-analytics-for-wordpress' ),
177 177
 				'refresh_report_failure_title'  => esc_html__( 'Error', 'google-analytics-for-wordpress' ),
178
-				'timezone'						=> date('e'),
178
+				'timezone'						=> date( 'e' ),
179 179
 			)
180 180
 		);
181 181
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		'kad_admin_js', // Pinnacle theme
225 225
 		'dt-chart', // DesignThemes core features plugin
226 226
 		'tweeetshare_font_script', // TweetShare - Click To Tweet
227
-		'tweeetshare_jquery_script',  // TweetShare - Click To Tweet
227
+		'tweeetshare_jquery_script', // TweetShare - Click To Tweet
228 228
 		'tweeetshare_jqueryui_script', // TweetShare - Click To Tweet
229 229
 		'tweeetshare_custom_script', // TweetShare - Click To Tweet
230 230
 		'imagify-promise-polyfill', // Imagify 
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
         'rml-modal', // WP Real Media Library
244 244
         'rml-order', // WP Real Media Library
245 245
         'rml-meta', // WP Real Media Library
246
-        'rml-uploader',  // WP Real Media Library
247
-        'rml-options',  // WP Real Media Library
248
-        'rml-usersettings',  // WP Real Media Library
246
+        'rml-uploader', // WP Real Media Library
247
+        'rml-options', // WP Real Media Library
248
+        'rml-usersettings', // WP Real Media Library
249 249
         'rml-main', // WP Real Media Library
250 250
         'control-panel-sweet-alert', // Ken Theme
251 251
 	);
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 
280 280
 	global $wp_styles;
281 281
 	foreach ( $wp_styles->queue as $handle ) {
282
-		if ( strpos( $wp_styles->registered[$handle]->src, 'wp-content') === false ) {
282
+		if ( strpos( $wp_styles->registered[$handle]->src, 'wp-content' ) === false ) {
283 283
 			return;
284 284
 		}
285 285
 		
286
-		if ( strpos( $wp_styles->registered[$handle]->handle, 'monsterinsights') !== false ) {
286
+		if ( strpos( $wp_styles->registered[$handle]->handle, 'monsterinsights' ) !== false ) {
287 287
 			return;
288 288
 		}
289 289
 
290
-		foreach( $third_party as $partial ) {
290
+		foreach ( $third_party as $partial ) {
291 291
 			if ( strpos( $wp_styles->registered[$handle]->handle, $partial ) !== false ) {
292 292
 				wp_dequeue_style( $handle ); // Remove css file from MI screen
293 293
 				wp_deregister_style( $handle );
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
 
303 303
 	global $wp_scripts;
304 304
 	foreach ( $wp_scripts->queue as $handle ) {
305
-		if ( strpos( $wp_scripts->registered[$handle]->src, 'wp-content') === false ) {
305
+		if ( strpos( $wp_scripts->registered[$handle]->src, 'wp-content' ) === false ) {
306 306
 			return;
307 307
 		}
308 308
 		
309
-		if ( strpos( $wp_scripts->registered[$handle]->handle, 'monsterinsights') !== false ) {
309
+		if ( strpos( $wp_scripts->registered[$handle]->handle, 'monsterinsights' ) !== false ) {
310 310
 			return;
311 311
 		}
312 312
 
313
-		foreach( $third_party as $partial ) {
313
+		foreach ( $third_party as $partial ) {
314 314
 			if ( strpos( $wp_scripts->registered[$handle]->handle, $partial ) !== false ) {
315 315
 				wp_dequeue_script( $handle ); // Remove JS file from MI screen
316 316
 				wp_deregister_script( $handle );
@@ -333,65 +333,65 @@  discard block
 block discarded – undo
333 333
  *
334 334
  * @return null Return early if not on the proper screen.
335 335
  */
336
-function hide_non_monsterinsights_warnings () {
336
+function hide_non_monsterinsights_warnings() {
337 337
 	// Bail if we're not on a MonsterInsights screen.
338 338
 	if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'monsterinsights' ) === false ) {
339 339
 		return;
340 340
 	}
341 341
 
342 342
 	global $wp_filter;
343
-	if ( !empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
344
-		foreach( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
343
+	if ( ! empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
344
+		foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
345 345
 			foreach ( $hooks as $name => $arr ) {
346 346
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
347
-					unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
347
+					unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] );
348 348
 					continue;
349 349
 				}
350 350
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
351 351
 					continue;
352 352
 				}
353
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
353
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
354 354
 					unset( $wp_filter['user_admin_notices']->callbacks[$priority][$name] );
355 355
 				}
356 356
 			}
357 357
 		}
358 358
 	}
359 359
 
360
-	if ( !empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
361
-		foreach( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
360
+	if ( ! empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
361
+		foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
362 362
 			foreach ( $hooks as $name => $arr ) {
363 363
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
364
-					unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
364
+					unset( $wp_filter['admin_notices']->callbacks[$priority][$name] );
365 365
 					continue;
366 366
 				}
367 367
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
368 368
 					continue;
369 369
 				}
370
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
370
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
371 371
 					unset( $wp_filter['admin_notices']->callbacks[$priority][$name] );
372 372
 				}
373 373
 			}
374 374
 		}
375 375
 	}
376 376
 
377
-	if ( !empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
378
-		foreach( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
377
+	if ( ! empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
378
+		foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
379 379
 			foreach ( $hooks as $name => $arr ) {
380 380
 				if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
381
-					unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
381
+					unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] );
382 382
 					continue;
383 383
 				}
384 384
 				if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'monsterinsights' ) !== false ) {
385 385
 					continue;
386 386
 				}
387
-				if ( !empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
387
+				if ( ! empty( $name ) && strpos( $name, 'monsterinsights' ) === false ) {
388 388
 					unset( $wp_filter['all_admin_notices']->callbacks[$priority][$name] );
389 389
 				}
390 390
 			}
391 391
 		}
392 392
 	}
393 393
 }
394
-add_action('admin_print_scripts', 'hide_non_monsterinsights_warnings');  
394
+add_action( 'admin_print_scripts', 'hide_non_monsterinsights_warnings' );  
395 395
 
396 396
 /**
397 397
  * Called whenever an upgrade button / link is displayed in Lite, this function will
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	return $shareasale_id;
453 453
 }
454 454
 
455
-function monsterinsights_settings_ublock_error_js(){
455
+function monsterinsights_settings_ublock_error_js() {
456 456
 	echo "<script type='text/javascript'>\n";
457 457
 	echo "jQuery( document ).ready( function( $ ) {
458 458
 			if ( window.uorigindetected == null){
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
 }
469 469
 
470 470
 function monsterinsights_ublock_notice() {
471
-	ob_start();?>
471
+	ob_start(); ?>
472 472
 	<div id="monsterinsights-ublock-origin-error" class="error inline" style="display:none;">
473
-		<?php echo sprintf( esc_html__( 'MonsterInsights has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of MonsterInsights. To solve this, ensure MonsterInsights is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/docs/monsterinsights-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://monsterinsights.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">');
473
+		<?php echo sprintf( esc_html__( 'MonsterInsights has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of MonsterInsights. To solve this, ensure MonsterInsights is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/docs/monsterinsights-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://monsterinsights.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' );
474 474
 		?>
475 475
 	</div>
476 476
 	<?php
Please login to merge, or discard this patch.
includes/admin/api-auth.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 	public function __construct() {
29 29
 
30 30
 		// Authentication Actions
31
-		add_action( 'wp_ajax_monsterinsights_maybe_authenticate',    array( $this, 'maybe_authenticate' ) );
32
-		add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate',  array( $this, 'maybe_reauthenticate' ) );
33
-		add_action( 'wp_ajax_monsterinsights_maybe_verify',          array( $this, 'maybe_verify' ) );
34
-		add_action( 'wp_ajax_monsterinsights_maybe_delete',          array( $this, 'maybe_delete' ) );
31
+		add_action( 'wp_ajax_monsterinsights_maybe_authenticate', array( $this, 'maybe_authenticate' ) );
32
+		add_action( 'wp_ajax_monsterinsights_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) );
33
+		add_action( 'wp_ajax_monsterinsights_maybe_verify', array( $this, 'maybe_verify' ) );
34
+		add_action( 'wp_ajax_monsterinsights_maybe_delete', array( $this, 'maybe_delete' ) );
35 35
 
36
-		add_action( 'admin_init',          							 array( $this, 'authenticate_listener' ) );
37
-		add_action( 'admin_init',          							 array( $this, 'reauthenticate_listener' ) );
36
+		add_action( 'admin_init', array( $this, 'authenticate_listener' ) );
37
+		add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) );
38 38
 	}
39 39
 
40
-	public function get_tt(){
40
+	public function get_tt() {
41 41
 		$tt = is_network_admin() ? get_site_option( 'monsterinsights_network_tt', '' ) : get_option( 'monsterinsights_site_tt', '' );
42 42
 		if ( empty( $tt ) ) {
43 43
 			// if TT is empty, generate a new one, save it and then return it
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 		return $tt;
48 48
 	}
49 49
 	
50
-	public function rotate_tt(){
50
+	public function rotate_tt() {
51 51
 		$tt = $this->generate_tt();
52 52
 		is_network_admin() ? update_site_option( 'monsterinsights_network_tt', $tt ) : update_option( 'monsterinsights_site_tt', $tt );
53 53
 	}
54 54
 
55
-	public function generate_tt(){
55
+	public function generate_tt() {
56 56
 		return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) );
57 57
 	}
58 58
 
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		return hash_equals( $tt, $passed_tt );
62 62
 	}
63 63
 
64
-	public function maybe_authenticate(){
64
+	public function maybe_authenticate() {
65 65
 
66 66
 		// Check nonce
67 67
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
68 68
 
69 69
 		// current user can authenticate
70 70
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
71
-			wp_send_json_error( array(	'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
71
+			wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
72 72
 		}
73 73
 
74 74
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 		// Only for Pro users, require a license key to be entered first so we can link to things.
79 79
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
80 80
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
81
-			wp_send_json_error( array(	'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
81
+			wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
82 82
 		}
83 83
 
84 84
 		// we do not have a current auth
85 85
 		if ( ! $this->is_network_admin() && MonsterInsights()->auth->is_authed() ) {
86
-			wp_send_json_error( array(	'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
86
+			wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-for-wordpress' ) ) );
87 87
 		} else if ( $this->is_network_admin() && MonsterInsights()->auth->is_network_authed() ) {
88
-			wp_send_json_error( array(	'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
88
+			wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
89 89
 		}
90 90
 
91 91
 		$sitei = $this->get_sitei();
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	}
110 110
 
111 111
 
112
-	public function authenticate_listener(){
112
+	public function authenticate_listener() {
113 113
 		// Make sure it's for us
114 114
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
115 115
 			return;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 
129 129
 		// Make sure has required params
130
-		if ( empty( $_REQUEST['key'] )      ||
131
-			 empty( $_REQUEST['token'] )    ||
132
-			 empty( $_REQUEST['ua'] )       ||
133
-			 empty( $_REQUEST['miview'] )   ||
134
-			 empty( $_REQUEST['a'] )        ||
135
-			 empty( $_REQUEST['w'] )        ||
130
+		if ( empty( $_REQUEST['key'] ) ||
131
+			 empty( $_REQUEST['token'] ) ||
132
+			 empty( $_REQUEST['ua'] ) ||
133
+			 empty( $_REQUEST['miview'] ) ||
134
+			 empty( $_REQUEST['a'] ) ||
135
+			 empty( $_REQUEST['w'] ) ||
136 136
 			 empty( $_REQUEST['p'] )
137 137
 		) {
138 138
 			return;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		$where = $this->is_network_admin() ? 'network' : 'site';
172 172
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
173 173
 
174
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
174
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
175 175
 		$url = add_query_arg( array(
176 176
 			 'mi_action' => 'auth',
177 177
 			 'success'   => 'true',
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 		exit;
181 181
 	}
182 182
 
183
-	public function maybe_reauthenticate(){
183
+	public function maybe_reauthenticate() {
184 184
 
185 185
 		// Check nonce
186 186
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
187 187
 
188 188
 		// current user can authenticate
189 189
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
190
-			wp_send_json_error( array(	'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
190
+			wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
191 191
 		}
192 192
 
193 193
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 		// Only for Pro users, require a license key to be entered first so we can link to things.
198 198
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
199 199
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
200
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
200
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
201 201
 		}
202 202
 
203 203
 		// we do have a current auth
204 204
 		if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
205
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
205
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
206 206
 		} else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
207
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
207
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
208 208
 		}
209 209
 
210 210
 		$siteurl = add_query_arg( array(
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		wp_send_json_success( array( 'redirect' => $siteurl ) );
228 228
 	}
229 229
 
230
-	public function reauthenticate_listener(){
230
+	public function reauthenticate_listener() {
231 231
 		// Make sure it's for us
232 232
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
233 233
 			return;
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 
246 246
 		// Make sure has required params
247 247
 		if (
248
-			 empty( $_REQUEST['ua'] )       ||
249
-			 empty( $_REQUEST['miview'] )   ||
250
-			 empty( $_REQUEST['a'] )        ||
251
-			 empty( $_REQUEST['w'] )        ||
248
+			 empty( $_REQUEST['ua'] ) ||
249
+			 empty( $_REQUEST['miview'] ) ||
250
+			 empty( $_REQUEST['a'] ) ||
251
+			 empty( $_REQUEST['w'] ) ||
252 252
 			 empty( $_REQUEST['p'] )       
253 253
 		) {
254 254
 			return;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$where = $this->is_network_admin() ? 'network' : 'site';
289 289
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
290 290
 
291
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
291
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
292 292
 		$url = add_query_arg( array(
293 293
 			 'mi_action' => 'reauth',
294 294
 			 'success'   => 'true',
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
 		exit;
298 298
 	}
299 299
 
300
-	public function maybe_verify(){
300
+	public function maybe_verify() {
301 301
 
302 302
 		// Check nonce
303 303
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
304 304
 
305 305
 		// current user can verify
306 306
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
307
-			wp_send_json_error( array(	'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
307
+			wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
308 308
 		}
309 309
 
310 310
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -313,25 +313,25 @@  discard block
 block discarded – undo
313 313
 
314 314
 		// we have an auth to verify
315 315
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
316
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
316
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
317 317
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
318
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
318
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
319 319
 		}
320 320
 
321 321
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
322 322
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
323
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
323
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
324 324
 		}
325 325
 
326 326
 		$worked = $this->verify_auth();
327
-		if ( $worked && ! is_wp_error(  $worked ) ) {
327
+		if ( $worked && ! is_wp_error( $worked ) ) {
328 328
 			wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) );
329 329
 		} else {
330 330
 			wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) );
331 331
 		}
332 332
 	}
333 333
 
334
-	public function verify_auth( $credentials = array() ){
334
+	public function verify_auth( $credentials = array() ) {
335 335
 		$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) );
336 336
 
337 337
 		if ( empty( $creds['key'] ) ) {
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 	}
350 350
 
351
-	public function maybe_delete(){
351
+	public function maybe_delete() {
352 352
 
353 353
 		// Check nonce
354 354
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
355 355
 
356 356
 		// current user can delete
357 357
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
358
-			wp_send_json_error( array(	'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
358
+			wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
359 359
 		}
360 360
 
361 361
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -364,20 +364,20 @@  discard block
 block discarded – undo
364 364
 
365 365
 		// we have an auth to delete
366 366
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
367
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
367
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
368 368
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
369
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
369
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
370 370
 		}
371 371
 
372 372
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
373 373
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
374
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
374
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for MonsterInsights Pro into the settings.", 'google-analytics-for-wordpress' ) ) );
375 375
 		}
376 376
 
377 377
 		$force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true';
378 378
 
379 379
 		$worked = $this->delete_auth( $force );
380
-		if ( $worked && ! is_wp_error(  $worked ) ) {
380
+		if ( $worked && ! is_wp_error( $worked ) ) {
381 381
 			wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) );
382 382
 		} else {
383 383
 			if ( $force ) {
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		}
389 389
 	}
390 390
 
391
-	public function delete_auth( $force = false ){
391
+	public function delete_auth( $force = false ) {
392 392
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
393 393
 			return false;
394 394
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
 		// If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways
405 405
 		if ( is_network_admin() ) {
406 406
 			$siteurl = network_admin_url();
407
-			if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) {
407
+			if ( ! empty( $creds['neturl'] ) && $creds['neturl'] !== $siteurl ) {
408 408
 				MonsterInsights()->auth->delete_network_analytics_profile( true );
409 409
 				return true;
410 410
 			}
411 411
 		} else {
412 412
 			$siteurl = site_url();
413
-			if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) {
413
+			if ( ! empty( $creds['siteurl'] ) && $creds['siteurl'] !== $siteurl ) {
414 414
 				MonsterInsights()->auth->delete_analytics_profile( true );
415 415
 				return true;
416 416
 			}
@@ -452,15 +452,15 @@  discard block
 block discarded – undo
452 452
 		// 	return $sitei;
453 453
 		// }
454 454
 
455
-		$auth_key        = defined( 'AUTH_KEY' )        ? AUTH_KEY 		  : '';
455
+		$auth_key        = defined( 'AUTH_KEY' ) ? AUTH_KEY 		  : '';
456 456
 		$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
457
-		$logged_in_key   = defined( 'LOGGED_IN_KEY' )   ? LOGGED_IN_KEY   : '';
457
+		$logged_in_key   = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY   : '';
458 458
 
459 459
 		$sitei = $auth_key . $secure_auth_key . $logged_in_key;
460
-		$sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei );
460
+		$sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei );
461 461
 		$sitei = sanitize_text_field( $sitei );
462 462
 		$sitei = trim( $sitei );
463
-		$sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei;
463
+		$sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei;
464 464
 		return $sitei;
465 465
 	}
466 466
 }
467 467
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/ajax.php 2 patches
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/reports/overview.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	// Outputs the report.
39
-	protected function get_report_html( $data = array() ){
39
+	protected function get_report_html( $data = array() ) {
40 40
 		ob_start();
41 41
 		if ( ! empty( $data['overviewgraph']['count'] ) && $data['overviewgraph']['count'] > 0 ) {
42 42
 			?>
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 					<img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/>
94 94
 					<?php echo esc_html( $data['infobox']['sessions']['prev'] ) . '%'; ?>
95 95
 				</div>
96
-				<?php } else  { ?>
96
+				<?php } else { ?>
97 97
 				<div class="monsterinsights-reports-infobox-prev">
98 98
 					<img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/>
99 99
 					<?php echo esc_html( absint( $data['infobox']['sessions']['prev'] ) ) . '%'; ?>
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 					<img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/>
121 121
 					<?php echo esc_html( $data['infobox']['pageviews']['prev'] ) . '%'; ?>
122 122
 				</div>
123
-				<?php } else  { ?>
123
+				<?php } else { ?>
124 124
 				<div class="monsterinsights-reports-infobox-prev">
125 125
 					<img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/>
126 126
 					<?php echo esc_html( absint( $data['infobox']['pageviews']['prev'] ) ) . '%'; ?>
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 					<img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/>
148 148
 					<?php echo esc_html( $data['infobox']['duration']['prev'] ) . '%'; ?>
149 149
 				</div>
150
-				<?php } else  { ?>
150
+				<?php } else { ?>
151 151
 				<div class="monsterinsights-reports-infobox-prev">
152 152
 					<img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/>
153
-					<?php echo esc_html( absint(  $data['infobox']['duration']['prev'] ) ) . '%'; ?>
153
+					<?php echo esc_html( absint( $data['infobox']['duration']['prev'] ) ) . '%'; ?>
154 154
 				</div>
155 155
 				<?php } ?>
156 156
 				<div class="monsterinsights-reports-infobox-compare">
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 					<img src="<?php echo $up; ?>" srcset="<?php echo $up2x; ?> 2x" alt="<?php echo $uplabel; ?>"/>
175 175
 					<?php echo esc_html( $data['infobox']['bounce']['prev'] ) . '%'; ?>
176 176
 				</div>
177
-				<?php } else  { ?>
177
+				<?php } else { ?>
178 178
 				<div class="monsterinsights-reports-infobox-prev">
179 179
 					<img src="<?php echo $down; ?>" srcset="<?php echo $down2x; ?> 2x" alt="<?php echo $downlabel; ?>"/>
180 180
 					<?php echo esc_html( absint( $data['infobox']['bounce']['prev'] ) ) . '%'; ?>
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 			  </div>
187 187
 			</div>
188 188
 		<?php } ?>
189
-		<?php if ( ! empty( $data['newvsreturn'] ) &&  ! empty( $data['devices'] ) ) { ?>
189
+		<?php if ( ! empty( $data['newvsreturn'] ) && ! empty( $data['devices'] ) ) { ?>
190 190
 			<div class="monsterinsights-reports-2-column-container row">
191 191
 			  <div class="monsterinsights-reports-2-column-item col-md-6">
192 192
 				<div class="monsterinsights-reports-2-column-panel panel monsterinsights-pie-chart-panel chart-panel">
193 193
 					<div class="monsterinsights-reports-panel-title">
194
-						<?php echo esc_html__( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' );?>
194
+						<?php echo esc_html__( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' ); ?>
195 195
 					</div>
196 196
 					<div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'New vs. Returning Visitors', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This graph shows what percent of your user sessions come from new versus repeat visitors.', 'google-analytics-for-wordpress' ) ); ?>"></div>
197 197
 					<div class="monsterinsights-reports-pie-graph monsterinsights-clear">
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 										}],
282 282
 										values: [<?php echo esc_js( $data['newvsreturn']['new'] ); ?>,<?php echo esc_js( $data['newvsreturn']['returning'] ); ?> ],
283 283
 										labels: [
284
-											"<?php echo esc_js( __('New', 'google-analytics-for-wordpress' ) ); ?>",
285
-											"<?php echo esc_js( __('Returning', 'google-analytics-for-wordpress' ) ); ?>",
284
+											"<?php echo esc_js( __( 'New', 'google-analytics-for-wordpress' ) ); ?>",
285
+											"<?php echo esc_js( __( 'Returning', 'google-analytics-for-wordpress' ) ); ?>",
286 286
 										]
287 287
 									},
288 288
 									options: {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 			<div class="monsterinsights-reports-2-column-item col-md-6">
341 341
 				<div class="monsterinsights-reports-2-column-panel panel monsterinsights-pie-chart-panel chart-panel">
342 342
 					<div class="monsterinsights-reports-panel-title">
343
-						<?php echo esc_html__( 'Device Breakdown', 'google-analytics-for-wordpress' );?>
343
+						<?php echo esc_html__( 'Device Breakdown', 'google-analytics-for-wordpress' ); ?>
344 344
 					</div>
345 345
 					<div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Device Breakdown', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This graph shows what percent of your visitor sessions are done using a traditional computer or laptop, tablet or mobile device to view your site.', 'google-analytics-for-wordpress' ) ); ?>"></div>
346 346
 					<div class="monsterinsights-reports-pie-graph monsterinsights-clear">
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
 										}],
433 433
 										values: [<?php echo esc_js( $data['devices']['desktop'] ); ?>,<?php echo esc_js( $data['devices']['tablet'] ); ?>,<?php echo esc_js( $data['devices']['mobile'] ); ?>  ],
434 434
 										labels: [
435
-											"<?php echo esc_js( __('Desktop', 'google-analytics-for-wordpress' ) ); ?>",
436
-											"<?php echo esc_js( __('Tablet', 'google-analytics-for-wordpress' ) ); ?>",
437
-											"<?php echo esc_js( __('Mobile', 'google-analytics-for-wordpress' ) ); ?>",
435
+											"<?php echo esc_js( __( 'Desktop', 'google-analytics-for-wordpress' ) ); ?>",
436
+											"<?php echo esc_js( __( 'Tablet', 'google-analytics-for-wordpress' ) ); ?>",
437
+											"<?php echo esc_js( __( 'Mobile', 'google-analytics-for-wordpress' ) ); ?>",
438 438
 										]
439 439
 									},
440 440
 									options: {
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 			</div>
493 493
 		<?php } ?>
494 494
 
495
-		<?php if ( ! empty( $data['countries'] ) &&  ! empty( $data['referrals'] ) ) { ?>
495
+		<?php if ( ! empty( $data['countries'] ) && ! empty( $data['referrals'] ) ) { ?>
496 496
 			<div class="monsterinsights-reports-2-column-container row">
497 497
 			  <div class="monsterinsights-reports-2-column-item col-md-6 list-has-icons">
498 498
 				<div class="monsterinsights-reports-2-column-panel panel nopadding">
499 499
 					<div class="monsterinsights-reports-panel-title">
500
-						<?php echo esc_html__( 'Top 10 Countries', 'google-analytics-for-wordpress' );?>
500
+						<?php echo esc_html__( 'Top 10 Countries', 'google-analytics-for-wordpress' ); ?>
501 501
 					</div>
502 502
 					<div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Top 10 Countries', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the top countries your website visitors are from.', 'google-analytics-for-wordpress' ) ); ?>"></div>
503 503
 					<div class="monsterinsights-reports-list">
@@ -505,11 +505,11 @@  discard block
 block discarded – undo
505 505
 						<?php 
506 506
 						$countries = monsterinsights_get_country_list( true );
507 507
 						$i = 1;
508
-						foreach( $data['countries'] as $icountry => $countrydata ) {
509
-							if ( ! empty( $countries[ $countrydata['iso'] ] ) ) {
510
-								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[ $countrydata['iso'] ] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
508
+						foreach ( $data['countries'] as $icountry => $countrydata ) {
509
+							if ( ! empty( $countries[$countrydata['iso']] ) ) {
510
+								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[$countrydata['iso']] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
511 511
 							} else { 
512
-								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
512
+								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">' . $i . '</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
513 513
 							}
514 514
 							$i++;
515 515
 						}
@@ -517,35 +517,35 @@  discard block
 block discarded – undo
517 517
 						</ul>
518 518
 					</div>
519 519
 					<?php 
520
-					$referral_url = 'https://analytics.google.com/analytics/web/#report/visitors-geo/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
520
+					$referral_url = 'https://analytics.google.com/analytics/web/#report/visitors-geo/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
521 521
 					?>
522 522
 					<div class="monsterinsights-reports-panel-footer">
523
-						<a href="<?php echo $referral_url; ?>" target="_blank"  title="<?php echo esc_html__( 'View Full Countries Report', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Countries Report', 'google-analytics-for-wordpress' );?></a>
523
+						<a href="<?php echo $referral_url; ?>" target="_blank"  title="<?php echo esc_html__( 'View Full Countries Report', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Countries Report', 'google-analytics-for-wordpress' ); ?></a>
524 524
 					</div>
525 525
 				</div>
526 526
 			  </div>
527 527
 			  <div class="monsterinsights-reports-2-column-item col-md-6 list-has-icons">
528 528
 				<div class="monsterinsights-reports-2-column-panel panel nopadding">
529 529
 					<div class="monsterinsights-reports-panel-title">
530
-						<?php echo esc_html__( 'Referrals', 'google-analytics-for-wordpress' );?>
530
+						<?php echo esc_html__( 'Referrals', 'google-analytics-for-wordpress' ); ?>
531 531
 					</div>
532 532
 					<div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Referrals', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the top websites that send your website traffic, known as "referral traffic".', 'google-analytics-for-wordpress' ) ); ?>"></div>
533 533
 					<div class="monsterinsights-reports-list">
534 534
 						<ul class="monsterinsights-reports-referral-list list-group">
535 535
 						<?php
536 536
 						$i = 1;
537
-						foreach( $data['referrals'] as $ireferrals => $referralsdata ) {
538
-								echo '<li class="list-group-item">'.
537
+						foreach ( $data['referrals'] as $ireferrals => $referralsdata ) {
538
+								echo '<li class="list-group-item">' .
539 539
 										'<span class="monsterinsights-reports-list-count">'
540 540
 											. $i .
541
-										'</span>'.
542
-										'<img class="monsterinsights-reports-referral-icon"  src="https://www.google.com/s2/favicons?domain=' . $referralsdata['url'] . '" width="16px" height="16px" />'.
541
+										'</span>' .
542
+										'<img class="monsterinsights-reports-referral-icon"  src="https://www.google.com/s2/favicons?domain=' . $referralsdata['url'] . '" width="16px" height="16px" />' .
543 543
 										'<span class="monsterinsights-reports-list-text">' 
544 544
 											. $referralsdata['url'] . 
545 545
 										'</span>
546 546
 										<span class="monsterinsights-reports-list-number">'
547 547
 											. number_format_i18n( $referralsdata['sessions'] ) . 
548
-										'</span>'.
548
+										'</span>' .
549 549
 									'</li>';
550 550
 							$i++;
551 551
 						}
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
 						</ul>
554 554
 					</div>
555 555
 					<?php 
556
-					$referral_url = 'https://analytics.google.com/analytics/web/#report/trafficsources-referrals/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
556
+					$referral_url = 'https://analytics.google.com/analytics/web/#report/trafficsources-referrals/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
557 557
 					?>
558 558
 					<div class="monsterinsights-reports-panel-footer">
559
-						<a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View All Referral Sources', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Referral Sources', 'google-analytics-for-wordpress' );?></a>
559
+						<a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View All Referral Sources', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button"><?php echo esc_html__( 'View All Referral Sources', 'google-analytics-for-wordpress' ); ?></a>
560 560
 					</div>
561 561
 				</div>
562 562
 			  </div>
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		<?php if ( ! empty( $data['toppages'] ) ) { ?>
567 567
 			<div class="monsterinsights-reports-1-column-row panel row container-fluid nopadding list-no-icons" style="position: relative;">
568 568
 				<div class="monsterinsights-reports-panel-title">
569
-					<?php echo esc_html__( 'Top Posts / Pages', 'google-analytics-for-wordpress' );?>
569
+					<?php echo esc_html__( 'Top Posts / Pages', 'google-analytics-for-wordpress' ); ?>
570 570
 				</div>
571 571
 				
572 572
 				<div class="monsterinsights-reports-uright-tooltip" data-tooltip-title="<?php echo esc_attr( __( 'Top Posts / Pages', 'google-analytics-for-wordpress' ) ); ?>" data-tooltip-description="<?php echo esc_attr( __( 'This list shows the most viewed posts and pages on your website.', 'google-analytics-for-wordpress' ) ); ?>"></div>
@@ -574,23 +574,23 @@  discard block
 block discarded – undo
574 574
 					<ul class="monsterinsights-reports-pages-list list-group">
575 575
 						<?php
576 576
 						$i = 1;
577
-						foreach( $data['toppages'] as $itoppages => $toppagesdata ) {
578
-								$hide     = $i > 10 ? ' style="display: none;" ': '';
577
+						foreach ( $data['toppages'] as $itoppages => $toppagesdata ) {
578
+								$hide     = $i > 10 ? ' style="display: none;" ' : '';
579 579
 								$protocol = is_ssl() ? 'https://' : 'http://';
580
-								$opening  = ! empty( $toppagesdata['url'] ) && ! empty( $toppagesdata['hostname'] ) ? '<a href="' . $protocol . esc_attr( $toppagesdata['hostname'] . $toppagesdata['url'] ) .'" target="_blank">' : '';
580
+								$opening  = ! empty( $toppagesdata['url'] ) && ! empty( $toppagesdata['hostname'] ) ? '<a href="' . $protocol . esc_attr( $toppagesdata['hostname'] . $toppagesdata['url'] ) . '" target="_blank">' : '';
581 581
 								$closing = ! empty( $opening ) ? '</a>' : '';
582
-								echo '<li class="list-group-item  monsterinsights-listing-table-row"'. $hide . '>'.
582
+								echo '<li class="list-group-item  monsterinsights-listing-table-row"' . $hide . '>' .
583 583
 										'<span class="monsterinsights-reports-list-count">'
584 584
 											. $i .
585
-										'. </span>&nbsp;'.
585
+										'. </span>&nbsp;' .
586 586
 										'<span class="monsterinsights-reports-list-text">' 
587 587
 											. $opening
588 588
 											. $toppagesdata['title']
589 589
 											. $closing .
590
-										'</span>'.
590
+										'</span>' .
591 591
 										'<span class="monsterinsights-reports-list-number">' . 
592 592
 											number_format_i18n( $toppagesdata['sessions'] ) . 
593
-										'</span>'.
593
+										'</span>' .
594 594
 									'</li>';
595 595
 							$i++;
596 596
 						}
@@ -598,16 +598,16 @@  discard block
 block discarded – undo
598 598
 					</ul>
599 599
 				</div>
600 600
 				<?php 
601
-				$referral_url = 'https://analytics.google.com/analytics/web/#report/content-pages/'. MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
601
+				$referral_url = 'https://analytics.google.com/analytics/web/#report/content-pages/' . MonsterInsights()->auth->get_referral_url() . $this->get_ga_report_range( $data );
602 602
 				?>
603 603
 				<div class="monsterinsights-reports-panel-footer monsterinsights-reports-panel-footer-large">
604
-					<?php echo esc_html__( 'Show', 'google-analytics-for-wordpress' );?>&nbsp;
605
-					<div class="monsterinsights-reports-show-selector-group btn-group" role="group" aria-label="<?php echo esc_html__( 'How many to show', 'google-analytics-for-wordpress' );?>">
604
+					<?php echo esc_html__( 'Show', 'google-analytics-for-wordpress' ); ?>&nbsp;
605
+					<div class="monsterinsights-reports-show-selector-group btn-group" role="group" aria-label="<?php echo esc_html__( 'How many to show', 'google-analytics-for-wordpress' ); ?>">
606 606
 						 <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button ten btn btn-default active" disabled="disabled">10</button>
607 607
 						 <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button twentyfive btn btn-default">25</button>
608 608
 						 <button type="button" data-tid="monsterinsights-report-top-page-list" class="monsterinsights-reports-show-selector-button fifty btn btn-default">50</button>
609 609
 					</div>
610
-					<a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' );?>" class="monsterinsights-reports-panel-footer-button alignright" style="margin-right: 20px;"><?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' );?></a>
610
+					<a href="<?php echo $referral_url; ?>" target="_blank" title="<?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' ); ?>" class="monsterinsights-reports-panel-footer-button alignright" style="margin-right: 20px;"><?php echo esc_html__( 'View Full Post/Page Report', 'google-analytics-for-wordpress' ); ?></a>
611 611
 				</div>
612 612
 			</div>
613 613
 		<?php } ?>
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 
645 645
 		ob_start(); ?>
646 646
 		<div class="monsterinsights-reports-box-datagraph" style="position:relative;">
647
-			<canvas id="monsterinsights-overview-<?php echo $class;?>" width="400px" height="400px"></canvas>
647
+			<canvas id="monsterinsights-overview-<?php echo $class; ?>" width="400px" height="400px"></canvas>
648 648
 			<script>
649 649
 				jQuery(document).ready(function() {
650 650
 					if ( window.uorigindetected != null){
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 						   }
676 676
 						});
677 677
 						
678
-						var ctx = document.getElementById("monsterinsights-overview-<?php echo $class;?>");
678
+						var ctx = document.getElementById("monsterinsights-overview-<?php echo $class; ?>");
679 679
 						var data = {
680 680
 							labels: [<?php echo implode( ', ', $labels ); ?>],
681 681
 							datasets: [
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
 									pointHoverRadius: 6,//The radius of the point when hovered.
701 701
 
702 702
 
703
-									labels: [<?php echo implode( ', ', $labels );   ?>],
704
-									data: [<?php echo implode( ', ', $datapoints );   ?>],
703
+									labels: [<?php echo implode( ', ', $labels ); ?>],
704
+									data: [<?php echo implode( ', ', $datapoints ); ?>],
705 705
 									trend: [<?php echo implode( ', ', $trendpoints ); ?>],
706 706
 								},
707 707
 							]
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 						  });
784 784
 						};
785 785
 
786
-						var MonsterInsightsOverview<?php echo time();?> = new Chart(ctx, {
786
+						var MonsterInsightsOverview<?php echo time(); ?> = new Chart(ctx, {
787 787
 							type: 'LineWithLine',
788 788
 							data: data,
789 789
 							plugins: [{
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	// Outputs the report.
39
-	protected function get_report_html( $data = array() ){
39
+	protected function get_report_html( $data = array() ) {
40 40
 		ob_start();
41 41
 		if ( ! empty( $data['overviewgraph']['count'] ) && $data['overviewgraph']['count'] > 0 ) {
42 42
 			?>
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 						foreach( $data['countries'] as $icountry => $countrydata ) {
509 509
 							if ( ! empty( $countries[ $countrydata['iso'] ] ) ) {
510 510
 								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'.</span><span class="monsterinsights-reports-country-flag monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countries[ $countrydata['iso'] ] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
511
-							} else { 
511
+							} else {
512 512
 								echo '<li class="list-group-item"><span class="monsterinsights-reports-list-count">'. $i .'</span><span class="monsterinsights-flag-icon monsterinsights-flag-icon-' . strtolower( $countrydata['iso'] ) . ' "></span><span class="monsterinsights-reports-list-text">' . $countrydata['iso'] . '</span><span class="monsterinsights-reports-list-number">' . number_format_i18n( $countrydata['sessions'] ) . '</span></li>';
513 513
 							}
514 514
 							$i++;
Please login to merge, or discard this patch.