Passed
Push — master ( 562556...f9cab4 )
by Chris
03:06
created
includes/admin/capabilities.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -35,54 +35,54 @@
 block discarded – undo
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36 36
  
37 37
     switch( $cap ) {
38
-        case 'monsterinsights_view_dashboard' :
39
-            $roles = monsterinsights_get_option( 'view_reports', array() );
38
+	case 'monsterinsights_view_dashboard' :
39
+	    $roles = monsterinsights_get_option( 'view_reports', array() );
40 40
 
41
-            $user_can_via_settings = false;
42
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
43
-                foreach ( $roles as $role ) {
44
-                    if ( is_string( $role ) ) {
45
-                        if ( user_can( $user_id, $role ) ) {
46
-                            $user_can_via_settings = true;
47
-                            break;
48
-                        }
49
-                    }
50
-                }
51
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
52
-                if ( user_can( $user_id, $roles ) ) {
53
-                    $user_can_via_settings = true;
54
-                }
55
-            }
41
+	    $user_can_via_settings = false;
42
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
43
+		foreach ( $roles as $role ) {
44
+		    if ( is_string( $role ) ) {
45
+			if ( user_can( $user_id, $role ) ) {
46
+			    $user_can_via_settings = true;
47
+			    break;
48
+			}
49
+		    }
50
+		}
51
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
52
+		if ( user_can( $user_id, $roles ) ) {
53
+		    $user_can_via_settings = true;
54
+		}
55
+	    }
56 56
 
57
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
58
-                $caps = array();
59
-            }
57
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
58
+		$caps = array();
59
+	    }
60 60
             
61
-            break;
62
-         case 'monsterinsights_save_settings' :
63
-            $roles = monsterinsights_get_option( 'save_settings', array() );
61
+	    break;
62
+	 case 'monsterinsights_save_settings' :
63
+	    $roles = monsterinsights_get_option( 'save_settings', array() );
64 64
 
65
-            $user_can_via_settings = false;
66
-            if ( ! empty( $roles ) && is_array( $roles ) ) {
67
-                foreach ( $roles as $role ) {
68
-                    if ( is_string( $role ) ) {
69
-                        if ( user_can( $user_id, $role ) ) {
70
-                            $user_can_via_settings = true;
71
-                            break;
72
-                        }
73
-                    }
74
-                }
75
-            } else if ( ! empty( $roles ) && is_string( $roles ) ) {
76
-                 if ( user_can( $user_id, $roles ) ) {
77
-                    $user_can_via_settings = true;
78
-                }
79
-            }
65
+	    $user_can_via_settings = false;
66
+	    if ( ! empty( $roles ) && is_array( $roles ) ) {
67
+		foreach ( $roles as $role ) {
68
+		    if ( is_string( $role ) ) {
69
+			if ( user_can( $user_id, $role ) ) {
70
+			    $user_can_via_settings = true;
71
+			    break;
72
+			}
73
+		    }
74
+		}
75
+	    } else if ( ! empty( $roles ) && is_string( $roles ) ) {
76
+		 if ( user_can( $user_id, $roles ) ) {
77
+		    $user_can_via_settings = true;
78
+		}
79
+	    }
80 80
 
81
-            if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
82
-                $caps = array();
83
-            }
81
+	    if ( user_can( $user_id, 'manage_options' ) || $user_can_via_settings ) {
82
+		$caps = array();
83
+	    }
84 84
 
85
-            break;
85
+	    break;
86 86
     }
87 87
     return $caps;
88 88
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function monsterinsights_add_capabilities( $caps, $cap, $user_id, $args ) {
36 36
  
37
-    switch( $cap ) {
37
+    switch ( $cap ) {
38 38
         case 'monsterinsights_view_dashboard' :
39 39
             $roles = monsterinsights_get_option( 'view_reports', array() );
40 40
 
@@ -86,4 +86,4 @@  discard block
 block discarded – undo
86 86
     }
87 87
     return $caps;
88 88
 }
89
-add_filter( 'map_meta_cap','monsterinsights_add_capabilities', 10, 4 );
90 89
\ No newline at end of file
90
+add_filter( 'map_meta_cap', 'monsterinsights_add_capabilities', 10, 4 );
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/api-auth.php 2 patches
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 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,7 +61,7 @@  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' );
@@ -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;
@@ -175,7 +175,7 @@  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' );
@@ -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;
@@ -290,7 +290,7 @@  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' );
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
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,7 +341,7 @@  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' );
@@ -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() ) {
Please login to merge, or discard this 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/reporting.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
 	}
26 26
 
27
-	public function add_report( $report = false ){
27
+	public function add_report( $report = false ) {
28 28
 		if ( empty( $report ) || ! is_object( $report ) ) {
29 29
 			return;
30 30
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
 	}
26 26
 
27
-	public function add_report( $report = false ){
27
+	public function add_report( $report = false ) {
28 28
 		if ( empty( $report ) || ! is_object( $report ) ) {
29 29
 			return;
30 30
 		}
Please login to merge, or discard this patch.
includes/admin/reports/abstract-report.php 2 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
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)
37
-	protected function get_report_html( $args = array() ) { 
37
+	protected function get_report_html( $args = array() ) {
38 38
 		/* Defined in the report class */ 
39 39
 		// For ajax, args start, end, and data will be set with the data to use. Else call $this->get_data( array( 'default' => true ) )
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
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			return monsterinsights_get_message( 'error', esc_html__( 'Access denied' , 'google-analytics-for-wordpress' ) );
55 55
 		}
56 56
 
57
-		if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) { 
57
+		if ( monsterinsights_get_option( 'dashboard_disabled', false ) ) {
58 58
 			if ( current_user_can( 'monsterinsights_save_settings' ) ) {
59 59
 				$url = is_network_admin() ? network_admin_url( 'admin.php?page=monsterinsights_settings' ) : admin_url( 'admin.php?page=monsterinsights_settings' );
60 60
 				return monsterinsights_get_message( 'error',
@@ -69,7 +69,7 @@  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 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>' );
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 if ( ! class_exists( 'MonsterInsightsDateTime' ) ) {
352 352
 	class MonsterInsightsDateTime extends DateTime {
353 353
 		public static function createFromFormat( $format, $time, $timezone = null ) {
354
-			if ( ! $timezone ) { 
354
+			if ( ! $timezone ) {
355 355
 				$timezone = new DateTimeZone( date_default_timezone_get() );
356 356
 			}
357 357
 			if ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 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">
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
     		return '';
353 353
     	} else {
354 354
     		if ( ! empty( $data['reportprevrange'] ) && ! empty( $data['reportprevrange']['startDate'] ) && ! empty( $data['reportprevrange']['endDate'] ) ) {
355
-    			return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) .'%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '%26_u.date10%3D' . str_replace( '-', '', $data['reportprevrange']['startDate'] ) .'%26_u.date11%3D' . str_replace( '-', '', $data['reportprevrange']['endDate'] ) . '/';
355
+    			return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) . '%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '%26_u.date10%3D' . str_replace( '-', '', $data['reportprevrange']['startDate'] ) . '%26_u.date11%3D' . str_replace( '-', '', $data['reportprevrange']['endDate'] ) . '/';
356 356
     		} else {
357
-    			return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) .'%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '/';
357
+    			return '%3F_u.date00%3D' . str_replace( '-', '', $data['reportcurrentrange']['startDate'] ) . '%26_u.date01%3D' . str_replace( '-', '', $data['reportcurrentrange']['endDate'] ) . '/';
358 358
     		}
359 359
     	}
360 360
     }
Please login to merge, or discard this patch.
includes/admin/licensing/license-actions.php 2 patches
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -47,27 +47,27 @@  discard block
 block discarded – undo
47 47
      * @since 6.0.0
48 48
      */
49 49
     public function __construct() {
50
-        add_action( 'admin_init', array( $this, 'admin_init' ) );
50
+	add_action( 'admin_init', array( $this, 'admin_init' ) );
51 51
     }
52 52
     
53 53
     public function admin_init() {
54
-        // Possibly verify the key.
55
-        $this->maybe_verify_key();
56
-
57
-        // Add potential admin notices for actions around the admin.
58
-        add_action( 'admin_notices', array( $this, 'monsterinsights_notices' ), 11 );
59
-        add_action( 'network_admin_notices', array( $this, 'monsterinsights_notices' ), 11 );
60
-
61
-        // Grab the license key. If it is not set (even after verification), return early.
62
-        $this->key = is_network_admin() ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
63
-        if ( ! $this->key ) {
64
-            return;
65
-        }
66
-
67
-        // Possibly handle validating, deactivating and refreshing license keys.
68
-        $this->maybe_validate_key();
69
-        $this->maybe_deactivate_key();
70
-        $this->maybe_refresh_key();
54
+	// Possibly verify the key.
55
+	$this->maybe_verify_key();
56
+
57
+	// Add potential admin notices for actions around the admin.
58
+	add_action( 'admin_notices', array( $this, 'monsterinsights_notices' ), 11 );
59
+	add_action( 'network_admin_notices', array( $this, 'monsterinsights_notices' ), 11 );
60
+
61
+	// Grab the license key. If it is not set (even after verification), return early.
62
+	$this->key = is_network_admin() ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
63
+	if ( ! $this->key ) {
64
+	    return;
65
+	}
66
+
67
+	// Possibly handle validating, deactivating and refreshing license keys.
68
+	$this->maybe_validate_key();
69
+	$this->maybe_deactivate_key();
70
+	$this->maybe_refresh_key();
71 71
     }
72 72
 
73 73
     /**
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function maybe_verify_key() {
81 81
 
82
-        if ( empty( $_POST['monsterinsights-license-key'] ) || strlen( $_POST['monsterinsights-license-key'] ) < 10 || empty( $_POST['monsterinsights-verify-submit'] ) ) {
83
-            return;
84
-        }
82
+	if ( empty( $_POST['monsterinsights-license-key'] ) || strlen( $_POST['monsterinsights-license-key'] ) < 10 || empty( $_POST['monsterinsights-verify-submit'] ) ) {
83
+	    return;
84
+	}
85 85
 
86
-        if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
87
-            return;
88
-        }
86
+	if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
87
+	    return;
88
+	}
89 89
 
90
-        if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
91
-            return;
92
-        }
90
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
91
+	    return;
92
+	}
93 93
 
94
-        $this->verify_key();
94
+	$this->verify_key();
95 95
 
96 96
     }
97 97
 
@@ -102,32 +102,32 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function verify_key() {
104 104
 
105
-        // Perform a request to verify the key.
106
-        $verify = $this->perform_remote_request( 'verify-key', array( 'tgm-updater-key' => trim( $_POST['monsterinsights-license-key'] ) ) );
107
-
108
-        // If it returns false, send back a generic error message and return.
109
-        if ( ! $verify ) {
110
-            $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
111
-            return;
112
-        }
113
-
114
-        // If an error is returned, set the error and return.
115
-        if ( ! empty( $verify->error ) ) {
116
-            $this->errors[] = $verify->error;
117
-            return;
118
-        }
119
-
120
-        // Otherwise, our request has been done successfully. Update the option and set the success message.
121
-        $option                = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
122
-        $option['key']         = trim( $_POST['monsterinsights-license-key'] );
123
-        $option['type']        = isset( $verify->type ) ? $verify->type : $option['type'];
124
-        $option['is_expired']  = false;
125
-        $option['is_disabled'] = false;
126
-        $option['is_invalid']  = false;
127
-        $this->success[]       = isset( $verify->success ) ? $verify->success : esc_html__( 'Congratulations! This site is now receiving automatic updates.', 'google-analytics-for-wordpress' );
128
-        is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
129
-        delete_transient( '_monsterinsights_addons' );
130
-        monsterinsights_get_addons_data( $option['key'] );
105
+	// Perform a request to verify the key.
106
+	$verify = $this->perform_remote_request( 'verify-key', array( 'tgm-updater-key' => trim( $_POST['monsterinsights-license-key'] ) ) );
107
+
108
+	// If it returns false, send back a generic error message and return.
109
+	if ( ! $verify ) {
110
+	    $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
111
+	    return;
112
+	}
113
+
114
+	// If an error is returned, set the error and return.
115
+	if ( ! empty( $verify->error ) ) {
116
+	    $this->errors[] = $verify->error;
117
+	    return;
118
+	}
119
+
120
+	// Otherwise, our request has been done successfully. Update the option and set the success message.
121
+	$option                = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
122
+	$option['key']         = trim( $_POST['monsterinsights-license-key'] );
123
+	$option['type']        = isset( $verify->type ) ? $verify->type : $option['type'];
124
+	$option['is_expired']  = false;
125
+	$option['is_disabled'] = false;
126
+	$option['is_invalid']  = false;
127
+	$this->success[]       = isset( $verify->success ) ? $verify->success : esc_html__( 'Congratulations! This site is now receiving automatic updates.', 'google-analytics-for-wordpress' );
128
+	is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
129
+	delete_transient( '_monsterinsights_addons' );
130
+	monsterinsights_get_addons_data( $option['key'] );
131 131
     }
132 132
 
133 133
     /**
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
      * @return null Return early if the transient has not expired yet.
139 139
      */
140 140
     public function maybe_validate_key() {
141
-        $check = is_network_admin() ? MonsterInsights()->license->time_to_check_network_license() : MonsterInsights()->license->time_to_check_site_license();
142
-        if ( $check ) {
143
-            $this->validate_key();
144
-        }
141
+	$check = is_network_admin() ? MonsterInsights()->license->time_to_check_network_license() : MonsterInsights()->license->time_to_check_site_license();
142
+	if ( $check ) {
143
+	    $this->validate_key();
144
+	}
145 145
     }
146 146
 
147 147
     /**
@@ -153,58 +153,58 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function validate_key( $forced = false ) {
155 155
 
156
-        $validate = $this->perform_remote_request( 'validate-key', array( 'tgm-updater-key' => $this->key ) );
157
-
158
-        // If there was a basic API error in validation, only set the transient for 10 minutes before retrying.
159
-        if ( ! $validate ) {
160
-            // If forced, set contextual success message.
161
-            if ( $forced ) {
162
-                $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
163
-            }
164
-            return;
165
-        }
166
-
167
-        $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
168
-        $option['is_expired']  = false;
169
-        $option['is_disabled'] = false;
170
-        $option['is_invalid']  = false;
171
-
172
-        // If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license.
173
-        if ( isset( $validate->key ) || isset( $validate->author ) ) {
174
-            $option['is_invalid']  = true;
175
-            is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
176
-            return;
177
-        }
178
-
179
-        // If the license has expired, set the transient and expired flag and return.
180
-        if ( isset( $validate->expired ) ) {
181
-            $option['is_expired']  = true;
182
-            is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
183
-            return;
184
-        }
185
-
186
-        // If the license is disabled, set the transient and disabled flag and return.
187
-        if ( isset( $validate->disabled ) ) {
188
-            $option['is_disabled'] = true;
189
-            is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
190
-            return;
191
-        }
192
-
193
-        // If forced, set contextual success message.
194
-        if ( ( ! empty( $validate->key ) || ! empty( $this->key ) ) && $forced ) {
195
-            $key = ! empty( $validate->key ) ? $validate->key : $this->key;
196
-            delete_transient( '_monsterinsights_addons' );
197
-            monsterinsights_get_addons_data( $key );
198
-            $this->success[] = esc_html__( 'Congratulations! Your key has been refreshed successfully.', 'google-analytics-for-wordpress' );
199
-        }
200
-
201
-        $option = array();
202
-        $option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
203
-        $option['type']        = isset( $validate->type ) ? $validate->type : $option['type'];
204
-        $option['is_expired']  = false;
205
-        $option['is_disabled'] = false;
206
-        $option['is_invalid']  = false;
207
-        is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
156
+	$validate = $this->perform_remote_request( 'validate-key', array( 'tgm-updater-key' => $this->key ) );
157
+
158
+	// If there was a basic API error in validation, only set the transient for 10 minutes before retrying.
159
+	if ( ! $validate ) {
160
+	    // If forced, set contextual success message.
161
+	    if ( $forced ) {
162
+		$this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
163
+	    }
164
+	    return;
165
+	}
166
+
167
+	$option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
168
+	$option['is_expired']  = false;
169
+	$option['is_disabled'] = false;
170
+	$option['is_invalid']  = false;
171
+
172
+	// If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license.
173
+	if ( isset( $validate->key ) || isset( $validate->author ) ) {
174
+	    $option['is_invalid']  = true;
175
+	    is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
176
+	    return;
177
+	}
178
+
179
+	// If the license has expired, set the transient and expired flag and return.
180
+	if ( isset( $validate->expired ) ) {
181
+	    $option['is_expired']  = true;
182
+	    is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
183
+	    return;
184
+	}
185
+
186
+	// If the license is disabled, set the transient and disabled flag and return.
187
+	if ( isset( $validate->disabled ) ) {
188
+	    $option['is_disabled'] = true;
189
+	    is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
190
+	    return;
191
+	}
192
+
193
+	// If forced, set contextual success message.
194
+	if ( ( ! empty( $validate->key ) || ! empty( $this->key ) ) && $forced ) {
195
+	    $key = ! empty( $validate->key ) ? $validate->key : $this->key;
196
+	    delete_transient( '_monsterinsights_addons' );
197
+	    monsterinsights_get_addons_data( $key );
198
+	    $this->success[] = esc_html__( 'Congratulations! Your key has been refreshed successfully.', 'google-analytics-for-wordpress' );
199
+	}
200
+
201
+	$option = array();
202
+	$option = is_network_admin() ? MonsterInsights()->license->get_network_license() : MonsterInsights()->license->get_site_license();
203
+	$option['type']        = isset( $validate->type ) ? $validate->type : $option['type'];
204
+	$option['is_expired']  = false;
205
+	$option['is_disabled'] = false;
206
+	$option['is_invalid']  = false;
207
+	is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
208 208
 
209 209
     }
210 210
 
@@ -217,19 +217,19 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function maybe_deactivate_key() {
219 219
 
220
-        if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-deactivate-submit'] ) ) {
221
-            return;
222
-        }
220
+	if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-deactivate-submit'] ) ) {
221
+	    return;
222
+	}
223 223
 
224
-        if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
225
-            return;
226
-        }
224
+	if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
225
+	    return;
226
+	}
227 227
 
228
-        if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
229
-            return;
230
-        }
228
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
229
+	    return;
230
+	}
231 231
 
232
-        $this->deactivate_key();
232
+	$this->deactivate_key();
233 233
 
234 234
     }
235 235
 
@@ -240,24 +240,24 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function deactivate_key() {
242 242
 
243
-        // Perform a request to deactivate the key.
244
-        $deactivate = $this->perform_remote_request( 'deactivate-key', array( 'tgm-updater-key' => $_POST['monsterinsights-license-key'] ) );
243
+	// Perform a request to deactivate the key.
244
+	$deactivate = $this->perform_remote_request( 'deactivate-key', array( 'tgm-updater-key' => $_POST['monsterinsights-license-key'] ) );
245 245
 
246
-        // If it returns false, send back a generic error message and return.
247
-        if ( ! $deactivate ) {
248
-            $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
249
-            return;
250
-        }
246
+	// If it returns false, send back a generic error message and return.
247
+	if ( ! $deactivate ) {
248
+	    $this->errors[] = esc_html__( 'There was an error connecting to the remote key API. Please try again later.', 'google-analytics-for-wordpress' );
249
+	    return;
250
+	}
251 251
 
252
-        // If an error is returned, set the error and return.
253
-        if ( ! empty( $deactivate->error ) && ! monsterinsights_is_debug_mode() ) {
254
-            $this->errors[] = $deactivate->error;
255
-            return;
256
-        }
252
+	// If an error is returned, set the error and return.
253
+	if ( ! empty( $deactivate->error ) && ! monsterinsights_is_debug_mode() ) {
254
+	    $this->errors[] = $deactivate->error;
255
+	    return;
256
+	}
257 257
 
258
-        // Otherwise, our request has been done successfully. Reset the option and set the success message.
259
-        $this->success[] = isset( $deactivate->success ) ? $deactivate->success : esc_html__( 'Congratulations! You have deactivated the key from this site successfully.', 'google-analytics-for-wordpress' );
260
-        is_network_admin() ? MonsterInsights()->license->delete_network_license() : MonsterInsights()->license->delete_site_license();
258
+	// Otherwise, our request has been done successfully. Reset the option and set the success message.
259
+	$this->success[] = isset( $deactivate->success ) ? $deactivate->success : esc_html__( 'Congratulations! You have deactivated the key from this site successfully.', 'google-analytics-for-wordpress' );
260
+	is_network_admin() ? MonsterInsights()->license->delete_network_license() : MonsterInsights()->license->delete_site_license();
261 261
 
262 262
     }
263 263
 
@@ -270,20 +270,20 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function maybe_refresh_key() {
272 272
 
273
-        if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-refresh-submit'] ) ) {
274
-            return;
275
-        }
273
+	if ( empty( $_POST['monsterinsights-license-key'] ) || empty( $_POST['monsterinsights-refresh-submit'] ) ) {
274
+	    return;
275
+	}
276 276
 
277
-        if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
278
-            return;
279
-        }
277
+	if ( ! wp_verify_nonce( $_POST['monsterinsights-key-nonce'], 'monsterinsights-key-nonce' ) ) {
278
+	    return;
279
+	}
280 280
 
281
-        if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
282
-            return;
283
-        }
281
+	if ( ! current_user_can( 'monsterinsights_save_settings' ) ) {
282
+	    return;
283
+	}
284 284
 
285
-        // Refreshing is simply a word alias for validating a key. Force true to set contextual messages.
286
-        $this->validate_key( true );
285
+	// Refreshing is simply a word alias for validating a key. Force true to set contextual messages.
286
+	$this->validate_key( true );
287 287
 
288 288
     }
289 289
 
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
      * @since 7.0.0
294 294
      */
295 295
     public function monsterinsights_notices() {
296
-        if ( ! monsterinsights_is_pro_version() ) {
297
-            return;
298
-        }
296
+	if ( ! monsterinsights_is_pro_version() ) {
297
+	    return;
298
+	}
299 299
 
300
-        $screen = get_current_screen();
301
-        if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
302
-            return;
303
-        }
300
+	$screen = get_current_screen();
301
+	if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
302
+	    return;
303
+	}
304 304
 
305
-        if ( ! empty( $this->errors ) ) { ?>
305
+	if ( ! empty( $this->errors ) ) { ?>
306 306
             <div class="error">
307 307
                 <p><?php echo implode( '<br>', $this->errors ); ?></p>
308 308
             </div>
@@ -326,46 +326,46 @@  discard block
 block discarded – undo
326 326
      */
327 327
     public function perform_remote_request( $action, $body = array(), $headers = array(), $return_format = 'json' ) {
328 328
 
329
-        // Build the body of the request.
330
-        $body = wp_parse_args(
331
-            $body,
332
-            array(
333
-                'tgm-updater-action'     => $action,
334
-                'tgm-updater-key'        => $this->key,
335
-                'tgm-updater-wp-version' => get_bloginfo( 'version' ),
336
-                'tgm-updater-referer'    => site_url(),
337
-                'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
338
-                'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
339
-            )
340
-        );
341
-        $body = http_build_query( $body, '', '&' );
342
-
343
-        // Build the headers of the request.
344
-        $headers = wp_parse_args(
345
-            $headers,
346
-            array(
347
-                'Content-Type'   => 'application/x-www-form-urlencoded',
348
-                'Content-Length' => strlen( $body )
349
-            )
350
-        );
351
-
352
-        // Setup variable for wp_remote_post.
353
-        $post = array(
354
-            'headers' => $headers,
355
-            'body'    => $body
356
-        );
357
-
358
-        // Perform the query and retrieve the response.
359
-        $response      = wp_remote_post( monsterinsights_get_licensing_url(), $post );
360
-        $response_code = wp_remote_retrieve_response_code( $response );
361
-        $response_body = wp_remote_retrieve_body( $response );
362
-
363
-        // Bail out early if there are any errors.
364
-        if ( 200 != $response_code || is_wp_error( $response_body ) ) {
365
-            return false;
366
-        }
367
-
368
-        // Return the json decoded content.
369
-        return json_decode( $response_body );
329
+	// Build the body of the request.
330
+	$body = wp_parse_args(
331
+	    $body,
332
+	    array(
333
+		'tgm-updater-action'     => $action,
334
+		'tgm-updater-key'        => $this->key,
335
+		'tgm-updater-wp-version' => get_bloginfo( 'version' ),
336
+		'tgm-updater-referer'    => site_url(),
337
+		'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
338
+		'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
339
+	    )
340
+	);
341
+	$body = http_build_query( $body, '', '&' );
342
+
343
+	// Build the headers of the request.
344
+	$headers = wp_parse_args(
345
+	    $headers,
346
+	    array(
347
+		'Content-Type'   => 'application/x-www-form-urlencoded',
348
+		'Content-Length' => strlen( $body )
349
+	    )
350
+	);
351
+
352
+	// Setup variable for wp_remote_post.
353
+	$post = array(
354
+	    'headers' => $headers,
355
+	    'body'    => $body
356
+	);
357
+
358
+	// Perform the query and retrieve the response.
359
+	$response      = wp_remote_post( monsterinsights_get_licensing_url(), $post );
360
+	$response_code = wp_remote_retrieve_response_code( $response );
361
+	$response_body = wp_remote_retrieve_body( $response );
362
+
363
+	// Bail out early if there are any errors.
364
+	if ( 200 != $response_code || is_wp_error( $response_body ) ) {
365
+	    return false;
366
+	}
367
+
368
+	// Return the json decoded content.
369
+	return json_decode( $response_body );
370 370
     }
371 371
 }
372 372
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -171,14 +171,14 @@
 block discarded – undo
171 171
 
172 172
         // If a key or author error is returned, the license no longer exists or the user has been deleted, so reset license.
173 173
         if ( isset( $validate->key ) || isset( $validate->author ) ) {
174
-            $option['is_invalid']  = true;
174
+            $option['is_invalid'] = true;
175 175
             is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
176 176
             return;
177 177
         }
178 178
 
179 179
         // If the license has expired, set the transient and expired flag and return.
180 180
         if ( isset( $validate->expired ) ) {
181
-            $option['is_expired']  = true;
181
+            $option['is_expired'] = true;
182 182
             is_network_admin() ? MonsterInsights()->license->set_network_license( $option ) : MonsterInsights()->license->set_site_license( $option );
183 183
             return;
184 184
         }
Please login to merge, or discard this patch.
includes/admin/settings/tab-tracking.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,65 +29,65 @@  discard block
 block discarded – undo
29 29
         <!-- Tabs -->
30 30
         <h1 id="monsterinsights-settings-page-sub-nav" class="monsterinsights-sub-nav-container monsterinsights-nav-container" data-container="#monsterinsights-settings-sub-pages">
31 31
             <?php 
32
-            $i      = 0;
33
-            $class  = '';
34
-            $is_pro = monsterinsights_is_pro_version();
35
-            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
36
-                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
37
-                    continue;
38
-                }
39
-                $class = ( 0 === $i ? 'monsterinsights-active' : '' );
40
-                ?>
32
+	    $i      = 0;
33
+	    $class  = '';
34
+	    $is_pro = monsterinsights_is_pro_version();
35
+	    foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
36
+		if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
37
+		    continue;
38
+		}
39
+		$class = ( 0 === $i ? 'monsterinsights-active' : '' );
40
+		?>
41 41
                 <a class="monsterinsights-sub-nav-item monsterinsights-nav-item monstericon-<?php echo esc_attr( $id ); ?> <?php echo esc_attr( $class ); ?>" href="#monsterinsights-main-tab-tracking?monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" title="<?php echo esc_attr( $item['title'] ); ?>">
42 42
                     <?php echo esc_html( $item['title'] ); ?>
43 43
                 </a>
44 44
                 <?php 
45
-                $i++; 
46
-            }
47
-            ?>
45
+		$i++; 
46
+	    }
47
+	    ?>
48 48
         </h1>
49 49
 
50 50
         <h1 class="monsterinsights-hideme"></h1><!-- so wp notices are below the nav bar -->
51 51
 
52 52
         <?php 
53
-        // Output any notices now
54
-        /** 
55
-         * Developer Alert:
56
-         *
57
-         * Per the README, this is considered an internal hook and should
58
-         * not be used by other developers. This hook's behavior may be modified
59
-         * or the hook may be removed at any time, without warning.
60
-         */
61
-        do_action( 'monsterinsights_settings_tracking_tab_notice' );
62
-        ?>
53
+	// Output any notices now
54
+	/** 
55
+	 * Developer Alert:
56
+	 *
57
+	 * Per the README, this is considered an internal hook and should
58
+	 * not be used by other developers. This hook's behavior may be modified
59
+	 * or the hook may be removed at any time, without warning.
60
+	 */
61
+	do_action( 'monsterinsights_settings_tracking_tab_notice' );
62
+	?>
63 63
 
64 64
         <!-- Tab Panels -->
65 65
         <div id="monsterinsights-settings-sub-pages" class="monsterinsights-sub-nav-tabs monsterinsights-nav-tabs" data-navigation="#monsterinsights-settings-page-sub-nav">
66 66
             <?php 
67
-            $i = 0; 
68
-            foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
69
-                if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
70
-                    continue;
71
-                }
72
-                $class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
73
-                $i++;
74
-                ?>
67
+	    $i = 0; 
68
+	    foreach ( (array) monsterinsights_get_settings_tabs() as $id => $item ) {
69
+		if ( isset( $item['comingsoon'] ) && $item['comingsoon'] || empty( $item['title'] ) ) {
70
+		    continue;
71
+		}
72
+		$class = ( 0 === $i ? ' monsterinsights-active' : '' ); 
73
+		$i++;
74
+		?>
75 75
                  <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
76 76
                     <?php if ( $item['level'] === 'lite' ||  $is_pro ) { ?>
77 77
                     <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
78 78
                     <?php } ?>
79 79
                      <div class="monsterinsights-subtab-settings-notices">
80 80
                         <?php 
81
-                        // Output any notices now
82
-                        /** 
83
-                         * Developer Alert:
84
-                         *
85
-                         * Per the README, this is considered an internal hook and should
86
-                         * not be used by other developers. This hook's behavior may be modified
87
-                         * or the hook may be removed at any time, without warning.
88
-                         */
89
-                        do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
90
-                        ?>
81
+			// Output any notices now
82
+			/** 
83
+			 * Developer Alert:
84
+			 *
85
+			 * Per the README, this is considered an internal hook and should
86
+			 * not be used by other developers. This hook's behavior may be modified
87
+			 * or the hook may be removed at any time, without warning.
88
+			 */
89
+			do_action( 'monsterinsights_tracking_' . $id . '_tab_notice' );
90
+			?>
91 91
                     </div>
92 92
                     <!-- Settings Form -->
93 93
                     <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
                         <table class="form-table">
96 96
                             <tbody>
97 97
                                 <?php
98
-                                //do_action( 'monsterinsights_settings_tab_top_' . $id  );
99
-                                echo monsterinsights_get_section_settings( $id, 'tracking' );
100
-                                //do_action( 'monsterinsights_settings_tab_bottom_' . $id  );
101
-                                ?>
98
+				//do_action( 'monsterinsights_settings_tab_top_' . $id  );
99
+				echo monsterinsights_get_section_settings( $id, 'tracking' );
100
+				//do_action( 'monsterinsights_settings_tab_bottom_' . $id  );
101
+				?>
102 102
                             </tbody>
103 103
                         </table>
104 104
                         <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
                     </form>
112 112
                 </div>
113 113
                 <?php
114
-            }
115
-            ?>
114
+	    }
115
+	    ?>
116 116
         </div>
117 117
     </div>
118 118
     <?php
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 $i++;
74 74
                 ?>
75 75
                  <div id="monsterinsights-sub-tab-<?php echo esc_attr( $id ); ?>" class="monsterinsights-sub-nav-tab monsterinsights-nav-tab<?php echo esc_attr( $class ); ?>">
76
-                    <?php if ( $item['level'] === 'lite' ||  $is_pro ) { ?>
76
+                    <?php if ( $item['level'] === 'lite' || $is_pro ) { ?>
77 77
                     <?php echo '<h2 class="monsterinsights-sub-tab-header">' . esc_html( $item['title'] ) . '</h2>'; ?>
78 78
                     <?php } ?>
79 79
                      <div class="monsterinsights-subtab-settings-notices">
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                     </div>
92 92
                     <!-- Settings Form -->
93 93
                     <?php $class = ( $item['level'] !== 'lite' && ! $is_pro ) ? 'monsterinsights-no-settings-shown' : ''; ?>
94
-                    <form id="monsterinsights-tracking-<?php echo esc_attr( $id );?>-tab" class="<?php echo $class; ?>" method="post">
94
+                    <form id="monsterinsights-tracking-<?php echo esc_attr( $id ); ?>-tab" class="<?php echo $class; ?>" method="post">
95 95
                         <table class="form-table">
96 96
                             <tbody>
97 97
                                 <?php
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                             </tbody>
103 103
                         </table>
104 104
                         <?php echo monsterinsights_render_submit_field( $id, 'tracking' ); ?>
105
-                        <?php if ( $item['level'] === 'lite' && !$is_pro ) { ?>
105
+                        <?php if ( $item['level'] === 'lite' && ! $is_pro ) { ?>
106 106
                             <div class="monsterinsights-upsell-under-box">
107 107
                                 <h2><?php esc_html_e( "Want even more fine tuned control over your website analytics?", 'google-analytics-for-wordpress' ); ?></h2>
108 108
                                 <p class="monsterinsights-upsell-lite-text"><?php esc_html_e( "By upgrading to MonsterInsights Pro, you get access to numerous addons and tools that help you better understand what people are doing on your website, so you can keep doing more of what's working. Some of the features include: Ecommerce tracking, Author tracking, Post Type tracking, Ads tracking, Google AMP tracking, Performance optimization, and so much more!", 'google-analytics-for-wordpress' ); ?></p>
Please login to merge, or discard this patch.
includes/admin/settings/tab-general.php 3 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@  discard block
 block discarded – undo
29 29
     <div id="monsterinsights-settings-general">
30 30
         <div class="monsterinsights-tab-settings-notices">
31 31
         <?php 
32
-        // Output any notices now
33
-        /** 
34
-         * Developer Alert:
35
-         *
36
-         * Per the README, this is considered an internal hook and should
37
-         * not be used by other developers. This hook's behavior may be modified
38
-         * or the hook may be removed at any time, without warning.
39
-         */
40
-        do_action( 'monsterinsights_settings_general_tab_notice' );
41
-        ?>
32
+	// Output any notices now
33
+	/** 
34
+	 * Developer Alert:
35
+	 *
36
+	 * Per the README, this is considered an internal hook and should
37
+	 * not be used by other developers. This hook's behavior may be modified
38
+	 * or the hook may be removed at any time, without warning.
39
+	 */
40
+	do_action( 'monsterinsights_settings_general_tab_notice' );
41
+	?>
42 42
         </div>
43 43
         <table class="form-table">
44 44
             <tbody>
45 45
                 <?php if ( monsterinsights_is_pro_version() ) {
46
-                    $license_key  = MonsterInsights()->license->get_site_license_key();
47
-                    $license_key  = $license_key ? $license_key : MonsterInsights()->license->get_network_license_key();
48
-                    $license_key  = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key();
46
+		    $license_key  = MonsterInsights()->license->get_site_license_key();
47
+		    $license_key  = $license_key ? $license_key : MonsterInsights()->license->get_network_license_key();
48
+		    $license_key  = $license_key ? $license_key : MonsterInsights()->license->get_default_license_key();
49 49
 
50
-                    $license_type = MonsterInsights()->license->get_site_license_type();
51
-                    ?>
50
+		    $license_type = MonsterInsights()->license->get_site_license_type();
51
+		    ?>
52 52
                     <tr id="monsterinsights-settings-key-box">
53 53
                         <th scope="row">
54 54
                             <label for="monsterinsights-settings-key"><?php esc_html_e( 'License Key', 'google-analytics-for-wordpress' ); ?></label>
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
                     <?php } ?>
155 155
 
156 156
                     <?php 
157
-                    $manual_ua = MonsterInsights()->auth->get_manual_ua();
158
-                    $auth_ua   = MonsterInsights()->auth->get_ua();
157
+		    $manual_ua = MonsterInsights()->auth->get_manual_ua();
158
+		    $auth_ua   = MonsterInsights()->auth->get_ua();
159 159
 
160
-                    if ( empty( $manual_ua ) && empty( $auth_ua ) && monsterinsights_get_network_ua() ) { ?>
160
+		    if ( empty( $manual_ua ) && empty( $auth_ua ) && monsterinsights_get_network_ua() ) { ?>
161 161
                         <!-- If we don't have a manual or auth UA but we have a valid default set (from network), explain that -->
162 162
                         <tr id="monsterinsights-default-google-authenticate-box">
163 163
                             <th scope="row">
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
                     <!-- Disable Dashboard -->
173 173
                     <?php
174
-                    $title       = esc_html__( 'Disable Reports', 'google-analytics-for-wordpress' );
175
-                    $description = esc_html__( 'Hide the reports page.', 'google-analytics-for-wordpress' );
176
-                    echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
177
-                    ?>
174
+		    $title       = esc_html__( 'Disable Reports', 'google-analytics-for-wordpress' );
175
+		    $description = esc_html__( 'Hide the reports page.', 'google-analytics-for-wordpress' );
176
+		    echo monsterinsights_make_checkbox( 'dashboards_disabled', $title, $description );
177
+		    ?>
178 178
 
179 179
                     <?php if ( $automatic_updates !== 'all' && $automatic_updates !== 'minor' ){  ?>
180 180
                     <?php $automatic_updates = $automatic_updates ? $automatic_updates : 'none'; ?>
@@ -192,23 +192,23 @@  discard block
 block discarded – undo
192 192
 
193 193
                     <!-- Tracking -->
194 194
                     <?php
195
-                    $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
196
-                    $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' );
197
-                    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ){
198
-                        echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
199
-                    }
200
-                    ?>
195
+		    $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
196
+		    $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' );
197
+		    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ){
198
+			echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
199
+		    }
200
+		    ?>
201 201
 
202 202
                     <?php 
203
-                    /** 
204
-                     * Developer Alert:
205
-                     *
206
-                     * Per the README, this is considered an internal hook and should
207
-                     * not be used by other developers. This hook's behavior may be modified
208
-                     * or the hook may be removed at any time, without warning.
209
-                     */
210
-                    do_action( 'monsterinsights_settings_general_box' ); 
211
-                    ?>
203
+		    /** 
204
+		     * Developer Alert:
205
+		     *
206
+		     * Per the README, this is considered an internal hook and should
207
+		     * not be used by other developers. This hook's behavior may be modified
208
+		     * or the hook may be removed at any time, without warning.
209
+		     */
210
+		    do_action( 'monsterinsights_settings_general_box' ); 
211
+		    ?>
212 212
                 </tbody>
213 213
             </table>
214 214
             <input type="hidden" name="monsterinsights_settings_tab" value="general"/>
@@ -235,28 +235,28 @@  discard block
 block discarded – undo
235 235
     $manual_ua_code_old = MonsterInsights()->auth->get_manual_ua();
236 236
     
237 237
     if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old === $manual_ua_code ) {
238
-        // Same code we had before
239
-            // Do nothing
238
+	// Same code we had before
239
+	    // Do nothing
240 240
     } else if ( $manual_ua_code && $manual_ua_code_old && $manual_ua_code_old !== $manual_ua_code ) {
241
-        // Different UA code
242
-        MonsterInsights()->auth->set_manual_ua( $manual_ua_code );
241
+	// Different UA code
242
+	MonsterInsights()->auth->set_manual_ua( $manual_ua_code );
243 243
     } else if ( $manual_ua_code && empty( $manual_ua_code_old ) ) {
244
-        // Move to manual
245
-        MonsterInsights()->auth->set_manual_ua( $manual_ua_code );
244
+	// Move to manual
245
+	MonsterInsights()->auth->set_manual_ua( $manual_ua_code );
246 246
     } else if ( empty( $manual_ua_code ) && $manual_ua_code_old ) {
247
-        // Deleted manual
248
-        MonsterInsights()->auth->delete_manual_ua();
247
+	// Deleted manual
248
+	MonsterInsights()->auth->delete_manual_ua();
249 249
     } else if ( isset( $_POST['manual_ua_code'] ) && empty( $manual_ua_code ) ) {
250
-        $throw_notice = true;
250
+	$throw_notice = true;
251 251
     } else {
252
-        // Not UA before or after
253
-            // Do nothing
252
+	// Not UA before or after
253
+	    // Do nothing
254 254
     }
255 255
 
256 256
     $dashboards_disabled     = isset( $_POST['dashboards_disabled'] ) ? 1 : 0;
257 257
     $dashboards_disabled_old = monsterinsights_get_option( 'dashboards_disabled', false );
258 258
     if ( $dashboards_disabled && ! $dashboards_disabled_old ) {
259
-        do_action( 'monsterinsights_reports_delete_aggregate_data' );
259
+	do_action( 'monsterinsights_reports_delete_aggregate_data' );
260 260
     }
261 261
     monsterinsights_update_option( 'dashboards_disabled', $dashboards_disabled );
262 262
 
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 
265 265
     $automatic_updates = isset( $_POST['automatic_updates'] ) && in_array( $_POST['automatic_updates'], array( 'all', 'minor', 'none' ) ) ? $_POST['automatic_updates'] : false;
266 266
     if ( $automatic_updates ) {
267
-        monsterinsights_update_option( 'automatic_updates', $automatic_updates );
267
+	monsterinsights_update_option( 'automatic_updates', $automatic_updates );
268 268
     }
269 269
 
270 270
     $anonymous_data = isset( $_POST['anonymous_data'] ) ? 1 : 0;
271 271
     if ( $anonymous_data ) {
272
-        if ( monsterinsights_is_pro_version() ) {
273
-             monsterinsights_update_option( 'anonymous_data', 1 );
274
-        } else {
275
-            monsterinsights_update_option( 'anonymous_data', $anonymous_data );
276
-        }
272
+	if ( monsterinsights_is_pro_version() ) {
273
+	     monsterinsights_update_option( 'anonymous_data', 1 );
274
+	} else {
275
+	    monsterinsights_update_option( 'anonymous_data', $anonymous_data );
276
+	}
277 277
     }
278 278
 
279 279
     /** 
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 
288 288
     // Output an admin notice so the user knows what happened
289 289
     if ( $throw_notice ) {
290
-        add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' );
290
+	add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_invalid_ua_code' );
291 291
     } else {
292
-        add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_updated_settings' );
292
+	add_action( 'monsterinsights_settings_general_tab_notice', 'monsterinsights_updated_settings' );
293 293
     }
294 294
 }
295 295
 add_action( 'monsterinsights_settings_save_general', 'monsterinsights_settings_save_general', 11 );
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
                     <?php
195 195
                     $title       = esc_html__( 'Allow Usage Tracking', 'google-analytics-for-wordpress' );
196 196
                     $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' );
197
-                    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ){
197
+                    if ( ( ! $anon_tracking || monsterinsights_is_debug_mode() ) && ! monsterinsights_is_pro_version() ) {
198 198
                         echo monsterinsights_make_checkbox( 'anonymous_data', $title, $description );
199 199
                     }
200 200
                     ?>
Please login to merge, or discard this 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.
includes/auth.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 final class MonsterInsights_Auth {
20 20
 
21
-	private $profile  = array();
21
+	private $profile = array();
22 22
 	private $network = array();
23 23
 
24 24
 	/**
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 	}
69 69
 
70
-	public function set_analytics_profile( $data = array() ){
70
+	public function set_analytics_profile( $data = array() ) {
71 71
 		update_option( 'monsterinsights_site_profile', $data );
72
-		$this->profile      = $data;
72
+		$this->profile = $data;
73 73
 	}
74 74
 
75
-	public function set_network_analytics_profile( $data = array() ){
75
+	public function set_network_analytics_profile( $data = array() ) {
76 76
 		update_site_option( 'monsterinsights_network_profile', $data );
77
-		$this->network      = $data;
77
+		$this->network = $data;
78 78
 	}
79 79
 
80
-	public function delete_analytics_profile( $migrate = true ){
80
+	public function delete_analytics_profile( $migrate = true ) {
81 81
 		if ( $migrate ) {
82 82
 			$newdata = array();
83 83
 			if ( isset( $this->profile['ua'] ) ) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 	}
93 93
 
94
-	public function delete_network_analytics_profile( $migrate = true ){
94
+	public function delete_network_analytics_profile( $migrate = true ) {
95 95
 		if ( $migrate ) {
96 96
 			$newdata = array();
97 97
 			if ( isset( $this->network['ua'] ) ) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		
125 125
 		do_action( 'monsterinsights_reports_delete_aggregate_data' );
126 126
 
127
-		$this->profile      = $data;
127
+		$this->profile = $data;
128 128
 		$this->set_analytics_profile( $data );
129 129
 	}
130 130
 
@@ -181,55 +181,55 @@  discard block
 block discarded – undo
181 181
 		return ! empty( $this->network['ua'] ) ? monsterinsights_is_valid_ua( $this->network['ua'] ) : '';
182 182
 	}
183 183
 
184
-	public function get_viewname(){
184
+	public function get_viewname() {
185 185
 		return ! empty( $this->profile['viewname'] ) ? $this->profile['viewname'] : '';
186 186
 	}
187 187
 
188
-	public function get_network_viewname(){
188
+	public function get_network_viewname() {
189 189
 		return ! empty( $this->network['viewname'] ) ? $this->network['viewname'] : '';
190 190
 	}
191 191
 
192
-	public function get_accountid(){
192
+	public function get_accountid() {
193 193
 		return ! empty( $this->profile['a'] ) ? $this->profile['a'] : '';
194 194
 	}
195 195
 
196
-	public function get_network_accountid(){
196
+	public function get_network_accountid() {
197 197
 		return ! empty( $this->network['a'] ) ? $this->network['a'] : '';
198 198
 	}
199 199
 
200
-	public function get_propertyid(){
200
+	public function get_propertyid() {
201 201
 		return ! empty( $this->profile['w'] ) ? $this->profile['w'] : '';
202 202
 	}
203 203
 
204
-	public function get_network_propertyid(){
204
+	public function get_network_propertyid() {
205 205
 		return ! empty( $this->network['w'] ) ? $this->network['w'] : '';
206 206
 	}
207 207
 
208
-	public function get_viewid(){ // also known as profileID
208
+	public function get_viewid() { // also known as profileID
209 209
 		return ! empty( $this->profile['p'] ) ? $this->profile['p'] : '';
210 210
 	}
211 211
 
212
-	public function get_network_viewid(){ // also known as profileID
212
+	public function get_network_viewid() { // also known as profileID
213 213
 		return ! empty( $this->network['p'] ) ? $this->network['p'] : '';
214 214
 	}
215 215
 
216
-	public function get_key(){
216
+	public function get_key() {
217 217
 		return ! empty( $this->profile['key'] ) ? $this->profile['key'] : '';
218 218
 	}
219 219
 
220
-	public function get_network_key(){
220
+	public function get_network_key() {
221 221
 		return ! empty( $this->network['key'] ) ? $this->network['key'] : '';
222 222
 	}
223 223
 
224
-	public function get_token(){
224
+	public function get_token() {
225 225
 		return ! empty( $this->profile['token'] ) ? $this->profile['token'] : '';
226 226
 	}
227 227
 
228
-	public function get_network_token(){
228
+	public function get_network_token() {
229 229
 		return ! empty( $this->network['token'] ) ? $this->network['token'] : '';
230 230
 	}
231 231
 
232
-	public function get_referral_url(){
232
+	public function get_referral_url() {
233 233
 		$url = '';
234 234
 
235 235
 		if ( $this->is_authed() ) {
Please login to merge, or discard this patch.
Braces   +19 added lines, -17 removed lines patch added patch discarded remove patch
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 	}
69 69
 
70
-	public function set_analytics_profile( $data = array() ){
70
+	public function set_analytics_profile( $data = array() ) {
71 71
 		update_option( 'monsterinsights_site_profile', $data );
72 72
 		$this->profile      = $data;
73 73
 	}
74 74
 
75
-	public function set_network_analytics_profile( $data = array() ){
75
+	public function set_network_analytics_profile( $data = array() ) {
76 76
 		update_site_option( 'monsterinsights_network_profile', $data );
77 77
 		$this->network      = $data;
78 78
 	}
79 79
 
80
-	public function delete_analytics_profile( $migrate = true ){
80
+	public function delete_analytics_profile( $migrate = true ) {
81 81
 		if ( $migrate ) {
82 82
 			$newdata = array();
83 83
 			if ( isset( $this->profile['ua'] ) ) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 	}
93 93
 
94
-	public function delete_network_analytics_profile( $migrate = true ){
94
+	public function delete_network_analytics_profile( $migrate = true ) {
95 95
 		if ( $migrate ) {
96 96
 			$newdata = array();
97 97
 			if ( isset( $this->network['ua'] ) ) {
@@ -181,55 +181,57 @@  discard block
 block discarded – undo
181 181
 		return ! empty( $this->network['ua'] ) ? monsterinsights_is_valid_ua( $this->network['ua'] ) : '';
182 182
 	}
183 183
 
184
-	public function get_viewname(){
184
+	public function get_viewname() {
185 185
 		return ! empty( $this->profile['viewname'] ) ? $this->profile['viewname'] : '';
186 186
 	}
187 187
 
188
-	public function get_network_viewname(){
188
+	public function get_network_viewname() {
189 189
 		return ! empty( $this->network['viewname'] ) ? $this->network['viewname'] : '';
190 190
 	}
191 191
 
192
-	public function get_accountid(){
192
+	public function get_accountid() {
193 193
 		return ! empty( $this->profile['a'] ) ? $this->profile['a'] : '';
194 194
 	}
195 195
 
196
-	public function get_network_accountid(){
196
+	public function get_network_accountid() {
197 197
 		return ! empty( $this->network['a'] ) ? $this->network['a'] : '';
198 198
 	}
199 199
 
200
-	public function get_propertyid(){
200
+	public function get_propertyid() {
201 201
 		return ! empty( $this->profile['w'] ) ? $this->profile['w'] : '';
202 202
 	}
203 203
 
204
-	public function get_network_propertyid(){
204
+	public function get_network_propertyid() {
205 205
 		return ! empty( $this->network['w'] ) ? $this->network['w'] : '';
206 206
 	}
207 207
 
208
-	public function get_viewid(){ // also known as profileID
208
+	public function get_viewid() {
209
+// also known as profileID
209 210
 		return ! empty( $this->profile['p'] ) ? $this->profile['p'] : '';
210 211
 	}
211 212
 
212
-	public function get_network_viewid(){ // also known as profileID
213
+	public function get_network_viewid() {
214
+// also known as profileID
213 215
 		return ! empty( $this->network['p'] ) ? $this->network['p'] : '';
214 216
 	}
215 217
 
216
-	public function get_key(){
218
+	public function get_key() {
217 219
 		return ! empty( $this->profile['key'] ) ? $this->profile['key'] : '';
218 220
 	}
219 221
 
220
-	public function get_network_key(){
222
+	public function get_network_key() {
221 223
 		return ! empty( $this->network['key'] ) ? $this->network['key'] : '';
222 224
 	}
223 225
 
224
-	public function get_token(){
226
+	public function get_token() {
225 227
 		return ! empty( $this->profile['token'] ) ? $this->profile['token'] : '';
226 228
 	}
227 229
 
228
-	public function get_network_token(){
230
+	public function get_network_token() {
229 231
 		return ! empty( $this->network['token'] ) ? $this->network['token'] : '';
230 232
 	}
231 233
 
232
-	public function get_referral_url(){
234
+	public function get_referral_url() {
233 235
 		$url = '';
234 236
 
235 237
 		if ( $this->is_authed() ) {
Please login to merge, or discard this patch.
lite/includes/load.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/settings.php';
4 4
 
5
-if ( is_admin() ) {		
5
+if ( is_admin() ) {
6 6
 	require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/tools.php';
7 7
 
8 8
 	//require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/admin/tab-support.php';
Please login to merge, or discard this patch.