Completed
Push — master ( 45b05a...b92b5a )
by Devin
53s
created
includes/class-give-stats.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -121,6 +121,7 @@
 block discarded – undo
121 121
 	 *
122 122
 	 * @access public
123 123
 	 * @since  1.0
124
+	 * @param string|boolean $date
124 125
 	 * @return array|WP_Error If the date is invalid, a WP_Error object will be returned
125 126
 	 */
126 127
 	public function convert_date( $date, $end_date = false ) {
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_predefined_dates() {
78 78
 		$predefined = array(
79
-			'today'        => __( 'Today', 'give' ),
80
-			'yesterday'    => __( 'Yesterday', 'give' ),
81
-			'this_week'    => __( 'This Week', 'give' ),
82
-			'last_week'    => __( 'Last Week', 'give' ),
83
-			'this_month'   => __( 'This Month', 'give' ),
84
-			'last_month'   => __( 'Last Month', 'give' ),
85
-			'this_quarter' => __( 'This Quarter', 'give' ),
86
-			'last_quarter' => __( 'Last Quarter', 'give' ),
87
-			'this_year'    => __( 'This Year', 'give' ),
88
-			'last_year'    => __( 'Last Year', 'give' )
79
+			'today'        => __('Today', 'give'),
80
+			'yesterday'    => __('Yesterday', 'give'),
81
+			'this_week'    => __('This Week', 'give'),
82
+			'last_week'    => __('Last Week', 'give'),
83
+			'this_month'   => __('This Month', 'give'),
84
+			'last_month'   => __('Last Month', 'give'),
85
+			'this_quarter' => __('This Quarter', 'give'),
86
+			'last_quarter' => __('Last Quarter', 'give'),
87
+			'this_year'    => __('This Year', 'give'),
88
+			'last_year'    => __('Last Year', 'give')
89 89
 		);
90 90
 
91
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
91
+		return apply_filters('give_stats_predefined_dates', $predefined);
92 92
 	}
93 93
 
94 94
 	/**
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return void
106 106
 	 */
107
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
107
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
108 108
 
109
-		if ( empty( $_start_date ) ) {
109
+		if (empty($_start_date)) {
110 110
 			$_start_date = 'this_month';
111 111
 		}
112 112
 
113
-		if ( empty( $_end_date ) ) {
113
+		if (empty($_end_date)) {
114 114
 			$_end_date = $_start_date;
115 115
 		}
116 116
 
117
-		$this->start_date = $this->convert_date( $_start_date );
118
-		$this->end_date   = $this->convert_date( $_end_date, true );
117
+		$this->start_date = $this->convert_date($_start_date);
118
+		$this->end_date   = $this->convert_date($_end_date, true);
119 119
 	}
120 120
 
121 121
 	/**
@@ -125,26 +125,26 @@  discard block
 block discarded – undo
125 125
 	 * @since  1.0
126 126
 	 * @return array|WP_Error If the date is invalid, a WP_Error object will be returned
127 127
 	 */
128
-	public function convert_date( $date, $end_date = false ) {
128
+	public function convert_date($date, $end_date = false) {
129 129
 
130 130
 		$this->timestamp = false;
131 131
 		$second          = $end_date ? 59 : 0;
132 132
 		$minute          = $end_date ? 59 : 0;
133 133
 		$hour            = $end_date ? 23 : 0;
134 134
 		$day             = 1;
135
-		$month           = date( 'n', current_time( 'timestamp' ) );
136
-		$year            = date( 'Y', current_time( 'timestamp' ) );
135
+		$month           = date('n', current_time('timestamp'));
136
+		$year            = date('Y', current_time('timestamp'));
137 137
 
138
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
138
+		if (array_key_exists($date, $this->get_predefined_dates())) {
139 139
 
140 140
 			// This is a predefined date rate, such as last_week
141
-			switch ( $date ) {
141
+			switch ($date) {
142 142
 
143 143
 				case 'this_month' :
144 144
 
145
-					if ( $end_date ) {
145
+					if ($end_date) {
146 146
 
147
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
147
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
148 148
 						$hour   = 23;
149 149
 						$minute = 59;
150 150
 						$second = 59;
@@ -154,28 +154,28 @@  discard block
 block discarded – undo
154 154
 
155 155
 				case 'last_month' :
156 156
 
157
-					if ( $month == 1 ) {
157
+					if ($month == 1) {
158 158
 
159 159
 						$month = 12;
160
-						$year --;
160
+						$year--;
161 161
 
162 162
 					} else {
163 163
 
164
-						$month --;
164
+						$month--;
165 165
 
166 166
 					}
167 167
 
168
-					if ( $end_date ) {
169
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
168
+					if ($end_date) {
169
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
170 170
 					}
171 171
 
172 172
 					break;
173 173
 
174 174
 				case 'today' :
175 175
 
176
-					$day = date( 'd', current_time( 'timestamp' ) );
176
+					$day = date('d', current_time('timestamp'));
177 177
 
178
-					if ( $end_date ) {
178
+					if ($end_date) {
179 179
 						$hour   = 23;
180 180
 						$minute = 59;
181 181
 						$second = 59;
@@ -185,23 +185,23 @@  discard block
 block discarded – undo
185 185
 
186 186
 				case 'yesterday' :
187 187
 
188
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
188
+					$day = date('d', current_time('timestamp')) - 1;
189 189
 
190 190
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
191
-					if ( $day < 1 ) {
191
+					if ($day < 1) {
192 192
 
193 193
 						// If current month is 1
194
-						if ( 1 == $month ) {
194
+						if (1 == $month) {
195 195
 
196 196
 							$year -= 1; // Today is January 1, so skip back to last day of December
197 197
 							$month = 12;
198
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
198
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
199 199
 
200 200
 						} else {
201 201
 
202 202
 							// Go back one month and get the last day of the month
203 203
 							$month -= 1;
204
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
204
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
205 205
 
206 206
 						}
207 207
 					}
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 
211 211
 				case 'this_week' :
212 212
 
213
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
214
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
213
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
214
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
215 215
 
216
-					if ( $today < $days_to_week_start ) {
216
+					if ($today < $days_to_week_start) {
217 217
 
218
-						if ( $month > 1 ) {
218
+						if ($month > 1) {
219 219
 							$month -= 1;
220 220
 						} else {
221 221
 							$month = 12;
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 
224 224
 					}
225 225
 
226
-					if ( ! $end_date ) {
226
+					if ( ! $end_date) {
227 227
 
228 228
 						// Getting the start day
229 229
 
230
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
231
-						$day += get_option( 'start_of_week' );
230
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
231
+						$day += get_option('start_of_week');
232 232
 
233 233
 					} else {
234 234
 
235 235
 						// Getting the end day
236 236
 
237
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
238
-						$day += get_option( 'start_of_week' ) + 6;
237
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
238
+						$day += get_option('start_of_week') + 6;
239 239
 
240 240
 					}
241 241
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 
244 244
 				case 'last_week' :
245 245
 
246
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
247
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
246
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
247
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
248 248
 
249
-					if ( $today < $days_to_week_start ) {
249
+					if ($today < $days_to_week_start) {
250 250
 
251
-						if ( $month > 1 ) {
251
+						if ($month > 1) {
252 252
 							$month -= 1;
253 253
 						} else {
254 254
 							$month = 12;
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 
257 257
 					}
258 258
 
259
-					if ( ! $end_date ) {
259
+					if ( ! $end_date) {
260 260
 
261 261
 						// Getting the start day
262 262
 
263
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
264
-						$day += get_option( 'start_of_week' );
263
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
264
+						$day += get_option('start_of_week');
265 265
 
266 266
 					} else {
267 267
 
268 268
 						// Getting the end day
269 269
 
270
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
271
-						$day += get_option( 'start_of_week' ) + 6;
270
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
271
+						$day += get_option('start_of_week') + 6;
272 272
 
273 273
 					}
274 274
 
@@ -276,39 +276,39 @@  discard block
 block discarded – undo
276 276
 
277 277
 				case 'this_quarter' :
278 278
 
279
-					$month_now = date( 'n', current_time( 'timestamp' ) );
279
+					$month_now = date('n', current_time('timestamp'));
280 280
 
281
-					if ( $month_now <= 3 ) {
281
+					if ($month_now <= 3) {
282 282
 
283
-						if ( ! $end_date ) {
283
+						if ( ! $end_date) {
284 284
 							$month = 1;
285 285
 						} else {
286 286
 							$month  = 3;
287
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
287
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
288 288
 							$hour   = 23;
289 289
 							$minute = 59;
290 290
 							$second = 59;
291 291
 						}
292 292
 
293
-					} else if ( $month_now <= 6 ) {
293
+					} else if ($month_now <= 6) {
294 294
 
295
-						if ( ! $end_date ) {
295
+						if ( ! $end_date) {
296 296
 							$month = 4;
297 297
 						} else {
298 298
 							$month  = 6;
299
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
299
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
300 300
 							$hour   = 23;
301 301
 							$minute = 59;
302 302
 							$second = 59;
303 303
 						}
304 304
 
305
-					} else if ( $month_now <= 9 ) {
305
+					} else if ($month_now <= 9) {
306 306
 
307
-						if ( ! $end_date ) {
307
+						if ( ! $end_date) {
308 308
 							$month = 7;
309 309
 						} else {
310 310
 							$month  = 9;
311
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
311
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
312 312
 							$hour   = 23;
313 313
 							$minute = 59;
314 314
 							$second = 59;
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 
317 317
 					} else {
318 318
 
319
-						if ( ! $end_date ) {
319
+						if ( ! $end_date) {
320 320
 							$month = 10;
321 321
 						} else {
322 322
 							$month  = 12;
323
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
323
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
324 324
 							$hour   = 23;
325 325
 							$minute = 59;
326 326
 							$second = 59;
@@ -332,40 +332,40 @@  discard block
 block discarded – undo
332 332
 
333 333
 				case 'last_quarter' :
334 334
 
335
-					$month_now = date( 'n', current_time( 'timestamp' ) );
335
+					$month_now = date('n', current_time('timestamp'));
336 336
 
337
-					if ( $month_now <= 3 ) {
337
+					if ($month_now <= 3) {
338 338
 
339
-						if ( ! $end_date ) {
339
+						if ( ! $end_date) {
340 340
 							$month = 10;
341 341
 						} else {
342 342
 							$year -= 1;
343 343
 							$month  = 12;
344
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
344
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
345 345
 							$hour   = 23;
346 346
 							$minute = 59;
347 347
 							$second = 59;
348 348
 						}
349 349
 
350
-					} else if ( $month_now <= 6 ) {
350
+					} else if ($month_now <= 6) {
351 351
 
352
-						if ( ! $end_date ) {
352
+						if ( ! $end_date) {
353 353
 							$month = 1;
354 354
 						} else {
355 355
 							$month  = 3;
356
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
356
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
357 357
 							$hour   = 23;
358 358
 							$minute = 59;
359 359
 							$second = 59;
360 360
 						}
361 361
 
362
-					} else if ( $month_now <= 9 ) {
362
+					} else if ($month_now <= 9) {
363 363
 
364
-						if ( ! $end_date ) {
364
+						if ( ! $end_date) {
365 365
 							$month = 4;
366 366
 						} else {
367 367
 							$month  = 6;
368
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
368
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
369 369
 							$hour   = 23;
370 370
 							$minute = 59;
371 371
 							$second = 59;
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
 
374 374
 					} else {
375 375
 
376
-						if ( ! $end_date ) {
376
+						if ( ! $end_date) {
377 377
 							$month = 7;
378 378
 						} else {
379 379
 							$month  = 9;
380
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
380
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
381 381
 							$hour   = 23;
382 382
 							$minute = 59;
383 383
 							$second = 59;
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 
390 390
 				case 'this_year' :
391 391
 
392
-					if ( ! $end_date ) {
392
+					if ( ! $end_date) {
393 393
 						$month = 1;
394 394
 					} else {
395 395
 						$month  = 12;
396
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
396
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
397 397
 						$hour   = 23;
398 398
 						$minute = 59;
399 399
 						$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 				case 'last_year' :
405 405
 
406 406
 					$year -= 1;
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 			}
420 420
 
421 421
 
422
-		} else if ( is_numeric( $date ) ) {
422
+		} else if (is_numeric($date)) {
423 423
 
424 424
 			// return $date unchanged since it is a timestamp
425 425
 			$this->timestamp = true;
426 426
 
427
-		} else if ( false !== strtotime( $date ) ) {
427
+		} else if (false !== strtotime($date)) {
428 428
 
429
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
430
-			$year  = date( 'Y', $date );
431
-			$month = date( 'm', $date );
432
-			$day   = date( 'd', $date );
429
+			$date  = strtotime($date, current_time('timestamp'));
430
+			$year  = date('Y', $date);
431
+			$month = date('m', $date);
432
+			$day   = date('d', $date);
433 433
 
434 434
 		} else {
435 435
 
436
-			return new WP_Error( 'invalid_date', __( 'Improper date provided.', 'give' ) );
436
+			return new WP_Error('invalid_date', __('Improper date provided.', 'give'));
437 437
 
438 438
 		}
439 439
 
440
-		if ( false === $this->timestamp ) {
440
+		if (false === $this->timestamp) {
441 441
 			// Create an exact timestamp
442
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
442
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
443 443
 		}
444 444
 
445
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
445
+		return apply_filters('give_stats_date', $date, $end_date, $this);
446 446
 
447 447
 	}
448 448
 
@@ -453,33 +453,33 @@  discard block
 block discarded – undo
453 453
 	 * @since  1.0
454 454
 	 * @return string
455 455
 	 */
456
-	public function count_where( $where = '' ) {
456
+	public function count_where($where = '') {
457 457
 		// Only get payments in our date range
458 458
 
459 459
 		$start_where = '';
460 460
 		$end_where   = '';
461 461
 
462
-		if ( $this->start_date ) {
462
+		if ($this->start_date) {
463 463
 
464
-			if ( $this->timestamp ) {
464
+			if ($this->timestamp) {
465 465
 				$format = 'Y-m-d H:i:s';
466 466
 			} else {
467 467
 				$format = 'Y-m-d 00:00:00';
468 468
 			}
469 469
 
470
-			$start_date  = date( $format, $this->start_date );
470
+			$start_date  = date($format, $this->start_date);
471 471
 			$start_where = " AND p.post_date >= '{$start_date}'";
472 472
 		}
473 473
 
474
-		if ( $this->end_date ) {
474
+		if ($this->end_date) {
475 475
 
476
-			if ( $this->timestamp ) {
476
+			if ($this->timestamp) {
477 477
 				$format = 'Y-m-d H:i:s';
478 478
 			} else {
479 479
 				$format = 'Y-m-d 23:59:59';
480 480
 			}
481 481
 
482
-			$end_date = date( $format, $this->end_date );
482
+			$end_date = date($format, $this->end_date);
483 483
 
484 484
 			$end_where = " AND p.post_date <= '{$end_date}'";
485 485
 		}
@@ -499,34 +499,34 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return string
501 501
 	 */
502
-	public function payments_where( $where = '' ) {
502
+	public function payments_where($where = '') {
503 503
 
504 504
 		global $wpdb;
505 505
 
506 506
 		$start_where = '';
507 507
 		$end_where   = '';
508 508
 
509
-		if ( ! is_wp_error( $this->start_date ) ) {
509
+		if ( ! is_wp_error($this->start_date)) {
510 510
 
511
-			if ( $this->timestamp ) {
511
+			if ($this->timestamp) {
512 512
 				$format = 'Y-m-d H:i:s';
513 513
 			} else {
514 514
 				$format = 'Y-m-d 00:00:00';
515 515
 			}
516 516
 
517
-			$start_date  = date( $format, $this->start_date );
517
+			$start_date  = date($format, $this->start_date);
518 518
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
519 519
 		}
520 520
 
521
-		if ( ! is_wp_error( $this->end_date ) ) {
521
+		if ( ! is_wp_error($this->end_date)) {
522 522
 
523
-			if ( $this->timestamp ) {
523
+			if ($this->timestamp) {
524 524
 				$format = 'Y-m-d 00:00:00';
525 525
 			} else {
526 526
 				$format = 'Y-m-d 23:59:59';
527 527
 			}
528 528
 
529
-			$end_date = date( $format, $this->end_date );
529
+			$end_date = date($format, $this->end_date);
530 530
 
531 531
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
532 532
 		}
Please login to merge, or discard this patch.
includes/forms/template.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param array $args Arguments for display
23 23
  *
24
- * @return string $purchase_form
24
+ * @return false|null $purchase_form
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
  * @param int   $form_id
1151 1151
  * @param array $args
1152 1152
  *
1153
- * @return mixed
1153
+ * @return boolean
1154 1154
  */
1155 1155
 
1156 1156
 function give_show_goal_progress( $form_id, $args ) {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1170,9 +1170,9 @@
 block discarded – undo
1170 1170
 
1171 1171
 	//Sanity check - ensure form has goal set to output
1172 1172
 	if ( empty( $form->ID )
1173
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1174
-	     || $goal_option !== 'yes'
1175
-	     || $goal == 0
1173
+		 || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1174
+		 || $goal_option !== 'yes'
1175
+		 || $goal == 0
1176 1176
 	) {
1177 1177
 		//not this form, bail
1178 1178
 		return false;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -740,8 +740,11 @@
 block discarded – undo
740 740
 					}
741 741
 					?>
742 742
 				</select>
743
-			<?php else : ?>
744
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
743
+			<?php else {
744
+	: ?>
745
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' );
746
+}
747
+?>"/>
745 748
 			<?php endif; ?>
746 749
 		</p>
747 750
 		<?php do_action( 'give_cc_billing_bottom' ); ?>
Please login to merge, or discard this patch.
Spacing   +393 added lines, -393 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,64 +23,64 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55
-	) );
55
+	));
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? ' float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
80
+		'give-form-'.$form->ID,
81 81
 		$float_labels_option
82
-	), $form->ID, $args );
83
-	$form_classes       = implode( ' ', $form_classes_array );
82
+	), $form->ID, $args);
83
+	$form_classes = implode(' ', $form_classes_array);
84 84
 
85 85
 
86 86
 	ob_start();
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 * @param int $form ->ID The current form ID
94 94
 	 * @param array $args An array of form args
95 95
 	 */
96
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
96
+	do_action('give_pre_form_output', $form->ID, $args); ?>
97 97
 
98 98
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
99 99
 
100 100
 		<?php
101
-		if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
101
+		if (isset($args['show_title']) && $args['show_title'] == true) {
102 102
 
103
-			echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
103
+			echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
104 104
 
105 105
 		} ?>
106 106
 
107
-		<?php do_action( 'give_pre_form', $form->ID, $args ); ?>
107
+		<?php do_action('give_pre_form', $form->ID, $args); ?>
108 108
 
109 109
 		<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
110 110
 			<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
111
-			<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
112
-			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
113
-			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
114
-			<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
111
+			<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
112
+			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
113
+			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
114
+			<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
115 115
 			<?php
116 116
 
117 117
 			//Price ID hidden field for variable (mult-level) donation forms
118
-			if ( give_has_variable_prices( $form_id ) ) {
118
+			if (give_has_variable_prices($form_id)) {
119 119
 				//get default selected price ID
120
-				$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
120
+				$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
121 121
 				$price_id = 0;
122 122
 				//loop through prices
123
-				foreach ( $prices as $price ) {
124
-					if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
123
+				foreach ($prices as $price) {
124
+					if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
125 125
 						$price_id = $price['_give_id']['level_id'];
126 126
 					};
127 127
 				}
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 				<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
130 130
 			<?php }
131 131
 
132
-			do_action( 'give_checkout_form_top', $form->ID, $args );
132
+			do_action('give_checkout_form_top', $form->ID, $args);
133 133
 
134
-			do_action( 'give_payment_mode_select', $form->ID, $args );
134
+			do_action('give_payment_mode_select', $form->ID, $args);
135 135
 
136
-			do_action( 'give_checkout_form_bottom', $form->ID, $args );
136
+			do_action('give_checkout_form_bottom', $form->ID, $args);
137 137
 
138 138
 			?>
139 139
 
140 140
 		</form>
141 141
 
142
-		<?php do_action( 'give_post_form', $form->ID, $args ); ?>
142
+		<?php do_action('give_post_form', $form->ID, $args); ?>
143 143
 
144
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
144
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
145 145
 	<?php
146 146
 
147 147
 	/**
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 * @param int $form ->ID The current form ID
153 153
 	 * @param array $args An array of form args
154 154
 	 */
155
-	do_action( 'give_post_form_output', $form->ID, $args );
155
+	do_action('give_post_form_output', $form->ID, $args);
156 156
 
157 157
 	$final_output = ob_get_clean();
158 158
 
159
-	echo apply_filters( 'give_donate_form', $final_output, $args );
159
+	echo apply_filters('give_donate_form', $final_output, $args);
160 160
 }
161 161
 
162 162
 
@@ -176,43 +176,43 @@  discard block
 block discarded – undo
176 176
  * @global    $give_options Array of all the Give options
177 177
  * @return string
178 178
  */
179
-function give_show_purchase_form( $form_id ) {
179
+function give_show_purchase_form($form_id) {
180 180
 
181
-	$payment_mode = give_get_chosen_gateway( $form_id );
181
+	$payment_mode = give_get_chosen_gateway($form_id);
182 182
 
183
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
183
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
184 184
 		$form_id = $_POST['give_form_id'];
185 185
 	}
186 186
 
187
-	do_action( 'give_purchase_form_top', $form_id );
187
+	do_action('give_purchase_form_top', $form_id);
188 188
 
189
-	if ( give_can_checkout() && isset( $form_id ) ) {
189
+	if (give_can_checkout() && isset($form_id)) {
190 190
 
191
-		do_action( 'give_purchase_form_before_register_login', $form_id );
191
+		do_action('give_purchase_form_before_register_login', $form_id);
192 192
 
193
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
193
+		do_action('give_purchase_form_register_login_fields', $form_id);
194 194
 
195
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
195
+		do_action('give_purchase_form_before_cc_form', $form_id);
196 196
 
197 197
 		// Load the credit card form and allow gateways to load their own if they wish
198
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
199
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
198
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
199
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
200 200
 		} else {
201
-			do_action( 'give_cc_form', $form_id );
201
+			do_action('give_cc_form', $form_id);
202 202
 		}
203 203
 
204
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
204
+		do_action('give_purchase_form_after_cc_form', $form_id);
205 205
 
206 206
 	} else {
207 207
 		// Can't checkout
208
-		do_action( 'give_purchase_form_no_access', $form_id );
208
+		do_action('give_purchase_form_no_access', $form_id);
209 209
 
210 210
 	}
211 211
 
212
-	do_action( 'give_purchase_form_bottom', $form_id );
212
+	do_action('give_purchase_form_bottom', $form_id);
213 213
 }
214 214
 
215
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
215
+add_action('give_purchase_form', 'give_show_purchase_form');
216 216
 
217 217
 /**
218 218
  *
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return void
226 226
  */
227
-function give_show_register_login_fields( $form_id ) {
227
+function give_show_register_login_fields($form_id) {
228 228
 
229
-	$show_register_form = give_show_login_register_option( $form_id );
229
+	$show_register_form = give_show_login_register_option($form_id);
230 230
 
231
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
231
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
232 232
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
233
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
233
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
234 234
 		</div>
235
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
235
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
236 236
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
237
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
237
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
238 238
 		</div>
239 239
 	<?php endif; ?>
240 240
 
241
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
242
-		do_action( 'give_purchase_form_after_user_info', $form_id );
241
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
242
+		do_action('give_purchase_form_after_user_info', $form_id);
243 243
 	}
244 244
 }
245 245
 
246
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
246
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
247 247
 
248 248
 /**
249 249
  * Donation Amount Field
@@ -257,33 +257,33 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @return void
259 259
  */
260
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
260
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
261 261
 
262 262
 	global $give_options;
263 263
 
264
-	$variable_pricing    = give_has_variable_prices( $form_id );
265
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
266
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
267
-	$symbol              = give_currency_symbol( give_get_currency() );
268
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
269
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
270
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
264
+	$variable_pricing    = give_has_variable_prices($form_id);
265
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
266
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
267
+	$symbol              = give_currency_symbol(give_get_currency());
268
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
269
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
270
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
271 271
 
272
-	do_action( 'give_before_donation_levels', $form_id, $args );
272
+	do_action('give_before_donation_levels', $form_id, $args);
273 273
 
274 274
 	//Set Price, No Custom Amount Allowed means hidden price field
275
-	if ( $allow_custom_amount == 'no' ) {
275
+	if ($allow_custom_amount == 'no') {
276 276
 		?>
277 277
 
278
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
278
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
279 279
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
280 280
 		       value="<?php echo $default_amount; ?>" required>
281 281
 		<div class="set-price give-donation-amount form-row-wide">
282
-			<?php if ( $currency_position == 'before' ) {
282
+			<?php if ($currency_position == 'before') {
283 283
 				echo $currency_output;
284 284
 			} ?>
285 285
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
286
-			<?php if ( $currency_position == 'after' ) {
286
+			<?php if ($currency_position == 'after') {
287 287
 				echo $currency_output;
288 288
 			} ?>
289 289
 		</div>
@@ -293,34 +293,34 @@  discard block
 block discarded – undo
293 293
 		?>
294 294
 		<div class="give-total-wrap">
295 295
 			<div class="give-donation-amount form-row-wide">
296
-				<?php if ( $currency_position == 'before' ) {
296
+				<?php if ($currency_position == 'before') {
297 297
 					echo $currency_output;
298 298
 				} ?>
299
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
299
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
300 300
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
301
-				<?php if ( $currency_position == 'after' ) {
301
+				<?php if ($currency_position == 'after') {
302 302
 					echo $currency_output;
303 303
 				} ?>
304 304
 			</div>
305 305
 		</div>
306 306
 	<?php }
307 307
 
308
-	do_action( 'give_after_donation_amount', $form_id, $args );
308
+	do_action('give_after_donation_amount', $form_id, $args);
309 309
 
310 310
 	//Custom Amount Text
311
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
311
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
312 312
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
313 313
 	<?php }
314 314
 
315 315
 	//Output Variable Pricing Levels
316
-	if ( $variable_pricing ) {
317
-		give_output_levels( $form_id );
316
+	if ($variable_pricing) {
317
+		give_output_levels($form_id);
318 318
 	}
319 319
 
320
-	do_action( 'give_after_donation_levels', $form_id, $args );
320
+	do_action('give_after_donation_levels', $form_id, $args);
321 321
 }
322 322
 
323
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
323
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
324 324
 
325 325
 
326 326
 /**
@@ -332,32 +332,32 @@  discard block
 block discarded – undo
332 332
  *
333 333
  * @return string
334 334
  */
335
-function give_output_levels( $form_id ) {
335
+function give_output_levels($form_id) {
336 336
 
337 337
 	//Get variable pricing
338
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
339
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
340
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
341
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
342
-	if ( empty( $custom_amount_text ) ) {
343
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
338
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
339
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
340
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
341
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
342
+	if (empty($custom_amount_text)) {
343
+		$custom_amount_text = __('Give a Custom Amount', 'give');
344 344
 	}
345 345
 
346 346
 	$output  = '';
347 347
 	$counter = 0;
348 348
 
349
-	switch ( $display_style ) {
349
+	switch ($display_style) {
350 350
 		case 'buttons':
351 351
 
352 352
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
353 353
 
354
-			foreach ( $prices as $price ) {
355
-				$counter ++;
356
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
357
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
354
+			foreach ($prices as $price) {
355
+				$counter++;
356
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
357
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
358 358
 
359 359
 				$output .= '<li>';
360
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
360
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
361 361
 				$output .= $level_text;
362 362
 				$output .= '</button>';
363 363
 				$output .= '</li>';
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			}
366 366
 
367 367
 			//Custom Amount
368
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
368
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
369 369
 				$output .= '<li>';
370 370
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
371 371
 				$output .= $custom_amount_text;
@@ -381,23 +381,23 @@  discard block
 block discarded – undo
381 381
 
382 382
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
383 383
 
384
-			foreach ( $prices as $price ) {
385
-				$counter ++;
386
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
387
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
384
+			foreach ($prices as $price) {
385
+				$counter++;
386
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
387
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
388 388
 
389 389
 				$output .= '<li>';
390
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
391
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
390
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
391
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
392 392
 				$output .= '</li>';
393 393
 
394 394
 			}
395 395
 
396 396
 			//Custom Amount
397
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
397
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
398 398
 				$output .= '<li>';
399 399
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
400
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
400
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
401 401
 				$output .= '</li>';
402 402
 			}
403 403
 
@@ -407,23 +407,23 @@  discard block
 block discarded – undo
407 407
 
408 408
 		case 'dropdown':
409 409
 
410
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
411
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
410
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
411
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
412 412
 
413 413
 			//first loop through prices
414
-			foreach ( $prices as $price ) {
415
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
416
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
414
+			foreach ($prices as $price) {
415
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
416
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
417 417
 
418
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
418
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
419 419
 				$output .= $level_text;
420 420
 				$output .= '</option>';
421 421
 
422 422
 			}
423 423
 
424 424
 			//Custom Amount
425
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
426
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
425
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
426
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
427 427
 			}
428 428
 
429 429
 			$output .= '</select>';
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			break;
432 432
 	}
433 433
 
434
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
434
+	echo apply_filters('give_form_level_output', $output, $form_id);
435 435
 }
436 436
 
437 437
 /**
@@ -443,26 +443,26 @@  discard block
 block discarded – undo
443 443
  * @param array $args
444 444
  *
445 445
  */
446
-function give_display_checkout_button( $form_id, $args ) {
446
+function give_display_checkout_button($form_id, $args) {
447 447
 
448
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
448
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
449 449
 		? $args['display_style']
450
-		: get_post_meta( $form_id, '_give_payment_display', true );
450
+		: get_post_meta($form_id, '_give_payment_display', true);
451 451
 
452 452
 	//no btn for onpage
453
-	if ( $display_option === 'onpage' ) {
453
+	if ($display_option === 'onpage') {
454 454
 		return;
455 455
 	}
456 456
 
457
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
458
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
457
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
458
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
459 459
 
460
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
460
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
461 461
 
462
-	echo apply_filters( 'give_display_checkout_button', $output );
462
+	echo apply_filters('give_display_checkout_button', $output);
463 463
 }
464 464
 
465
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
465
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
466 466
 
467 467
 /**
468 468
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -473,71 +473,71 @@  discard block
 block discarded – undo
473 473
  *
474 474
  * @return void
475 475
  */
476
-function give_user_info_fields( $form_id ) {
476
+function give_user_info_fields($form_id) {
477 477
 
478
-	if ( is_user_logged_in() ) :
479
-		$user_data = get_userdata( get_current_user_id() );
478
+	if (is_user_logged_in()) :
479
+		$user_data = get_userdata(get_current_user_id());
480 480
 	endif;
481 481
 
482
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
482
+	do_action('give_purchase_form_before_personal_info', $form_id);
483 483
 	?>
484 484
 	<fieldset id="give_checkout_user_info">
485
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
485
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
486 486
 		<p id="give-first-name-wrap" class="form-row form-row-first">
487 487
 			<label class="give-label" for="give-first">
488
-				<?php _e( 'First Name', 'give' ); ?>
489
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
488
+				<?php _e('First Name', 'give'); ?>
489
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
490 490
 					<span class="give-required-indicator">*</span>
491 491
 				<?php } ?>
492
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
492
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
493 493
 			</label>
494
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
494
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
495 495
 				echo ' required ';
496 496
 			} ?>/>
497 497
 		</p>
498 498
 
499 499
 		<p id="give-last-name-wrap" class="form-row form-row-last">
500 500
 			<label class="give-label" for="give-last">
501
-				<?php _e( 'Last Name', 'give' ); ?>
502
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
501
+				<?php _e('Last Name', 'give'); ?>
502
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
503 503
 					<span class="give-required-indicator">*</span>
504 504
 				<?php } ?>
505
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
505
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
506 506
 			</label>
507 507
 
508
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
508
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
509 509
 				echo ' required';
510
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
510
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
511 511
 				echo ' required ';
512 512
 			} ?> />
513 513
 		</p>
514 514
 
515
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
515
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
516 516
 		<p id="give-email-wrap" class="form-row form-row-wide">
517 517
 			<label class="give-label" for="give-email">
518
-				<?php _e( 'Email Address', 'give' ); ?>
519
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
518
+				<?php _e('Email Address', 'give'); ?>
519
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
520 520
 					<span class="give-required-indicator">*</span>
521 521
 				<?php } ?>
522
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
522
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
523 523
 			</label>
524 524
 
525
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
525
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
526 526
 				echo ' required ';
527 527
 			} ?>/>
528 528
 
529 529
 		</p>
530
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
530
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
531 531
 
532
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
532
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
533 533
 	</fieldset>
534 534
 	<?php
535
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
535
+	do_action('give_purchase_form_after_personal_info', $form_id);
536 536
 
537 537
 }
538 538
 
539
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
540
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
539
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
540
+add_action('give_register_fields_before', 'give_user_info_fields');
541 541
 
542 542
 /**
543 543
  * Renders the credit card info form.
@@ -548,73 +548,73 @@  discard block
 block discarded – undo
548 548
  *
549 549
  * @return void
550 550
  */
551
-function give_get_cc_form( $form_id ) {
551
+function give_get_cc_form($form_id) {
552 552
 
553 553
 	ob_start();
554 554
 
555
-	do_action( 'give_before_cc_fields', $form_id ); ?>
555
+	do_action('give_before_cc_fields', $form_id); ?>
556 556
 
557 557
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
558
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
559
-		<?php if ( is_ssl() ) : ?>
558
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
559
+		<?php if (is_ssl()) : ?>
560 560
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
561 561
 				<span class="give-icon padlock"></span>
562
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
562
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
563 563
 			</div>
564 564
 		<?php endif; ?>
565 565
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
566 566
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
567
-				<?php _e( 'Card Number', 'give' ); ?>
567
+				<?php _e('Card Number', 'give'); ?>
568 568
 				<span class="give-required-indicator">*</span>
569
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
569
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
570 570
 				<span class="card-type"></span>
571 571
 			</label>
572 572
 
573
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
573
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
574 574
 		</p>
575 575
 
576 576
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
577 577
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
578
-				<?php _e( 'CVC', 'give' ); ?>
578
+				<?php _e('CVC', 'give'); ?>
579 579
 				<span class="give-required-indicator">*</span>
580
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
580
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
581 581
 			</label>
582 582
 
583
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/>
583
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/>
584 584
 		</p>
585 585
 
586 586
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
587 587
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
588
-				<?php _e( 'Name on the Card', 'give' ); ?>
588
+				<?php _e('Name on the Card', 'give'); ?>
589 589
 				<span class="give-required-indicator">*</span>
590
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
590
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
591 591
 			</label>
592 592
 
593
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/>
593
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/>
594 594
 		</p>
595
-		<?php do_action( 'give_before_cc_expiration' ); ?>
595
+		<?php do_action('give_before_cc_expiration'); ?>
596 596
 		<p class="card-expiration form-row form-row-one-third">
597 597
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
598
-				<?php _e( 'Expiration', 'give' ); ?>
598
+				<?php _e('Expiration', 'give'); ?>
599 599
 				<span class="give-required-indicator">*</span>
600
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
600
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
601 601
 			</label>
602 602
 
603 603
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
604 604
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
605 605
 
606
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/>
606
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/>
607 607
 		</p>
608
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
608
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
609 609
 
610 610
 	</fieldset>
611 611
 	<?php
612
-	do_action( 'give_after_cc_fields', $form_id );
612
+	do_action('give_after_cc_fields', $form_id);
613 613
 
614 614
 	echo ob_get_clean();
615 615
 }
616 616
 
617
-add_action( 'give_cc_form', 'give_get_cc_form' );
617
+add_action('give_cc_form', 'give_get_cc_form');
618 618
 
619 619
 /**
620 620
  * Outputs the default credit card address fields
@@ -625,110 +625,110 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_default_cc_address_fields( $form_id ) {
628
+function give_default_cc_address_fields($form_id) {
629 629
 
630 630
 	$logged_in = is_user_logged_in();
631 631
 
632
-	if ( $logged_in ) {
633
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
632
+	if ($logged_in) {
633
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
634 634
 	}
635
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
636
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
637
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
638
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
635
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
636
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
637
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
638
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
639 639
 	ob_start(); ?>
640 640
 	<fieldset id="give_cc_address" class="cc-address">
641
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
642
-		<?php do_action( 'give_cc_billing_top' ); ?>
641
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
642
+		<?php do_action('give_cc_billing_top'); ?>
643 643
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
644 644
 			<label for="card_address" class="give-label">
645
-				<?php _e( 'Address', 'give' ); ?>
645
+				<?php _e('Address', 'give'); ?>
646 646
 				<?php
647
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
647
+				if (give_field_is_required('card_address', $form_id)) { ?>
648 648
 					<span class="give-required-indicator">*</span>
649 649
 				<?php } ?>
650
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
650
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
651 651
 			</label>
652 652
 
653
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
653
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
654 654
 				echo ' required';
655
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
655
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
656 656
 				echo '  required ';
657 657
 			} ?>/>
658 658
 		</p>
659 659
 
660 660
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
661 661
 			<label for="card_address_2" class="give-label">
662
-				<?php _e( 'Address Line 2', 'give' ); ?>
663
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
662
+				<?php _e('Address Line 2', 'give'); ?>
663
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
664 664
 					<span class="give-required-indicator">*</span>
665 665
 				<?php } ?>
666
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
666
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
667 667
 			</label>
668 668
 
669
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
669
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
670 670
 				echo ' required';
671
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
671
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
672 672
 				echo ' required ';
673 673
 			} ?>/>
674 674
 		</p>
675 675
 
676 676
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
677 677
 			<label for="card_city" class="give-label">
678
-				<?php _e( 'City', 'give' ); ?>
679
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
678
+				<?php _e('City', 'give'); ?>
679
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
680 680
 					<span class="give-required-indicator">*</span>
681 681
 				<?php } ?>
682
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
682
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
683 683
 			</label>
684
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
684
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
685 685
 				echo ' required';
686
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
686
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
687 687
 				echo ' required ';
688 688
 			} ?>/>
689 689
 		</p>
690 690
 
691 691
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
692 692
 			<label for="card_zip" class="give-label">
693
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
694
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
693
+				<?php _e('Zip / Postal Code', 'give'); ?>
694
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
695 695
 					<span class="give-required-indicator">*</span>
696 696
 				<?php } ?>
697
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
697
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
698 698
 			</label>
699 699
 
700
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
700
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
701 701
 				echo ' required';
702
-			} ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
702
+			} ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
703 703
 				echo ' required ';
704 704
 			} ?>/>
705 705
 		</p>
706 706
 
707 707
 		<p id="give-card-country-wrap" class="form-row form-row-first">
708 708
 			<label for="billing_country" class="give-label">
709
-				<?php _e( 'Country', 'give' ); ?>
710
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
709
+				<?php _e('Country', 'give'); ?>
710
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
711 711
 					<span class="give-required-indicator">*</span>
712 712
 				<?php } ?>
713
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
713
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
714 714
 			</label>
715 715
 
716
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
716
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
717 717
 				echo ' required';
718
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
718
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
719 719
 				echo ' required ';
720 720
 			} ?>>
721 721
 				<?php
722 722
 
723 723
 				$selected_country = give_get_country();
724 724
 
725
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
725
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
726 726
 					$selected_country = $user_address['country'];
727 727
 				}
728 728
 
729 729
 				$countries = give_get_country_list();
730
-				foreach ( $countries as $country_code => $country ) {
731
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
730
+				foreach ($countries as $country_code => $country) {
731
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
732 732
 				}
733 733
 				?>
734 734
 			</select>
@@ -736,44 +736,44 @@  discard block
 block discarded – undo
736 736
 
737 737
 		<p id="give-card-state-wrap" class="form-row form-row-last">
738 738
 			<label for="card_state" class="give-label">
739
-				<?php _e( 'State / Province', 'give' ); ?>
740
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
739
+				<?php _e('State / Province', 'give'); ?>
740
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
741 741
 					<span class="give-required-indicator">*</span>
742 742
 				<?php } ?>
743
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
743
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
744 744
 			</label>
745 745
 
746 746
 			<?php
747 747
 			$selected_state = give_get_state();
748
-			$states         = give_get_states( $selected_country );
748
+			$states         = give_get_states($selected_country);
749 749
 
750
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
750
+			if ($logged_in && ! empty($user_address['state'])) {
751 751
 				$selected_state = $user_address['state'];
752 752
 			}
753 753
 
754
-			if ( ! empty( $states ) ) : ?>
755
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
754
+			if ( ! empty($states)) : ?>
755
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
756 756
 					echo ' required';
757
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
757
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
758 758
 					echo ' required ';
759 759
 				} ?>>
760 760
 					<?php
761
-					foreach ( $states as $state_code => $state ) {
762
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
761
+					foreach ($states as $state_code => $state) {
762
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
763 763
 					}
764 764
 					?>
765 765
 				</select>
766 766
 			<?php else : ?>
767
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
767
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
768 768
 			<?php endif; ?>
769 769
 		</p>
770
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
770
+		<?php do_action('give_cc_billing_bottom'); ?>
771 771
 	</fieldset>
772 772
 	<?php
773 773
 	echo ob_get_clean();
774 774
 }
775 775
 
776
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
776
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
777 777
 
778 778
 
779 779
 /**
@@ -785,93 +785,93 @@  discard block
 block discarded – undo
785 785
  *
786 786
  * @return string
787 787
  */
788
-function give_get_register_fields( $form_id ) {
788
+function give_get_register_fields($form_id) {
789 789
 
790 790
 	global $user_ID;
791 791
 
792
-	if ( is_user_logged_in() ) {
793
-		$user_data = get_userdata( $user_ID );
792
+	if (is_user_logged_in()) {
793
+		$user_data = get_userdata($user_ID);
794 794
 	}
795 795
 
796
-	$show_register_form = give_show_login_register_option( $form_id );
796
+	$show_register_form = give_show_login_register_option($form_id);
797 797
 
798 798
 	ob_start(); ?>
799 799
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
800 800
 
801
-		<?php if ( $show_register_form == 'both' ) { ?>
801
+		<?php if ($show_register_form == 'both') { ?>
802 802
 			<div class="give-login-account-wrap">
803
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
804
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
803
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
804
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
805 805
 				</p>
806 806
 				<p class="give-loading-text">
807
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
807
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
808 808
 			</div>
809 809
 		<?php } ?>
810 810
 
811
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
811
+		<?php do_action('give_register_fields_before', $form_id); ?>
812 812
 
813 813
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
814
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
815
-				if ( ! give_logged_in_only( $form_id ) ) {
816
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
814
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
815
+				if ( ! give_logged_in_only($form_id)) {
816
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
817 817
 				} ?></legend>
818
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
818
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
819 819
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
820 820
 				<label for="give-user-login-<?php echo $form_id; ?>">
821
-					<?php _e( 'Username', 'give' ); ?>
822
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
821
+					<?php _e('Username', 'give'); ?>
822
+					<?php if (give_logged_in_only($form_id)) { ?>
823 823
 						<span class="give-required-indicator">*</span>
824 824
 					<?php } ?>
825
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
825
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
826 826
 				</label>
827 827
 
828
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
828
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
829 829
 					echo 'required ';
830
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
830
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
831 831
 			</div>
832 832
 
833 833
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
834 834
 				<label for="give-user-pass-<?php echo $form_id; ?>">
835
-					<?php _e( 'Password', 'give' ); ?>
836
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
835
+					<?php _e('Password', 'give'); ?>
836
+					<?php if (give_logged_in_only($form_id)) { ?>
837 837
 						<span class="give-required-indicator">*</span>
838 838
 					<?php } ?>
839
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
839
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
840 840
 				</label>
841 841
 
842
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
842
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
843 843
 					echo 'required ';
844
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
844
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
845 845
 			</div>
846 846
 
847 847
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
848 848
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
849
-					<?php _e( 'Confirm PW', 'give' ); ?>
850
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
849
+					<?php _e('Confirm PW', 'give'); ?>
850
+					<?php if (give_logged_in_only($form_id)) { ?>
851 851
 						<span class="give-required-indicator">*</span>
852 852
 					<?php } ?>
853
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
853
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
854 854
 				</label>
855 855
 
856
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
856
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
857 857
 					echo 'required ';
858
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
858
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
859 859
 			</div>
860
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
860
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
861 861
 		</fieldset>
862 862
 
863
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
863
+		<?php do_action('give_register_fields_after', $form_id); ?>
864 864
 
865 865
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
866 866
 
867
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
867
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
868 868
 
869 869
 	</fieldset>
870 870
 	<?php
871 871
 	echo ob_get_clean();
872 872
 }
873 873
 
874
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
874
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
875 875
 
876 876
 /**
877 877
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -884,73 +884,73 @@  discard block
 block discarded – undo
884 884
  *
885 885
  * @return string
886 886
  */
887
-function give_get_login_fields( $form_id ) {
887
+function give_get_login_fields($form_id) {
888 888
 
889
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
890
-	$show_register_form = give_show_login_register_option( $form_id );
889
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
890
+	$show_register_form = give_show_login_register_option($form_id);
891 891
 
892 892
 	ob_start();
893 893
 	?>
894 894
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
895
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
896
-			if ( ! give_logged_in_only( $form_id ) ) {
897
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
895
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
896
+			if ( ! give_logged_in_only($form_id)) {
897
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
898 898
 			} ?>
899 899
 		</legend>
900
-		<?php if ( $show_register_form == 'both' ) { ?>
900
+		<?php if ($show_register_form == 'both') { ?>
901 901
 			<p class="give-new-account-link">
902
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
903
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
904
-					<?php _e( 'Register', 'give' );
905
-					if ( ! give_logged_in_only( $form_id ) ) {
906
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
902
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
903
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
904
+					<?php _e('Register', 'give');
905
+					if ( ! give_logged_in_only($form_id)) {
906
+						echo ' '.__('or checkout as a guest.', 'give');
907 907
 					} ?>
908 908
 				</a>
909 909
 			</p>
910 910
 			<p class="give-loading-text">
911
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
911
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
912 912
 		<?php } ?>
913
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
913
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
914 914
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
915 915
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
916
-				<?php _e( 'Username', 'give' ); ?>
917
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
916
+				<?php _e('Username', 'give'); ?>
917
+				<?php if (give_logged_in_only($form_id)) { ?>
918 918
 					<span class="give-required-indicator">*</span>
919 919
 				<?php } ?>
920 920
 			</label>
921 921
 
922
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
922
+			<input class="<?php if (give_logged_in_only($form_id)) {
923 923
 				echo 'required ';
924
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
924
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
925 925
 		</div>
926 926
 
927 927
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
928 928
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
929
-				<?php _e( 'Password', 'give' ); ?>
930
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
929
+				<?php _e('Password', 'give'); ?>
930
+				<?php if (give_logged_in_only($form_id)) { ?>
931 931
 					<span class="give-required-indicator">*</span>
932 932
 				<?php } ?>
933 933
 			</label>
934
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
934
+			<input class="<?php if (give_logged_in_only($form_id)) {
935 935
 				echo 'required ';
936
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
936
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
937 937
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
938 938
 		</div>
939 939
 
940 940
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
941
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
942
-			<?php if ( $show_register_form !== 'login' ) { ?>
943
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/>
941
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
942
+			<?php if ($show_register_form !== 'login') { ?>
943
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/>
944 944
 			<?php } ?>
945 945
 			<span class="give-loading-animation"></span>
946 946
 		</div>
947
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
947
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
948 948
 	</fieldset><!--end #give-login-fields-->
949 949
 	<?php
950 950
 	echo ob_get_clean();
951 951
 }
952 952
 
953
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
953
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
954 954
 
955 955
 /**
956 956
  * Payment Mode Select
@@ -966,49 +966,49 @@  discard block
 block discarded – undo
966 966
  *
967 967
  * @return void
968 968
  */
969
-function give_payment_mode_select( $form_id ) {
969
+function give_payment_mode_select($form_id) {
970 970
 
971 971
 	$gateways = give_get_enabled_payment_gateways();
972 972
 
973
-	do_action( 'give_payment_mode_top', $form_id ); ?>
973
+	do_action('give_payment_mode_top', $form_id); ?>
974 974
 
975 975
 	<fieldset id="give-payment-mode-select">
976
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
976
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
977 977
 		<div id="give-payment-mode-wrap">
978
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
979
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
978
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
979
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
980 980
 			</legend>
981 981
 			<?php
982 982
 
983
-			do_action( 'give_payment_mode_before_gateways' ) ?>
983
+			do_action('give_payment_mode_before_gateways') ?>
984 984
 
985 985
 			<ul id="give-gateway-radio-list">
986
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
987
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
986
+				<?php foreach ($gateways as $gateway_id => $gateway) :
987
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
988 988
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
989
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
990
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
989
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
990
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
991 991
 					echo '</label></li>';
992 992
 				endforeach; ?>
993 993
 			</ul>
994
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
994
+			<?php do_action('give_payment_mode_after_gateways'); ?>
995 995
 		</div>
996
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
996
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
997 997
 	</fieldset>
998 998
 
999
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
999
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1000 1000
 
1001 1001
 	<div id="give_purchase_form_wrap">
1002 1002
 
1003
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1003
+		<?php do_action('give_purchase_form', $form_id); ?>
1004 1004
 
1005 1005
 	</div><!-- the checkout fields are loaded into this-->
1006 1006
 
1007
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1007
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1008 1008
 
1009 1009
 }
1010 1010
 
1011
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1011
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1012 1012
 
1013 1013
 
1014 1014
 /**
@@ -1023,35 +1023,35 @@  discard block
 block discarded – undo
1023 1023
  *
1024 1024
  * @return void
1025 1025
  */
1026
-function give_terms_agreement( $form_id ) {
1026
+function give_terms_agreement($form_id) {
1027 1027
 
1028
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1029
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1030
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1028
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1029
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1030
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1031 1031
 
1032
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1032
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1033 1033
 		<fieldset id="give_terms_agreement">
1034 1034
 			<div id="give_terms" style="display:none;">
1035 1035
 				<?php
1036
-				do_action( 'give_before_terms' );
1037
-				echo wpautop( stripslashes( $terms ) );
1038
-				do_action( 'give_after_terms' );
1036
+				do_action('give_before_terms');
1037
+				echo wpautop(stripslashes($terms));
1038
+				do_action('give_after_terms');
1039 1039
 				?>
1040 1040
 			</div>
1041 1041
 			<div id="give_show_terms">
1042
-				<a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a>
1043
-				<a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1042
+				<a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a>
1043
+				<a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1044 1044
 			</div>
1045 1045
 
1046 1046
 			<label
1047
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1047
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1048 1048
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1049 1049
 		</fieldset>
1050 1050
 		<?php
1051 1051
 	}
1052 1052
 }
1053 1053
 
1054
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1054
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1055 1055
 
1056 1056
 /**
1057 1057
  * Checkout Final Total
@@ -1063,27 +1063,27 @@  discard block
 block discarded – undo
1063 1063
  * @since      1.0
1064 1064
  * @return void
1065 1065
  */
1066
-function give_checkout_final_total( $form_id ) {
1066
+function give_checkout_final_total($form_id) {
1067 1067
 
1068
-	if ( isset( $_POST['give_total'] ) ) {
1069
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1068
+	if (isset($_POST['give_total'])) {
1069
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1070 1070
 	} else {
1071 1071
 		//default total
1072
-		$total = give_get_default_form_amount( $form_id );
1072
+		$total = give_get_default_form_amount($form_id);
1073 1073
 	}
1074 1074
 	//Only proceed if give_total available
1075
-	if ( empty( $total ) ) {
1075
+	if (empty($total)) {
1076 1076
 		return;
1077 1077
 	}
1078 1078
 	?>
1079 1079
 	<p id="give-final-total-wrap" class="form-wrap ">
1080
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1081
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1080
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1081
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1082 1082
 	</p>
1083 1083
 	<?php
1084 1084
 }
1085 1085
 
1086
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1086
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1087 1087
 
1088 1088
 
1089 1089
 /**
@@ -1095,22 +1095,22 @@  discard block
 block discarded – undo
1095 1095
  *
1096 1096
  * @return void
1097 1097
  */
1098
-function give_checkout_submit( $form_id ) {
1098
+function give_checkout_submit($form_id) {
1099 1099
 	?>
1100 1100
 	<fieldset id="give_purchase_submit">
1101
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1101
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1102 1102
 
1103
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1103
+		<?php give_checkout_hidden_fields($form_id); ?>
1104 1104
 
1105
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1105
+		<?php echo give_checkout_button_purchase($form_id); ?>
1106 1106
 
1107
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1107
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1108 1108
 
1109 1109
 	</fieldset>
1110 1110
 	<?php
1111 1111
 }
1112 1112
 
1113
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1113
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1114 1114
 
1115 1115
 
1116 1116
 /**
@@ -1123,17 +1123,17 @@  discard block
 block discarded – undo
1123 1123
  *
1124 1124
  * @return string
1125 1125
  */
1126
-function give_checkout_button_purchase( $form_id ) {
1126
+function give_checkout_button_purchase($form_id) {
1127 1127
 
1128
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1129
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1128
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1129
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1130 1130
 	ob_start(); ?>
1131 1131
 	<div class="give-submit-button-wrap give-clearfix">
1132 1132
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1133 1133
 		<span class="give-loading-animation"></span>
1134 1134
 	</div>
1135 1135
 	<?php
1136
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1136
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1137 1137
 }
1138 1138
 
1139 1139
 /**
@@ -1146,11 +1146,11 @@  discard block
 block discarded – undo
1146 1146
  *
1147 1147
  * @return void
1148 1148
  */
1149
-function give_agree_to_terms_js( $form_id ) {
1149
+function give_agree_to_terms_js($form_id) {
1150 1150
 
1151
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1151
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1152 1152
 
1153
-	if ( $form_option === 'yes' ) {
1153
+	if ($form_option === 'yes') {
1154 1154
 		?>
1155 1155
 		<script type="text/javascript">
1156 1156
 			jQuery(document).ready(function ($) {
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	}
1167 1167
 }
1168 1168
 
1169
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1169
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1170 1170
 
1171 1171
 /**
1172 1172
  * Show Give Goals
@@ -1179,25 +1179,25 @@  discard block
 block discarded – undo
1179 1179
  * @return mixed
1180 1180
  */
1181 1181
 
1182
-function give_show_goal_progress( $form_id, $args ) {
1182
+function give_show_goal_progress($form_id, $args) {
1183 1183
 
1184
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1185
-	$form        = new Give_Donate_Form( $form_id );
1184
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1185
+	$form        = new Give_Donate_Form($form_id);
1186 1186
 	$goal        = $form->goal;
1187
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1187
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1188 1188
 	$income      = $form->get_earnings();
1189
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1190
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1191
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1189
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1190
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1191
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1192 1192
 
1193 1193
 	//Sanity check - respect shortcode args
1194
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1194
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1195 1195
 		return false;
1196 1196
 	}
1197 1197
 
1198 1198
 	//Sanity check - ensure form has goal set to output
1199
-	if ( empty( $form->ID )
1200
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1199
+	if (empty($form->ID)
1200
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1201 1201
 	     || $goal_option !== 'yes'
1202 1202
 	     || $goal == 0
1203 1203
 	) {
@@ -1205,26 +1205,26 @@  discard block
 block discarded – undo
1205 1205
 		return false;
1206 1206
 	}
1207 1207
 
1208
-	$progress = round( ( $income / $goal ) * 100, 2 );
1208
+	$progress = round(($income / $goal) * 100, 2);
1209 1209
 
1210
-	if ( $income >= $goal ) {
1210
+	if ($income >= $goal) {
1211 1211
 		$progress = 100;
1212 1212
 	}
1213 1213
 
1214 1214
 	$output = '<div class="give-goal-progress">';
1215 1215
 
1216 1216
 	//Goal Progress Text
1217
-	if ( ! empty( $show_text ) ) {
1217
+	if ( ! empty($show_text)) {
1218 1218
 
1219 1219
 		$output .= '<div class="raised">';
1220 1220
 
1221
-		if ( $goal_format !== 'percentage' ) {
1221
+		if ($goal_format !== 'percentage') {
1222 1222
 
1223
-			$output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>';
1223
+			$output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>';
1224 1224
 
1225
-		} elseif ( $goal_format == 'percentage' ) {
1225
+		} elseif ($goal_format == 'percentage') {
1226 1226
 
1227
-			$output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>';
1227
+			$output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>';
1228 1228
 
1229 1229
 		}
1230 1230
 
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	}
1234 1234
 
1235 1235
 	//Goal Progress Bar
1236
-	if ( ! empty( $show_bar ) ) {
1236
+	if ( ! empty($show_bar)) {
1237 1237
 		$output .= '<div class="give-progress-bar">';
1238
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1239
-		if ( ! empty( $color ) ) {
1240
-			$output .= 'background-color:' . $color;
1238
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1239
+		if ( ! empty($color)) {
1240
+			$output .= 'background-color:'.$color;
1241 1241
 		}
1242 1242
 		$output .= '"></span>';
1243 1243
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
 	$output .= '</div><!-- /.goal-progress -->';
1247 1247
 
1248
-	echo apply_filters( 'give_goal_output', $output );
1248
+	echo apply_filters('give_goal_output', $output);
1249 1249
 
1250 1250
 	return false;
1251 1251
 
1252 1252
 }
1253 1253
 
1254
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1254
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1255 1255
 
1256 1256
 /**
1257 1257
  * Adds Actions to Render Form Content
@@ -1263,19 +1263,19 @@  discard block
 block discarded – undo
1263 1263
  *
1264 1264
  * @return void
1265 1265
  */
1266
-function give_form_content( $form_id, $args ) {
1266
+function give_form_content($form_id, $args) {
1267 1267
 
1268
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1268
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1269 1269
 		? $args['show_content']
1270
-		: get_post_meta( $form_id, '_give_content_option', true );
1270
+		: get_post_meta($form_id, '_give_content_option', true);
1271 1271
 
1272
-	if ( $show_content !== 'none' ) {
1272
+	if ($show_content !== 'none') {
1273 1273
 		//add action according to value
1274
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1274
+		add_action($show_content, 'give_form_display_content', 10, 2);
1275 1275
 	}
1276 1276
 }
1277 1277
 
1278
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1278
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1279 1279
 
1280 1280
 /**
1281 1281
  * Renders Post Form Content
@@ -1287,24 +1287,24 @@  discard block
 block discarded – undo
1287 1287
  * @return void
1288 1288
  * @since      1.0
1289 1289
  */
1290
-function give_form_display_content( $form_id, $args ) {
1290
+function give_form_display_content($form_id, $args) {
1291 1291
 
1292
-	$content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1293
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1292
+	$content = wpautop(get_post_meta($form_id, '_give_form_content', true));
1293
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1294 1294
 		? $args['show_content']
1295
-		: get_post_meta( $form_id, '_give_content_option', true );
1295
+		: get_post_meta($form_id, '_give_content_option', true);
1296 1296
 
1297
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1298
-		$content = apply_filters( 'the_content', $content );
1297
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1298
+		$content = apply_filters('the_content', $content);
1299 1299
 	}
1300 1300
 
1301
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1301
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1302 1302
 
1303
-	echo apply_filters( 'give_form_content_output', $output );
1303
+	echo apply_filters('give_form_content_output', $output);
1304 1304
 
1305 1305
 	//remove action to prevent content output on addition forms on page
1306 1306
 	//@see: https://github.com/WordImpress/Give/issues/634
1307
-	remove_action( $show_content, 'give_form_display_content' );
1307
+	remove_action($show_content, 'give_form_display_content');
1308 1308
 }
1309 1309
 
1310 1310
 
@@ -1317,16 +1317,16 @@  discard block
 block discarded – undo
1317 1317
  *
1318 1318
  * @return void
1319 1319
  */
1320
-function give_checkout_hidden_fields( $form_id ) {
1320
+function give_checkout_hidden_fields($form_id) {
1321 1321
 
1322
-	do_action( 'give_hidden_fields_before', $form_id );
1323
-	if ( is_user_logged_in() ) { ?>
1322
+	do_action('give_hidden_fields_before', $form_id);
1323
+	if (is_user_logged_in()) { ?>
1324 1324
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1325 1325
 	<?php } ?>
1326 1326
 	<input type="hidden" name="give_action" value="purchase"/>
1327
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1327
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1328 1328
 	<?php
1329
-	do_action( 'give_hidden_fields_after', $form_id );
1329
+	do_action('give_hidden_fields_after', $form_id);
1330 1330
 
1331 1331
 }
1332 1332
 
@@ -1341,20 +1341,20 @@  discard block
 block discarded – undo
1341 1341
  *
1342 1342
  * @return string $content Filtered content
1343 1343
  */
1344
-function give_filter_success_page_content( $content ) {
1344
+function give_filter_success_page_content($content) {
1345 1345
 
1346 1346
 	global $give_options;
1347 1347
 
1348
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1349
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1350
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1348
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1349
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1350
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1351 1351
 		}
1352 1352
 	}
1353 1353
 
1354 1354
 	return $content;
1355 1355
 }
1356 1356
 
1357
-add_filter( 'the_content', 'give_filter_success_page_content' );
1357
+add_filter('the_content', 'give_filter_success_page_content');
1358 1358
 
1359 1359
 
1360 1360
 /**
@@ -1366,14 +1366,14 @@  discard block
 block discarded – undo
1366 1366
 
1367 1367
 function give_test_mode_frontend_warning() {
1368 1368
 
1369
-	$test_mode = give_get_option( 'test_mode' );
1369
+	$test_mode = give_get_option('test_mode');
1370 1370
 
1371
-	if ( $test_mode == 'on' ) {
1372
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1371
+	if ($test_mode == 'on') {
1372
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1373 1373
 	}
1374 1374
 }
1375 1375
 
1376
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1376
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1377 1377
 
1378 1378
 
1379 1379
 /**
@@ -1383,21 +1383,21 @@  discard block
 block discarded – undo
1383 1383
  * @since       1.4.1
1384 1384
  */
1385 1385
 
1386
-function give_members_only_form( $final_output, $args ) {
1386
+function give_members_only_form($final_output, $args) {
1387 1387
 
1388
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1388
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1389 1389
 
1390 1390
 	//Sanity Check: Must have form_id & not be logged in
1391
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1391
+	if (empty($form_id) || is_user_logged_in()) {
1392 1392
 		return $final_output;
1393 1393
 	}
1394 1394
 
1395 1395
 	//Logged in only and Register / Login set to none
1396
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1396
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1397 1397
 
1398
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1398
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1399 1399
 
1400
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1400
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1401 1401
 
1402 1402
 	}
1403 1403
 
@@ -1405,4 +1405,4 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
 }
1407 1407
 
1408
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1409 1408
\ No newline at end of file
1409
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1410 1410
\ No newline at end of file
Please login to merge, or discard this patch.
includes/process-purchase.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @access      private
23 23
  * @since       1.0
24
- * @return      void
24
+ * @return      false|null
25 25
  */
26 26
 function give_process_purchase_form() {
27 27
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @since  1.0.1
328 328
  *
329
- * @param $payment_mode
329
+ * @param string $payment_mode
330 330
  *
331 331
  * @return mixed|void
332 332
  */
Please login to merge, or discard this patch.
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_process_purchase_form() {
27 27
 
28
-	do_action( 'give_pre_process_purchase' );
28
+	do_action('give_pre_process_purchase');
29 29
 
30 30
 	// Validate the form $_POST data
31 31
 	$valid_data = give_purchase_form_validate_fields();
32 32
 
33 33
 	// Allow themes and plugins to hook to errors
34
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
34
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
35 35
 
36
-	$is_ajax = isset( $_POST['give_ajax'] );
36
+	$is_ajax = isset($_POST['give_ajax']);
37 37
 
38 38
 	// Process the login form
39
-	if ( isset( $_POST['give_login_submit'] ) ) {
39
+	if (isset($_POST['give_login_submit'])) {
40 40
 		give_process_form_login();
41 41
 	}
42 42
 
43 43
 	// Validate the user
44
-	$user = give_get_purchase_form_user( $valid_data );
44
+	$user = give_get_purchase_form_user($valid_data);
45 45
 
46
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
47
-		if ( $is_ajax ) {
48
-			do_action( 'give_ajax_checkout_errors' );
46
+	if (false === $valid_data || give_get_errors() || ! $user) {
47
+		if ($is_ajax) {
48
+			do_action('give_ajax_checkout_errors');
49 49
 			give_die();
50 50
 		} else {
51 51
 			return false;
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	//If AJAX send back success to proceed with form submission
56
-	if ( $is_ajax ) {
56
+	if ($is_ajax) {
57 57
 		echo 'success';
58 58
 		give_die();
59 59
 	}
60 60
 
61 61
 	//After AJAX: Setup session if not using php_sessions
62
-	if ( ! Give()->session->use_php_sessions() ) {
62
+	if ( ! Give()->session->use_php_sessions()) {
63 63
 		//Double-check that set_cookie is publicly accessible;
64 64
 		// we're using a slightly modified class-wp-sessions.php
65
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
66
-		if ( $session_reflection->isPublic() ) {
65
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
66
+		if ($session_reflection->isPublic()) {
67 67
 			// Manually set the cookie.
68 68
 			Give()->session->init()->set_cookie();
69 69
 		}
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 		'address'    => $user['address']
79 79
 	);
80 80
 
81
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
81
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
82 82
 
83
-	$price = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
84
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
83
+	$price = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
84
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
85 85
 	
86 86
 	// Setup purchase information
87 87
 	$purchase_data = array(
88 88
 		'price'        => $price,
89 89
 		'purchase_key' => $purchase_key,
90 90
 		'user_email'   => $user['user_email'],
91
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
92
-		'user_info'    => stripslashes_deep( $user_info ),
91
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
92
+		'user_info'    => stripslashes_deep($user_info),
93 93
 		'post_data'    => $_POST,
94 94
 		'gateway'      => $valid_data['gateway'],
95 95
 		'card_info'    => $valid_data['cc_info']
@@ -99,37 +99,37 @@  discard block
 block discarded – undo
99 99
 	$valid_data['user'] = $user;
100 100
 
101 101
 	// Allow themes and plugins to hook before the gateway
102
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
102
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
103 103
 
104 104
 	//Sanity check for price
105
-	if ( ! $purchase_data['price'] ) {
105
+	if ( ! $purchase_data['price']) {
106 106
 		// Revert to manual
107 107
 		$purchase_data['gateway'] = 'manual';
108 108
 		$_POST['give-gateway']    = 'manual';
109 109
 	}
110 110
 
111 111
 	// Allow the purchase data to be modified before it is sent to the gateway
112
-	$purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data );
112
+	$purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data);
113 113
 
114 114
 	// Setup the data we're storing in the purchase session
115 115
 	$session_data = $purchase_data;
116 116
 
117 117
 	// Make sure credit card numbers are never stored in sessions
118
-	unset( $session_data['card_info']['card_number'] );
119
-	unset( $session_data['post_data']['card_number'] );
118
+	unset($session_data['card_info']['card_number']);
119
+	unset($session_data['post_data']['card_number']);
120 120
 
121 121
 	// Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data.
122
-	give_set_purchase_session( $session_data );
122
+	give_set_purchase_session($session_data);
123 123
 
124 124
 	// Send info to the gateway for payment processing
125
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
125
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
126 126
 	give_die();
127 127
 
128 128
 }
129 129
 
130
-add_action( 'give_purchase', 'give_process_purchase_form' );
131
-add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' );
132
-add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' );
130
+add_action('give_purchase', 'give_process_purchase_form');
131
+add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form');
132
+add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form');
133 133
 
134 134
 /**
135 135
  * Process the checkout login form
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_process_form_login() {
142 142
 
143
-	$is_ajax = isset( $_POST['give_ajax'] );
143
+	$is_ajax = isset($_POST['give_ajax']);
144 144
 
145 145
 	$user_data = give_purchase_form_validate_user_login();
146 146
 
147
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
148
-		if ( $is_ajax ) {
149
-			do_action( 'give_ajax_checkout_errors' );
147
+	if (give_get_errors() || $user_data['user_id'] < 1) {
148
+		if ($is_ajax) {
149
+			do_action('give_ajax_checkout_errors');
150 150
 			give_die();
151 151
 		} else {
152
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
152
+			wp_redirect($_SERVER['HTTP_REFERER']);
153 153
 			exit;
154 154
 		}
155 155
 	}
156 156
 
157
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
157
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
158 158
 
159
-	if ( $is_ajax ) {
159
+	if ($is_ajax) {
160 160
 		echo 'success';
161 161
 		give_die();
162 162
 	} else {
163
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
163
+		wp_redirect($_SERVER['HTTP_REFERER']);
164 164
 	}
165 165
 }
166 166
 
167
-add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' );
168
-add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' );
167
+add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login');
168
+add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login');
169 169
 
170 170
 /**
171 171
  * Purchase Form Validate Fields
@@ -177,40 +177,40 @@  discard block
 block discarded – undo
177 177
 function give_purchase_form_validate_fields() {
178 178
 
179 179
 	// Check if there is $_POST
180
-	if ( empty( $_POST ) ) {
180
+	if (empty($_POST)) {
181 181
 		return false;
182 182
 	}
183 183
 
184
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
184
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
185 185
 
186 186
 	// Start an array to collect valid data
187 187
 	$valid_data = array(
188 188
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
189
-		'need_new_user'    => false,     // New user flag
190
-		'need_user_login'  => false,     // Login user flag
191
-		'logged_user_data' => array(),   // Logged user collected data
192
-		'new_user_data'    => array(),   // New user collected data
193
-		'login_user_data'  => array(),   // Login user collected data
194
-		'guest_user_data'  => array(),   // Guest user collected data
189
+		'need_new_user'    => false, // New user flag
190
+		'need_user_login'  => false, // Login user flag
191
+		'logged_user_data' => array(), // Logged user collected data
192
+		'new_user_data'    => array(), // New user collected data
193
+		'login_user_data'  => array(), // Login user collected data
194
+		'guest_user_data'  => array(), // Guest user collected data
195 195
 		'cc_info'          => give_purchase_form_validate_cc()    // Credit card info
196 196
 	);
197 197
 
198 198
 	// Validate agree to terms
199
-	$terms_option = get_post_meta( $form_id, '_give_terms_option', true );
200
-	if ( isset( $terms_option ) && $terms_option === 'yes' ) {
199
+	$terms_option = get_post_meta($form_id, '_give_terms_option', true);
200
+	if (isset($terms_option) && $terms_option === 'yes') {
201 201
 		give_purchase_form_validate_agree_to_terms();
202 202
 	}
203 203
 
204
-	if ( is_user_logged_in() ) {
204
+	if (is_user_logged_in()) {
205 205
 		// Collect logged in user data
206 206
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
207
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
207
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
208 208
 		// Set new user registration as required
209 209
 		$valid_data['need_new_user'] = true;
210 210
 		// Validate new user data
211 211
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
212 212
 		// Check if login validation is needed
213
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
213
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
214 214
 		// Set user login as required
215 215
 		$valid_data['need_user_login'] = true;
216 216
 		// Validate users login info
@@ -235,37 +235,37 @@  discard block
 block discarded – undo
235 235
  */
236 236
 function give_purchase_form_validate_gateway() {
237 237
 
238
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
239
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
240
-	$gateway = give_get_default_gateway( $form_id );
238
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
239
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
240
+	$gateway = give_get_default_gateway($form_id);
241 241
 
242 242
 	// Check if a gateway value is present
243
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
243
+	if ( ! empty($_REQUEST['give-gateway'])) {
244 244
 
245
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
245
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
246 246
 
247 247
 		//Is amount being donated in LIVE mode 0.00? If so, error:
248
-		if ( $amount == 0 && ! give_is_test_mode() ) {
248
+		if ($amount == 0 && ! give_is_test_mode()) {
249 249
 
250
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
250
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
251 251
 
252 252
 		} //Check for a minimum custom amount
253
-		elseif ( ! give_verify_minimum_price() ) {
253
+		elseif ( ! give_verify_minimum_price()) {
254 254
 
255
-			$minimum       = give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) );
256
-			$error_message = __( 'This form has a minimum donation amount of %s', 'give' );
255
+			$minimum       = give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)));
256
+			$error_message = __('This form has a minimum donation amount of %s', 'give');
257 257
 
258
-			give_set_error( 'invalid_donation_minimum', sprintf( $error_message, $minimum ) );
258
+			give_set_error('invalid_donation_minimum', sprintf($error_message, $minimum));
259 259
 
260 260
 		} //Is this test mode zero donation? Let it through but set to manual gateway
261
-		elseif ( $amount == 0 && give_is_test_mode() ) {
261
+		elseif ($amount == 0 && give_is_test_mode()) {
262 262
 
263 263
 			$gateway = 'manual';
264 264
 
265 265
 		} //Check if this gateway is active
266
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
266
+		elseif ( ! give_is_gateway_active($gateway)) {
267 267
 
268
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) );
268
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give'));
269 269
 
270 270
 		}
271 271
 
@@ -284,23 +284,23 @@  discard block
 block discarded – undo
284 284
  */
285 285
 function give_verify_minimum_price() {
286 286
 
287
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
288
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
289
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
290
-	$variable_prices = give_has_variable_prices( $form_id );
287
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
288
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
289
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
290
+	$variable_prices = give_has_variable_prices($form_id);
291 291
 
292
-	if ( $variable_prices && ! empty( $price_id ) ) {
292
+	if ($variable_prices && ! empty($price_id)) {
293 293
 
294
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
294
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
295 295
 
296
-		if ( $price_level_amount == $amount ) {
296
+		if ($price_level_amount == $amount) {
297 297
 			return true;
298 298
 		}
299 299
 	}
300 300
 
301
-	$minimum = give_get_form_minimum_price( $form_id );
301
+	$minimum = give_get_form_minimum_price($form_id);
302 302
 
303
-	if ( $minimum > $amount ) {
303
+	if ($minimum > $amount) {
304 304
 		return false;
305 305
 	}
306 306
 
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
  */
317 317
 function give_purchase_form_validate_agree_to_terms() {
318 318
 	// Validate agree to terms
319
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
319
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
320 320
 		// User did not agree
321
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) );
321
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give')));
322 322
 	}
323 323
 }
324 324
 
@@ -332,47 +332,47 @@  discard block
 block discarded – undo
332 332
  *
333 333
  * @return      array
334 334
  */
335
-function give_purchase_form_required_fields( $form_id ) {
335
+function give_purchase_form_required_fields($form_id) {
336 336
 
337
-	$payment_mode = give_get_chosen_gateway( $form_id );
337
+	$payment_mode = give_get_chosen_gateway($form_id);
338 338
 
339 339
 	$required_fields = array(
340 340
 		'give_email' => array(
341 341
 			'error_id'      => 'invalid_email',
342
-			'error_message' => __( 'Please enter a valid email address', 'give' )
342
+			'error_message' => __('Please enter a valid email address', 'give')
343 343
 		),
344 344
 		'give_first' => array(
345 345
 			'error_id'      => 'invalid_first_name',
346
-			'error_message' => __( 'Please enter your first name', 'give' )
346
+			'error_message' => __('Please enter your first name', 'give')
347 347
 		)
348 348
 	);
349 349
 
350
-	$require_address = give_require_billing_address( $payment_mode );
350
+	$require_address = give_require_billing_address($payment_mode);
351 351
 
352
-	if ( $require_address ) {
353
-		$required_fields['card_address']    = array(
352
+	if ($require_address) {
353
+		$required_fields['card_address'] = array(
354 354
 			'error_id'      => 'invalid_card_address',
355
-			'error_message' => __( 'Please enter your primary billing address', 'give' )
355
+			'error_message' => __('Please enter your primary billing address', 'give')
356 356
 		);
357
-		$required_fields['card_zip']        = array(
357
+		$required_fields['card_zip'] = array(
358 358
 			'error_id'      => 'invalid_zip_code',
359
-			'error_message' => __( 'Please enter your zip / postal code', 'give' )
359
+			'error_message' => __('Please enter your zip / postal code', 'give')
360 360
 		);
361
-		$required_fields['card_city']       = array(
361
+		$required_fields['card_city'] = array(
362 362
 			'error_id'      => 'invalid_city',
363
-			'error_message' => __( 'Please enter your billing city', 'give' )
363
+			'error_message' => __('Please enter your billing city', 'give')
364 364
 		);
365 365
 		$required_fields['billing_country'] = array(
366 366
 			'error_id'      => 'invalid_country',
367
-			'error_message' => __( 'Please select your billing country', 'give' )
367
+			'error_message' => __('Please select your billing country', 'give')
368 368
 		);
369
-		$required_fields['card_state']      = array(
369
+		$required_fields['card_state'] = array(
370 370
 			'error_id'      => 'invalid_state',
371
-			'error_message' => __( 'Please enter billing state / province', 'give' )
371
+			'error_message' => __('Please enter billing state / province', 'give')
372 372
 		);
373 373
 	}
374 374
 
375
-	return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id );
375
+	return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id);
376 376
 
377 377
 }
378 378
 
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
  *
386 386
  * @return mixed|void
387 387
  */
388
-function give_require_billing_address( $payment_mode ) {
388
+function give_require_billing_address($payment_mode) {
389 389
 
390 390
 	$return = false;
391 391
 
392
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
392
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
393 393
 		$return = true;
394 394
 	}
395 395
 
396 396
 	// Let payment gateways and other extensions determine if address fields should be required
397
-	return apply_filters( 'give_require_billing_address', $return );
397
+	return apply_filters('give_require_billing_address', $return);
398 398
 
399 399
 }
400 400
 
@@ -408,43 +408,43 @@  discard block
 block discarded – undo
408 408
 function give_purchase_form_validate_logged_in_user() {
409 409
 	global $user_ID;
410 410
 
411
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
411
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
412 412
 
413 413
 	// Start empty array to collect valid user data
414 414
 	$valid_user_data = array(
415 415
 		// Assume there will be errors
416
-		'user_id' => - 1
416
+		'user_id' => -1
417 417
 	);
418 418
 
419 419
 	// Verify there is a user_ID
420
-	if ( $user_ID > 0 ) {
420
+	if ($user_ID > 0) {
421 421
 		// Get the logged in user data
422
-		$user_data = get_userdata( $user_ID );
422
+		$user_data = get_userdata($user_ID);
423 423
 
424 424
 		// Loop through required fields and show error messages
425
-		foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
426
-			if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
427
-				give_set_error( $value['error_id'], $value['error_message'] );
425
+		foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
426
+			if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
427
+				give_set_error($value['error_id'], $value['error_message']);
428 428
 			}
429 429
 		}
430 430
 
431 431
 		// Verify data
432
-		if ( $user_data ) {
432
+		if ($user_data) {
433 433
 			// Collected logged in user data
434 434
 			$valid_user_data = array(
435 435
 				'user_id'    => $user_ID,
436
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
437
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
438
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
436
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
437
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
438
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
439 439
 			);
440 440
 
441
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
442
-				give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
441
+			if ( ! is_email($valid_user_data['user_email'])) {
442
+				give_set_error('email_invalid', __('Invalid email', 'give'));
443 443
 			}
444 444
 
445 445
 		} else {
446 446
 			// Set invalid user error
447
-			give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) );
447
+			give_set_error('invalid_user', __('The user information is invalid', 'give'));
448 448
 		}
449 449
 	}
450 450
 
@@ -462,90 +462,90 @@  discard block
 block discarded – undo
462 462
 function give_purchase_form_validate_new_user() {
463 463
 
464 464
 	$registering_new_user = false;
465
-	$form_id              = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
465
+	$form_id              = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
466 466
 
467 467
 	// Start an empty array to collect valid user data
468 468
 	$valid_user_data = array(
469 469
 		// Assume there will be errors
470
-		'user_id'    => - 1,
470
+		'user_id'    => -1,
471 471
 		// Get first name
472
-		'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '',
472
+		'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '',
473 473
 		// Get last name
474
-		'user_last'  => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '',
474
+		'user_last'  => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '',
475 475
 	);
476 476
 
477 477
 	// Check the new user's credentials against existing ones
478
-	$user_login   = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false;
479
-	$user_email   = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false;
480
-	$user_pass    = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false;
481
-	$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;
478
+	$user_login   = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false;
479
+	$user_email   = isset($_POST['give_email']) ? trim($_POST['give_email']) : false;
480
+	$user_pass    = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false;
481
+	$pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false;
482 482
 
483 483
 	// Loop through required fields and show error messages
484
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
485
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
486
-			give_set_error( $value['error_id'], $value['error_message'] );
484
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
485
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
486
+			give_set_error($value['error_id'], $value['error_message']);
487 487
 		}
488 488
 	}
489 489
 
490 490
 	// Check if we have an username to register
491
-	if ( $user_login && strlen( $user_login ) > 0 ) {
491
+	if ($user_login && strlen($user_login) > 0) {
492 492
 		$registering_new_user = true;
493 493
 
494 494
 		// We have an user name, check if it already exists
495
-		if ( username_exists( $user_login ) ) {
495
+		if (username_exists($user_login)) {
496 496
 			// Username already registered
497
-			give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) );
497
+			give_set_error('username_unavailable', __('Username already taken', 'give'));
498 498
 			// Check if it's valid
499
-		} else if ( ! give_validate_username( $user_login ) ) {
499
+		} else if ( ! give_validate_username($user_login)) {
500 500
 			// Invalid username
501
-			if ( is_multisite() ) {
502
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) );
501
+			if (is_multisite()) {
502
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give'));
503 503
 			} else {
504
-				give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) );
504
+				give_set_error('username_invalid', __('Invalid username', 'give'));
505 505
 			}
506 506
 		} else {
507 507
 			// All the checks have run and it's good to go
508 508
 			$valid_user_data['user_login'] = $user_login;
509 509
 		}
510
-	} elseif ( give_logged_in_only( $form_id ) ) {
511
-		give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation', 'give' ) );
510
+	} elseif (give_logged_in_only($form_id)) {
511
+		give_set_error('registration_required', esc_html__('You must register or login to complete your donation', 'give'));
512 512
 	}
513 513
 
514 514
 	// Check if we have an email to verify
515
-	if ( $user_email && strlen( $user_email ) > 0 ) {
515
+	if ($user_email && strlen($user_email) > 0) {
516 516
 		// Validate email
517
-		if ( ! is_email( $user_email ) ) {
518
-			give_set_error( 'email_invalid', __( 'Sorry, that email is invalid', 'give' ) );
517
+		if ( ! is_email($user_email)) {
518
+			give_set_error('email_invalid', __('Sorry, that email is invalid', 'give'));
519 519
 			// Check if email exists
520
-		} else if ( email_exists( $user_email ) && $registering_new_user ) {
521
-			give_set_error( 'email_used', __( 'Sorry, that email already active for another user', 'give' ) );
520
+		} else if (email_exists($user_email) && $registering_new_user) {
521
+			give_set_error('email_used', __('Sorry, that email already active for another user', 'give'));
522 522
 		} else {
523 523
 			// All the checks have run and it's good to go
524 524
 			$valid_user_data['user_email'] = $user_email;
525 525
 		}
526 526
 	} else {
527 527
 		// No email
528
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
528
+		give_set_error('email_empty', __('Enter an email', 'give'));
529 529
 	}
530 530
 
531 531
 	// Check password
532
-	if ( $user_pass && $pass_confirm ) {
532
+	if ($user_pass && $pass_confirm) {
533 533
 		// Verify confirmation matches
534
-		if ( $user_pass != $pass_confirm ) {
534
+		if ($user_pass != $pass_confirm) {
535 535
 			// Passwords do not match
536
-			give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) );
536
+			give_set_error('password_mismatch', __('Passwords don\'t match', 'give'));
537 537
 		} else {
538 538
 			// All is good to go
539 539
 			$valid_user_data['user_pass'] = $user_pass;
540 540
 		}
541 541
 	} else {
542 542
 		// Password or confirmation missing
543
-		if ( ! $user_pass && $registering_new_user ) {
543
+		if ( ! $user_pass && $registering_new_user) {
544 544
 			// The password is invalid
545
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
546
-		} else if ( ! $pass_confirm && $registering_new_user ) {
545
+			give_set_error('password_empty', __('Enter a password', 'give'));
546
+		} else if ( ! $pass_confirm && $registering_new_user) {
547 547
 			// Confirmation password is invalid
548
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) );
548
+			give_set_error('confirmation_empty', __('Enter the password confirmation', 'give'));
549 549
 		}
550 550
 	}
551 551
 
@@ -564,34 +564,34 @@  discard block
 block discarded – undo
564 564
 	// Start an array to collect valid user data
565 565
 	$valid_user_data = array(
566 566
 		// Assume there will be errors
567
-		'user_id' => - 1
567
+		'user_id' => -1
568 568
 	);
569 569
 
570 570
 	// Username
571
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
572
-		give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) );
571
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
572
+		give_set_error('must_log_in', __('You must login or register to complete your donation', 'give'));
573 573
 
574 574
 		return $valid_user_data;
575 575
 	}
576 576
 
577 577
 	// Get the user by login
578
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
578
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
579 579
 
580 580
 	// Check if user exists
581
-	if ( $user_data ) {
581
+	if ($user_data) {
582 582
 		// Get password
583
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
583
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
584 584
 
585 585
 		// Check user_pass
586
-		if ( $user_pass ) {
586
+		if ($user_pass) {
587 587
 			// Check if password is valid
588
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
588
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
589 589
 				// Incorrect password
590 590
 				give_set_error(
591 591
 					'password_incorrect',
592 592
 					sprintf(
593
-						__( 'The password you entered is incorrect. %sReset Password%s', 'give' ),
594
-						'<a href="' . wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) . '" title="' . __( 'Lost Password', 'give' ) . '">',
593
+						__('The password you entered is incorrect. %sReset Password%s', 'give'),
594
+						'<a href="'.wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]").'" title="'.__('Lost Password', 'give').'">',
595 595
 						'</a>'
596 596
 					)
597 597
 				);
@@ -609,11 +609,11 @@  discard block
 block discarded – undo
609 609
 			}
610 610
 		} else {
611 611
 			// Empty password
612
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
612
+			give_set_error('password_empty', __('Enter a password', 'give'));
613 613
 		}
614 614
 	} else {
615 615
 		// no username
616
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) );
616
+		give_set_error('username_incorrect', __('The username you entered does not exist', 'give'));
617 617
 	}
618 618
 
619 619
 	return $valid_user_data;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
  */
629 629
 function give_purchase_form_validate_guest_user() {
630 630
 
631
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
631
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
632 632
 
633 633
 	// Start an array to collect valid user data
634 634
 	$valid_user_data = array(
@@ -637,32 +637,32 @@  discard block
 block discarded – undo
637 637
 	);
638 638
 
639 639
 	// Show error message if user must be logged in
640
-	if ( give_logged_in_only( $form_id ) ) {
641
-		give_set_error( 'logged_in_only', __( 'You must be logged into to donate', 'give' ) );
640
+	if (give_logged_in_only($form_id)) {
641
+		give_set_error('logged_in_only', __('You must be logged into to donate', 'give'));
642 642
 	}
643 643
 
644 644
 	// Get the guest email
645
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
645
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
646 646
 
647 647
 	// Check email
648
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
648
+	if ($guest_email && strlen($guest_email) > 0) {
649 649
 		// Validate email
650
-		if ( ! is_email( $guest_email ) ) {
650
+		if ( ! is_email($guest_email)) {
651 651
 			// Invalid email
652
-			give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
652
+			give_set_error('email_invalid', __('Invalid email', 'give'));
653 653
 		} else {
654 654
 			// All is good to go
655 655
 			$valid_user_data['user_email'] = $guest_email;
656 656
 		}
657 657
 	} else {
658 658
 		// No email
659
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
659
+		give_set_error('email_empty', __('Enter an email', 'give'));
660 660
 	}
661 661
 
662 662
 	// Loop through required fields and show error messages
663
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
664
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
665
-			give_set_error( $value['error_id'], $value['error_message'] );
663
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
664
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
665
+			give_set_error($value['error_id'], $value['error_message']);
666 666
 		}
667 667
 	}
668 668
 
@@ -678,42 +678,42 @@  discard block
 block discarded – undo
678 678
  * @since   1.0
679 679
  * @return  integer
680 680
  */
681
-function give_register_and_login_new_user( $user_data = array() ) {
681
+function give_register_and_login_new_user($user_data = array()) {
682 682
 	// Verify the array
683
-	if ( empty( $user_data ) ) {
684
-		return - 1;
683
+	if (empty($user_data)) {
684
+		return -1;
685 685
 	}
686 686
 
687
-	if ( give_get_errors() ) {
688
-		return - 1;
687
+	if (give_get_errors()) {
688
+		return -1;
689 689
 	}
690 690
 
691
-	$user_args = apply_filters( 'give_insert_user_args', array(
692
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
693
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
694
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
695
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
696
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
697
-		'user_registered' => date( 'Y-m-d H:i:s' ),
698
-		'role'            => get_option( 'default_role' )
699
-	), $user_data );
691
+	$user_args = apply_filters('give_insert_user_args', array(
692
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
693
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
694
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
695
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
696
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
697
+		'user_registered' => date('Y-m-d H:i:s'),
698
+		'role'            => get_option('default_role')
699
+	), $user_data);
700 700
 
701 701
 	// Insert new user
702
-	$user_id = wp_insert_user( $user_args );
702
+	$user_id = wp_insert_user($user_args);
703 703
 
704 704
 	// Validate inserted user
705
-	if ( is_wp_error( $user_id ) ) {
706
-		return - 1;
705
+	if (is_wp_error($user_id)) {
706
+		return -1;
707 707
 	}
708 708
 
709 709
 	// Allow themes and plugins to filter the user data
710
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
710
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
711 711
 
712 712
 	// Allow themes and plugins to hook
713
-	do_action( 'give_insert_user', $user_id, $user_data );
713
+	do_action('give_insert_user', $user_id, $user_data);
714 714
 
715 715
 	// Login new user
716
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
716
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
717 717
 
718 718
 	// Return user id
719 719
 	return $user_id;
@@ -728,27 +728,27 @@  discard block
 block discarded – undo
728 728
  * @since   1.0
729 729
  * @return  array
730 730
  */
731
-function give_get_purchase_form_user( $valid_data = array() ) {
731
+function give_get_purchase_form_user($valid_data = array()) {
732 732
 
733 733
 	// Initialize user
734 734
 	$user    = false;
735
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
735
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
736 736
 
737
-	if ( $is_ajax ) {
737
+	if ($is_ajax) {
738 738
 		// Do not create or login the user during the ajax submission (check for errors only)
739 739
 		return true;
740
-	} else if ( is_user_logged_in() ) {
740
+	} else if (is_user_logged_in()) {
741 741
 		// Set the valid user as the logged in collected data
742 742
 		$user = $valid_data['logged_in_user'];
743
-	} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
743
+	} else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
744 744
 		// New user registration
745
-		if ( $valid_data['need_new_user'] === true ) {
745
+		if ($valid_data['need_new_user'] === true) {
746 746
 			// Set user
747 747
 			$user = $valid_data['new_user_data'];
748 748
 			// Register and login new user
749
-			$user['user_id'] = give_register_and_login_new_user( $user );
749
+			$user['user_id'] = give_register_and_login_new_user($user);
750 750
 			// User login
751
-		} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
751
+		} else if ($valid_data['need_user_login'] === true && ! $is_ajax) {
752 752
 
753 753
 			/*
754 754
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -763,48 +763,48 @@  discard block
 block discarded – undo
763 763
 			// Set user
764 764
 			$user = $valid_data['login_user_data'];
765 765
 			// Login user
766
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
766
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
767 767
 		}
768 768
 	}
769 769
 
770 770
 	// Check guest checkout
771
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
771
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
772 772
 		// Set user
773 773
 		$user = $valid_data['guest_user_data'];
774 774
 	}
775 775
 
776 776
 	// Verify we have an user
777
-	if ( false === $user || empty( $user ) ) {
777
+	if (false === $user || empty($user)) {
778 778
 		// Return false
779 779
 		return false;
780 780
 	}
781 781
 
782 782
 	// Get user first name
783
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
784
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
783
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
784
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
785 785
 	}
786 786
 
787 787
 	// Get user last name
788
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
789
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
788
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
789
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
790 790
 	}
791 791
 
792 792
 	// Get the user's billing address details
793 793
 	$user['address']            = array();
794
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
795
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
796
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
797
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
798
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
799
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
800
-
801
-	if ( empty( $user['address']['country'] ) ) {
794
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
795
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
796
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
797
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
798
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
799
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
800
+
801
+	if (empty($user['address']['country'])) {
802 802
 		$user['address'] = false;
803 803
 	} // Country will always be set if address fields are present
804 804
 
805
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
805
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
806 806
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases
807
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
807
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
808 808
 	}
809 809
 
810 810
 	// Return valid user
@@ -823,16 +823,16 @@  discard block
 block discarded – undo
823 823
 	$card_data = give_get_purchase_cc_info();
824 824
 
825 825
 	// Validate the card zip
826
-	if ( ! empty( $card_data['card_zip'] ) ) {
827
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
828
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) );
826
+	if ( ! empty($card_data['card_zip'])) {
827
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
828
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give'));
829 829
 		}
830 830
 	}
831 831
 
832 832
 	//Ensure no spaces
833
-	if ( ! empty( $card_data['card_number'] ) ) {
834
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs
835
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
833
+	if ( ! empty($card_data['card_number'])) {
834
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs
835
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
836 836
 	}
837 837
 
838 838
 	// This should validate card numbers at some point too
@@ -848,17 +848,17 @@  discard block
 block discarded – undo
848 848
  */
849 849
 function give_get_purchase_cc_info() {
850 850
 	$cc_info                   = array();
851
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
852
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
853
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
854
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
855
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
856
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
857
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
858
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
859
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
860
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
861
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
851
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
852
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
853
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
854
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
855
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
856
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
857
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
858
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
859
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
860
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
861
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
862 862
 
863 863
 	// Return cc info
864 864
 	return $cc_info;
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
  *
875 875
  * @return bool|mixed|void
876 876
  */
877
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
877
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
878 878
 	$ret = false;
879 879
 
880
-	if ( empty( $zip ) || empty( $country_code ) ) {
880
+	if (empty($zip) || empty($country_code)) {
881 881
 		return $ret;
882 882
 	}
883 883
 
884
-	$country_code = strtoupper( $country_code );
884
+	$country_code = strtoupper($country_code);
885 885
 
886 886
 	$zip_regex = array(
887 887
 		"AD" => "AD\d{3}",
@@ -1041,9 +1041,9 @@  discard block
 block discarded – undo
1041 1041
 		"ZM" => "\d{5}"
1042 1042
 	);
1043 1043
 
1044
-	if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) {
1044
+	if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) {
1045 1045
 		$ret = true;
1046 1046
 	}
1047 1047
 
1048
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1048
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1049 1049
 }
1050 1050
\ No newline at end of file
Please login to merge, or discard this patch.
includes/user-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@
 block discarded – undo
270 270
  * @access      public
271 271
  * @since       1.0
272 272
  *
273
- * @param       $username string - the username to validate
273
+ * @param       string $username string - the username to validate
274 274
  *
275 275
  * @return      bool
276 276
  */
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user purchases
32 32
  */
33
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 
45
-	if ( $pagination ) {
46
-		if ( get_query_var( 'paged' ) ) {
47
-			$paged = get_query_var( 'paged' );
48
-		} else if ( get_query_var( 'page' ) ) {
49
-			$paged = get_query_var( 'page' );
45
+	if ($pagination) {
46
+		if (get_query_var('paged')) {
47
+			$paged = get_query_var('paged');
48
+		} else if (get_query_var('page')) {
49
+			$paged = get_query_var('page');
50 50
 		} else {
51 51
 			$paged = 1;
52 52
 		}
53 53
 	}
54 54
 
55
-	$args = apply_filters( 'give_get_users_purchases_args', array(
55
+	$args = apply_filters('give_get_users_purchases_args', array(
56 56
 		'user'    => $user,
57 57
 		'number'  => $number,
58 58
 		'status'  => $status,
59 59
 		'orderby' => 'date'
60
-	) );
60
+	));
61 61
 
62
-	if ( $pagination ) {
62
+	if ($pagination) {
63 63
 
64 64
 		$args['page'] = $paged;
65 65
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	$by_user_id = is_numeric( $user ) ? true : false;
73
-	$customer   = new Give_Customer( $user, $by_user_id );
72
+	$by_user_id = is_numeric($user) ? true : false;
73
+	$customer   = new Give_Customer($user, $by_user_id);
74 74
 
75
-	if ( ! empty( $customer->payment_ids ) ) {
75
+	if ( ! empty($customer->payment_ids)) {
76 76
 
77
-		unset( $args['user'] );
78
-		$args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) );
77
+		unset($args['user']);
78
+		$args['post__in'] = array_map('absint', explode(',', $customer->payment_ids));
79 79
 
80 80
 	}
81 81
 
82
-	$purchases = give_get_payments( apply_filters( 'give_get_users_purchases_args', $args ) );
82
+	$purchases = give_get_payments(apply_filters('give_get_users_purchases_args', $args));
83 83
 
84 84
 	// No purchases
85
-	if ( ! $purchases ) {
85
+	if ( ! $purchases) {
86 86
 		return false;
87 87
 	}
88 88
 
@@ -101,64 +101,64 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return bool|object List of unique forms purchased by user
103 103
  */
104
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
105
-	if ( empty( $user ) ) {
104
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
105
+	if (empty($user)) {
106 106
 		$user = get_current_user_id();
107 107
 	}
108 108
 
109
-	if ( empty( $user ) ) {
109
+	if (empty($user)) {
110 110
 		return false;
111 111
 	}
112 112
 
113
-	$by_user_id = is_numeric( $user ) ? true : false;
113
+	$by_user_id = is_numeric($user) ? true : false;
114 114
 
115
-	$customer = new Give_Customer( $user, $by_user_id );
115
+	$customer = new Give_Customer($user, $by_user_id);
116 116
 
117
-	if ( empty( $customer->payment_ids ) ) {
117
+	if (empty($customer->payment_ids)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	// Get all the items purchased
122
-	$payment_ids    = array_reverse( explode( ',', $customer->payment_ids ) );
123
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
124
-	if ( ! empty( $limit_payments ) ) {
125
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
122
+	$payment_ids    = array_reverse(explode(',', $customer->payment_ids));
123
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
124
+	if ( ! empty($limit_payments)) {
125
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
126 126
 	}
127 127
 	$donation_data = array();
128
-	foreach ( $payment_ids as $payment_id ) {
129
-		$donation_data[] = give_get_payment_meta( $payment_id );
128
+	foreach ($payment_ids as $payment_id) {
129
+		$donation_data[] = give_get_payment_meta($payment_id);
130 130
 	}
131 131
 
132
-	if ( empty( $donation_data ) ) {
132
+	if (empty($donation_data)) {
133 133
 		return false;
134 134
 	}
135 135
 
136 136
 	// Grab only the post ids "form_id" of the forms purchased on this order
137 137
 	$completed_donations_ids = array();
138
-	foreach ( $donation_data as $purchase_meta ) {
138
+	foreach ($donation_data as $purchase_meta) {
139 139
 		$completed_donations_ids[] = $purchase_meta['form_id'];
140 140
 	}
141
-	if ( empty( $completed_donations_ids ) ) {
141
+	if (empty($completed_donations_ids)) {
142 142
 		return false;
143 143
 	}
144 144
 
145 145
 	// Only include each product purchased once
146
-	$form_ids = array_unique( $completed_donations_ids );
146
+	$form_ids = array_unique($completed_donations_ids);
147 147
 
148 148
 	// Make sure we still have some products and a first item
149
-	if ( empty ( $form_ids ) || ! isset( $form_ids[0] ) ) {
149
+	if (empty ($form_ids) || ! isset($form_ids[0])) {
150 150
 		return false;
151 151
 	}
152 152
 
153
-	$post_type = get_post_type( $form_ids[0] );
153
+	$post_type = get_post_type($form_ids[0]);
154 154
 
155
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
155
+	$args = apply_filters('give_get_users_completed_donations_args', array(
156 156
 		'include'        => $form_ids,
157 157
 		'post_type'      => $post_type,
158
-		'posts_per_page' => - 1
159
-	) );
158
+		'posts_per_page' => -1
159
+	));
160 160
 
161
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
161
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
162 162
 }
163 163
 
164 164
 
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
  *
175 175
  * @return      bool - true if has purchased, false other wise.
176 176
  */
177
-function give_has_purchases( $user_id = null ) {
178
-	if ( empty( $user_id ) ) {
177
+function give_has_purchases($user_id = null) {
178
+	if (empty($user_id)) {
179 179
 		$user_id = get_current_user_id();
180 180
 	}
181 181
 
182
-	if ( give_get_users_purchases( $user_id, 1 ) ) {
182
+	if (give_get_users_purchases($user_id, 1)) {
183 183
 		return true; // User has at least one purchase
184 184
 	}
185 185
 
@@ -199,32 +199,32 @@  discard block
 block discarded – undo
199 199
  *
200 200
  * @return      array
201 201
  */
202
-function give_get_purchase_stats_by_user( $user = '' ) {
202
+function give_get_purchase_stats_by_user($user = '') {
203 203
 
204
-	if ( is_email( $user ) ) {
204
+	if (is_email($user)) {
205 205
 
206 206
 		$field = 'email';
207 207
 
208
-	} elseif ( is_numeric( $user ) ) {
208
+	} elseif (is_numeric($user)) {
209 209
 
210 210
 		$field = 'user_id';
211 211
 
212 212
 	}
213 213
 
214 214
 	$stats    = array();
215
-	$customer = Give()->customers->get_customer_by( $field, $user );
215
+	$customer = Give()->customers->get_customer_by($field, $user);
216 216
 
217
-	if ( $customer ) {
217
+	if ($customer) {
218 218
 
219
-		$customer = new Give_Customer( $customer->id );
219
+		$customer = new Give_Customer($customer->id);
220 220
 
221
-		$stats['purchases']   = absint( $customer->purchase_count );
222
-		$stats['total_spent'] = give_sanitize_amount( $customer->purchase_value );
221
+		$stats['purchases']   = absint($customer->purchase_count);
222
+		$stats['total_spent'] = give_sanitize_amount($customer->purchase_value);
223 223
 
224 224
 	}
225 225
 
226 226
 
227
-	return (array) apply_filters( 'give_purchase_stats_by_user', $stats, $user );
227
+	return (array) apply_filters('give_purchase_stats_by_user', $stats, $user);
228 228
 }
229 229
 
230 230
 
@@ -240,22 +240,22 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return      int - the total number of purchases
242 242
  */
243
-function give_count_purchases_of_customer( $user = null ) {
243
+function give_count_purchases_of_customer($user = null) {
244 244
 
245 245
 	//Logged in?
246
-	if ( empty( $user ) ) {
246
+	if (empty($user)) {
247 247
 		$user = get_current_user_id();
248 248
 	}
249 249
 
250 250
 	//Email access?
251
-	if ( empty( $user ) && Give()->email_access->token_email ) {
251
+	if (empty($user) && Give()->email_access->token_email) {
252 252
 		$user = Give()->email_access->token_email;
253 253
 	}
254 254
 
255 255
 
256
-	$stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false;
256
+	$stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false;
257 257
 
258
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
258
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
259 259
 }
260 260
 
261 261
 /**
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return      float - the total amount the user has spent
270 270
  */
271
-function give_purchase_total_of_user( $user = null ) {
271
+function give_purchase_total_of_user($user = null) {
272 272
 
273
-	$stats = give_get_purchase_stats_by_user( $user );
273
+	$stats = give_get_purchase_stats_by_user($user);
274 274
 
275 275
 	return $stats['total_spent'];
276 276
 }
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @return      bool
288 288
  */
289
-function give_validate_username( $username ) {
290
-	$sanitized = sanitize_user( $username, false );
291
-	$valid     = ( $sanitized == $username );
289
+function give_validate_username($username) {
290
+	$sanitized = sanitize_user($username, false);
291
+	$valid     = ($sanitized == $username);
292 292
 
293
-	return (bool) apply_filters( 'give_validate_username', $valid, $username );
293
+	return (bool) apply_filters('give_validate_username', $valid, $username);
294 294
 }
295 295
 
296 296
 
@@ -307,32 +307,32 @@  discard block
 block discarded – undo
307 307
  *
308 308
  * @return      void
309 309
  */
310
-function give_add_past_purchases_to_new_user( $user_id ) {
310
+function give_add_past_purchases_to_new_user($user_id) {
311 311
 
312
-	$email = get_the_author_meta( 'user_email', $user_id );
312
+	$email = get_the_author_meta('user_email', $user_id);
313 313
 
314
-	$payments = give_get_payments( array( 's' => $email ) );
314
+	$payments = give_get_payments(array('s' => $email));
315 315
 
316
-	if ( $payments ) {
317
-		foreach ( $payments as $payment ) {
318
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
316
+	if ($payments) {
317
+		foreach ($payments as $payment) {
318
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
319 319
 				continue;
320 320
 			} // This payment already associated with an account
321 321
 
322
-			$meta                    = give_get_payment_meta( $payment->ID );
323
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
322
+			$meta                    = give_get_payment_meta($payment->ID);
323
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
324 324
 			$meta['user_info']['id'] = $user_id;
325 325
 			$meta['user_info']       = $meta['user_info'];
326 326
 
327 327
 			// Store the updated user ID in the payment meta
328
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
329
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
328
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
329
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
330 330
 		}
331 331
 	}
332 332
 
333 333
 }
334 334
 
335
-add_action( 'user_register', 'give_add_past_purchases_to_new_user' );
335
+add_action('user_register', 'give_add_past_purchases_to_new_user');
336 336
 
337 337
 
338 338
 /**
@@ -354,34 +354,34 @@  discard block
 block discarded – undo
354 354
  * @since         1.0
355 355
  * @return        array - The donor's address, if any
356 356
  */
357
-function give_get_donor_address( $user_id = 0 ) {
358
-	if ( empty( $user_id ) ) {
357
+function give_get_donor_address($user_id = 0) {
358
+	if (empty($user_id)) {
359 359
 		$user_id = get_current_user_id();
360 360
 	}
361 361
 
362
-	$address = get_user_meta( $user_id, '_give_user_address', true );
362
+	$address = get_user_meta($user_id, '_give_user_address', true);
363 363
 
364
-	if ( ! isset( $address['line1'] ) ) {
364
+	if ( ! isset($address['line1'])) {
365 365
 		$address['line1'] = '';
366 366
 	}
367 367
 
368
-	if ( ! isset( $address['line2'] ) ) {
368
+	if ( ! isset($address['line2'])) {
369 369
 		$address['line2'] = '';
370 370
 	}
371 371
 
372
-	if ( ! isset( $address['city'] ) ) {
372
+	if ( ! isset($address['city'])) {
373 373
 		$address['city'] = '';
374 374
 	}
375 375
 
376
-	if ( ! isset( $address['zip'] ) ) {
376
+	if ( ! isset($address['zip'])) {
377 377
 		$address['zip'] = '';
378 378
 	}
379 379
 
380
-	if ( ! isset( $address['country'] ) ) {
380
+	if ( ! isset($address['country'])) {
381 381
 		$address['country'] = '';
382 382
 	}
383 383
 
384
-	if ( ! isset( $address['state'] ) ) {
384
+	if ( ! isset($address['state'])) {
385 385
 		$address['state'] = '';
386 386
 	}
387 387
 
@@ -401,25 +401,25 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return        void
403 403
  */
404
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
404
+function give_new_user_notification($user_id = 0, $user_data = array()) {
405 405
 
406
-	if ( empty( $user_id ) || empty( $user_data ) ) {
406
+	if (empty($user_id) || empty($user_data)) {
407 407
 		return;
408 408
 	}
409
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
410
-	$message  = sprintf( esc_attr__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
411
-	$message .= sprintf( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n\r\n";
412
-	$message .= sprintf( esc_attr__( 'E-mail: %s' ), $user_data['user_email'] ) . "\r\n";
409
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
410
+	$message  = sprintf(esc_attr__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
411
+	$message .= sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n\r\n";
412
+	$message .= sprintf(esc_attr__('E-mail: %s'), $user_data['user_email'])."\r\n";
413 413
 
414
-	@wp_mail( get_option( 'admin_email' ), sprintf( esc_attr__( '[%s] New User Registration' ), $blogname ), $message );
414
+	@wp_mail(get_option('admin_email'), sprintf(esc_attr__('[%s] New User Registration'), $blogname), $message);
415 415
 
416
-	$message = sprintf( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n";
417
-	$message .= sprintf( esc_attr__( 'Password: %s' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n";
416
+	$message = sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n";
417
+	$message .= sprintf(esc_attr__('Password: %s'), esc_attr__('[Password entered during donation]', 'give'))."\r\n";
418 418
 
419
-	$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login', 'give' ) . ' &raquo;</a>' . "\r\n";
419
+	$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login', 'give').' &raquo;</a>'."\r\n";
420 420
 
421
-	wp_mail( $user_data['user_email'], sprintf( esc_attr__( '[%s] Your username and password' ), $blogname ), $message );
421
+	wp_mail($user_data['user_email'], sprintf(esc_attr__('[%s] Your username and password'), $blogname), $message);
422 422
 
423 423
 }
424 424
 
425
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
425
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_get_actions() {
26
-	if ( isset( $_GET['give_action'] ) ) {
27
-		do_action( 'give_' . $_GET['give_action'], $_GET );
26
+	if (isset($_GET['give_action'])) {
27
+		do_action('give_'.$_GET['give_action'], $_GET);
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'init', 'give_get_actions' );
31
+add_action('init', 'give_get_actions');
32 32
 
33 33
 /**
34 34
  * Hooks Give actions, when present in the $_POST superglobal. Every give_action
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  * @return void
40 40
  */
41 41
 function give_post_actions() {
42
-	if ( isset( $_POST['give_action'] ) ) {
43
-		do_action( 'give_' . $_POST['give_action'], $_POST );
42
+	if (isset($_POST['give_action'])) {
43
+		do_action('give_'.$_POST['give_action'], $_POST);
44 44
 	}
45 45
 }
46 46
 
47
-add_action( 'init', 'give_post_actions' );
48 47
\ No newline at end of file
48
+add_action('init', 'give_post_actions');
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  * @return void
23 23
  */
24 24
 function give_process_actions() {
25
-	if ( isset( $_POST['give-action'] ) ) {
26
-		do_action( 'give_' . $_POST['give-action'], $_POST );
25
+	if (isset($_POST['give-action'])) {
26
+		do_action('give_'.$_POST['give-action'], $_POST);
27 27
 	}
28 28
 
29
-	if ( isset( $_GET['give-action'] ) ) {
30
-		do_action( 'give_' . $_GET['give-action'], $_GET );
29
+	if (isset($_GET['give-action'])) {
30
+		do_action('give_'.$_GET['give-action'], $_GET);
31 31
 	}
32 32
 }
33 33
 
34
-add_action( 'admin_init', 'give_process_actions' );
35 34
\ No newline at end of file
35
+add_action('admin_init', 'give_process_actions');
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
31
-		$rate_text = sprintf( __( 'If you like <strong>Give</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">', '</a>' );
30
+	if ($typenow == 'give_forms') {
31
+		$rate_text = sprintf(__('If you like <strong>Give</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">', '</a>');
32 32
 
33 33
 		return $rate_text;
34 34
 	} else {
@@ -36,4 +36,4 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 }
38 38
 
39
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
39
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -34,31 +34,31 @@  discard block
 block discarded – undo
34 34
 	//	$give_campaigns_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_campaigns->labels->menu_name, $give_campaigns->labels->add_new, 'edit_' . $give_campaigns->capability_type . 's', 'post-new.php?post_type=give_campaigns', null );
35 35
 
36 36
 	//Payments
37
-	$give_payment       = get_post_type_object( 'give_payment' );
38
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
37
+	$give_payment       = get_post_type_object('give_payment');
38
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
39 39
 
40 40
 	//Donors
41
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donors', 'give' ), __( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
41
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', __('Donors', 'give'), __('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
42 42
 
43 43
 	//Reports
44
-	$give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donation Reports', 'give' ), __( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' );
44
+	$give_reports_page = add_submenu_page('edit.php?post_type=give_forms', __('Donation Reports', 'give'), __('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page');
45 45
 
46 46
 	//Settings
47
-	$give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Settings', 'give' ), __( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array(
47
+	$give_settings_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Settings', 'give'), __('Settings', 'give'), 'manage_give_settings', 'give-settings', array(
48 48
 		Give()->give_settings,
49 49
 		'admin_page_display'
50
-	) );
50
+	));
51 51
 
52 52
 	//Add-ons
53
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Add-ons', 'give' ), __( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
53
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Add-ons', 'give'), __('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
54 54
 
55 55
 	//Upgrades
56
-	$give_upgrades_screen = add_submenu_page( null, __( 'Give Upgrades', 'give' ), __( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
56
+	$give_upgrades_screen = add_submenu_page(null, __('Give Upgrades', 'give'), __('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
57 57
 
58 58
 
59 59
 }
60 60
 
61
-add_action( 'admin_menu', 'give_add_options_links', 10 );
61
+add_action('admin_menu', 'give_add_options_links', 10);
62 62
 
63 63
 /**
64 64
  *  Determines whether the current admin page is a Give admin page.
@@ -73,224 +73,224 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return bool True if Give admin page.
75 75
  */
76
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
76
+function give_is_admin_page($passed_page = '', $passed_view = '') {
77 77
 
78 78
 	global $pagenow, $typenow;
79 79
 
80 80
 	$found     = false;
81
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
82
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
83
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
84
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
85
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
86
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
81
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
82
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
83
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
84
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
85
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
86
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
87 87
 
88
-	switch ( $passed_page ) {
88
+	switch ($passed_page) {
89 89
 		case 'give_forms':
90
-			switch ( $passed_view ) {
90
+			switch ($passed_view) {
91 91
 				case 'list-table':
92
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
92
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
93 93
 						$found = true;
94 94
 					}
95 95
 					break;
96 96
 				case 'edit':
97
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
97
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
98 98
 						$found = true;
99 99
 					}
100 100
 					break;
101 101
 				case 'new':
102
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
102
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
103 103
 						$found = true;
104 104
 					}
105 105
 					break;
106 106
 				default:
107
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
107
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
108 108
 						$found = true;
109 109
 					}
110 110
 					break;
111 111
 			}
112 112
 			break;
113 113
 		case 'categories':
114
-			switch ( $passed_view ) {
114
+			switch ($passed_view) {
115 115
 				case 'list-table':
116 116
 				case 'new':
117
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
117
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
118 118
 						$found = true;
119 119
 					}
120 120
 					break;
121 121
 				case 'edit':
122
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
122
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
123 123
 						$found = true;
124 124
 					}
125 125
 					break;
126 126
 				default:
127
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
127
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
128 128
 						$found = true;
129 129
 					}
130 130
 					break;
131 131
 			}
132 132
 			break;
133 133
 		case 'tags':
134
-			switch ( $passed_view ) {
134
+			switch ($passed_view) {
135 135
 				case 'list-table':
136 136
 				case 'new':
137
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
137
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
138 138
 						$found = true;
139 139
 					}
140 140
 					break;
141 141
 				case 'edit':
142
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
142
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
143 143
 						$found = true;
144 144
 					}
145 145
 					break;
146 146
 				default:
147
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
147
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
148 148
 						$found = true;
149 149
 					}
150 150
 					break;
151 151
 			}
152 152
 			break;
153 153
 		case 'payments':
154
-			switch ( $passed_view ) {
154
+			switch ($passed_view) {
155 155
 				case 'list-table':
156
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
156
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
157 157
 						$found = true;
158 158
 					}
159 159
 					break;
160 160
 				case 'edit':
161
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
161
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
162 162
 						$found = true;
163 163
 					}
164 164
 					break;
165 165
 				default:
166
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
166
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
167 167
 						$found = true;
168 168
 					}
169 169
 					break;
170 170
 			}
171 171
 			break;
172 172
 		case 'reports':
173
-			switch ( $passed_view ) {
173
+			switch ($passed_view) {
174 174
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
175 175
 				case 'earnings':
176
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
176
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
177 177
 						$found = true;
178 178
 					}
179 179
 					break;
180 180
 				case 'donors':
181
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
181
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
182 182
 						$found = true;
183 183
 					}
184 184
 					break;
185 185
 				case 'gateways':
186
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
186
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
187 187
 						$found = true;
188 188
 					}
189 189
 					break;
190 190
 				case 'export':
191
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
191
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
192 192
 						$found = true;
193 193
 					}
194 194
 					break;
195 195
 				case 'logs':
196
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
196
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
197 197
 						$found = true;
198 198
 					}
199 199
 					break;
200 200
 				default:
201
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
201
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
202 202
 						$found = true;
203 203
 					}
204 204
 					break;
205 205
 			}
206 206
 			break;
207 207
 		case 'settings':
208
-			switch ( $passed_view ) {
208
+			switch ($passed_view) {
209 209
 				case 'general':
210
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
210
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
211 211
 						$found = true;
212 212
 					}
213 213
 					break;
214 214
 				case 'gateways':
215
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
215
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
216 216
 						$found = true;
217 217
 					}
218 218
 					break;
219 219
 				case 'emails':
220
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
220
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
221 221
 						$found = true;
222 222
 					}
223 223
 					break;
224 224
 				case 'display':
225
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
225
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
226 226
 						$found = true;
227 227
 					}
228 228
 					break;
229 229
 				case 'licenses':
230
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
230
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
231 231
 						$found = true;
232 232
 					}
233 233
 					break;
234 234
 				case 'api':
235
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
235
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
236 236
 						$found = true;
237 237
 					}
238 238
 					break;
239 239
 				case 'advanced':
240
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
240
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
241 241
 						$found = true;
242 242
 					}
243 243
 					break;
244 244
 				case 'system_info':
245
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
245
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
246 246
 						$found = true;
247 247
 					}
248 248
 					break;
249 249
 				default:
250
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
250
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
251 251
 						$found = true;
252 252
 					}
253 253
 					break;
254 254
 			}
255 255
 			break;
256 256
 		case 'addons':
257
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
257
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
258 258
 				$found = true;
259 259
 			}
260 260
 			break;
261 261
 		case 'donors':
262
-			switch ( $passed_view ) {
262
+			switch ($passed_view) {
263 263
 				case 'list-table':
264
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
264
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
265 265
 						$found = true;
266 266
 					}
267 267
 					break;
268 268
 				case 'overview':
269
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
269
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
270 270
 						$found = true;
271 271
 					}
272 272
 					break;
273 273
 				case 'notes':
274
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
274
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
275 275
 						$found = true;
276 276
 					}
277 277
 					break;
278 278
 				default:
279
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
279
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
280 280
 						$found = true;
281 281
 					}
282 282
 					break;
283 283
 			}
284 284
 			break;
285 285
 		case 'reports':
286
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
286
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
287 287
 				$found = true;
288 288
 			}
289 289
 			break;
290 290
 		default:
291 291
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page;
292 292
 
293
-			$admin_pages = apply_filters( 'give_admin_pages', array(
293
+			$admin_pages = apply_filters('give_admin_pages', array(
294 294
 				$give_payments_page,
295 295
 				$give_settings_page,
296 296
 				$give_reports_page,
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 				$give_upgrades_screen,
300 300
 				$give_settings_export,
301 301
 				$give_customers_page
302
-			) );
303
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
302
+			));
303
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
304 304
 				$found = true;
305
-				if ( 'give-upgrades' === $page ) {
305
+				if ('give-upgrades' === $page) {
306 306
 					$found = false;
307 307
 				}
308
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
308
+			} elseif (in_array($pagenow, $admin_pages)) {
309 309
 				$found = true;
310 310
 			}
311 311
 			break;
312 312
 	}
313 313
 
314
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
314
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
315 315
 
316 316
 }
317 317
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param $_banner_details
26 26
 	 */
27
-	function __construct( $_banner_details ) {
27
+	function __construct($_banner_details) {
28 28
 
29 29
 		global $current_user;
30 30
 		$this->banner_details = $_banner_details;
31
-		$this->test_mode      = ( $this->banner_details['testing'] == 'true' ) ? true : false;
32
-		$this->nag_meta_key   = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
31
+		$this->test_mode      = ($this->banner_details['testing'] == 'true') ? true : false;
32
+		$this->nag_meta_key   = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
33 33
 
34 34
 		//Get current user
35 35
 		$this->user_id = $current_user->ID;
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 	public function init() {
49 49
 
50 50
 		//Testing?
51
-		if ( $this->test_mode ) {
52
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
51
+		if ($this->test_mode) {
52
+			delete_user_meta($this->user_id, $this->nag_meta_key);
53 53
 		}
54 54
 
55 55
 		//Get the current page to add the notice to
56
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
57
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
56
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
57
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
58 58
 
59 59
 
60 60
 	}
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		global $pagenow;
70 70
 
71 71
 		//Make sure we're on the plugins page.
72
-		if ( $pagenow !== 'plugins.php' ) {
72
+		if ($pagenow !== 'plugins.php') {
73 73
 			return false;
74 74
 		}
75 75
 
76 76
 		// If the user hasn't already dismissed our alert,
77 77
 		// Output the activation banner
78
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?>
78
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?>
79 79
 
80 80
 			<!-- * I output inline styles here
81 81
 				 * because there's no reason to keep these
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 				<img src="<?php echo GIVE_PLUGIN_URL; ?>assets/images/svg/give-icon-full-circle.svg" class="give-logo" />
153 153
 
154 154
 				<!-- Your Message -->
155
-				<h3><?php echo sprintf( __( 'Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give' ), '<span>', $this->banner_details['name'], '</span>' ); ?></h3>
155
+				<h3><?php echo sprintf(__('Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give'), '<span>', $this->banner_details['name'], '</span>'); ?></h3>
156 156
 
157 157
 				<a href="<?php
158 158
 				//The Dismiss Button
159
-				$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
160
-				echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
159
+				$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
160
+				echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
161 161
 
162 162
 				<!-- * Now we output a few "actions"
163 163
 					 * that the user can take from here -->
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 				<div class="alert-actions">
166 166
 
167 167
 					<?php //Point them to your settings page
168
-					if ( isset( $this->banner_details['settings_url'] ) ) { ?>
168
+					if (isset($this->banner_details['settings_url'])) { ?>
169 169
 						<a href="<?php echo $this->banner_details['settings_url']; ?>">
170
-							<span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?>
170
+							<span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?>
171 171
 						</a>
172 172
 					<?php } ?>
173 173
 
174 174
 					<?php
175 175
 					// Show them how to configure the Addon
176
-					if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
177
-						<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf( __( 'Documentation: %1$s Add-on', 'give' ), $this->banner_details['name'] ); ?>
176
+					if (isset($this->banner_details['documentation_url'])) { ?>
177
+						<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf(__('Documentation: %1$s Add-on', 'give'), $this->banner_details['name']); ?>
178 178
 						</a>
179 179
 					<?php } ?>
180 180
 					<?php
181 181
 					//Let them signup for plugin updates
182
-					if ( isset( $this->banner_details['support_url'] ) ) { ?>
182
+					if (isset($this->banner_details['support_url'])) { ?>
183 183
 
184 184
 						<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
185
-							<span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?>
185
+							<span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?>
186 186
 						</a>
187 187
 
188 188
 					<?php } ?>
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 		/* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
204 204
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
205 205
 		 */
206
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
206
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
207 207
 
208 208
 			//Get the global user
209 209
 			global $current_user;
210 210
 			$user_id = $current_user->ID;
211 211
 
212
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
212
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
213 213
 		}
214 214
 	}
215 215
 
Please login to merge, or discard this patch.