Passed
Push — master ( cf9d65...a7feb4 )
by Chris
03:29
created
includes/frontend/frontend.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     do_action( 'monsterinsights_tracking_before_' . $mode );
38 38
     do_action( 'monsterinsights_tracking_before', $mode );
39 39
     if ( $mode === 'preview' ) {
40
-        require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php';
41
-        $tracking = new MonsterInsights_Tracking_Preview();
42
-        echo $tracking->frontend_output();
40
+	require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php';
41
+	$tracking = new MonsterInsights_Tracking_Preview();
42
+	echo $tracking->frontend_output();
43 43
     } else {
44
-         require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php';
45
-         $tracking = new MonsterInsights_Tracking_Analytics();
46
-         echo $tracking->frontend_output();
44
+	 require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php';
45
+	 $tracking = new MonsterInsights_Tracking_Analytics();
46
+	 echo $tracking->frontend_output();
47 47
     }
48 48
 
49 49
     do_action( 'monsterinsights_tracking_after_' . $mode );
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
     $track_user    = monsterinsights_track_user();
70 70
 
71 71
     if ( $track_user && ( $events_mode === 'js' || $events_mode === 'php' ) ) {
72
-        require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php';
73
-        new MonsterInsights_Analytics_Events();
72
+	require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/events/class-analytics-events.php';
73
+	new MonsterInsights_Analytics_Events();
74 74
     } else {
75
-        // User is in the disabled group or events mode is off
75
+	// User is in the disabled group or events mode is off
76 76
     }
77 77
 }
78 78
 add_action( 'template_redirect', 'monsterinsights_events_tracking', 9 );
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
     global $post;
92 92
 
93 93
     if ( monsterinsights_get_option( 'tag_links_in_rss', false ) ){
94
-        if ( is_feed() ) {
95
-            if ( monsterinsights_get_option( 'allow_anchor', false ) ) {
96
-                $delimiter = '#';
97
-            } else {
98
-                $delimiter = '?';
99
-                if ( strpos( $guid, $delimiter ) > 0 ) {
100
-                    $delimiter = '&';
101
-                }
102
-            }
103
-            return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name );
104
-        }
94
+	if ( is_feed() ) {
95
+	    if ( monsterinsights_get_option( 'allow_anchor', false ) ) {
96
+		$delimiter = '#';
97
+	    } else {
98
+		$delimiter = '?';
99
+		if ( strpos( $guid, $delimiter ) > 0 ) {
100
+		    $delimiter = '&';
101
+		}
102
+	    }
103
+	    return $guid . $delimiter . 'utm_source=rss&utm_medium=rss&utm_campaign=' . urlencode( $post->post_name );
104
+	}
105 105
     }
106 106
     return $guid;
107 107
 }
Please login to merge, or discard this patch.
includes/frontend/tracking/class-tracking-analytics.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		if ( $create && ! empty( $create ) && is_array( $create ) ) {
91 91
 			$create = json_encode( $create );
92
-			$create = str_replace( '"', "'",  $create );
93
-			$options['create'] = "'create', '" . esc_js( $ua_code ). "', '" . esc_js( $domain ) . "', " . $create;
92
+			$create = str_replace( '"', "'", $create );
93
+			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "', " . $create;
94 94
 		} else {
95 95
 			$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "'";
96 96
 		}
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function frontend_output( ) {
168 168
 		$options        = $this->frontend_tracking_options();
169
-		$is_debug_mode  =  monsterinsights_is_debug_mode();
170
-		$src     	    = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' );
169
+		$is_debug_mode  = monsterinsights_is_debug_mode();
170
+		$src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' );
171 171
 		if ( current_user_can( 'manage_options' ) && $is_debug_mode ) {
172 172
 			$src       = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics_debug.js' );
173 173
 		}
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 	$reason = '';
184 184
 	if ( empty( $ua ) ) {
185 185
 		$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' );
186
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
186
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
187 187
 	} else if ( current_user_can( 'monsterinsights_save_settings' ) ) {
188
-		$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' );
189
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
188
+		$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' );
189
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
190 190
 	} else {
191 191
 		$reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' );
192
-	    $output .=  '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
192
+	    $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL;
193 193
 	}
194 194
 	echo $output;
195 195
 } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 	?>
242 242
 	} else {
243
-		console.log( '%c' + "<?php echo esc_js( $reason );?>", 'color:#F74C2F;font-size: 1.5em;font-weight:800;');
243
+		console.log( '%c' + "<?php echo esc_js( $reason ); ?>", 'color:#F74C2F;font-size: 1.5em;font-weight:800;');
244 244
 		(function() {
245 245
 			/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
246 246
 			var noopfn = function() {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				}
264 264
 				var f = arguments[len-1];
265 265
 				if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) {
266
-					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 ) );?>");
266
+					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 ) ); ?>");
267 267
 					return;
268 268
 				}
269 269
 				try {
Please login to merge, or discard this patch.
includes/admin/reports/abstract-report.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @since 6.0.0
31 31
 	 */
32 32
 	public function __construct() {
33
-		add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10 , 3 );
33
+		add_filter( 'monsterinsights_reports_abstract_get_data_pre_cache', array( $this, 'requirements' ), 10, 3 );
34 34
 	}
35 35
 
36 36
 	// Let's get the HTML to output for a particular report. This is not the AJAX endpoint. Args can hold things (generally start/end date range)
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		return ''; 
41 41
 	}
42 42
 
43
-	public function additional_data(){
43
+	public function additional_data() {
44 44
 		return array();
45 45
 	}
46 46
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	public function show_report( $args = array() ) {
52 52
 
53 53
 		if ( ! current_user_can( 'monsterinsights_view_dashboard' ) ) {
54
-			return monsterinsights_get_message( 'error', esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) );
54
+			return monsterinsights_get_message( 'error', esc_html__( 'Access denied', 'google-analytics-for-wordpress' ) );
55 55
 		}
56 56
 
57 57
 		if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 		}
71 71
 
72
-		if ( monsterinsights_is_pro_version() ){
72
+		if ( monsterinsights_is_pro_version() ) {
73 73
 			if ( ! MonsterInsights()->license->has_license() ) {
74 74
 				$url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
75
-				return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ),'<a href="' . $url . '">','</a>' );
75
+				return monsterinsights_get_message( 'error', esc_html__( 'You do not have an active license. Please %1$scheck your license configuration.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' );
76 76
 			} else if ( MonsterInsights()->license->license_has_error() ) {
77 77
 				return monsterinsights_get_message( 'error', $this->get_license_error() );
78 78
 			}
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			return monsterinsights_get_message( 'error', $args['error'] );
108 108
 		}
109 109
 
110
-		if ( empty( $args['data' ] ) || ! is_array( $args['data' ] ) ) {
110
+		if ( empty( $args['data'] ) || ! is_array( $args['data'] ) ) {
111 111
 			if ( monsterinsights_is_pro_version() ) {
112 112
 				return '';
113 113
 			} else {
114 114
 				// Try to get default data.
115 115
 				$args = $this->get_data( array( 'default' => true ) );
116
-				if ( empty( $args['data'] ) || is_array( $args['data' ] ) ) {
116
+				if ( empty( $args['data'] ) || is_array( $args['data'] ) ) {
117 117
 					return monsterinsights_get_message( 'error', __( 'No data found', 'google-analytics-for-wordpress' ) );
118 118
 				}
119 119
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		}
148 148
 		
149 149
 		$start = ! empty( $args['start'] ) && $this->is_valid_date( $args['start'] ) ? $args['start'] : '';
150
-		$end   = ! empty( $args['end'] )   && $this->is_valid_date( $args['end'] )   ? $args['end']   : '';
150
+		$end   = ! empty( $args['end'] ) && $this->is_valid_date( $args['end'] ) ? $args['end'] : '';
151 151
 
152 152
 		if ( ! MonsterInsights()->license->license_can( $this->level ) ) {
153 153
 			return array(
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 				$data = ! $site_auth && $ms_auth ? get_site_transient( $transient ) : get_transient( $transient );
203 203
 			}
204 204
 
205
-			if ( ! empty( $data )             &&
206
-				 ! empty( $data['expires'] )  &&
205
+			if ( ! empty( $data ) &&
206
+				 ! empty( $data['expires'] ) &&
207 207
 				   $data['expires'] >= time() &&
208
-				 ! empty( $data['data'] )     && 
209
-				 ! empty( $data['p'] )        && 
208
+				 ! empty( $data['data'] ) && 
209
+				 ! empty( $data['p'] ) && 
210 210
 				   $data['p'] === $p
211 211
 			) {
212 212
 				return array(
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 			}
217 217
 
218 218
 			// Nothing in cache, either not saved before, expired or mismatch. Let's grab from API
219
-			$api_options = array( 'start' => $start, 'end' => $end);
219
+			$api_options = array( 'start' => $start, 'end' => $end );
220 220
 			if ( ! $site_auth && $ms_auth ) {
221 221
 				$api_options['network'] = true;
222 222
 			}
223 223
 			
224
-			$api   = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' );
224
+			$api = new MonsterInsights_API_Request( 'analytics/reports/' . $this->name . '/', $api_options, 'GET' );
225 225
 
226 226
 			$additional_data = $this->additional_data();
227 227
 			
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 				$api->set_additional_data( $additional_data );
230 230
 			}
231 231
 			
232
-			$ret   = $api->request();
232
+			$ret = $api->request();
233 233
 			//echo print_r( $ret['data']);wp_die();
234 234
 			
235 235
 			if ( is_wp_error( $ret ) ) {
@@ -290,44 +290,44 @@  discard block
 block discarded – undo
290 290
 	// Is a valid date value
291 291
 	public function is_valid_date( $date = '' ) {
292 292
 		$d = MonsterInsightsDateTime::createFromFormat( 'Y-m-d', $date );
293
-		return $d && $d->format('Y-m-d') === $date;
293
+		return $d && $d->format( 'Y-m-d' ) === $date;
294 294
 	}
295 295
 
296 296
 	/**
297 297
 	 * Do not use the functions below this. They are unused and are just here so people
298 298
 	 * with out of date MonsterInsights addons won't get fatal errors.
299 299
 	 */
300
-	protected function get_api_max_limit() {return 300;}
301
-	protected function get_date_range() {return array();}
300
+	protected function get_api_max_limit() {return 300; }
301
+	protected function get_date_range() {return array(); }
302 302
 
303 303
 	public function get_upsell_notice() {
304 304
 		$has_level = MonsterInsights()->license->get_license_type();
305 305
 		$has_level = $has_level ? $has_level : 'lite';
306 306
 		$message = sprintf( __( 'You currently have a %s level license, but this report requires at least a %s level license to view the %s. Please upgrade to view this report.', 'google-analytics-for-wordpress' ), $has_level, $this->level, $this->title );
307
-		ob_start();?>
308
-		<div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name;?>-bg">
307
+		ob_start(); ?>
308
+		<div class="monsterinsights-upsell-report-container monsterinsights-upsell-report-<?php echo $this->name; ?>-bg">
309 309
 			<div class="monsterinsights-upsell-container">
310 310
 		  		<div class="row justify-content-center">
311 311
 					<div class="col-lg-10 col-lg-offset-1 align-self-center">
312 312
 						<div class="monsterinsights-upsell-card">
313
-							  <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL );?>assets/css/images/[email protected] 2x" alt="">
313
+							  <img class="monsterinsights-upgrade-mascot" src="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/mascot.png" srcset="<?php echo trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ); ?>assets/css/images/[email protected] 2x" alt="">
314 314
 								<div class="monsterinsights-upsell-card-card-content">
315
-								  <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' );?></span>
316
-								  <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' );?></strong></p> &nbsp;
315
+								  <span class="monsterinsights-upsell-card-title"><?php esc_html_e( 'Ready to Get Analytics Super-Powers?', 'google-analytics-for-wordpress' ); ?></span>
316
+								  <p class="monsterinsights-upsell-card-subtitle"><strong><?php esc_html_e( '(And Crush Your Competition?)', 'google-analytics-for-wordpress' ); ?></strong></p> &nbsp;
317 317
 								  <?php if ( monsterinsights_is_pro_version() ) { ?>
318 318
 									  <p ><?php echo sprintf( esc_html__( "Hey there! It looks like you've got the %s license installed on your site.
319
-									  That's awesome! %s",'google-analytics-for-wordpress'), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p>
319
+									  That's awesome! %s",'google-analytics-for-wordpress' ), $has_level, '<span class="dashicons dashicons-smiley"></span>' ); ?></p>
320 320
 									   &nbsp;
321
-									  <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. You'll need to upgrade your license to get instant access.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<a href="https://monsterinsights.com/my-account/">' . $this->level,'</a>' ); ?></p>
322
-									   &nbsp;<p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.",'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/my-account/?utm_source=wpdashboard&utm_campaign=reportupsellpro"><strong>','</strong></a>', '<a href="https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/" style="text-decoration:underline !important">', '</a>' ); ?></p>
323
-									   &nbsp;<p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p>
321
+									  <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. You'll need to upgrade your license to get instant access.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<a href="https://monsterinsights.com/my-account/">' . $this->level, '</a>' ); ?></p>
322
+									   &nbsp;<p><?php echo sprintf( esc_html__( "It's easy! To upgrade, navigate to %sMy Account%s on MonsterInsights.com, go to the licenses tab, and click upgrade. We also have a %sstep by step guide%s with pictures of this process.", 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/my-account/?utm_source=wpdashboard&utm_campaign=reportupsellpro"><strong>', '</strong></a>', '<a href="https://www.monsterinsights.com/docs/upgrade-monsterinsights-license/" style="text-decoration:underline !important">', '</a>' ); ?></p>
323
+									   &nbsp;<p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p>
324 324
 									<?php } else { ?>
325 325
 									   <p><?php echo sprintf( esc_html__( "Hey there! %s It looks like you've got the free version of MonsterInsights installed on your site.
326
-									  That's awesome!",'google-analytics-for-wordpress'), '<span class="dashicons dashicons-smiley"></span>' ); ?></p>
326
+									  That's awesome!",'google-analytics-for-wordpress' ), '<span class="dashicons dashicons-smiley"></span>' ); ?></p>
327 327
 									   &nbsp;
328
-									  <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.",'google-analytics-for-wordpress'), '<strong>' . $this->title, '</strong>','<a href="https://monsterinsights.com/lite/">' . $this->level,'</a>' ); ?></p>
329
-									   &nbsp;<p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.",'google-analytics-for-wordpress'), '<a href="https://monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=reportupselllite"><strong>', '</strong></a>','<a style="text-decoration:underline !important" href="https://www.monsterinsights.com/docs/go-lite-pro/">', '</a>' ); ?></p>
330
-									   &nbsp;<p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress');?></p>
328
+									  <p><?php echo sprintf( esc_html__( "Do you you want to access to %s reporting right now%s in your WordPress Dashboard? That comes with %s level%s of our paid packages. To get instant access, you'll want to buy a MonsterInsights license, which also gives you access to powerful addons, expanded reporting (including the ability to use custom date ranges), comprehensive tracking features (like UserID tracking) and access to our world-class support team.", 'google-analytics-for-wordpress' ), '<strong>' . $this->title, '</strong>', '<a href="https://monsterinsights.com/lite/">' . $this->level, '</a>' ); ?></p>
329
+									   &nbsp;<p><?php echo sprintf( esc_html__( "Upgrading is easy! To upgrade, navigate to %sour pricing page%s, purchase the required license, and then follow the %sinstructions in the email receipt%s to upgrade. It only takes a few minutes to unlock the most powerful, yet easy to use analytics tracking system for WordPress.", 'google-analytics-for-wordpress' ), '<a href="https://monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=reportupselllite"><strong>', '</strong></a>', '<a style="text-decoration:underline !important" href="https://www.monsterinsights.com/docs/go-lite-pro/">', '</a>' ); ?></p>
330
+									   &nbsp;<p><?php esc_html_e( "If you have any questions, don't hesitate to reach out. We're here to help.", 'google-analytics-for-wordpress' ); ?></p>
331 331
 									<?php } ?>
332 332
 								</div>
333 333
 								<div class="monsterinsights-upsell-card-action">
Please login to merge, or discard this patch.
includes/admin/admin.php 3 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
     $hook = 'monsterinsights_settings';
34 34
 
35 35
     if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) {
36
-        // If dashboards disabled, first settings page
37
-        add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
38
-        $hook = 'monsterinsights_settings';
36
+	// If dashboards disabled, first settings page
37
+	add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
38
+	$hook = 'monsterinsights_settings';
39 39
 
40
-        add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' );
41
-        add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' );
40
+	add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' );
41
+	add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' );
42 42
     } else {
43
-        // if dashboards enabled, first dashboard
44
-        add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
43
+	// if dashboards enabled, first dashboard
44
+	add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
45 45
 
46
-        $hook = 'monsterinsights_reports';
46
+	$hook = 'monsterinsights_reports';
47 47
 
48
-        add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' );
48
+	add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-for-wordpress' ), __( 'Reports', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page' );
49 49
 
50
-        // then settings page
51
-        add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' );
50
+	// then settings page
51
+	add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page' );
52 52
 
53
-        add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' );
53
+	add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' );
54 54
 
55 55
     }
56 56
     
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     // then addons
61 61
     $network_key = MonsterInsights()->license->get_network_license_key();
62 62
     if ( ! monsterinsights_is_network_active() || ( monsterinsights_is_network_active() && empty( $network_key ) ) ) {
63
-        add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' );
63
+	add_submenu_page( $hook, __( 'Addons:', 'google-analytics-for-wordpress' ), '<span style="color:#7cc048"> ' . __( 'Addons', 'google-analytics-for-wordpress' ) . '</span>', 'monsterinsights_save_settings', 'monsterinsights_addons', 'monsterinsights_addons_page' );
64 64
     }
65 65
 }
66 66
 add_action( 'admin_menu', 'monsterinsights_admin_menu' );
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
     // First, let's see if this is an MS network enabled plugin. If it is, we should load the license 
75 75
     // menu page and the updater on the network panel
76 76
     if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
77
-        require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
77
+	require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
78 78
     }
79 79
 
80 80
     $plugin = plugin_basename( MONSTERINSIGHTS_PLUGIN_FILE );
81 81
     if ( ! is_plugin_active_for_network( $plugin ) ) {
82
-        return;
82
+	return;
83 83
     }
84 84
 
85 85
     $hook = 'monsterinsights_network';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 function monsterinsights_add_admin_body_class( $classes ) {
104 104
     $screen = get_current_screen(); 
105 105
     if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
106
-        return $classes;
106
+	return $classes;
107 107
     }
108 108
        
109 109
     return "$classes monsterinsights_page ";
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
 
124 124
     // If lite, show a link where they can get pro from
125 125
     if ( ! monsterinsights_is_pro_version() ) {
126
-        $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
127
-        array_unshift( $links, $get_pro );
126
+	$get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
127
+	array_unshift( $links, $get_pro );
128 128
     }   
129 129
     
130 130
     // If Lite, support goes to forum. If pro, it goes to our website
131 131
     if ( monsterinsights_is_pro_version() ) {
132
-        $support = '<a title="MonsterInsights Pro Support" href="https://www.monsterinsights.com/my-account/support/">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
133
-        array_unshift( $links, $support );
132
+	$support = '<a title="MonsterInsights Pro Support" href="https://www.monsterinsights.com/my-account/support/">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
133
+	array_unshift( $links, $support );
134 134
     } else {
135
-        $support = '<a title="MonsterInsights Lite Support" href="https://wordpress.org/support/plugin/google-analytics-for-wordpress">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
136
-        array_unshift( $links, $support );      
135
+	$support = '<a title="MonsterInsights Lite Support" href="https://wordpress.org/support/plugin/google-analytics-for-wordpress">' . esc_html__( 'Support', 'google-analytics-for-wordpress' ) . '</a>';
136
+	array_unshift( $links, $support );      
137 137
     }
138 138
 
139 139
     $settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=monsterinsights_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-for-wordpress' ) . '</a>';
@@ -158,26 +158,26 @@  discard block
 block discarded – undo
158 158
 function monsterinsights_load_admin_partial( $template, $data = array() ) {
159 159
 
160 160
     if ( monsterinsights_is_pro_version() ) {
161
-        $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' );
161
+	$dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' );
162 162
     
163
-        if ( file_exists( $dir . $template . '.php' ) ) {
164
-            require_once(  $dir . $template . '.php' );
165
-            return true;
166
-        }
163
+	if ( file_exists( $dir . $template . '.php' ) ) {
164
+	    require_once(  $dir . $template . '.php' );
165
+	    return true;
166
+	}
167 167
     } else {
168
-        $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' );
168
+	$dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' );
169 169
     
170
-        if ( file_exists( $dir . $template . '.php' ) ) {
171
-            require_once(  $dir . $template . '.php' );
172
-            return true;
173
-        }   
170
+	if ( file_exists( $dir . $template . '.php' ) ) {
171
+	    require_once(  $dir . $template . '.php' );
172
+	    return true;
173
+	}   
174 174
     }
175 175
         
176 176
     $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' );
177 177
 
178 178
     if ( file_exists( $dir . $template . '.php' ) ) {
179
-        require_once(  $dir . $template . '.php' );
180
-        return true;
179
+	require_once(  $dir . $template . '.php' );
180
+	return true;
181 181
     }
182 182
                 
183 183
     return false;
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
     // Get the current screen, and check whether we're viewing a MonsterInsights screen;
194 194
     $screen = get_current_screen(); 
195 195
     if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
196
-        return;
196
+	return;
197 197
     }
198 198
 
199 199
     // If here, we're on an MonsterInsights screen, so output the header.
200 200
     monsterinsights_load_admin_partial( 'header', array(
201
-        'mascot'   => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ),
202
-        'logo'     => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ),
203
-        '2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ),
204
-        '2xlogo'   => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ),
201
+	'mascot'   => plugins_url( 'assets/css/images/mascot.png', MonsterInsights()->file ),
202
+	'logo'     => plugins_url( 'assets/css/images/logo.png', MonsterInsights()->file ),
203
+	'2xmascot' => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ),
204
+	'2xlogo'   => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ),
205 205
     ) );
206 206
 }
207 207
 add_action( 'in_admin_header','monsterinsights_admin_header', 100 );
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 function monsterinsights_welcome_redirect() {
210 210
     // Bail if no activation redirect
211 211
     if ( ! get_transient( '_monsterinsights_activation_redirect' ) ) {
212
-        return;
212
+	return;
213 213
     }
214 214
 
215 215
     // Delete the redirect transient
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 
218 218
     // Bail if activating from network, or bulk
219 219
     if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
220
-        return;
220
+	return;
221 221
     }
222 222
 
223 223
     $upgrade = get_option( 'monsterinsights_version_upgraded_from' );
224 224
     if( ! $upgrade ) { // First time install
225
-        //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
225
+	//wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
226 226
     } else { // Update
227
-        return;
228
-        //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
227
+	return;
228
+	//wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
229 229
     }
230 230
 }
231 231
 //add_action( 'admin_init', 'monsterinsights_welcome_redirect', 11 ); @todo: Investigate
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 function monsterinsights_admin_footer( $text ) {
242 242
     global $current_screen;
243 243
     if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) {
244
-        $url  = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
245
-        $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' .  $url . '" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
244
+	$url  = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
245
+	$text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' .  $url . '" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
246 246
     }
247 247
     return $text;
248 248
 }
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
     // Don't show on MonsterInsights pages
254 254
     $screen = get_current_screen(); 
255 255
     if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) !== false ) {
256
-        return;
256
+	return;
257 257
     }
258 258
 
259 259
     // Make sure they have the permissions to do something
260 260
     if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
261
-        return;
261
+	return;
262 262
     }
263 263
 
264 264
     // Priority:
@@ -271,164 +271,164 @@  discard block
 block discarded – undo
271 271
 
272 272
     // 1. Google Analytics not authenticated
273 273
     if ( ! is_network_admin() && ! monsterinsights_get_ua() ) {
274
-        $page = admin_url( 'admin.php?page=monsterinsights_settings' );
275
-        $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' );
276
-        echo '<div class="error"><p>'. $message.'</p></div>';
277
-        return;
274
+	$page = admin_url( 'admin.php?page=monsterinsights_settings' );
275
+	$message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' );
276
+	echo '<div class="error"><p>'. $message.'</p></div>';
277
+	return;
278 278
     }
279 279
 
280 280
     // 2. License key not entered for pro
281 281
     $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : '';
282 282
     if ( monsterinsights_is_pro_version() && empty( $key ) ) {
283
-        $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
284
-        $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
285
-        echo '<div class="error"><p>'. $message.'</p></div>';
286
-        return;
283
+	$page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
284
+	$message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
285
+	echo '<div class="error"><p>'. $message.'</p></div>';
286
+	return;
287 287
     }
288 288
 
289 289
     // 3. License key not valid/okay for pro
290 290
     if ( monsterinsights_is_pro_version() ) {
291
-        $message = '';
292
-        if ( MonsterInsights()->license->get_site_license_key() ){
293
-            if ( MonsterInsights()->license->site_license_expired() ) {
294
-                $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
295
-            } else if ( MonsterInsights()->license->site_license_disabled() ) {
296
-                $message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
297
-            } else if ( MonsterInsights()->license->site_license_invalid() ) {
298
-                $message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' );
299
-            }
300
-        } else if ( MonsterInsights()->license->get_network_license_key() ) {
301
-            if ( MonsterInsights()->license->network_license_expired() ) {
302
-                $message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
303
-            } else if ( MonsterInsights()->license->network_license_disabled() ) {
304
-                $message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
305
-            } else if ( MonsterInsights()->license->network_license_invalid() ) {
306
-                $message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' );
307
-            }
308
-        }
309
-        if ( ! empty( $message ) ) {
310
-            echo '<div class="error"><p>'. $message.'</p></div>';
311
-            return;
312
-        }
291
+	$message = '';
292
+	if ( MonsterInsights()->license->get_site_license_key() ){
293
+	    if ( MonsterInsights()->license->site_license_expired() ) {
294
+		$message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
295
+	    } else if ( MonsterInsights()->license->site_license_disabled() ) {
296
+		$message = esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
297
+	    } else if ( MonsterInsights()->license->site_license_invalid() ) {
298
+		$message = esc_html__( 'Your license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' );
299
+	    }
300
+	} else if ( MonsterInsights()->license->get_network_license_key() ) {
301
+	    if ( MonsterInsights()->license->network_license_expired() ) {
302
+		$message = sprintf( esc_html__( 'Your network license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
303
+	    } else if ( MonsterInsights()->license->network_license_disabled() ) {
304
+		$message = esc_html__( 'Your network license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
305
+	    } else if ( MonsterInsights()->license->network_license_invalid() ) {
306
+		$message = esc_html__( 'Your network license key for MonsterInsights is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-for-wordpress' );
307
+	    }
308
+	}
309
+	if ( ! empty( $message ) ) {
310
+	    echo '<div class="error"><p>'. $message.'</p></div>';
311
+	    return;
312
+	}
313 313
     }
314 314
 
315 315
     // 4. Optin setting not configured
316 316
     if ( ! is_network_admin() ) {
317
-        if ( ! get_option( 'monsterinsights_tracking_notice' ) ) {
318
-            if ( ! monsterinsights_get_option( 'anonymous_data', false ) ) {
319
-                if ( ! monsterinsights_is_dev_url( network_site_url( '/' ) ) ) {
320
-                    if ( monsterinsights_is_pro_version() ) {
321
-                        monsterinsights_update_option( 'anonymous_data', 1 );
322
-                        return;
323
-                    }
324
-                    $optin_url  = add_query_arg( 'mi_action', 'opt_into_tracking' );
325
-                    $optout_url = add_query_arg( 'mi_action', 'opt_out_of_tracking' );
326
-                    echo '<div class="updated"><p>';
327
-                    echo esc_html__( 'Allow MonsterInsights to track plugin usage? Opt-in to tracking and our newsletter to stay informed of the latest changes to MonsterInsights and help us ensure compatibility.', 'google-analytics-for-wordpress' );
328
-                    echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'google-analytics-for-wordpress' ) . '</a>';
329
-                    echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'google-analytics-for-wordpress' ) . '</a>';
330
-                    echo '</p></div>';
331
-                    return;
332
-                } else {
333
-                    // is testing site
334
-                     update_option( 'monsterinsights_tracking_notice', '1' );
335
-                }
336
-            }
337
-        }
317
+	if ( ! get_option( 'monsterinsights_tracking_notice' ) ) {
318
+	    if ( ! monsterinsights_get_option( 'anonymous_data', false ) ) {
319
+		if ( ! monsterinsights_is_dev_url( network_site_url( '/' ) ) ) {
320
+		    if ( monsterinsights_is_pro_version() ) {
321
+			monsterinsights_update_option( 'anonymous_data', 1 );
322
+			return;
323
+		    }
324
+		    $optin_url  = add_query_arg( 'mi_action', 'opt_into_tracking' );
325
+		    $optout_url = add_query_arg( 'mi_action', 'opt_out_of_tracking' );
326
+		    echo '<div class="updated"><p>';
327
+		    echo esc_html__( 'Allow MonsterInsights to track plugin usage? Opt-in to tracking and our newsletter to stay informed of the latest changes to MonsterInsights and help us ensure compatibility.', 'google-analytics-for-wordpress' );
328
+		    echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'google-analytics-for-wordpress' ) . '</a>';
329
+		    echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'google-analytics-for-wordpress' ) . '</a>';
330
+		    echo '</p></div>';
331
+		    return;
332
+		} else {
333
+		    // is testing site
334
+		     update_option( 'monsterinsights_tracking_notice', '1' );
335
+		}
336
+	    }
337
+	}
338 338
     }
339 339
 
340 340
     $notices = array();
341 341
     if ( ! is_network_admin() || ( ! monsterinsights_is_pro_version() && ( class_exists( 'WooCommerce' ) || class_exists( 'Easy_Digital_Downloads' ) ) ) ) {
342
-        $notices   = get_option( 'monsterinsights_notices' );
343
-        if ( ! is_array( $notices ) ) {
344
-            $notices = array();
345
-        }
342
+	$notices   = get_option( 'monsterinsights_notices' );
343
+	if ( ! is_array( $notices ) ) {
344
+	    $notices = array();
345
+	}
346 346
     }
347 347
     // 5. Automatic updates not configured
348 348
     $authed   = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed();
349 349
     $url      = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
350 350
 
351 351
     if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { 
352
-        echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
353
-            echo '<p>';
354
-            echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
355
-            echo '</p>';
356
-        echo '</div>';
357
-        return;
352
+	echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
353
+	    echo '<p>';
354
+	    echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
355
+	    echo '</p>';
356
+	echo '</div>';
357
+	return;
358 358
     }
359 359
 
360 360
     // 6. Authetnicate, not manual
361 361
     if ( ! is_network_admin() ) {
362
-        $updates   = monsterinsights_get_option( 'automatic_updates', false );
363
-        $url       = admin_url( 'admin.php?page=monsterinsights_settings' );
364
-
365
-        if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) { 
366
-            echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_automatic_updates">';
367
-                echo '<p>';
368
-                echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
369
-                echo '</p>';
370
-            echo '</div>';
371
-            return;
372
-        }
362
+	$updates   = monsterinsights_get_option( 'automatic_updates', false );
363
+	$url       = admin_url( 'admin.php?page=monsterinsights_settings' );
364
+
365
+	if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) { 
366
+	    echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_automatic_updates">';
367
+		echo '<p>';
368
+		echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
369
+		echo '</p>';
370
+	    echo '</div>';
371
+	    return;
372
+	}
373 373
     }
374 374
 
375 375
     if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) {
376
-        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { 
377
-            echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">';
378
-                echo '<div class="monsterinsights-wooedd-upsell-left">';
379
-                    echo '<p><strong>';
380
-                    echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' );
381
-                    echo '</strong></p>';
382
-                    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
383
-                    echo '<p>';
384
-                    echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' );
385
-                    echo '</p>';
386
-                    echo '<p>';
387
-                    echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' );
388
-                    echo '</p>';
389
-                    echo '<p>';
390
-                    echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' );
391
-                    echo '</p>';
392
-                    echo '<p>';
393
-                    echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
394
-                    echo '</p>';
395
-                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=woocommercelite">', ' &raquo;</a>' ); 
396
-                    echo '</p>';
397
-                echo '</div><div class="monsterinsights-wooedd-upsell-right">';
398
-                    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
399
-                echo '</div>';
400
-            echo '</div>';
401
-            return;
402
-        }
376
+	if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { 
377
+	    echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">';
378
+		echo '<div class="monsterinsights-wooedd-upsell-left">';
379
+		    echo '<p><strong>';
380
+		    echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-for-wordpress' );
381
+		    echo '</strong></p>';
382
+		    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
383
+		    echo '<p>';
384
+		    echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' );
385
+		    echo '</p>';
386
+		    echo '<p>';
387
+		    echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' );
388
+		    echo '</p>';
389
+		    echo '<p>';
390
+		    echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' );
391
+		    echo '</p>';
392
+		    echo '<p>';
393
+		    echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
394
+		    echo '</p>';
395
+		    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=woocommercelite">', ' &raquo;</a>' ); 
396
+		    echo '</p>';
397
+		echo '</div><div class="monsterinsights-wooedd-upsell-right">';
398
+		    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
399
+		echo '</div>';
400
+	    echo '</div>';
401
+	    return;
402
+	}
403 403
     }
404 404
     if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) {
405
-        if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { 
406
-            echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
407
-                echo '<div class="monsterinsights-wooedd-upsell-left">';
408
-                    echo '<p><strong>';
409
-                    echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' );
410
-                    echo '</strong></p>';
411
-                    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
412
-                    echo '<p>';
413
-                    echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' );
414
-                    echo '</p>';
415
-                    echo '<p>';
416
-                    echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' );
417
-                    echo '</p>';
418
-                    echo '<p>';
419
-                    echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' );
420
-                    echo '</p>';
421
-                    echo '<p>';
422
-                    echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
423
-                    echo '</p>';
424
-                    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=eddlite">', ' &raquo;</a>' ); 
425
-                    echo '</p>';
426
-                echo '</div><div class="monsterinsights-wooedd-upsell-right">';
427
-                    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
428
-                echo '</div>';
429
-            echo '</div>';
430
-            return;
431
-        }
405
+	if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { 
406
+	    echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
407
+		echo '<div class="monsterinsights-wooedd-upsell-left">';
408
+		    echo '<p><strong>';
409
+		    echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-for-wordpress' );
410
+		    echo '</strong></p>';
411
+		    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-small" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
412
+		    echo '<p>';
413
+		    echo esc_html( 'MonsterInsights Pro gives you detailed stats and insights about your customers.', 'google-analytics-for-wordpress' );
414
+		    echo '</p>';
415
+		    echo '<p>';
416
+		    echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-for-wordpress' );
417
+		    echo '</p>';
418
+		    echo '<p>';
419
+		    echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-for-wordpress' );
420
+		    echo '</p>';
421
+		    echo '<p>';
422
+		    echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-for-wordpress' );
423
+		    echo '</p>';
424
+		    echo sprintf( esc_html__( '%1$sGet MonsterInsights Pro%2$s', 'google-analytics-for-wordpress' ), '<a class="button button-primary button-hero" href="https://www.monsterinsights.com/lite/?utm_source=wpdashboard&utm_campaign=eddlite">', ' &raquo;</a>' ); 
425
+		    echo '</p>';
426
+		echo '</div><div class="monsterinsights-wooedd-upsell-right">';
427
+		    echo '<img class="monsterinsights-wooedd-upsell-image monsterinsights-wooedd-upsell-image-large" src="' . trailingslashit( MONSTERINSIGHTS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
428
+		echo '</div>';
429
+	    echo '</div>';
430
+	    return;
431
+	}
432 432
     }
433 433
 }
434 434
 add_action( 'admin_notices', 'monsterinsights_admin_setup_notices' );
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
     if ( $dashboards_disabled || ! $is_authed || ( current_user_can( 'monsterinsights_save_settings' ) && ! current_user_can( 'monsterinsights_view_dashboard' ) ) ) {
36 36
         // If dashboards disabled, first settings page
37
-        add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
37
+        add_menu_page( __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings', 'monsterinsights_settings_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
38 38
         $hook = 'monsterinsights_settings';
39 39
 
40 40
         add_submenu_page( $hook, __( 'Settings:', 'google-analytics-for-wordpress' ), __( 'Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_settings' );
41 41
         add_submenu_page( $hook, __( 'Settings - Tracking:', 'google-analytics-for-wordpress' ), __( 'Settings - Tracking', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_tracking', 'monsterinsights_tracking_page' );
42 42
     } else {
43 43
         // if dashboards enabled, first dashboard
44
-        add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
44
+        add_menu_page( __( 'General:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_view_dashboard', 'monsterinsights_reports', 'monsterinsights_reports_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
45 45
 
46 46
         $hook = 'monsterinsights_reports';
47 47
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     }
84 84
 
85 85
     $hook = 'monsterinsights_network';
86
-    add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page',  plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
86
+    add_menu_page( __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Insights', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page', plugins_url( 'assets/css/images/[email protected]', $base->file ), '100.00013467543' );
87 87
 
88 88
     add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-for-wordpress' ), __( 'Network Settings', 'google-analytics-for-wordpress' ), 'monsterinsights_save_settings', 'monsterinsights_network', 'monsterinsights_network_page' );
89 89
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
     // If lite, show a link where they can get pro from
125 125
     if ( ! monsterinsights_is_pro_version() ) {
126
-        $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) .'" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
126
+        $get_pro = '<a title="' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '" href="https://www.monsterinsights.com/lite/">' . esc_html__( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>';
127 127
         array_unshift( $links, $get_pro );
128 128
     }   
129 129
     
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
         $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'pro/includes/admin/partials' );
162 162
     
163 163
         if ( file_exists( $dir . $template . '.php' ) ) {
164
-            require_once(  $dir . $template . '.php' );
164
+            require_once( $dir . $template . '.php' );
165 165
             return true;
166 166
         }
167 167
     } else {
168 168
         $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'lite/includes/admin/partials' );
169 169
     
170 170
         if ( file_exists( $dir . $template . '.php' ) ) {
171
-            require_once(  $dir . $template . '.php' );
171
+            require_once( $dir . $template . '.php' );
172 172
             return true;
173 173
         }   
174 174
     }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     $dir = trailingslashit( plugin_dir_path( MonsterInsights()->file ) . 'includes/admin/partials' );
177 177
 
178 178
     if ( file_exists( $dir . $template . '.php' ) ) {
179
-        require_once(  $dir . $template . '.php' );
179
+        require_once( $dir . $template . '.php' );
180 180
         return true;
181 181
     }
182 182
                 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         '2xlogo'   => plugins_url( 'assets/css/images/[email protected]', MonsterInsights()->file ),
205 205
     ) );
206 206
 }
207
-add_action( 'in_admin_header','monsterinsights_admin_header', 100 );
207
+add_action( 'in_admin_header', 'monsterinsights_admin_header', 100 );
208 208
 
209 209
 function monsterinsights_welcome_redirect() {
210 210
     // Bail if no activation redirect
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     }
222 222
 
223 223
     $upgrade = get_option( 'monsterinsights_version_upgraded_from' );
224
-    if( ! $upgrade ) { // First time install
224
+    if ( ! $upgrade ) { // First time install
225 225
         //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
226 226
     } else { // Update
227 227
         return;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     global $current_screen;
243 243
     if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'monsterinsights' ) !== false ) {
244 244
         $url  = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-for-wordpress?filter=5';
245
-        $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' .  $url . '" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
245
+        $text = sprintf( esc_html__( 'Please rate %sMonsterInsights%s %s on %sWordPress.org%s to help us spread the word. Thank you from the MonsterInsights team!', 'google-analytics-for-wordpress' ), '<strong>', '</strong>', '<a class="monsterinsights-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
246 246
     }
247 247
     return $text;
248 248
 }
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
     // 1. Google Analytics not authenticated
273 273
     if ( ! is_network_admin() && ! monsterinsights_get_ua() ) {
274 274
         $page = admin_url( 'admin.php?page=monsterinsights_settings' );
275
-        $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ),'<a href="' . $page . '">', '</a>' );
276
-        echo '<div class="error"><p>'. $message.'</p></div>';
275
+        $message = sprintf( esc_html__( 'Please configure your %1$sGoogle Analytics settings%2$s!', 'google-analytics-for-wordpress' ), '<a href="' . $page . '">', '</a>' );
276
+        echo '<div class="error"><p>' . $message . '</p></div>';
277 277
         return;
278 278
     }
279 279
 
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
     $key = monsterinsights_is_pro_version() ? MonsterInsights()->license->get_license_key() : '';
282 282
     if ( monsterinsights_is_pro_version() && empty( $key ) ) {
283 283
         $page = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
284
-        $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
285
-        echo '<div class="error"><p>'. $message.'</p></div>';
284
+        $message = sprintf( esc_html__( 'Warning: No valid license key has been entered for MonsterInsights. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . esc_url( $page ) . '">', '</a>' );
285
+        echo '<div class="error"><p>' . $message . '</p></div>';
286 286
         return;
287 287
     }
288 288
 
289 289
     // 3. License key not valid/okay for pro
290 290
     if ( monsterinsights_is_pro_version() ) {
291 291
         $message = '';
292
-        if ( MonsterInsights()->license->get_site_license_key() ){
292
+        if ( MonsterInsights()->license->get_site_license_key() ) {
293 293
             if ( MonsterInsights()->license->site_license_expired() ) {
294 294
                 $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
295 295
             } else if ( MonsterInsights()->license->site_license_disabled() ) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             }
308 308
         }
309 309
         if ( ! empty( $message ) ) {
310
-            echo '<div class="error"><p>'. $message.'</p></div>';
310
+            echo '<div class="error"><p>' . $message . '</p></div>';
311 311
             return;
312 312
         }
313 313
     }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
     $notices = array();
341 341
     if ( ! is_network_admin() || ( ! monsterinsights_is_pro_version() && ( class_exists( 'WooCommerce' ) || class_exists( 'Easy_Digital_Downloads' ) ) ) ) {
342
-        $notices   = get_option( 'monsterinsights_notices' );
342
+        $notices = get_option( 'monsterinsights_notices' );
343 343
         if ( ! is_array( $notices ) ) {
344 344
             $notices = array();
345 345
         }
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
     $authed   = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed();
349 349
     $url      = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
350 350
 
351
-    if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { 
351
+    if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual'] ) ) { 
352 352
         echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
353 353
             echo '<p>';
354
-            echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
354
+            echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); 
355 355
             echo '</p>';
356 356
         echo '</div>';
357 357
         return;
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
         $updates   = monsterinsights_get_option( 'automatic_updates', false );
363 363
         $url       = admin_url( 'admin.php?page=monsterinsights_settings' );
364 364
 
365
-        if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) { 
365
+        if ( empty( $updates ) && ! isset( $notices['monsterinsights_automatic_updates'] ) ) { 
366 366
             echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_automatic_updates">';
367 367
                 echo '<p>';
368
-                echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
368
+                echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url . '">', '</a>' ); 
369 369
                 echo '</p>';
370 370
             echo '</div>';
371 371
             return;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     }
374 374
 
375 375
     if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) {
376
-        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { 
376
+        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available'] ) ) { 
377 377
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">';
378 378
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
379 379
                     echo '<p><strong>';
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         }
403 403
     }
404 404
     if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) {
405
-        if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { 
405
+        if ( ! isset( $notices['monsterinsights_edd_tracking_available'] ) ) { 
406 406
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
407 407
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
408 408
                     echo '<p><strong>';
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -221,9 +221,11 @@  discard block
 block discarded – undo
221 221
     }
222 222
 
223 223
     $upgrade = get_option( 'monsterinsights_version_upgraded_from' );
224
-    if( ! $upgrade ) { // First time install
224
+    if( ! $upgrade ) {
225
+// First time install
225 226
         //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
226
-    } else { // Update
227
+    } else {
228
+// Update
227 229
         return;
228 230
         //wp_safe_redirect( admin_url( 'admin.php?page=monsterinsights_settings#monsterinsights-main-tab-general' ) ); exit;
229 231
     }
@@ -289,7 +291,7 @@  discard block
 block discarded – undo
289 291
     // 3. License key not valid/okay for pro
290 292
     if ( monsterinsights_is_pro_version() ) {
291 293
         $message = '';
292
-        if ( MonsterInsights()->license->get_site_license_key() ){
294
+        if ( MonsterInsights()->license->get_site_license_key() ) {
293 295
             if ( MonsterInsights()->license->site_license_expired() ) {
294 296
                 $message = sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/login/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
295 297
             } else if ( MonsterInsights()->license->site_license_disabled() ) {
@@ -348,7 +350,7 @@  discard block
 block discarded – undo
348 350
     $authed   = MonsterInsights()->auth->is_authed() || MonsterInsights()->auth->is_network_authed();
349 351
     $url      = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
350 352
 
351
-    if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) { 
353
+    if ( empty( $authed ) && ! isset( $notices['monsterinsights_auth_not_manual' ] ) ) {
352 354
         echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_auth_not_manual">';
353 355
             echo '<p>';
354 356
             echo sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with MonsterInsights%2$s so that you can access our new reporting area and take advantage of new MonsterInsights features.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
@@ -362,7 +364,7 @@  discard block
 block discarded – undo
362 364
         $updates   = monsterinsights_get_option( 'automatic_updates', false );
363 365
         $url       = admin_url( 'admin.php?page=monsterinsights_settings' );
364 366
 
365
-        if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) { 
367
+        if ( empty( $updates) && ! isset( $notices['monsterinsights_automatic_updates' ] ) ) {
366 368
             echo '<div class="notice notice-info is-dismissible monsterinsights-notice" data-notice="monsterinsights_automatic_updates">';
367 369
                 echo '<p>';
368 370
                 echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in MonsterInsights.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
@@ -373,7 +375,7 @@  discard block
 block discarded – undo
373 375
     }
374 376
 
375 377
     if ( ! monsterinsights_is_pro_version() && class_exists( 'WooCommerce' ) ) {
376
-        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) { 
378
+        if ( ! isset( $notices['monsterinsights_woocommerce_tracking_available' ] ) ) {
377 379
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_woocommerce_tracking_available">';
378 380
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
379 381
                     echo '<p><strong>';
@@ -402,7 +404,7 @@  discard block
 block discarded – undo
402 404
         }
403 405
     }
404 406
     if ( ! monsterinsights_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) {
405
-        if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) { 
407
+        if ( ! isset( $notices['monsterinsights_edd_tracking_available' ] ) ) {
406 408
             echo '<div class="notice notice-success is-dismissible monsterinsights-notice monsterinsights-wooedd-upsell-row" data-notice="monsterinsights_edd_tracking_available">';
407 409
                 echo '<div class="monsterinsights-wooedd-upsell-left">';
408 410
                     echo '<p><strong>';
Please login to merge, or discard this patch.
includes/admin/api-auth.php 1 patch
Spacing   +51 added lines, -51 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
 		$siteurl = add_query_arg( array(
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-	public function authenticate_listener(){
109
+	public function authenticate_listener() {
110 110
 		// Make sure it's for us
111 111
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
112 112
 			return;
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 		}
125 125
 
126 126
 		// Make sure has required params
127
-		if ( empty( $_REQUEST['key'] )      ||
128
-			 empty( $_REQUEST['token'] )    ||
129
-			 empty( $_REQUEST['ua'] )       ||
130
-			 empty( $_REQUEST['miview'] )   ||
131
-			 empty( $_REQUEST['a'] )        ||
132
-			 empty( $_REQUEST['w'] )        ||
127
+		if ( empty( $_REQUEST['key'] ) ||
128
+			 empty( $_REQUEST['token'] ) ||
129
+			 empty( $_REQUEST['ua'] ) ||
130
+			 empty( $_REQUEST['miview'] ) ||
131
+			 empty( $_REQUEST['a'] ) ||
132
+			 empty( $_REQUEST['w'] ) ||
133 133
 			 empty( $_REQUEST['p'] )
134 134
 		) {
135 135
 			return;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$where = $this->is_network_admin() ? 'network' : 'site';
167 167
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
168 168
 
169
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
169
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
170 170
 		$url = add_query_arg( array(
171 171
 			 'mi_action' => 'auth',
172 172
 			 'success'   => 'true',
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 		exit;
176 176
 	}
177 177
 
178
-	public function maybe_reauthenticate(){
178
+	public function maybe_reauthenticate() {
179 179
 
180 180
 		// Check nonce
181 181
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
182 182
 
183 183
 		// current user can authenticate
184 184
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
185
-			wp_send_json_error( array(	'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
185
+			wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
186 186
 		}
187 187
 
188 188
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 		// Only for Pro users, require a license key to be entered first so we can link to things.
193 193
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
194 194
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
195
-			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' ) ) );
195
+			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' ) ) );
196 196
 		}
197 197
 
198 198
 		// we do have a current auth
199 199
 		if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
200
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
200
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
201 201
 		} else if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
202
-			wp_send_json_error( array(	'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
202
+			wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-for-wordpress' ) ) );
203 203
 		}
204 204
 
205 205
 		$siteurl = add_query_arg( array(
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		wp_send_json_success( array( 'redirect' => $siteurl ) );
223 223
 	}
224 224
 
225
-	public function reauthenticate_listener(){
225
+	public function reauthenticate_listener() {
226 226
 		// Make sure it's for us
227 227
 		if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
228 228
 			return;
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 
241 241
 		// Make sure has required params
242 242
 		if (
243
-			 empty( $_REQUEST['ua'] )       ||
244
-			 empty( $_REQUEST['miview'] )   ||
245
-			 empty( $_REQUEST['a'] )        ||
246
-			 empty( $_REQUEST['w'] )        ||
243
+			 empty( $_REQUEST['ua'] ) ||
244
+			 empty( $_REQUEST['miview'] ) ||
245
+			 empty( $_REQUEST['a'] ) ||
246
+			 empty( $_REQUEST['w'] ) ||
247 247
 			 empty( $_REQUEST['p'] )       
248 248
 		) {
249 249
 			return;
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		$where = $this->is_network_admin() ? 'network' : 'site';
282 282
 		MonsterInsights()->reporting->delete_aggregate_data( $where );
283 283
 
284
-		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' )  : admin_url( 'admin.php?page=monsterinsights_settings' ) ;
284
+		$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_network' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
285 285
 		$url = add_query_arg( array(
286 286
 			 'mi_action' => 'reauth',
287 287
 			 'success'   => 'true',
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 		exit;
291 291
 	}
292 292
 
293
-	public function maybe_verify(){
293
+	public function maybe_verify() {
294 294
 
295 295
 		// Check nonce
296 296
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
297 297
 
298 298
 		// current user can verify
299 299
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
300
-			wp_send_json_error( array(	'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
300
+			wp_send_json_error( array( 'message' => __( "You don't have permission to verify MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
301 301
 		}
302 302
 
303 303
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -306,25 +306,25 @@  discard block
 block discarded – undo
306 306
 
307 307
 		// we have an auth to verify
308 308
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
309
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
309
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
310 310
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
311
-			wp_send_json_error( array(	'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
311
+			wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-for-wordpress' ) ) );
312 312
 		}
313 313
 
314 314
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
315 315
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
316
-			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' ) ) );
316
+			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' ) ) );
317 317
 		}
318 318
 
319 319
 		$worked = $this->verify_auth();
320
-		if ( $worked && ! is_wp_error(  $worked ) ) {
320
+		if ( $worked && ! is_wp_error( $worked ) ) {
321 321
 			wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-for-wordpress' ) ) );
322 322
 		} else {
323 323
 			wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-for-wordpress' ) ) );
324 324
 		}
325 325
 	}
326 326
 
327
-	public function verify_auth( $credentials = array() ){
327
+	public function verify_auth( $credentials = array() ) {
328 328
 		$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? MonsterInsights()->auth->get_network_analytics_profile( true ) : MonsterInsights()->auth->get_analytics_profile( true ) );
329 329
 
330 330
 		if ( empty( $creds['key'] ) ) {
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
 		}
342 342
 	}
343 343
 
344
-	public function maybe_delete(){
344
+	public function maybe_delete() {
345 345
 
346 346
 		// Check nonce
347 347
 		check_ajax_referer( 'mi-admin-nonce', 'nonce' );
348 348
 
349 349
 		// current user can delete
350 350
 		if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
351
-			wp_send_json_error( array(	'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
351
+			wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate MonsterInsights.", 'google-analytics-for-wordpress' ) ) );
352 352
 		}
353 353
 
354 354
 		if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
@@ -357,20 +357,20 @@  discard block
 block discarded – undo
357 357
 
358 358
 		// we have an auth to delete
359 359
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
360
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
360
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
361 361
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
362
-			wp_send_json_error( array(	'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
362
+			wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-for-wordpress' ) ) );
363 363
 		}
364 364
 
365 365
 		$valid = is_network_admin() ? MonsterInsights()->license->is_network_licensed() : MonsterInsights()->license->is_site_licensed();
366 366
 		if ( monsterinsights_is_pro_version() && ! $valid ) {
367
-			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' ) ) );
367
+			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' ) ) );
368 368
 		}
369 369
 
370 370
 		$force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true';
371 371
 
372 372
 		$worked = $this->delete_auth( $force );
373
-		if ( $worked && ! is_wp_error(  $worked ) ) {
373
+		if ( $worked && ! is_wp_error( $worked ) ) {
374 374
 			wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-for-wordpress' ) ) );
375 375
 		} else {
376 376
 			if ( $force ) {
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		}
382 382
 	}
383 383
 
384
-	public function delete_auth( $force = false ){
384
+	public function delete_auth( $force = false ) {
385 385
 		if ( $this->is_network_admin() && ! MonsterInsights()->auth->is_network_authed() ) {
386 386
 			return false;
387 387
 		} else if ( ! $this->is_network_admin() && ! MonsterInsights()->auth->is_authed() ) {
@@ -425,15 +425,15 @@  discard block
 block discarded – undo
425 425
 	}
426 426
 
427 427
 	public function get_sitei() {
428
-		$auth_key        = defined( 'AUTH_KEY' )        ? AUTH_KEY 		  : '';
428
+		$auth_key        = defined( 'AUTH_KEY' ) ? AUTH_KEY 		  : '';
429 429
 		$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
430
-		$logged_in_key   = defined( 'LOGGED_IN_KEY' )   ? LOGGED_IN_KEY   : '';
430
+		$logged_in_key   = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY   : '';
431 431
 
432 432
 		$sitei = $auth_key . $secure_auth_key . $logged_in_key;
433
-		$sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei );
433
+		$sitei = preg_replace( '/[^a-zA-Z0-9]/', '', $sitei );
434 434
 		$sitei = sanitize_text_field( $sitei );
435 435
 		$sitei = trim( $sitei );
436
-		$sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei;
436
+		$sitei = ( strlen( $sitei ) > 30 ) ? substr( $sitei, 0, 30 ) : $sitei;
437 437
 		return $sitei;
438 438
 	}
439 439
 }
440 440
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/common.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -239,15 +239,15 @@
 block discarded – undo
239 239
 		'rml-general', // WP Real Media Library
240 240
 		'rml-library', // WP Real Media Library
241 241
 		'rml-grid', // WP Real Media Library
242
-        'rml-list', // WP Real Media Library
243
-        'rml-modal', // WP Real Media Library
244
-        'rml-order', // WP Real Media Library
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
249
-        'rml-main', // WP Real Media Library
250
-        'control-panel-sweet-alert', // Ken Theme
242
+	'rml-list', // WP Real Media Library
243
+	'rml-modal', // WP Real Media Library
244
+	'rml-order', // WP Real Media Library
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
249
+	'rml-main', // WP Real Media Library
250
+	'control-panel-sweet-alert', // Ken Theme
251 251
 	);
252 252
 
253 253
 	if ( ! empty( $styles ) ) {
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -151,26 +151,26 @@  discard block
 block discarded – undo
151 151
 				'copytoclip'       				=> esc_html__( 'Copy to Clipboard', 'google-analytics-for-wordpress' ),
152 152
 				'failed'           				=> esc_html__( 'Failed!', 'google-analytics-for-wordpress' ),
153 153
 				'admin_nonce'      				=> wp_create_nonce( 'mi-admin-nonce' ),
154
-				'shorten'         				=> esc_html__( 'Shorten URL' ,'google-analytics-for-wordpress'),
155
-				'shortened'        				=> esc_html__( 'Shortened!' ,'google-analytics-for-wordpress'),
156
-				'working'          				=> esc_html__( 'Working...' ,'google-analytics-for-wordpress'),
157
-				'importtext'       				=> esc_html__( 'Import' ,'google-analytics-for-wordpress'),
158
-				'imported'         				=> esc_html__( 'Imported!' ,'google-analytics-for-wordpress'),
159
-				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:' ,'google-analytics-for-wordpress'),
160
-				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds." ,'google-analytics-for-wordpress'),
161
-				'redirect_loading_error_title'  => esc_html__( "Authentication Error:" ,'google-analytics-for-wordpress'),
162
-				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....' ,'google-analytics-for-wordpress'),
163
-				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
164
-				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:" ,'google-analytics-for-wordpress'),
165
-				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!' ,'google-analytics-for-wordpress'),
166
-				'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'),
167
-				'verify_loading_title_text'  	=> esc_html__( 'Verifying....' ,'google-analytics-for-wordpress'),
168
-				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds." ,'google-analytics-for-wordpress'),
169
-				'verify_loading_error_title' 	=> esc_html__( "Verification Error:" ,'google-analytics-for-wordpress'),
170
-				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!' ,'google-analytics-for-wordpress'),
171
-				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!" ,'google-analytics-for-wordpress'),
172
-				'ok_text' 						=> esc_html__( "OK" ,'google-analytics-for-wordpress'),
173
-				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate" ,'google-analytics-for-wordpress'),
154
+				'shorten'         				=> esc_html__( 'Shorten URL', 'google-analytics-for-wordpress' ),
155
+				'shortened'        				=> esc_html__( 'Shortened!', 'google-analytics-for-wordpress' ),
156
+				'working'          				=> esc_html__( 'Working...', 'google-analytics-for-wordpress' ),
157
+				'importtext'       				=> esc_html__( 'Import', 'google-analytics-for-wordpress' ),
158
+				'imported'         				=> esc_html__( 'Imported!', 'google-analytics-for-wordpress' ),
159
+				'redirect_loading_title_text'   => esc_html__( 'Preparing to redirect:', 'google-analytics-for-wordpress' ),
160
+				'redirect_loading_text_text'    => esc_html__( "You'll be redirected momentarily to complete authentication. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
161
+				'redirect_loading_error_title'  => esc_html__( "Authentication Error:", 'google-analytics-for-wordpress' ),
162
+				'deauth_loading_title_text'  	=> esc_html__( 'Deauthenticating....', 'google-analytics-for-wordpress' ),
163
+				'deauth_loading_text_text'   	=> esc_html__( "We're deactivating your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
164
+				'deauth_loading_error_title' 	=> esc_html__( "Deactivation Error:", 'google-analytics-for-wordpress' ),
165
+				'deauth_success_title_text'  	=> esc_html__( 'Deactivated Successfully!', 'google-analytics-for-wordpress' ),
166
+				'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' ),
167
+				'verify_loading_title_text'  	=> esc_html__( 'Verifying....', 'google-analytics-for-wordpress' ),
168
+				'verify_loading_text_text'   	=> esc_html__( "We're verifying your site. This may take a couple seconds.", 'google-analytics-for-wordpress' ),
169
+				'verify_loading_error_title' 	=> esc_html__( "Verification Error:", 'google-analytics-for-wordpress' ),
170
+				'verify_success_title_text' 	=> esc_html__( 'Verified Successfully!', 'google-analytics-for-wordpress' ),
171
+				'verify_success_text_text'  	=> esc_html__( "Your site is connected to MonsterInsights!", 'google-analytics-for-wordpress' ),
172
+				'ok_text' 						=> esc_html__( "OK", 'google-analytics-for-wordpress' ),
173
+				'force_deauth_button_text'  	=> esc_html__( "Force Deauthenticate", 'google-analytics-for-wordpress' ),
174 174
 				'refresh_report_title'          => esc_html__( 'Refreshing Report', 'ga-premium' ),
175 175
 				'refresh_report_text'           => esc_html__( 'Loading new report data...', 'ga-premium' ),
176 176
 				'refresh_report_success_text'   => esc_html__( 'Success', 'ga-premium' ),
@@ -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/settings/register-settings.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 			)
173 173
 		),
174 174
 		/** Demographics Settings */
175
-		'demographics' => apply_filters('monsterinsights_settings_demographics',
175
+		'demographics' => apply_filters( 'monsterinsights_settings_demographics',
176 176
 			array(
177 177
 				'demographics' => array(
178 178
 					'id'          => 'demographics',
179 179
 					'name'        => __( 'Enable Demographics and Interests Reports for Remarketing and Advertising', 'google-analytics-for-wordpress' ),
180 180
 					'desc'        => sprintf( esc_html__( 'Check this setting to add the Demographics and Remarketing features to your Google Analytics tracking code. Make sure to enable Demographics and Remarketing in your Google Analytics account. We have a guide for how to do that in our %1$sknowledge base%2$s. For more information about Remarketing, we refer you to %3$sGoogle\'s documentation%2$s. Note that usage of this function is affected by privacy and cookie laws around the world. Be sure to follow the laws that affect your target audience.', 'google-analytics-for-wordpress' ), '<a href="https://www.monsterinsights.com/docs/enable-demographics-and-interests-report-in-google-analytics/#utm_medium=kb-link&amp;utm_source=gawp-config&amp;utm_campaign=wpgaplugin" target="_blank" rel="noopener noreferrer" referrer="no-referrer">',
181
-									'</a>','<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">'
181
+									'</a>', '<a href="https://support.google.com/analytics/answer/2444872?hl=' . get_locale() . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">'
182 182
 					),
183 183
 					'type' 		  => 'checkbox',
184 184
 				),
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			)
192 192
 		),
193 193
 		/** Enhanced Link Attribution Settings */
194
-		'links' => apply_filters('monsterinsights_settings_links',
194
+		'links' => apply_filters( 'monsterinsights_settings_links',
195 195
 			array(
196 196
 				'enhanced_link_attribution' => array(
197 197
 					'id'          => 'enhanced_link_attribution',
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			)
227 227
 		),
228 228
 		/** File Download Settings */
229
-		'files' => apply_filters('monsterinsights_settings_files',
229
+		'files' => apply_filters( 'monsterinsights_settings_files',
230 230
 			array(
231 231
 				'track_download_as' => array(
232 232
 					'id'          => 'track_download_as',
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 			)
249 249
 		),
250 250
 		/** Affiliate Tracking Settings */
251
-		'affiliates' => apply_filters('monsterinsights_settings_affiliates',
251
+		'affiliates' => apply_filters( 'monsterinsights_settings_affiliates',
252 252
 			array(
253 253
 				'track_internal_as_outbound' => array(
254 254
 					'id'          => 'track_internal_as_outbound',
@@ -265,68 +265,68 @@  discard block
 block discarded – undo
265 265
 			)
266 266
 		),
267 267
 		/** Social Tracking Settings */
268
-		'social' => apply_filters('monsterinsights_settings_social',
268
+		'social' => apply_filters( 'monsterinsights_settings_social',
269 269
 			array()
270 270
 		),
271 271
 		/** Ad Tracking Settings */
272
-		'ads' => apply_filters('monsterinsights_settings_ads',
272
+		'ads' => apply_filters( 'monsterinsights_settings_ads',
273 273
 			array()
274 274
 		),
275 275
 		/** Forms Tracking Settings */
276
-		'forms' => apply_filters('monsterinsights_settings_forms',
276
+		'forms' => apply_filters( 'monsterinsights_settings_forms',
277 277
 			array()
278 278
 		),
279 279
 		/** eCommerce Tracking Settings */
280
-		'ecommerce' => apply_filters('monsterinsights_settings_ecommerce',
280
+		'ecommerce' => apply_filters( 'monsterinsights_settings_ecommerce',
281 281
 			array()
282 282
 		),
283 283
 		/** Media Tracking Settings */
284
-		'media' => apply_filters('monsterinsights_settings_media',
284
+		'media' => apply_filters( 'monsterinsights_settings_media',
285 285
 			array()
286 286
 		),
287 287
 		/** Members Tracking Settings */
288
-		'memberships' => apply_filters('monsterinsights_settings_memberships',
288
+		'memberships' => apply_filters( 'monsterinsights_settings_memberships',
289 289
 			array()
290 290
 		),
291 291
 		/** Dimensions Tracking Settings */
292
-		'dimensions' => apply_filters('monsterinsights_settings_dimensions',
292
+		'dimensions' => apply_filters( 'monsterinsights_settings_dimensions',
293 293
 			array()
294 294
 		),
295 295
 		/** Performance Tracking Settings */
296
-		'performance' => apply_filters('monsterinsights_settings_performance',
296
+		'performance' => apply_filters( 'monsterinsights_settings_performance',
297 297
 			array()
298 298
 		),
299 299
 		/** AMP Tracking Settings */
300
-		'amp' => apply_filters('monsterinsights_settings_amp',
300
+		'amp' => apply_filters( 'monsterinsights_settings_amp',
301 301
 			array()
302 302
 		),
303 303
 		/** Google Optimize Tracking Settings */
304
-		'goptimize' => apply_filters('monsterinsights_settings_goptimize',
304
+		'goptimize' => apply_filters( 'monsterinsights_settings_goptimize',
305 305
 			array()
306 306
 		),
307 307
 		/** Facebook Instant Articles Tracking Settings */
308
-		'fbia' => apply_filters('monsterinsights_settings_fbia',
308
+		'fbia' => apply_filters( 'monsterinsights_settings_fbia',
309 309
 			array()
310 310
 		),
311 311
 		/** Bounce Reduction Settings */
312
-		'bounce' => apply_filters('monsterinsights_settings_bounce',
312
+		'bounce' => apply_filters( 'monsterinsights_settings_bounce',
313 313
 			array()
314 314
 		),
315 315
 		/** Reporting Tracking Settings */
316
-		'reporting' => apply_filters('monsterinsights_settings_reporting',
316
+		'reporting' => apply_filters( 'monsterinsights_settings_reporting',
317 317
 			array()
318 318
 		),
319 319
 		/** Notifications Tracking Settings */
320
-		'notifications' => apply_filters('monsterinsights_settings_notifications',
320
+		'notifications' => apply_filters( 'monsterinsights_settings_notifications',
321 321
 			array()
322 322
 		),
323 323
 		/** Compatibility Tracking Settings */
324
-		'compatibility' => apply_filters('monsterinsights_settings_compatibility',
324
+		'compatibility' => apply_filters( 'monsterinsights_settings_compatibility',
325 325
 			array(
326 326
 				'subdomain_tracking' => array(
327 327
 					'id'          => 'subdomain_tracking',
328 328
 					'name'        => __( 'Domain to track as:', 'google-analytics-for-wordpress' ),
329
-					'desc'        => sprintf( esc_html__( 'This allows you to %1$sset the domain%2$s that\'s used for tracking. Only is used if set to a value, else defaults to automatic determination. It is very rare that you would need to use this setting.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' ,'</a>' ),
329
+					'desc'        => sprintf( esc_html__( 'This allows you to %1$sset the domain%2$s that\'s used for tracking. Only is used if set to a value, else defaults to automatic determination. It is very rare that you would need to use this setting.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' ),
330 330
 					'type' 		  => 'text',
331 331
 				),
332 332
 				'custom_code' => array(
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 				'debug_mode' => array(
339 339
 					'id'          => 'debug_mode',
340 340
 					'name'        => __( 'Enable Debug Mode', 'google-analytics-for-wordpress' ),
341
-					'desc'        => __( 'Turns on debugging in JS events tracking, logging of eCommerce requests and enables debug settings.', 'google-analytics-for-wordpress'),
341
+					'desc'        => __( 'Turns on debugging in JS events tracking, logging of eCommerce requests and enables debug settings.', 'google-analytics-for-wordpress' ),
342 342
 					'type' 		  => 'checkbox',
343 343
 				),
344 344
 			)
345 345
 		),
346 346
 		/** Permissions Tracking Settings */
347
-		'permissions' => apply_filters('monsterinsights_settings_permissions',
347
+		'permissions' => apply_filters( 'monsterinsights_settings_permissions',
348 348
 			array(
349 349
 				'view_reports' => array(
350 350
 					'id'          => 'view_reports',
351 351
 					'name'        => __( 'Let these user roles see reports:', 'google-analytics-for-wordpress' ),
352
-					'desc'        => sprintf( esc_html( 'Users that have at least one of these roles will be able to view the reports, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>'),
352
+					'desc'        => sprintf( esc_html( 'Users that have at least one of these roles will be able to view the reports, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>' ),
353 353
 					'type'        => 'select',
354 354
 					'options'     => monsterinsights_get_roles(),
355 355
 					'select2'     => true,
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				'save_settings' => array(
360 360
 					'id'          => 'save_settings',
361 361
 					'name'        => __( 'Let these user roles save settings:', 'google-analytics-for-wordpress' ),
362
-					'desc'        => sprintf( esc_html__( 'Users that have at least one of these roles will be able to view and save the settings panel, along with any user with the %s capability.', 'google-analytics-for-wordpress'), '<code>manage_options</code>' ),
362
+					'desc'        => sprintf( esc_html__( 'Users that have at least one of these roles will be able to view and save the settings panel, along with any user with the %s capability.', 'google-analytics-for-wordpress' ), '<code>manage_options</code>' ),
363 363
 					'type'        => 'select',
364 364
 					'options'     => monsterinsights_get_roles(),
365 365
 					'select2'     => true,
Please login to merge, or discard this patch.
includes/admin/settings/tab-general.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                         <form id="monsterinsights-google-authenticate" method="post">
110 110
                             <?php if ( MonsterInsights()->auth->get_viewname() && MonsterInsights()->auth->get_ua() ) { ?>
111 111
                                 <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_site_licensed() ) { ?>
112
-                                    <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p>
112
+                                    <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p>
113 113
                                 <?php } else { ?>
114 114
                                     <p><?php echo esc_html__( 'Profile Active: ', 'google-analytics-for-wordpress' ) . MonsterInsights()->auth->get_viewname(); ?></p>
115 115
                                     <p><?php wp_nonce_field( 'monsterinsights-google-authenticated-nonce', 'monsterinsights-google-authenticated-nonce' ); ?>
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                                 <?php } ?>
120 120
                             <?php } else { ?>
121 121
                                 <?php if ( monsterinsights_is_pro_version() && ! MonsterInsights()->license->is_site_licensed() ) { ?>
122
-                                    <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.' , 'google-analytics-for-wordpress' ); ?></p>
122
+                                    <p><?php echo esc_html__( 'Please activate MonsterInsights Pro with an active, valid license key in order to use MonsterInsights Pro.', 'google-analytics-for-wordpress' ); ?></p>
123 123
                                 <?php } else { ?>
124 124
                                     <?php wp_nonce_field( 'monsterinsights-google-authenticate-nonce', 'monsterinsights-google-authenticate-nonce' ); ?>
125 125
                                     <?php submit_button( esc_html__( 'Authenticate with your Google account', 'google-analytics-for-wordpress' ), 'button-action', 'monsterinsights-google-authenticate-submit', false ); ?>
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 <tbody>
143 143
                     <?php if ( ! MonsterInsights()->auth->get_viewname() ) { ?>
144 144
                     <!-- Manual UA -->
145
-                    <tr id="monsterinsights-google-ua-box" <?php echo ( ! MonsterInsights()->auth->get_manual_ua() ? 'class="monsterinsights-hideme"' : ''); ?> >
145
+                    <tr id="monsterinsights-google-ua-box" <?php echo ( ! MonsterInsights()->auth->get_manual_ua() ? 'class="monsterinsights-hideme"' : '' ); ?> >
146 146
                         <th scope="row">
147 147
                             <label for="monsterinsights-google-ua"><?php esc_html_e( 'Manually enter your UA code', 'google-analytics-for-wordpress' ); ?></label>
148 148
                         </th>
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
                     echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
194 194
                     ?>
195 195
 
196
-                    <?php if ( $automatic_updates !== 'all' && $automatic_updates !== 'minor' ){  ?>
196
+                    <?php if ( $automatic_updates !== 'all' && $automatic_updates !== 'minor' ) {  ?>
197 197
                     <?php $automatic_updates = $automatic_updates ? $automatic_updates : 'none'; ?>
198 198
                     <tr id="monsterinsights-automatic-updates-mode">
199 199
                         <th scope="row">
200 200
                             <label for="monsterinsights-automatic-updates-mode"><?php esc_html_e( 'Automatic Updates', 'google-analytics-for-wordpress' ); ?></label>
201 201
                         </th>
202 202
                         <td>
203
-                            <label><input type="radio" name="automatic_updates" value="all" <?php checked( $automatic_updates, 'all' ); ?> ><?php esc_html_e('Yes (Recommended) - Get the latest features, bugfixes, and security updates as they are released.', 'google-analytics-for-wordpress'); ?> </label>
204
-                            <label><input type="radio" name="automatic_updates" value="minor" <?php checked( $automatic_updates, 'minor' ); ?> ><?php esc_html_e( 'Minor Only - Only get bugfixes and security updates, but not major features.', 'google-analytics-for-wordpress'); ?> </label>
205
-                            <label><input type="radio" name="automatic_updates" value="none" <?php checked( $automatic_updates, 'none' ); ?> ><?php esc_html_e( 'None - Manually update everything.', 'google-analytics-for-wordpress'); ?> </label>
203
+                            <label><input type="radio" name="automatic_updates" value="all" <?php checked( $automatic_updates, 'all' ); ?> ><?php esc_html_e( 'Yes (Recommended) - Get the latest features, bugfixes, and security updates as they are released.', 'google-analytics-for-wordpress' ); ?> </label>
204
+                            <label><input type="radio" name="automatic_updates" value="minor" <?php checked( $automatic_updates, 'minor' ); ?> ><?php esc_html_e( 'Minor Only - Only get bugfixes and security updates, but not major features.', 'google-analytics-for-wordpress' ); ?> </label>
205
+                            <label><input type="radio" name="automatic_updates" value="none" <?php checked( $automatic_updates, 'none' ); ?> ><?php esc_html_e( 'None - Manually update everything.', 'google-analytics-for-wordpress' ); ?> </label>
206 206
                         </td>
207 207
                     </tr>
208 208
                     <?php } ?>
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                     <?php
212 212
                     $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
213 213
                     $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' );
214
-                    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ){
214
+                    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ) {
215 215
                         echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
216 216
                     }
217 217
                     ?>
Please login to merge, or discard this patch.