Passed
Branch master (82fe3a)
by Chris
03:10
created
includes/admin/settings/settings-api.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( !defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Get the settings for a section
@@ -153,7 +155,7 @@  discard block
 block discarded – undo
153 155
 }
154 156
 add_action( 'current_screen', 'monsterinsights_save_settings' );
155 157
 
156
-function monsterinsights_is_settings_tab( $tab = '' ){
158
+function monsterinsights_is_settings_tab( $tab = '' ) {
157 159
 	$tabs = monsterinsights_get_settings_tabs();
158 160
 	if ( empty( $tab ) || empty( $tabs ) || ! is_string( $tab ) || ! is_array( $tabs ) ) {
159 161
 		return false;
@@ -317,7 +319,7 @@  discard block
 block discarded – undo
317 319
 function monsterinsights_sanitize_multicheck_field( $value, $id, $setting, $previous_value ) {
318 320
 	$save_value = array();
319 321
 	if ( ! empty( $value ) && is_array( $value ) ) {
320
-		foreach( $setting['options'] as $key => $option ){
322
+		foreach( $setting['options'] as $key => $option ) {
321 323
 			if ( in_array( $key, $value ) ) {
322 324
 				$save_value[] = $key;
323 325
 			}
@@ -342,7 +344,7 @@  discard block
 block discarded – undo
342 344
 	if ( ! empty( $value ) && is_array( $value ) ) {
343 345
 		if ( $setting['multiple'] ) {
344 346
 			foreach ( $value as $vid => $vname ) {
345
-				foreach( $setting['options'] as $key => $option ){
347
+				foreach( $setting['options'] as $key => $option ) {
346 348
 					if ( $key === $vname ) {
347 349
 						$save_value[] = $key;
348 350
 						break;
@@ -350,11 +352,11 @@  discard block
 block discarded – undo
350 352
 				}
351 353
 			}
352 354
 		} else {
353
-			foreach( $setting['options'] as $key => $option ){
355
+			foreach( $setting['options'] as $key => $option ) {
354 356
 				if ( is_array( $value ) && in_array( $key, $value ) ) {
355 357
 					$save_value = $key;
356 358
 					break;
357
-				} else if ( is_string( $value ) && $key === $value ){
359
+				} else if ( is_string( $value ) && $key === $value ) {
358 360
 					$save_value = $key;
359 361
 					break;
360 362
 				}
@@ -375,7 +377,7 @@  discard block
 block discarded – undo
375 377
 function monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ) {
376 378
 	$save_value = '';
377 379
 	if ( ! empty( $value ) ) {
378
-		foreach( $setting['options'] as $key => $option ){
380
+		foreach( $setting['options'] as $key => $option ) {
379 381
 			if ( $key === $value ) {
380 382
 				$save_value = $key;
381 383
 			}
@@ -995,7 +997,8 @@  discard block
 block discarded – undo
995 997
 /** 
996 998
  * @todo  docbloc
997 999
  */
998
-function monsterinsights_add_setting_tooltip( $html, $args ) { // @todo: enqueue tooltips
1000
+function monsterinsights_add_setting_tooltip( $html, $args ) {
1001
+// @todo: enqueue tooltips
999 1002
 
1000 1003
 	if ( ! empty( $args['tooltip_title'] ) && ! empty( $args['tooltip_desc'] ) ) {
1001 1004
 		$tooltip = '<span alt="f223" class="monsterinsights-help-tip dashicons dashicons-editor-help" title="<strong>' . $args['tooltip_title'] . '</strong>: ' . $args['tooltip_desc'] . '"></span>';
@@ -1052,6 +1055,6 @@  discard block
 block discarded – undo
1052 1055
 /** 
1053 1056
  * @todo  docbloc
1054 1057
  */
1055
-function monsterinsights_get_non_setting_types(){
1058
+function monsterinsights_get_non_setting_types() {
1056 1059
 	return apply_filters( 'monsterinsights_non_setting_types', array(  'descriptive_text', 'hook', 'upgrade_notice', 'install_notice', 'notice' ) );
1057 1060
 }
1058 1061
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/settings/tab-general.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
                     <?php
198 198
                     $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
199 199
                     $description = esc_html__( 'By allowing us to track usage data we can better help you, because we know with which WordPress configurations, themes and plugins we should test.', 'google-analytics-for-wordpress' );
200
-                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ){
200
+                    if ( ! $anon_tracking || monsterinsights_is_debug_mode() ) {
201 201
                         echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
202 202
                     }
203 203
                     ?>
Please login to merge, or discard this patch.
includes/admin/reports/overview.php 1 patch
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	// Adds/Refreshes the data
39
-	public function add_report_data( $client, $id ){
39
+	public function add_report_data( $client, $id ) {
40 40
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
41 41
 			return false;
42 42
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	// Gets the data
70
-	public function get_report_data( ){
70
+	public function get_report_data( ) {
71 71
 		$data = array();
72 72
 		$data['pageviews'] = get_option( 'monsterinsights_report_overview_pageviews', array() );
73 73
 		$data['top-content'] = get_option( 'monsterinsights_report_overview_top_content', array() );
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	// Removes report data
80
-	public function delete_report_data(){
80
+	public function delete_report_data() {
81 81
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
82 82
 			return false;
83 83
 		}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	// Outputs the report.
93
-	public function show_report( ){
93
+	public function show_report( ) {
94 94
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
95 95
 			return false;
96 96
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				}
120 120
 			}
121 121
 
122
-			if ( $max >= 1 ) { 
122
+			if ( $max >= 1 ) {
123 123
 			?>
124 124
 			<div class="monsterinsights-grid">
125 125
 				<div class="monsterinsights-col-1-1 monsterinsights-grid-grey-bg monsterinsights-grid-border">
@@ -325,7 +325,8 @@  discard block
 block discarded – undo
325 325
 								$i = 0;
326 326
 								foreach ( $top['data'] as $top_index => $top_values ) { ?>
327 327
 								<?php
328
-									if ( $i === 10 ) { // Limit to 10 max
328
+									if ( $i === 10 ) {
329
+// Limit to 10 max
329 330
 										break;
330 331
 									} else {
331 332
 										$i++;
@@ -338,7 +339,8 @@  discard block
 block discarded – undo
338 339
 									<div class="monsterinsights-col-1-8"><?php echo $views ?></div>
339 340
 								</div>
340 341
 							<?php } 
341
-								for ( $i; $i < 10; $i++ ) { // if we have less than 10, make empty rows
342
+								for ( $i; $i < 10; $i++ ) {
343
+// if we have less than 10, make empty rows
342 344
 									?>
343 345
 									<div class="monsterinsights-data-row">
344 346
 										<div class="monsterinsights-col-7-8">&nbsp;</div>
@@ -370,7 +372,8 @@  discard block
 block discarded – undo
370 372
 								$i = 0;
371 373
 								foreach ( $sources['data'] as $sources_index => $sources_values ) { ?>
372 374
 								<?php
373
-									if ( $i === 10 ) { // Limit to 10 max
375
+									if ( $i === 10 ) {
376
+// Limit to 10 max
374 377
 										break;
375 378
 									} else {
376 379
 										$i++;
@@ -383,7 +386,8 @@  discard block
 block discarded – undo
383 386
 									<div class="monsterinsights-col-1-8"><?php echo $views ?></div>
384 387
 								</div>
385 388
 							<?php } 
386
-								for ( $i; $i < 10; $i++ ) { // if we have less than 10, make empty rows
389
+								for ( $i; $i < 10; $i++ ) {
390
+// if we have less than 10, make empty rows
387 391
 									?>
388 392
 									<div class="monsterinsights-data-row">
389 393
 										<div class="monsterinsights-col-7-8">&nbsp;</div>
@@ -450,7 +454,8 @@  discard block
 block discarded – undo
450 454
 							$list_of_countries = monsterinsights_get_country_list( true );
451 455
 							foreach ( $countries['data'] as $countries_index => $countries_values ) { ?>
452 456
 							<?php
453
-								if ( $i === 10 ) { // Limit to 10 max
457
+								if ( $i === 10 ) {
458
+// Limit to 10 max
454 459
 									break;
455 460
 								} else {
456 461
 									$i++;
@@ -477,7 +482,7 @@  discard block
 block discarded – undo
477 482
 
478 483
 	public function parse_request( $request ) {
479 484
 		$to_save = array();
480
-		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ){
485
+		if ( ! empty( $request['response'] ) && ! empty( $request['response']['code'] ) && 200 == $request['response']['code'] ) {
481 486
 			$dates = $this->get_date_range();
482 487
 			$to_save['start-date'] = $dates['start'];
483 488
 			$to_save['end-date']   = $dates['end'];
Please login to merge, or discard this patch.
includes/admin/reporting.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				// Clear data + last run + failed
99 99
 				$this->delete_aggregate_data();
100 100
 
101
-		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ){
101
+		} else if ( ! $dashboards_disabled && $dashboards_disabled_old ) {
102 102
 			// The dashboards are now being enabled
103 103
 				// Refresh data + schedule cron
104 104
 				$this->refresh_aggregate_data();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		$last_run = monsterinsights_get_option( 'cron_last_run', false );
122 122
 
123 123
 		// See if issue connecting or expired
124
-		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date('Ymd', time() ) ) { 
124
+		if ( $last_run === false || monsterinsights_hours_between( $last_run ) >= 24 || date( 'Ymd', $last_run ) !== date('Ymd', time() ) ) {
125 125
 			$this->run_cron();
126 126
 		}
127 127
 	}
Please login to merge, or discard this patch.
includes/admin/admin.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -224,9 +224,11 @@  discard block
 block discarded – undo
224 224
     }
225 225
 
226 226
     $upgrade = get_option( 'monsterinsights_version_upgraded_from' );
227
-    if( ! $upgrade ) { // First time install
227
+    if( ! $upgrade ) {
228
+// First time install
228 229
         //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
229
-    } else { // Update
230
+    } else {
231
+// Update
230 232
         return;
231 233
         //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
232 234
     }
@@ -268,19 +270,19 @@  discard block
 block discarded – undo
268 270
         $notices = array();
269 271
     }
270 272
 
271
-    if ( $analytics === 'ga' && ! isset( $notices ['monsterinsights_deprecated_ga' ] ) ){
273
+    if ( $analytics === 'ga' && ! isset( $notices ['monsterinsights_deprecated_ga' ] ) ) {
272 274
        echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_deprecated_ga">';
273 275
             echo '<p>';
274 276
             echo sprintf( esc_html__( 'Warning: You\'re currently using deprecated ga.js tracking which we will be removing support for in an upcoming release. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s. Users who do not manually switch over will be automatically switched over in an upcoming release.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
275 277
             echo '</p>';
276 278
         echo '</div>';
277
-    } else if ( $events === 'php' && ! isset( $notices ['monsterinsights_deprecated_php' ] ) ){
279
+    } else if ( $events === 'php' && ! isset( $notices ['monsterinsights_deprecated_php' ] ) ) {
278 280
        echo '<div class="notice notice-error is-dismissible monsterinsights-notice" data-notice="monsterinsights_deprecated_php">';
279 281
             echo '<p>';
280 282
             echo sprintf( esc_html__( 'Warning: You\'re currently using deprecated PHP based events tracking which we will be removing support for in an upcoming release. We recommend switching to JS events tracking, as it is significantly more accurate than PHP based events tracking. To switch %1$sclick here%2$s. Users who do not manually switch over will be automatically switched over in an upcoming release.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
281 283
             echo '</p>';
282 284
         echo '</div>';
283
-    } else if ( empty( $updates) && ! isset( $notices ['monsterinsights_automatic_updates' ] ) ){ 
285
+    } else if ( empty( $updates) && ! isset( $notices ['monsterinsights_automatic_updates' ] ) ) {
284 286
         if ( defined( 'MONSTERINSIGHTS_SHOWING_EMPTY_CONFIG_NOTICE' ) && MONSTERINSIGHTS_SHOWING_EMPTY_CONFIG_NOTICE ) {
285 287
             return;
286 288
         }
Please login to merge, or discard this patch.
includes/admin/licensing/license.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -506,7 +506,7 @@
 block discarded – undo
506 506
         } else {
507 507
             // If there is no license key, output nag about ensuring key is set for automatic updates.
508 508
             if ( ! $key ) :
509
-                if ( ! monsterinsights_is_pro_version() ) { 
509
+                if ( ! monsterinsights_is_pro_version() ) {
510 510
                     return;
511 511
                 }
512 512
                 $screen = get_current_screen(); 
Please login to merge, or discard this patch.
includes/admin/ajax.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 
167 167
     // Deactivate the addon.
168 168
     if ( isset( $_POST['plugin'] ) ) {
169
-        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) { 
169
+        if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
170 170
             $deactivate = deactivate_plugins( $_POST['plugin'], false, true );
171 171
         } else {
172 172
             $deactivate = deactivate_plugins( $_POST['plugin'] );
Please login to merge, or discard this patch.
includes/admin/common.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -390,7 +390,7 @@
 block discarded – undo
390 390
 	return $shareasale_id;
391 391
 }
392 392
 
393
-function monsterinsights_settings_ublock_error_js(){
393
+function monsterinsights_settings_ublock_error_js() {
394 394
 	echo "<script type='text/javascript'>\n";
395 395
 	echo "jQuery( document ).ready( function( $ ) {
396 396
 			if ( window.uorigindetected == null){
Please login to merge, or discard this patch.
includes/admin/pages/tools.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	<?php
52 52
 }
53 53
 
54
-function monsterinsights_tools_url_builder_tab(){
54
+function monsterinsights_tools_url_builder_tab() {
55 55
 	do_action( 'monsterinsights_tools_url_builder_tab' );
56 56
 }
57 57
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 				</th>
71 71
 				<td>
72 72
 					<?php 
73
-					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ){
73
+					if ( ! empty( $_REQUEST['action'] ) && ! empty( $_REQUEST['result'] ) && $_REQUEST['action'] === 'import' && $_REQUEST['result'] === 'success' ) {
74 74
 						echo MonsterInsights()->notices->display_inline_notice( 'monsterinsights_standard_notice', '', __( 'Successfully imported settings!','google-analytics-for-wordpress'), 'success', false, array() );
75 75
 					}
76 76
 					?>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		return;
134 134
 	}
135 135
 
136
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ){
136
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_export_settings' ) {
137 137
 		return;
138 138
 	}
139 139
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		return;
165 165
 	}
166 166
 
167
-	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ){
167
+	if ( $_POST['monsterinsights_action'] !== 'monsterinsights_import_settings' ) {
168 168
 		return;
169 169
 	}
170 170
 
Please login to merge, or discard this patch.