Passed
Branch master (29aa47)
by Chris
05:48
created
lite/includes/admin/reports/report-forms.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		parent::__construct();
24 24
 	}
25 25
 
26
-	protected function get_report_html( $data = array() ){
26
+	protected function get_report_html( $data = array() ) {
27 27
 		return $this->get_upsell_notice();
28 28
 	}
29 29
 }
30 30
\ 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
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		parent::__construct();
24 24
 	}
25 25
 
26
-	protected function get_report_html( $data = array() ){
26
+	protected function get_report_html( $data = array() ) {
27 27
 		return $this->get_upsell_notice();
28 28
 	}
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
includes/license.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 		$license_key  = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key();
88 88
 		return $license_key;
89 89
 	}
90
-	public function get_site_license_key(){
90
+	public function get_site_license_key() {
91 91
 		return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : '';
92 92
 	}
93
-	public function get_network_license_key(){
93
+	public function get_network_license_key() {
94 94
 		return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : '';
95 95
 	}
96 96
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		return $this->licensed;
99 99
 	}
100 100
 
101
-	public function is_site_licensed(){
101
+	public function is_site_licensed() {
102 102
 		return    ! empty( $this->site['key'] ) // has key
103 103
 			   &&   $this->get_site_license_type() // has type
104 104
 			   && ! $this->site_license_expired()  // isn't expired
@@ -117,28 +117,28 @@  discard block
 block discarded – undo
117 117
 	}
118 118
 
119 119
 
120
-	public function get_site_license_updates(){
120
+	public function get_site_license_updates() {
121 121
 		return get_option( 'monsterinsights_license_updates', '' );
122 122
 	}
123
-	public function get_network_license_updates(){
123
+	public function get_network_license_updates() {
124 124
 		return get_site_option( 'monsterinsights_network_license_updates', '' );
125 125
 	}
126 126
 
127
-	public function set_site_license_updates(){
127
+	public function set_site_license_updates() {
128 128
 		update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) );
129 129
 	}
130 130
 	public function set_network_license_updates() {
131 131
 		update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) );
132 132
 	}
133 133
 
134
-	public function delete_site_license_updates(){
134
+	public function delete_site_license_updates() {
135 135
 		delete_option( 'monsterinsights_license_updates' );
136 136
 	}
137
-	public function delete_network_license_updates(){
137
+	public function delete_network_license_updates() {
138 138
 		delete_site_option( 'monsterinsights_license_updates' );
139 139
 	}
140 140
 
141
-	public function time_to_check_site_license(){
141
+	public function time_to_check_site_license() {
142 142
 		$timestamp = get_option( 'monsterinsights_license_updates' );
143 143
 		if ( ! $timestamp ) {
144 144
 			 return true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			}
152 152
 		}
153 153
 	}	
154
-	public function time_to_check_network_license(){
154
+	public function time_to_check_network_license() {
155 155
 		$timestamp = get_site_option( 'monsterinsights_network_license_updates' );
156 156
 		if ( ! $timestamp ) {
157 157
 			 return true;
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 		}
166 166
 	}
167 167
 
168
-	public function set_site_license( $data = array() ){
168
+	public function set_site_license( $data = array() ) {
169 169
 		update_option( 'monsterinsights_license', $data );
170 170
 		$this->set_site_license_updates();
171
-		$this->site      = $data;
171
+		$this->site = $data;
172 172
 	}
173
-	public function set_network_license( $data = array() ){
173
+	public function set_network_license( $data = array() ) {
174 174
 		update_site_option( 'monsterinsights_network_license', $data );
175 175
 		$this->set_network_license_updates();
176
-		$this->network   = $data;
176
+		$this->network = $data;
177 177
 	}
178 178
 
179 179
 	public function delete_site_license() {
180 180
 		delete_option( 'monsterinsights_license' );
181 181
 		$this->delete_site_license_updates();
182
-		$this->site      = array();
182
+		$this->site = array();
183 183
 	}
184 184
 	public function delete_network_license() {
185 185
 		delete_site_option( 'monsterinsights_network_license' );
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 		$this->network = array();
188 188
 	}
189 189
 
190
-	public function get_license_type(){
190
+	public function get_license_type() {
191 191
 		if ( ! $this->has_license() ) {
192 192
 			return false;
193 193
 		}
194 194
 
195 195
 		return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type();
196 196
 	}
197
-	public function get_site_license_type(){
197
+	public function get_site_license_type() {
198 198
 		return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : '';
199 199
 	}
200
-	public function get_network_license_type(){
200
+	public function get_network_license_type() {
201 201
 		return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : '';
202 202
 	}
203 203
 
204
-	public function license_has_error(){
204
+	public function license_has_error() {
205 205
 		if ( ! $this->has_license() ) {
206 206
 			return false;
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			   || $this->site_license_invalid()  // is invalid
216 216
 		;
217 217
 	}
218
-	public function network_license_has_error(){
218
+	public function network_license_has_error() {
219 219
 		return 
220 220
 				  $this->network_license_expired()  // is expired
221 221
 			   || $this->network_license_disabled()  // is disabled
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
 		;
224 224
 	}
225 225
 
226
-	public function license_expired(){
226
+	public function license_expired() {
227 227
 		if ( ! $this->has_license() ) {
228 228
 			return false;
229 229
 		}
230 230
 		
231 231
 		return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired();
232 232
 	}
233
-	public function site_license_expired(){
233
+	public function site_license_expired() {
234 234
 		return ! empty( $this->site['is_expired'] );
235 235
 	}
236
-	public function network_license_expired(){
236
+	public function network_license_expired() {
237 237
 		return ! empty( $this->network['is_expired'] );
238 238
 	}
239 239
 
240
-	public function license_disabled(){
240
+	public function license_disabled() {
241 241
 		if ( ! $this->has_license() ) {
242 242
 			return false;
243 243
 		}
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	public function site_license_disabled() {
248 248
 		return ! empty( $this->site['is_disabled'] );
249 249
 	}
250
-	public function network_license_disabled(){
250
+	public function network_license_disabled() {
251 251
 		return ! empty( $this->network['is_disabled'] );
252 252
 	}
253 253
 
254
-	public function license_invalid(){
254
+	public function license_invalid() {
255 255
 		if ( ! $this->has_license() ) {
256 256
 			return false;
257 257
 		}
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 	public function site_license_invalid() {
262 262
 		return ! empty( $this->site['is_invalid'] );
263 263
 	}
264
-	public function network_license_invalid(){
264
+	public function network_license_invalid() {
265 265
 		return ! empty( $this->network['is_invalid'] );
266 266
 	}
267 267
 
268 268
 
269
-	public function get_license_error(){
269
+	public function get_license_error() {
270 270
 		if ( ! $this->has_license() ) {
271 271
 			return false;
272 272
 		}
273 273
 		
274 274
 		return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error();
275 275
 	}
276
-	public function get_site_license_error(){
276
+	public function get_site_license_error() {
277 277
 		if ( $this->site_license_expired() ) {
278
-			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
278
+			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
279 279
 		} else if ( $this->site_license_disabled() ) {
280 280
 			return esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
281 281
 		} else if ( $this->site_license_invalid() ) {
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
 		return '';
285 285
 	}
286 286
 
287
-	public function get_network_license_error(){
287
+	public function get_network_license_error() {
288 288
 		if ( $this->site_license_expired() ) {
289
-			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
289
+			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="' . monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
290 290
 		} else if ( $this->site_license_disabled() ) {
291 291
 			return esc_html__( 'Your license key for MonsterInsights has been disabled. Please use a different key.', 'google-analytics-for-wordpress' );
292 292
 		} else if ( $this->site_license_invalid() ) {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 		return $can_access;
363 363
 	}
364 364
 
365
-	public function get_default_license_key(){
365
+	public function get_default_license_key() {
366 366
 		if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
367 367
 			return MONSTERINSIGHTS_LICENSE_KEY;
368 368
 		}
Please login to merge, or discard this patch.
Braces   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 		$license_key  = ! empty( $license_key ) ? $license_key : MonsterInsights()->license->get_default_license_key();
88 88
 		return $license_key;
89 89
 	}
90
-	public function get_site_license_key(){
90
+	public function get_site_license_key() {
91 91
 		return ( ! empty( $this->site['key'] ) && is_string( $this->site['key'] ) && strlen( $this->site['key'] ) > 10 ) ? $this->site['key'] : '';
92 92
 	}
93
-	public function get_network_license_key(){
93
+	public function get_network_license_key() {
94 94
 		return ( ! empty( $this->network['key'] ) && is_string( $this->network['key'] ) && strlen( $this->network['key'] ) > 10 ) ? $this->network['key'] : '';
95 95
 	}
96 96
 
97
-	public function has_license() { 
97
+	public function has_license() {
98 98
 		return $this->licensed;
99 99
 	}
100 100
 
101
-	public function is_site_licensed(){
101
+	public function is_site_licensed() {
102 102
 		return    ! empty( $this->site['key'] ) // has key
103 103
 			   &&   $this->get_site_license_type() // has type
104 104
 			   && ! $this->site_license_expired()  // isn't expired
@@ -117,28 +117,28 @@  discard block
 block discarded – undo
117 117
 	}
118 118
 
119 119
 
120
-	public function get_site_license_updates(){
120
+	public function get_site_license_updates() {
121 121
 		return get_option( 'monsterinsights_license_updates', '' );
122 122
 	}
123
-	public function get_network_license_updates(){
123
+	public function get_network_license_updates() {
124 124
 		return get_site_option( 'monsterinsights_network_license_updates', '' );
125 125
 	}
126 126
 
127
-	public function set_site_license_updates(){
127
+	public function set_site_license_updates() {
128 128
 		update_option( 'monsterinsights_license_updates', strtotime( '+8 hours' ) );
129 129
 	}
130 130
 	public function set_network_license_updates() {
131 131
 		update_site_option( 'monsterinsights_network_license_updates', strtotime( '+8 hours' ) );
132 132
 	}
133 133
 
134
-	public function delete_site_license_updates(){
134
+	public function delete_site_license_updates() {
135 135
 		delete_option( 'monsterinsights_license_updates' );
136 136
 	}
137
-	public function delete_network_license_updates(){
137
+	public function delete_network_license_updates() {
138 138
 		delete_site_option( 'monsterinsights_license_updates' );
139 139
 	}
140 140
 
141
-	public function time_to_check_site_license(){
141
+	public function time_to_check_site_license() {
142 142
 		$timestamp = get_option( 'monsterinsights_license_updates' );
143 143
 		if ( ! $timestamp ) {
144 144
 			 return true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			}
152 152
 		}
153 153
 	}	
154
-	public function time_to_check_network_license(){
154
+	public function time_to_check_network_license() {
155 155
 		$timestamp = get_site_option( 'monsterinsights_network_license_updates' );
156 156
 		if ( ! $timestamp ) {
157 157
 			 return true;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 		}
166 166
 	}
167 167
 
168
-	public function set_site_license( $data = array() ){
168
+	public function set_site_license( $data = array() ) {
169 169
 		update_option( 'monsterinsights_license', $data );
170 170
 		$this->set_site_license_updates();
171 171
 		$this->site      = $data;
172 172
 	}
173
-	public function set_network_license( $data = array() ){
173
+	public function set_network_license( $data = array() ) {
174 174
 		update_site_option( 'monsterinsights_network_license', $data );
175 175
 		$this->set_network_license_updates();
176 176
 		$this->network   = $data;
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 		$this->network = array();
188 188
 	}
189 189
 
190
-	public function get_license_type(){
190
+	public function get_license_type() {
191 191
 		if ( ! $this->has_license() ) {
192 192
 			return false;
193 193
 		}
194 194
 
195 195
 		return $this->using_network_license() ? $this->get_network_license_type() : $this->get_site_license_type();
196 196
 	}
197
-	public function get_site_license_type(){
197
+	public function get_site_license_type() {
198 198
 		return ( $this->get_site_license_key() && ! empty( $this->site['type'] ) && $this->is_valid_license_type( $this->site['type'] ) ) ? $this->site['type'] : '';
199 199
 	}
200
-	public function get_network_license_type(){
200
+	public function get_network_license_type() {
201 201
 		return ( $this->get_network_license_key() && ! empty( $this->network['type'] ) && $this->is_valid_license_type( $this->network['type'] ) ) ? $this->network['type'] : '';
202 202
 	}
203 203
 
204
-	public function license_has_error(){
204
+	public function license_has_error() {
205 205
 		if ( ! $this->has_license() ) {
206 206
 			return false;
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			   || $this->site_license_invalid()  // is invalid
216 216
 		;
217 217
 	}
218
-	public function network_license_has_error(){
218
+	public function network_license_has_error() {
219 219
 		return 
220 220
 				  $this->network_license_expired()  // is expired
221 221
 			   || $this->network_license_disabled()  // is disabled
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
 		;
224 224
 	}
225 225
 
226
-	public function license_expired(){
226
+	public function license_expired() {
227 227
 		if ( ! $this->has_license() ) {
228 228
 			return false;
229 229
 		}
230 230
 		
231 231
 		return $this->using_network_license() ? $this->network_license_expired() : $this->site_license_expired();
232 232
 	}
233
-	public function site_license_expired(){
233
+	public function site_license_expired() {
234 234
 		return ! empty( $this->site['is_expired'] );
235 235
 	}
236
-	public function network_license_expired(){
236
+	public function network_license_expired() {
237 237
 		return ! empty( $this->network['is_expired'] );
238 238
 	}
239 239
 
240
-	public function license_disabled(){
240
+	public function license_disabled() {
241 241
 		if ( ! $this->has_license() ) {
242 242
 			return false;
243 243
 		}
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	public function site_license_disabled() {
248 248
 		return ! empty( $this->site['is_disabled'] );
249 249
 	}
250
-	public function network_license_disabled(){
250
+	public function network_license_disabled() {
251 251
 		return ! empty( $this->network['is_disabled'] );
252 252
 	}
253 253
 
254
-	public function license_invalid(){
254
+	public function license_invalid() {
255 255
 		if ( ! $this->has_license() ) {
256 256
 			return false;
257 257
 		}
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
 	public function site_license_invalid() {
262 262
 		return ! empty( $this->site['is_invalid'] );
263 263
 	}
264
-	public function network_license_invalid(){
264
+	public function network_license_invalid() {
265 265
 		return ! empty( $this->network['is_invalid'] );
266 266
 	}
267 267
 
268 268
 
269
-	public function get_license_error(){
269
+	public function get_license_error() {
270 270
 		if ( ! $this->has_license() ) {
271 271
 			return false;
272 272
 		}
273 273
 		
274 274
 		return $this->using_network_license() ? $this->get_network_license_error() : $this->get_site_license_error();
275 275
 	}
276
-	public function get_site_license_error(){
276
+	public function get_site_license_error() {
277 277
 		if ( $this->site_license_expired() ) {
278 278
 			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
279 279
 		} else if ( $this->site_license_disabled() ) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		return '';
285 285
 	}
286 286
 
287
-	public function get_network_license_error(){
287
+	public function get_network_license_error() {
288 288
 		if ( $this->site_license_expired() ) {
289 289
 			return sprintf( esc_html__( 'Your license key for MonsterInsights has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-for-wordpress' ), '<a href="'. monsterinsights_get_url( 'license-error', 'expired-license', 'https://www.monsterinsights.com/login/' ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
290 290
 		} else if ( $this->site_license_disabled() ) {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		return '';
296 296
 	}
297 297
 
298
-	public function license_can( $requires = 'lite' ) {		
298
+	public function license_can( $requires = 'lite' ) {
299 299
 		if ( ! monsterinsights_is_pro_version() || ! $this->has_license() ) {
300 300
 			return $requires === 'lite';
301 301
 		}
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 		return $can_access;
363 363
 	}
364 364
 
365
-	public function get_default_license_key(){
365
+	public function get_default_license_key() {
366 366
 		if ( defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
367 367
 			return MONSTERINSIGHTS_LICENSE_KEY;
368 368
 		}
Please login to merge, or discard this patch.
includes/admin/tracking.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		$data['usagetracking'] = get_option( 'monsterinsights_usage_tracking_config', false );
95 95
 		$data['usercount']     = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set';
96 96
 		$data['usesauth']      = $usesauth;
97
-		$data['timezoneoffset']= date('P');
98
-		$data['installed_lite']= get_option( 'monsterinsights_installed_lite', array() );
97
+		$data['timezoneoffset'] = date( 'P' );
98
+		$data['installed_lite'] = get_option( 'monsterinsights_installed_lite', array() );
99 99
 		$data['installed_pro'] = get_option( 'monsterinsights_installed_pro', array() );
100 100
 
101 101
 
102 102
 
103 103
 		// Retrieve current plugin information
104
-		if( ! function_exists( 'get_plugins' ) ) {
104
+		if ( ! function_exists( 'get_plugins' ) ) {
105 105
 			include ABSPATH . '/wp-admin/includes/plugin.php';
106 106
 		}
107 107
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		foreach ( $plugins as $key => $plugin ) {
112 112
 			if ( in_array( $plugin, $active_plugins ) ) {
113 113
 				// Remove active plugins from list so we can show active and inactive separately
114
-				unset( $plugins[ $key ] );
114
+				unset( $plugins[$key] );
115 115
 			}
116 116
 		}
117 117
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			return false;
130 130
 		}
131 131
 
132
-		if( ! $this->tracking_allowed() && ! $override ) {
132
+		if ( ! $this->tracking_allowed() && ! $override ) {
133 133
 			return false;
134 134
 		}
135 135
 
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	public function schedule_send() {
162 162
 		if ( ! wp_next_scheduled( 'monsterinsights_usage_tracking_cron' ) ) {
163 163
 			$tracking             = array();
164
-			$tracking['day']      = rand( 0, 6  );
164
+			$tracking['day']      = rand( 0, 6 );
165 165
 			$tracking['hour']     = rand( 0, 23 );
166 166
 			$tracking['minute']   = rand( 0, 59 );
167 167
 			$tracking['second']   = rand( 0, 59 );
168
-			$tracking['offset']   = ( $tracking['day']    * DAY_IN_SECONDS    ) +
169
-									( $tracking['hour']   * HOUR_IN_SECONDS   ) +
168
+			$tracking['offset']   = ( $tracking['day'] * DAY_IN_SECONDS ) +
169
+									( $tracking['hour'] * HOUR_IN_SECONDS ) +
170 170
 									( $tracking['minute'] * MINUTE_IN_SECONDS ) +
171 171
 									 $tracking['second'];
172
-			$tracking['initsend'] = strtotime("next sunday") + $tracking['offset'];
172
+			$tracking['initsend'] = strtotime( "next sunday" ) + $tracking['offset'];
173 173
 
174 174
 			wp_schedule_event( $tracking['initsend'], 'weekly', 'monsterinsights_usage_tracking_cron' );
175 175
 			update_option( 'monsterinsights_usage_tracking_config', $tracking );
Please login to merge, or discard this patch.
lite/includes/admin/reports/report-realtime.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		parent::__construct();
24 24
 	}
25 25
 
26
-	protected function get_report_html( $data = array() ){
26
+	protected function get_report_html( $data = array() ) {
27 27
 		return $this->get_upsell_notice();
28 28
 	}
29 29
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		parent::__construct();
24 24
 	}
25 25
 
26
-	protected function get_report_html( $data = array() ){
26
+	protected function get_report_html( $data = array() ) {
27 27
 		return $this->get_upsell_notice();
28 28
 	}
29 29
 }
Please login to merge, or discard this patch.
googleanalytics.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return void
504 504
 	 */
505
-	public function load_licensing(){
505
+	public function load_licensing() {
506 506
 		if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
507 507
 			require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php';
508 508
 			self::$instance->license = new MonsterInsights_License();
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
  *
796 796
  * @return void
797 797
  */
798
-function monsterinsights_lite_call_install_and_upgrade(){
798
+function monsterinsights_lite_call_install_and_upgrade() {
799 799
 	add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' );
800 800
 }
801 801
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 				self::$instance->notices          = new MonsterInsights_Notice_Admin();
234 234
 				self::$instance->license_actions  = new MonsterInsights_License_Actions();
235 235
 				self::$instance->reporting 	      = new MonsterInsights_Reporting();
236
-				self::$instance->api_auth    	  = new MonsterInsights_API_Auth();
236
+				self::$instance->api_auth = new MonsterInsights_API_Auth();
237 237
 				if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
238 238
 					self::$instance->require_updater();
239 239
 				} else {
240 240
 					add_action( 'admin_init', array( self::$instance, 'require_updater' ) );
241 241
 				}
242 242
 
243
-				self::$instance->routes 		  = new MonsterInsights_Rest_Routes();
243
+				self::$instance->routes = new MonsterInsights_Rest_Routes();
244 244
 			}
245 245
 
246 246
 			if ( monsterinsights_is_pro_version() ) {
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
 		}
352 352
 
353 353
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_DIR' ) ) {
354
-			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file )  );
354
+			define( 'MONSTERINSIGHTS_PLUGIN_DIR', plugin_dir_path( $this->file ) );
355 355
 		}
356 356
 
357 357
 		if ( ! defined( 'MONSTERINSIGHTS_PLUGIN_URL' ) ) {
358
-			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file )  );
358
+			define( 'MONSTERINSIGHTS_PLUGIN_URL', plugin_dir_url( $this->file ) );
359 359
 		}
360 360
 	}
361 361
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		}
376 376
 
377 377
 		// Traditional WordPress plugin locale filter.
378
-		$mi_locale  = apply_filters( 'plugin_locale',  $mi_locale, 'google-analytics-for-wordpress' );
378
+		$mi_locale  = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-for-wordpress' );
379 379
 		$mi_mofile  = sprintf( '%1$s-%2$s.mo', 'google-analytics-for-wordpress', $mi_locale );
380 380
 
381 381
 		// Look for wp-content/languages/google-analytics-for-wordpress/google-analytics-for-wordpress-{lang}_{country}.mo
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	public function monsterinsights_wp_notice() {
415 415
 		$url = admin_url( 'plugins.php' );
416 416
 		// Check for MS dashboard
417
-		if( is_network_admin() ) {
417
+		if ( is_network_admin() ) {
418 418
 			$url = network_admin_url( 'plugins.php' );
419 419
 		}
420 420
 		?>
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	public function monsterinsights_pro_notice() {
436 436
 		$url = admin_url( 'plugins.php' );
437 437
 		// Check for MS dashboard
438
-		if( is_network_admin() ) {
438
+		if ( is_network_admin() ) {
439 439
 			$url = network_admin_url( 'plugins.php' );
440 440
 		}
441 441
 		?>
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/options.php';
462 462
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/helpers.php';
463 463
 		require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/deprecated.php';
464
-		$monsterinsights_settings  = monsterinsights_get_options();
464
+		$monsterinsights_settings = monsterinsights_get_options();
465 465
 	}
466 466
 
467 467
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 *
476 476
 	 * @return void
477 477
 	 */
478
-	public function load_licensing(){
478
+	public function load_licensing() {
479 479
 		if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
480 480
 			require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/license.php';
481 481
 			self::$instance->license = new MonsterInsights_License();
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			$instance->api_auth->delete_auth();
643 643
 
644 644
 			// Delete data
645
-			$instance->reporting->delete_aggregate_data('site');
645
+			$instance->reporting->delete_aggregate_data( 'site' );
646 646
 
647 647
 			// Delete license
648 648
 			$instance->license->delete_site_license();
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$instance->api_auth->uninstall_network_auth();
654 654
 
655 655
 		// Delete network data
656
-		$instance->reporting->delete_aggregate_data('network');
656
+		$instance->reporting->delete_aggregate_data( 'network' );
657 657
 
658 658
 		// Delete network license
659 659
 		$instance->license->delete_network_license();
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 		$instance->api_auth->delete_auth();
663 663
 
664 664
 		// Delete data
665
-		$instance->reporting->delete_aggregate_data('site');
665
+		$instance->reporting->delete_aggregate_data( 'site' );
666 666
 
667 667
 		// Delete license
668 668
 		$instance->license->delete_site_license();
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
  *
757 757
  * @return void
758 758
  */
759
-function monsterinsights_lite_call_install_and_upgrade(){
759
+function monsterinsights_lite_call_install_and_upgrade() {
760 760
 	add_action( 'wp_loaded', 'monsterinsights_lite_install_and_upgrade' );
761 761
 }
762 762
 
Please login to merge, or discard this patch.
includes/admin/licensing/updater.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -105,39 +105,39 @@  discard block
 block discarded – undo
105 105
      * @param array $config Array of updater config args.
106 106
      */
107 107
     public function __construct( array $config ) {
108
-        // Set class properties.
109
-        $accepted_args = array(
110
-            'plugin_name',
111
-            'plugin_slug',
112
-            'plugin_path',
113
-            'plugin_url',
114
-            'remote_url',
115
-            'version',
116
-            'key'
117
-        );
118
-        foreach ( $accepted_args as $arg ) {
119
-            $this->$arg = $config[$arg];
120
-        }
121
-
122
-        // If the user cannot update plugins, stop processing here.
123
-        if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) {
124
-            return;
125
-        }
126
-
127
-        // If it's our site, then return so we don't redirect loop.
128
-        if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) {
129
-            return;
130
-        }
131
-
132
-        // Load the updater hooks and filters.
133
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) );
134
-
135
-        add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
136
-        add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
137
-
138
-        // ManageWP premium update filters
139
-        //add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) );
140
-        //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) );
108
+	// Set class properties.
109
+	$accepted_args = array(
110
+	    'plugin_name',
111
+	    'plugin_slug',
112
+	    'plugin_path',
113
+	    'plugin_url',
114
+	    'remote_url',
115
+	    'version',
116
+	    'key'
117
+	);
118
+	foreach ( $accepted_args as $arg ) {
119
+	    $this->$arg = $config[$arg];
120
+	}
121
+
122
+	// If the user cannot update plugins, stop processing here.
123
+	if ( ! current_user_can( 'update_plugins' ) && ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) ) {
124
+	    return;
125
+	}
126
+
127
+	// If it's our site, then return so we don't redirect loop.
128
+	if ( strpos( site_url(), 'monsterinsights.com' ) !== false ) {
129
+	    return;
130
+	}
131
+
132
+	// Load the updater hooks and filters.
133
+	add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_filter' ) );
134
+
135
+	add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
136
+	add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
137
+
138
+	// ManageWP premium update filters
139
+	//add_filter( 'mwp_premium_update_notification', array( $this, 'premium_update_push' ) );
140
+	//add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) );
141 141
 
142 142
 	    // Add additional info if the license is expired.
143 143
 	    add_action( 'in_plugin_update_message-'. $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 );
@@ -162,33 +162,33 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function update_plugins_filter( $value ) {
164 164
 
165
-        // If no update object exists, return early.
166
-        if ( empty( $value ) ) {
167
-            return $value;
168
-        }
169
-
170
-        // Run update check by pinging the external API. If it fails, return the default update object.
171
-        if ( ! $this->update ) {
172
-            $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
173
-            if ( ! $this->update || ! empty( $this->update->error ) ) {
174
-                $this->update = false;
175
-                return $value;
176
-            }
177
-        }
178
-
179
-        // Infuse the update object with our data if the version from the remote API is newer.
180
-        if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) {
181
-            // The $plugin_update object contains new_version, package, slug and last_update keys.
182
-            //$this->update->full_slug             = $this->plugin_slug;
183
-            //$this->update->name                  = $this->plugin_name;
184
-            $this->update->monsterinsights_plugin  = true;
185
-            $this->update->old_version             = $this->version;
186
-            $this->update->plugin                  = $this->plugin_path;
187
-            $value->response[$this->plugin_path]   = $this->update;
188
-        }
189
-
190
-        // Return the update object.
191
-        return $value;
165
+	// If no update object exists, return early.
166
+	if ( empty( $value ) ) {
167
+	    return $value;
168
+	}
169
+
170
+	// Run update check by pinging the external API. If it fails, return the default update object.
171
+	if ( ! $this->update ) {
172
+	    $this->update = $this->perform_remote_request( 'get-plugin-update', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
173
+	    if ( ! $this->update || ! empty( $this->update->error ) ) {
174
+		$this->update = false;
175
+		return $value;
176
+	    }
177
+	}
178
+
179
+	// Infuse the update object with our data if the version from the remote API is newer.
180
+	if ( isset( $this->update->new_version ) && version_compare( $this->version, $this->update->new_version, '<' ) ) {
181
+	    // The $plugin_update object contains new_version, package, slug and last_update keys.
182
+	    //$this->update->full_slug             = $this->plugin_slug;
183
+	    //$this->update->name                  = $this->plugin_name;
184
+	    $this->update->monsterinsights_plugin  = true;
185
+	    $this->update->old_version             = $this->version;
186
+	    $this->update->plugin                  = $this->plugin_path;
187
+	    $value->response[$this->plugin_path]   = $this->update;
188
+	}
189
+
190
+	// Return the update object.
191
+	return $value;
192 192
 
193 193
     }
194 194
 
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function http_request_args( $args, $url ) {
205 205
 
206
-        // If this is an SSL request and we are performing an upgrade routine, disable SSL verification.
207
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) {
208
-            $args['sslverify'] = false;
209
-        }
206
+	// If this is an SSL request and we are performing an upgrade routine, disable SSL verification.
207
+	if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'tgm-updater-action=get-plugin-update' ) ) {
208
+	    $args['sslverify'] = false;
209
+	}
210 210
 
211
-        return $args;
211
+	return $args;
212 212
 
213 213
     }
214 214
 
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function plugins_api( $api, $action = '', $args = null ) {
227 227
 
228
-        $plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug );
228
+	$plugin = ( 'plugin_information' == $action ) && isset( $args->slug ) && ( $this->plugin_slug == $args->slug );
229 229
 
230
-        // If our plugin matches the request, set our own plugin data, else return the default response.
231
-        if ( $plugin ) {
232
-            return $this->set_plugins_api( $api );
233
-        } else {
234
-            return $api;
235
-        }
230
+	// If our plugin matches the request, set our own plugin data, else return the default response.
231
+	if ( $plugin ) {
232
+	    return $this->set_plugins_api( $api );
233
+	} else {
234
+	    return $api;
235
+	}
236 236
 
237 237
     }
238 238
 
@@ -246,82 +246,82 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function set_plugins_api( $default_api ) {
248 248
 
249
-        // Perform the remote request to retrieve our plugin information. If it fails, return the default object.
250
-        if ( ! $this->info ) {
251
-            $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
252
-            if ( ! $this->info || ! empty( $this->info->error ) ) {
253
-                $this->info = false;
254
-                return $default_api;
255
-            }
256
-        }
257
-
258
-        // Create a new stdClass object and populate it with our plugin information.
259
-        $api                        = new stdClass;
260
-        $api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
261
-        $api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
262
-        $api->version               = isset( $this->info->version )        ? $this->info->version        : '';
263
-        $api->author                = isset( $this->info->author )         ? $this->info->author         : '';
264
-        $api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
265
-        $api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
266
-        $api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
267
-        $api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
268
-        $api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
269
-
270
-        $changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
271
-        $description                = isset( $this->info->description )    ? $this->info->description     : '';
272
-
273
-        if ( ! empty( $changelog ) ) {
274
-             if ( ! empty( $description ) ) {
275
-                $api->sections['description'] = $description;
276
-                $api->sections['changelog']   = $changelog;
277
-             } else {
278
-                $api->sections['changelog']   = $changelog;
279
-             }
280
-        } else if ( ! empty( $description ) ) {
281
-            $api->sections['description'] = $description;
282
-        } else {
283
-            $api->sections = array();
284
-        }
285
-
286
-        $api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
287
-
288
-        // Return the new API object with our custom data.
289
-        return $api;
249
+	// Perform the remote request to retrieve our plugin information. If it fails, return the default object.
250
+	if ( ! $this->info ) {
251
+	    $this->info = $this->perform_remote_request( 'get-plugin-info', array( 'tgm-updater-plugin' => $this->plugin_slug ) );
252
+	    if ( ! $this->info || ! empty( $this->info->error ) ) {
253
+		$this->info = false;
254
+		return $default_api;
255
+	    }
256
+	}
257
+
258
+	// Create a new stdClass object and populate it with our plugin information.
259
+	$api                        = new stdClass;
260
+	$api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
261
+	$api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
262
+	$api->version               = isset( $this->info->version )        ? $this->info->version        : '';
263
+	$api->author                = isset( $this->info->author )         ? $this->info->author         : '';
264
+	$api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
265
+	$api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
266
+	$api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
267
+	$api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
268
+	$api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
269
+
270
+	$changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
271
+	$description                = isset( $this->info->description )    ? $this->info->description     : '';
272
+
273
+	if ( ! empty( $changelog ) ) {
274
+	     if ( ! empty( $description ) ) {
275
+		$api->sections['description'] = $description;
276
+		$api->sections['changelog']   = $changelog;
277
+	     } else {
278
+		$api->sections['changelog']   = $changelog;
279
+	     }
280
+	} else if ( ! empty( $description ) ) {
281
+	    $api->sections['description'] = $description;
282
+	} else {
283
+	    $api->sections = array();
284
+	}
285
+
286
+	$api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
287
+
288
+	// Return the new API object with our custom data.
289
+	return $api;
290 290
 
291 291
     }
292 292
 
293 293
     // Integration with ManageWP
294 294
     public function premium_update_push( $premium_update ) {
295
-        if ( ! function_exists( 'get_plugin_data' ) ) {
296
-            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
297
-        }
298
-
299
-        $update = $this->set_plugins_api( array() );
300
-        if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
301
-            $plugin_data                = get_plugin_data( $update->slug );
302
-            $plugin_data['type']        = 'plugin';
303
-            $plugin_data['slug']        = $update->slug;
304
-            $plugin_data['new_version'] = $update->version;
305
-            $premium_update[]           = $plugin_data;
306
-        }
307
-        return $premium_update;
295
+	if ( ! function_exists( 'get_plugin_data' ) ) {
296
+	    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
297
+	}
298
+
299
+	$update = $this->set_plugins_api( array() );
300
+	if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
301
+	    $plugin_data                = get_plugin_data( $update->slug );
302
+	    $plugin_data['type']        = 'plugin';
303
+	    $plugin_data['slug']        = $update->slug;
304
+	    $plugin_data['new_version'] = $update->version;
305
+	    $premium_update[]           = $plugin_data;
306
+	}
307
+	return $premium_update;
308 308
     }
309 309
 
310 310
     // Integration with ManageWP
311 311
     public function premium_update( $premium_update ) {
312
-        if ( ! function_exists( 'get_plugin_data' ) ) {
313
-            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
314
-        }
315
-
316
-        $update = $this->set_plugins_api( array() );
317
-        if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
318
-            $plugin_data                = get_plugin_data( $update->slug );
319
-            $plugin_data['type']        = 'plugin';
320
-            $plugin_data['slug']        = $update->slug;
321
-            $plugin_data['url']         = $update->download_link; // OR provide your own callback function for managing the update
322
-            array_push( $premium_update, $plugin_data );
323
-        }
324
-        return $premium_update;
312
+	if ( ! function_exists( 'get_plugin_data' ) ) {
313
+	    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
314
+	}
315
+
316
+	$update = $this->set_plugins_api( array() );
317
+	if ( ! empty( $update ) && version_compare( MONSTERINSIGHTS_VERSION, $update->version, '<' ) ) {
318
+	    $plugin_data                = get_plugin_data( $update->slug );
319
+	    $plugin_data['type']        = 'plugin';
320
+	    $plugin_data['slug']        = $update->slug;
321
+	    $plugin_data['url']         = $update->download_link; // OR provide your own callback function for managing the update
322
+	    array_push( $premium_update, $plugin_data );
323
+	}
324
+	return $premium_update;
325 325
     }
326 326
 
327 327
     /**
@@ -337,47 +337,47 @@  discard block
 block discarded – undo
337 337
      */
338 338
     public function perform_remote_request( $action, $body = array(), $headers = array(), $return_format = 'json' ) {
339 339
 
340
-        // Build the body of the request.
341
-        $body = wp_parse_args(
342
-            $body,
343
-            array(
344
-                'tgm-updater-action'     => $action,
345
-                'tgm-updater-key'        => $this->key,
346
-                'tgm-updater-wp-version' => get_bloginfo( 'version' ),
347
-                'tgm-updater-referer'    => site_url(),
348
-                'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
349
-                'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
350
-            )
351
-        );
352
-        $body = http_build_query( $body, '', '&' );
353
-
354
-        // Build the headers of the request.
355
-        $headers = wp_parse_args(
356
-            $headers,
357
-            array(
358
-                'Content-Type'   => 'application/x-www-form-urlencoded',
359
-                'Content-Length' => strlen( $body )
360
-            )
361
-        );
362
-
363
-        // Setup variable for wp_remote_post.
364
-        $post = array(
365
-            'headers' => $headers,
366
-            'body'    => $body
367
-        );
368
-
369
-        // Perform the query and retrieve the response.
370
-        $response      = wp_remote_post( esc_url_raw( $this->remote_url ), $post );
371
-        $response_code = wp_remote_retrieve_response_code( $response );
372
-        $response_body = wp_remote_retrieve_body( $response );
373
-
374
-        // Bail out early if there are any errors.
375
-        if ( 200 != $response_code || is_wp_error( $response_body ) ) {
376
-            return false;
377
-        }
378
-
379
-        // Return the json decoded content.
380
-        return json_decode( $response_body );
340
+	// Build the body of the request.
341
+	$body = wp_parse_args(
342
+	    $body,
343
+	    array(
344
+		'tgm-updater-action'     => $action,
345
+		'tgm-updater-key'        => $this->key,
346
+		'tgm-updater-wp-version' => get_bloginfo( 'version' ),
347
+		'tgm-updater-referer'    => site_url(),
348
+		'tgm-updater-mi-version' => MONSTERINSIGHTS_VERSION,
349
+		'tgm-updater-is-pro'     => monsterinsights_is_pro_version(),
350
+	    )
351
+	);
352
+	$body = http_build_query( $body, '', '&' );
353
+
354
+	// Build the headers of the request.
355
+	$headers = wp_parse_args(
356
+	    $headers,
357
+	    array(
358
+		'Content-Type'   => 'application/x-www-form-urlencoded',
359
+		'Content-Length' => strlen( $body )
360
+	    )
361
+	);
362
+
363
+	// Setup variable for wp_remote_post.
364
+	$post = array(
365
+	    'headers' => $headers,
366
+	    'body'    => $body
367
+	);
368
+
369
+	// Perform the query and retrieve the response.
370
+	$response      = wp_remote_post( esc_url_raw( $this->remote_url ), $post );
371
+	$response_code = wp_remote_retrieve_response_code( $response );
372
+	$response_body = wp_remote_retrieve_body( $response );
373
+
374
+	// Bail out early if there are any errors.
375
+	if ( 200 != $response_code || is_wp_error( $response_body ) ) {
376
+	    return false;
377
+	}
378
+
379
+	// Return the json decoded content.
380
+	return json_decode( $response_body );
381 381
 
382 382
     }
383 383
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         //add_filter( 'mwp_premium_perform_update', array( $this, 'premium_update' ) );
141 141
 
142 142
 	    // Add additional info if the license is expired.
143
-	    add_action( 'in_plugin_update_message-'. $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 );
143
+	    add_action( 'in_plugin_update_message-' . $this->plugin_path, array( $this, 'maybe_show_license_expired_message' ), 10, 2 );
144 144
     }
145 145
 
146 146
 	public function maybe_show_license_expired_message( $plugin_data, $response ) {
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 
258 258
         // Create a new stdClass object and populate it with our plugin information.
259 259
         $api                        = new stdClass;
260
-        $api->name                  = isset( $this->info->name )           ? $this->info->name           : '';
261
-        $api->slug                  = isset( $this->info->slug )           ? $this->info->slug           : '';
262
-        $api->version               = isset( $this->info->version )        ? $this->info->version        : '';
263
-        $api->author                = isset( $this->info->author )         ? $this->info->author         : '';
260
+        $api->name                  = isset( $this->info->name ) ? $this->info->name : '';
261
+        $api->slug                  = isset( $this->info->slug ) ? $this->info->slug : '';
262
+        $api->version               = isset( $this->info->version ) ? $this->info->version : '';
263
+        $api->author                = isset( $this->info->author ) ? $this->info->author : '';
264 264
         $api->author_profile        = isset( $this->info->author_profile ) ? $this->info->author_profile : '';
265
-        $api->requires              = isset( $this->info->requires )       ? $this->info->requires       : '';
266
-        $api->tested                = isset( $this->info->tested )         ? $this->info->tested         : '';
267
-        $api->last_updated          = isset( $this->info->last_updated )   ? $this->info->last_updated   : '';
268
-        $api->homepage              = isset( $this->info->homepage )       ? $this->info->homepage       : '';
265
+        $api->requires              = isset( $this->info->requires ) ? $this->info->requires : '';
266
+        $api->tested                = isset( $this->info->tested ) ? $this->info->tested : '';
267
+        $api->last_updated          = isset( $this->info->last_updated ) ? $this->info->last_updated : '';
268
+        $api->homepage              = isset( $this->info->homepage ) ? $this->info->homepage : '';
269 269
 
270
-        $changelog                  = isset( $this->info->changelog )      ? $this->info->changelog       : '';
271
-        $description                = isset( $this->info->description )    ? $this->info->description     : '';
270
+        $changelog                  = isset( $this->info->changelog ) ? $this->info->changelog : '';
271
+        $description                = isset( $this->info->description ) ? $this->info->description : '';
272 272
 
273 273
         if ( ! empty( $changelog ) ) {
274 274
              if ( ! empty( $description ) ) {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             $api->sections = array();
284 284
         }
285 285
 
286
-        $api->download_link         = isset( $this->info->download_link )  ? $this->info->download_link  : '';
286
+        $api->download_link = isset( $this->info->download_link ) ? $this->info->download_link : '';
287 287
 
288 288
         // Return the new API object with our custom data.
289 289
         return $api;
Please login to merge, or discard this patch.
lite/includes/admin/onboarding-wizard.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@
 block discarded – undo
270 270
 			),
271 271
 			admin_url( 'admin.php' )
272 272
 		);
273
-		$url    = esc_url( $url );
273
+		$url = esc_url( $url );
274 274
 
275 275
 		ob_start();
276 276
 		if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@
 block discarded – undo
52 52
 		// Check for wizard-specific parameter
53 53
 		// Allow plugins to disable the onboarding wizard
54 54
 		// Check if current user is allowed to save settings.
55
-		if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) { // WPCS: CSRF ok, input var ok.
55
+		if ( ! ( isset( $_GET['page'] ) || 'monsterinsights-onboarding' !== $_GET['page'] || apply_filters( 'monsterinsights_enable_onboarding_wizard', true ) || ! current_user_can( 'monsterinsights_save_settings' ) ) ) {
56
+// WPCS: CSRF ok, input var ok.
56 57
 			return;
57 58
 		}
58 59
 
Please login to merge, or discard this patch.
lite/includes/admin/welcome.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@
 block discarded – undo
28 28
 		delete_transient( '_monsterinsights_activation_redirect' );
29 29
 
30 30
 		// Bail if activating from network, or bulk.
31
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { // WPCS: CSRF ok, input var ok.
31
+		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
32
+// WPCS: CSRF ok, input var ok.
32 33
 			return;
33 34
 		}
34 35
 
Please login to merge, or discard this patch.
includes/api-request.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -155,25 +155,25 @@  discard block
 block discarded – undo
155 155
 		$this->network   = is_network_admin() || ! empty( $args['network'] );
156 156
 
157 157
 		$default_token   = $this->network ? MonsterInsights()->auth->get_network_token() : MonsterInsights()->auth->get_token();
158
-		$default_key     = $this->network ? MonsterInsights()->auth->get_network_key()   : MonsterInsights()->auth->get_key();
158
+		$default_key     = $this->network ? MonsterInsights()->auth->get_network_key() : MonsterInsights()->auth->get_key();
159 159
 
160
-		$this->token     = ! empty( $args['token'] )     ? $args['token']  : $default_token;
161
-		$this->key       = ! empty( $args['key'] ) 	     ? $args['key']    : $default_key;
162
-		$this->tt        = ! empty( $args['tt'] ) 		 ? $args['tt']     : '';
163
-		$this->return    = ! empty( $args['return'] )    ? $args['return'] : '';
164
-		$this->start     = ! empty( $args['start'] )	 ? $args['start']  : '';
165
-		$this->end       = ! empty( $args['end'] )  	 ? $args['end']    : '';
160
+		$this->token     = ! empty( $args['token'] ) ? $args['token'] : $default_token;
161
+		$this->key       = ! empty( $args['key'] ) ? $args['key'] : $default_key;
162
+		$this->tt        = ! empty( $args['tt'] ) ? $args['tt'] : '';
163
+		$this->return    = ! empty( $args['return'] ) ? $args['return'] : '';
164
+		$this->start     = ! empty( $args['start'] ) ? $args['start'] : '';
165
+		$this->end       = ! empty( $args['end'] ) ? $args['end'] : '';
166 166
 
167 167
 		// We need to do this hack so that the network panel + the site_url of the main site are distinct
168 168
 		$this->site_url  = is_network_admin() ? network_admin_url() : site_url();
169 169
 
170 170
 		if ( monsterinsights_is_pro_version() ) {
171
-			$this->license   = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
171
+			$this->license = $this->network ? MonsterInsights()->license->get_network_license_key() : MonsterInsights()->license->get_site_license_key();
172 172
 		}
173 173
 		$this->plugin    = MonsterInsights()->plugin_slug;
174 174
 		$this->miversion = MONSTERINSIGHTS_VERSION;
175
-		$this->sitei     = ! empty( $args['sitei'] )   ? $args['sitei'] : '';
176
-		$this->testurl   = ! empty( $args['testurl'] ) ? $args['testurl']    : '';
175
+		$this->sitei     = ! empty( $args['sitei'] ) ? $args['sitei'] : '';
176
+		$this->testurl   = ! empty( $args['testurl'] ) ? $args['testurl'] : '';
177 177
 	}
178 178
 
179 179
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	public function request() {
187 187
 		// Make sure we're not blocked
188 188
 		$blocked = $this->is_blocked( $this->url );
189
-		if ( $blocked || is_wp_error( $blocked )  ) {
189
+		if ( $blocked || is_wp_error( $blocked ) ) {
190 190
 			if ( is_wp_error( $blocked ) ) {
191 191
 				return new WP_Error( 'api-error', sprintf( __( 'The firewall of your server is blocking outbound calls. Please contact your hosting provider to fix this issue. %s', 'google-analytics-for-wordpress' ), $blocked->get_error_message() ) );
192 192
 			} else {
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 		}
244 244
 
245 245
 		if ( 'GET' == $this->method ) {
246
-			$body['time']   = time(); // just to avoid caching
246
+			$body['time'] = time(); // just to avoid caching
247 247
 		}
248 248
 
249
-		$body['timezone'] = date('e');
249
+		$body['timezone'] = date( 'e' );
250 250
 
251 251
 		$body['network']  = $this->network ? 'network' : 'site';
252 252
 
253
-		$body['ip']   = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '';
253
+		$body['ip'] = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : '';
254 254
 
255 255
 		// This filter will be removed in the future.
256 256
 		$body   = apply_filters( 'monsterinsights_api_request_body', $body );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		);
282 282
 
283 283
 		// Perform the query and retrieve the response.
284
-		$response      = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data );
284
+		$response = 'GET' == $this->method ? wp_remote_get( esc_url_raw( $this->url ) . '?' . $string, $data ) : wp_remote_post( esc_url_raw( $this->url ), $data );
285 285
 
286 286
 		//return new WP_Error( 'debug', '<pre>' . var_export( $response, true ) . '</pre>' );
287 287
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
 		// If not a 200 status header, send back error.
302 302
 		if ( 200 != $response_code ) {
303
-			$type  = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error';
303
+			$type = ! empty( $response_body['type'] ) ? $response_body['type'] : 'api-error';
304 304
 
305 305
 			if ( empty( $response_code ) ) {
306 306
 				return new WP_Error( $type, __( 'The API was unreachable.', 'google-analytics-for-wordpress' ) );
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		// and for image linking purposes in Google Images. We use it to test outbound connections since it is run on google.com
388 388
 		// and is only a few bytes large. Plus on Google's main CDN so it loads in most places in 0.07 seconds or less. Perfect for our
389 389
 		// use case of quickly testing outbound connections. 
390
-		$testurl = ! empty( $this->testurl ) ? $this->testurl :'http://www.google.com/blank.html';
390
+		$testurl = ! empty( $this->testurl ) ? $this->testurl : 'http://www.google.com/blank.html';
391 391
 		if ( defined( 'WP_HTTP_BLOCK_EXTERNAL' ) && WP_HTTP_BLOCK_EXTERNAL ) {
392 392
 			if ( defined( 'WP_ACCESSIBLE_HOSTS' ) ) {
393 393
 				$wp_http      = new WP_Http();
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 						'body'          => ''
403 403
 					);
404 404
 					$response = wp_remote_get( $testurl, $params );
405
-					if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
405
+					if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
406 406
 						return false;
407 407
 					} else {
408 408
 						if ( is_wp_error( $response ) ) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 			);
425 425
 			$response = wp_remote_get( $testurl, $params );
426 426
 
427
-			if( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
427
+			if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
428 428
 				return false;
429 429
 			} else {
430 430
 				if ( is_wp_error( $response ) ) {
Please login to merge, or discard this patch.