Completed
Push — master ( 92b4ca...04de2e )
by Matt
17:28
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.
Spacing   +396 added lines, -396 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
-		<?php if ( $form->is_close_donation_form() ) : ?>
100
+		<?php if ($form->is_close_donation_form()) : ?>
101 101
 			<?php
102 102
 			//Get thank you message.
103
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
104
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our goal.', 'give' );
103
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
104
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our goal.', 'give');
105 105
 
106 106
 			//Print thank you message.
107 107
 			echo "<p class=\"give-from-thankyou-msg\">{$display_thankyou_message}</p>";
108 108
 			?>
109 109
 		<?php else : ?>
110 110
 			<?php
111
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
111
+			if (isset($args['show_title']) && $args['show_title'] == true) {
112 112
 
113
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
113
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
114 114
 
115 115
 			} ?>
116 116
 
117
-			<?php do_action( 'give_pre_form', $form->ID, $args ); ?>
117
+			<?php do_action('give_pre_form', $form->ID, $args); ?>
118 118
 
119 119
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
120 120
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
121
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
122
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
123
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
124
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
121
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
122
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
123
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
124
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
125 125
 
126 126
 				<!-- The following field is for robots only, invisible to humans: -->
127 127
 				<span class="give-hidden" style="display: none !important;">
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 				<?php
133 133
 
134 134
 				//Price ID hidden field for variable (mult-level) donation forms
135
-				if ( give_has_variable_prices( $form_id ) ) {
135
+				if (give_has_variable_prices($form_id)) {
136 136
 					//get default selected price ID
137
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
137
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
138 138
 					$price_id = 0;
139 139
 					//loop through prices
140
-					foreach ( $prices as $price ) {
141
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
140
+					foreach ($prices as $price) {
141
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
142 142
 							$price_id = $price['_give_id']['level_id'];
143 143
 						};
144 144
 					}
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
147 147
 				<?php }
148 148
 
149
-				do_action( 'give_checkout_form_top', $form->ID, $args );
149
+				do_action('give_checkout_form_top', $form->ID, $args);
150 150
 
151
-				do_action( 'give_payment_mode_select', $form->ID, $args );
151
+				do_action('give_payment_mode_select', $form->ID, $args);
152 152
 
153
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
153
+				do_action('give_checkout_form_bottom', $form->ID, $args);
154 154
 
155 155
 				?>
156 156
 			</form>
157 157
 
158
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
158
+			<?php do_action('give_post_form', $form->ID, $args); ?>
159 159
 
160 160
 		<?php endif; ?>
161 161
 
162
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
162
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
163 163
 	<?php
164 164
 
165 165
 	/**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 * @param int $form ->ID The current form ID
171 171
 	 * @param array $args An array of form args
172 172
 	 */
173
-	do_action( 'give_post_form_output', $form->ID, $args );
173
+	do_action('give_post_form_output', $form->ID, $args);
174 174
 
175 175
 	$final_output = ob_get_clean();
176 176
 
177
-	echo apply_filters( 'give_donate_form', $final_output, $args );
177
+	echo apply_filters('give_donate_form', $final_output, $args);
178 178
 }
179 179
 
180 180
 
@@ -194,43 +194,43 @@  discard block
 block discarded – undo
194 194
  * @global    $give_options Array of all the Give options
195 195
  * @return string
196 196
  */
197
-function give_show_purchase_form( $form_id ) {
197
+function give_show_purchase_form($form_id) {
198 198
 
199
-	$payment_mode = give_get_chosen_gateway( $form_id );
199
+	$payment_mode = give_get_chosen_gateway($form_id);
200 200
 
201
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
201
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
202 202
 		$form_id = $_POST['give_form_id'];
203 203
 	}
204 204
 
205
-	do_action( 'give_purchase_form_top', $form_id );
205
+	do_action('give_purchase_form_top', $form_id);
206 206
 
207
-	if ( give_can_checkout() && isset( $form_id ) ) {
207
+	if (give_can_checkout() && isset($form_id)) {
208 208
 
209
-		do_action( 'give_purchase_form_before_register_login', $form_id );
209
+		do_action('give_purchase_form_before_register_login', $form_id);
210 210
 
211
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
211
+		do_action('give_purchase_form_register_login_fields', $form_id);
212 212
 
213
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
213
+		do_action('give_purchase_form_before_cc_form', $form_id);
214 214
 
215 215
 		// Load the credit card form and allow gateways to load their own if they wish
216
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
217
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
216
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
217
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
218 218
 		} else {
219
-			do_action( 'give_cc_form', $form_id );
219
+			do_action('give_cc_form', $form_id);
220 220
 		}
221 221
 
222
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
222
+		do_action('give_purchase_form_after_cc_form', $form_id);
223 223
 
224 224
 	} else {
225 225
 		// Can't checkout
226
-		do_action( 'give_purchase_form_no_access', $form_id );
226
+		do_action('give_purchase_form_no_access', $form_id);
227 227
 
228 228
 	}
229 229
 
230
-	do_action( 'give_purchase_form_bottom', $form_id );
230
+	do_action('give_purchase_form_bottom', $form_id);
231 231
 }
232 232
 
233
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
233
+add_action('give_purchase_form', 'give_show_purchase_form');
234 234
 
235 235
 /**
236 236
  *
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return void
244 244
  */
245
-function give_show_register_login_fields( $form_id ) {
245
+function give_show_register_login_fields($form_id) {
246 246
 
247
-	$show_register_form = give_show_login_register_option( $form_id );
247
+	$show_register_form = give_show_login_register_option($form_id);
248 248
 
249
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
249
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
250 250
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
251
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
251
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
252 252
 		</div>
253
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
253
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
254 254
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
255
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
255
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
256 256
 		</div>
257 257
 	<?php endif; ?>
258 258
 
259
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
260
-		do_action( 'give_purchase_form_after_user_info', $form_id );
259
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
260
+		do_action('give_purchase_form_after_user_info', $form_id);
261 261
 	}
262 262
 }
263 263
 
264
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
264
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
265 265
 
266 266
 /**
267 267
  * Donation Amount Field
@@ -275,33 +275,33 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @return void
277 277
  */
278
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
278
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
279 279
 
280 280
 	global $give_options;
281 281
 
282
-	$variable_pricing    = give_has_variable_prices( $form_id );
283
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
284
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
285
-	$symbol              = give_currency_symbol( give_get_currency() );
286
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
287
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
288
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
282
+	$variable_pricing    = give_has_variable_prices($form_id);
283
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
284
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
285
+	$symbol              = give_currency_symbol(give_get_currency());
286
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
287
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
288
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
289 289
 
290
-	do_action( 'give_before_donation_levels', $form_id, $args );
290
+	do_action('give_before_donation_levels', $form_id, $args);
291 291
 
292 292
 	//Set Price, No Custom Amount Allowed means hidden price field
293
-	if ( $allow_custom_amount == 'no' ) {
293
+	if ($allow_custom_amount == 'no') {
294 294
 		?>
295 295
 
296
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
296
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
297 297
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
298 298
 		       value="<?php echo $default_amount; ?>" required>
299 299
 		<div class="set-price give-donation-amount form-row-wide">
300
-			<?php if ( $currency_position == 'before' ) {
300
+			<?php if ($currency_position == 'before') {
301 301
 				echo $currency_output;
302 302
 			} ?>
303 303
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
304
-			<?php if ( $currency_position == 'after' ) {
304
+			<?php if ($currency_position == 'after') {
305 305
 				echo $currency_output;
306 306
 			} ?>
307 307
 		</div>
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		?>
312 312
 		<div class="give-total-wrap">
313 313
 			<div class="give-donation-amount form-row-wide">
314
-				<?php if ( $currency_position == 'before' ) {
314
+				<?php if ($currency_position == 'before') {
315 315
 					echo $currency_output;
316 316
 				} ?>
317
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
317
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
318 318
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
319
-				<?php if ( $currency_position == 'after' ) {
319
+				<?php if ($currency_position == 'after') {
320 320
 					echo $currency_output;
321 321
 				} ?>
322 322
 			</div>
323 323
 		</div>
324 324
 	<?php }
325 325
 
326
-	do_action( 'give_after_donation_amount', $form_id, $args );
326
+	do_action('give_after_donation_amount', $form_id, $args);
327 327
 
328 328
 	//Custom Amount Text
329
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
329
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
330 330
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
331 331
 	<?php }
332 332
 
333 333
 	//Output Variable Pricing Levels
334
-	if ( $variable_pricing ) {
335
-		give_output_levels( $form_id );
334
+	if ($variable_pricing) {
335
+		give_output_levels($form_id);
336 336
 	}
337 337
 
338
-	do_action( 'give_after_donation_levels', $form_id, $args );
338
+	do_action('give_after_donation_levels', $form_id, $args);
339 339
 }
340 340
 
341
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
341
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
342 342
 
343 343
 
344 344
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  *
351 351
  * @return string
352 352
  */
353
-function give_output_levels( $form_id ) {
353
+function give_output_levels($form_id) {
354 354
 
355 355
 	//Get variable pricing
356
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
357
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
358
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
359
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
360
-	if ( empty( $custom_amount_text ) ) {
361
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
356
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
357
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
358
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
359
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
360
+	if (empty($custom_amount_text)) {
361
+		$custom_amount_text = __('Give a Custom Amount', 'give');
362 362
 	}
363 363
 
364 364
 	$output  = '';
365 365
 	$counter = 0;
366 366
 
367
-	switch ( $display_style ) {
367
+	switch ($display_style) {
368 368
 		case 'buttons':
369 369
 
370 370
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
371 371
 
372
-			foreach ( $prices as $price ) {
373
-				$counter ++;
374
-				$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 );
375
-				$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 );
372
+			foreach ($prices as $price) {
373
+				$counter++;
374
+				$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);
375
+				$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);
376 376
 
377 377
 				$output .= '<li>';
378
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
378
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
379 379
 				$output .= $level_text;
380 380
 				$output .= '</button>';
381 381
 				$output .= '</li>';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 
385 385
 			//Custom Amount
386
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
386
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
387 387
 				$output .= '<li>';
388 388
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
389 389
 				$output .= $custom_amount_text;
@@ -399,23 +399,23 @@  discard block
 block discarded – undo
399 399
 
400 400
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
401 401
 
402
-			foreach ( $prices as $price ) {
403
-				$counter ++;
404
-				$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 );
405
-				$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 );
402
+			foreach ($prices as $price) {
403
+				$counter++;
404
+				$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);
405
+				$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);
406 406
 
407 407
 				$output .= '<li>';
408
-				$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'] ) . '">';
409
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
408
+				$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']).'">';
409
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
410 410
 				$output .= '</li>';
411 411
 
412 412
 			}
413 413
 
414 414
 			//Custom Amount
415
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
415
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
416 416
 				$output .= '<li>';
417 417
 				$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">';
418
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
418
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
419 419
 				$output .= '</li>';
420 420
 			}
421 421
 
@@ -425,23 +425,23 @@  discard block
 block discarded – undo
425 425
 
426 426
 		case 'dropdown':
427 427
 
428
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
429
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
428
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
429
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
430 430
 
431 431
 			//first loop through prices
432
-			foreach ( $prices as $price ) {
433
-				$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 );
434
-				$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 );
432
+			foreach ($prices as $price) {
433
+				$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);
434
+				$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);
435 435
 
436
-				$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'] ) . '">';
436
+				$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']).'">';
437 437
 				$output .= $level_text;
438 438
 				$output .= '</option>';
439 439
 
440 440
 			}
441 441
 
442 442
 			//Custom Amount
443
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
444
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
443
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
444
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
445 445
 			}
446 446
 
447 447
 			$output .= '</select>';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 			break;
450 450
 	}
451 451
 
452
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
452
+	echo apply_filters('give_form_level_output', $output, $form_id);
453 453
 }
454 454
 
455 455
 /**
@@ -461,26 +461,26 @@  discard block
 block discarded – undo
461 461
  * @param array $args
462 462
  *
463 463
  */
464
-function give_display_checkout_button( $form_id, $args ) {
464
+function give_display_checkout_button($form_id, $args) {
465 465
 
466
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
466
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
467 467
 		? $args['display_style']
468
-		: get_post_meta( $form_id, '_give_payment_display', true );
468
+		: get_post_meta($form_id, '_give_payment_display', true);
469 469
 
470 470
 	//no btn for onpage
471
-	if ( $display_option === 'onpage' ) {
471
+	if ($display_option === 'onpage') {
472 472
 		return;
473 473
 	}
474 474
 
475
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
476
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
475
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
476
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
477 477
 
478
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
478
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
479 479
 
480
-	echo apply_filters( 'give_display_checkout_button', $output );
480
+	echo apply_filters('give_display_checkout_button', $output);
481 481
 }
482 482
 
483
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
483
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
484 484
 
485 485
 /**
486 486
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -491,71 +491,71 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return void
493 493
  */
494
-function give_user_info_fields( $form_id ) {
494
+function give_user_info_fields($form_id) {
495 495
 
496
-	if ( is_user_logged_in() ) :
497
-		$user_data = get_userdata( get_current_user_id() );
496
+	if (is_user_logged_in()) :
497
+		$user_data = get_userdata(get_current_user_id());
498 498
 	endif;
499 499
 
500
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
500
+	do_action('give_purchase_form_before_personal_info', $form_id);
501 501
 	?>
502 502
 	<fieldset id="give_checkout_user_info">
503
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
503
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
504 504
 		<p id="give-first-name-wrap" class="form-row form-row-first">
505 505
 			<label class="give-label" for="give-first">
506
-				<?php _e( 'First Name', 'give' ); ?>
507
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
506
+				<?php _e('First Name', 'give'); ?>
507
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
508 508
 					<span class="give-required-indicator">*</span>
509 509
 				<?php } ?>
510
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
510
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
511 511
 			</label>
512
-			<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 ) ) {
512
+			<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)) {
513 513
 				echo ' required ';
514 514
 			} ?>/>
515 515
 		</p>
516 516
 
517 517
 		<p id="give-last-name-wrap" class="form-row form-row-last">
518 518
 			<label class="give-label" for="give-last">
519
-				<?php _e( 'Last Name', 'give' ); ?>
520
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
519
+				<?php _e('Last Name', 'give'); ?>
520
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
521 521
 					<span class="give-required-indicator">*</span>
522 522
 				<?php } ?>
523
-				<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>
523
+				<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>
524 524
 			</label>
525 525
 
526
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
526
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
527 527
 				echo ' required';
528
-			} ?>" 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 ) ) {
528
+			} ?>" 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)) {
529 529
 				echo ' required ';
530 530
 			} ?> />
531 531
 		</p>
532 532
 
533
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
533
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
534 534
 		<p id="give-email-wrap" class="form-row form-row-wide">
535 535
 			<label class="give-label" for="give-email">
536
-				<?php _e( 'Email Address', 'give' ); ?>
537
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
536
+				<?php _e('Email Address', 'give'); ?>
537
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
538 538
 					<span class="give-required-indicator">*</span>
539 539
 				<?php } ?>
540
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
540
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
541 541
 			</label>
542 542
 
543
-			<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 ) ) {
543
+			<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)) {
544 544
 				echo ' required ';
545 545
 			} ?>/>
546 546
 
547 547
 		</p>
548
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
548
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
549 549
 
550
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
550
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
551 551
 	</fieldset>
552 552
 	<?php
553
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
553
+	do_action('give_purchase_form_after_personal_info', $form_id);
554 554
 
555 555
 }
556 556
 
557
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
558
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
557
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
558
+add_action('give_register_fields_before', 'give_user_info_fields');
559 559
 
560 560
 /**
561 561
  * Renders the credit card info form.
@@ -566,73 +566,73 @@  discard block
 block discarded – undo
566 566
  *
567 567
  * @return void
568 568
  */
569
-function give_get_cc_form( $form_id ) {
569
+function give_get_cc_form($form_id) {
570 570
 
571 571
 	ob_start();
572 572
 
573
-	do_action( 'give_before_cc_fields', $form_id ); ?>
573
+	do_action('give_before_cc_fields', $form_id); ?>
574 574
 
575 575
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
576
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
577
-		<?php if ( is_ssl() ) : ?>
576
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
577
+		<?php if (is_ssl()) : ?>
578 578
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
579 579
 				<span class="give-icon padlock"></span>
580
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
580
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
581 581
 			</div>
582 582
 		<?php endif; ?>
583 583
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
584 584
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
585
-				<?php _e( 'Card Number', 'give' ); ?>
585
+				<?php _e('Card Number', 'give'); ?>
586 586
 				<span class="give-required-indicator">*</span>
587
-				<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>
587
+				<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>
588 588
 				<span class="card-type"></span>
589 589
 			</label>
590 590
 
591
-			<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/>
591
+			<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/>
592 592
 		</p>
593 593
 
594 594
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
595 595
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
596
-				<?php _e( 'CVC', 'give' ); ?>
596
+				<?php _e('CVC', 'give'); ?>
597 597
 				<span class="give-required-indicator">*</span>
598
-				<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>
598
+				<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>
599 599
 			</label>
600 600
 
601
-			<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/>
601
+			<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/>
602 602
 		</p>
603 603
 
604 604
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
605 605
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
606
-				<?php _e( 'Name on the Card', 'give' ); ?>
606
+				<?php _e('Name on the Card', 'give'); ?>
607 607
 				<span class="give-required-indicator">*</span>
608
-				<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>
608
+				<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>
609 609
 			</label>
610 610
 
611
-			<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/>
611
+			<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/>
612 612
 		</p>
613
-		<?php do_action( 'give_before_cc_expiration' ); ?>
613
+		<?php do_action('give_before_cc_expiration'); ?>
614 614
 		<p class="card-expiration form-row form-row-one-third">
615 615
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
616
-				<?php _e( 'Expiration', 'give' ); ?>
616
+				<?php _e('Expiration', 'give'); ?>
617 617
 				<span class="give-required-indicator">*</span>
618
-				<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>
618
+				<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>
619 619
 			</label>
620 620
 
621 621
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
622 622
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
623 623
 
624
-			<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/>
624
+			<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/>
625 625
 		</p>
626
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
626
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
627 627
 
628 628
 	</fieldset>
629 629
 	<?php
630
-	do_action( 'give_after_cc_fields', $form_id );
630
+	do_action('give_after_cc_fields', $form_id);
631 631
 
632 632
 	echo ob_get_clean();
633 633
 }
634 634
 
635
-add_action( 'give_cc_form', 'give_get_cc_form' );
635
+add_action('give_cc_form', 'give_get_cc_form');
636 636
 
637 637
 /**
638 638
  * Outputs the default credit card address fields
@@ -643,110 +643,110 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return void
645 645
  */
646
-function give_default_cc_address_fields( $form_id ) {
646
+function give_default_cc_address_fields($form_id) {
647 647
 
648 648
 	$logged_in = is_user_logged_in();
649 649
 
650
-	if ( $logged_in ) {
651
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
650
+	if ($logged_in) {
651
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
652 652
 	}
653
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
654
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
655
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
656
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
653
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
654
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
655
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
656
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
657 657
 	ob_start(); ?>
658 658
 	<fieldset id="give_cc_address" class="cc-address">
659
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
660
-		<?php do_action( 'give_cc_billing_top' ); ?>
659
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
660
+		<?php do_action('give_cc_billing_top'); ?>
661 661
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
662 662
 			<label for="card_address" class="give-label">
663
-				<?php _e( 'Address', 'give' ); ?>
663
+				<?php _e('Address', 'give'); ?>
664 664
 				<?php
665
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
665
+				if (give_field_is_required('card_address', $form_id)) { ?>
666 666
 					<span class="give-required-indicator">*</span>
667 667
 				<?php } ?>
668
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
668
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
671
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
672 672
 				echo ' required';
673
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
673
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
674 674
 				echo '  required ';
675 675
 			} ?>/>
676 676
 		</p>
677 677
 
678 678
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
679 679
 			<label for="card_address_2" class="give-label">
680
-				<?php _e( 'Address Line 2', 'give' ); ?>
681
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
680
+				<?php _e('Address Line 2', 'give'); ?>
681
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
682 682
 					<span class="give-required-indicator">*</span>
683 683
 				<?php } ?>
684
-				<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>
684
+				<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>
685 685
 			</label>
686 686
 
687
-			<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 ) ) {
687
+			<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)) {
688 688
 				echo ' required';
689
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
689
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
690 690
 				echo ' required ';
691 691
 			} ?>/>
692 692
 		</p>
693 693
 
694 694
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
695 695
 			<label for="card_city" class="give-label">
696
-				<?php _e( 'City', 'give' ); ?>
697
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
696
+				<?php _e('City', 'give'); ?>
697
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
698 698
 					<span class="give-required-indicator">*</span>
699 699
 				<?php } ?>
700
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
700
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
701 701
 			</label>
702
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
702
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
703 703
 				echo ' required';
704
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
704
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
705 705
 				echo ' required ';
706 706
 			} ?>/>
707 707
 		</p>
708 708
 
709 709
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
710 710
 			<label for="card_zip" class="give-label">
711
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
712
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
711
+				<?php _e('Zip / Postal Code', 'give'); ?>
712
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
713 713
 					<span class="give-required-indicator">*</span>
714 714
 				<?php } ?>
715
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
715
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
716 716
 			</label>
717 717
 
718
-			<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 ) ) {
718
+			<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)) {
719 719
 				echo ' required';
720
-			} ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
720
+			} ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
721 721
 				echo ' required ';
722 722
 			} ?>/>
723 723
 		</p>
724 724
 
725 725
 		<p id="give-card-country-wrap" class="form-row form-row-first">
726 726
 			<label for="billing_country" class="give-label">
727
-				<?php _e( 'Country', 'give' ); ?>
728
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
727
+				<?php _e('Country', 'give'); ?>
728
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
729 729
 					<span class="give-required-indicator">*</span>
730 730
 				<?php } ?>
731
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
731
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
732 732
 			</label>
733 733
 
734
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
734
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
735 735
 				echo ' required';
736
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
736
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
737 737
 				echo ' required ';
738 738
 			} ?>>
739 739
 				<?php
740 740
 
741 741
 				$selected_country = give_get_country();
742 742
 
743
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
743
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
744 744
 					$selected_country = $user_address['country'];
745 745
 				}
746 746
 
747 747
 				$countries = give_get_country_list();
748
-				foreach ( $countries as $country_code => $country ) {
749
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
748
+				foreach ($countries as $country_code => $country) {
749
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
750 750
 				}
751 751
 				?>
752 752
 			</select>
@@ -754,44 +754,44 @@  discard block
 block discarded – undo
754 754
 
755 755
 		<p id="give-card-state-wrap" class="form-row form-row-last">
756 756
 			<label for="card_state" class="give-label">
757
-				<?php _e( 'State / Province', 'give' ); ?>
758
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
757
+				<?php _e('State / Province', 'give'); ?>
758
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
759 759
 					<span class="give-required-indicator">*</span>
760 760
 				<?php } ?>
761
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
761
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
762 762
 			</label>
763 763
 
764 764
 			<?php
765 765
 			$selected_state = give_get_state();
766
-			$states         = give_get_states( $selected_country );
766
+			$states         = give_get_states($selected_country);
767 767
 
768
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
768
+			if ($logged_in && ! empty($user_address['state'])) {
769 769
 				$selected_state = $user_address['state'];
770 770
 			}
771 771
 
772
-			if ( ! empty( $states ) ) : ?>
773
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
772
+			if ( ! empty($states)) : ?>
773
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
774 774
 					echo ' required';
775
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
775
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
776 776
 					echo ' required ';
777 777
 				} ?>>
778 778
 					<?php
779
-					foreach ( $states as $state_code => $state ) {
780
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
779
+					foreach ($states as $state_code => $state) {
780
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
781 781
 					}
782 782
 					?>
783 783
 				</select>
784 784
 			<?php else : ?>
785
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
785
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
786 786
 			<?php endif; ?>
787 787
 		</p>
788
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
788
+		<?php do_action('give_cc_billing_bottom'); ?>
789 789
 	</fieldset>
790 790
 	<?php
791 791
 	echo ob_get_clean();
792 792
 }
793 793
 
794
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
794
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
795 795
 
796 796
 
797 797
 /**
@@ -803,93 +803,93 @@  discard block
 block discarded – undo
803 803
  *
804 804
  * @return string
805 805
  */
806
-function give_get_register_fields( $form_id ) {
806
+function give_get_register_fields($form_id) {
807 807
 
808 808
 	global $user_ID;
809 809
 
810
-	if ( is_user_logged_in() ) {
811
-		$user_data = get_userdata( $user_ID );
810
+	if (is_user_logged_in()) {
811
+		$user_data = get_userdata($user_ID);
812 812
 	}
813 813
 
814
-	$show_register_form = give_show_login_register_option( $form_id );
814
+	$show_register_form = give_show_login_register_option($form_id);
815 815
 
816 816
 	ob_start(); ?>
817 817
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
818 818
 
819
-		<?php if ( $show_register_form == 'both' ) { ?>
819
+		<?php if ($show_register_form == 'both') { ?>
820 820
 			<div class="give-login-account-wrap">
821
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
822
-					<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>
821
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
822
+					<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>
823 823
 				</p>
824 824
 				<p class="give-loading-text">
825
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
825
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
826 826
 			</div>
827 827
 		<?php } ?>
828 828
 
829
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
829
+		<?php do_action('give_register_fields_before', $form_id); ?>
830 830
 
831 831
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
832
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
833
-				if ( ! give_logged_in_only( $form_id ) ) {
834
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
832
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
833
+				if ( ! give_logged_in_only($form_id)) {
834
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
835 835
 				} ?></legend>
836
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
836
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
837 837
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
838 838
 				<label for="give-user-login-<?php echo $form_id; ?>">
839
-					<?php _e( 'Username', 'give' ); ?>
840
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
839
+					<?php _e('Username', 'give'); ?>
840
+					<?php if (give_logged_in_only($form_id)) { ?>
841 841
 						<span class="give-required-indicator">*</span>
842 842
 					<?php } ?>
843
-					<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>
843
+					<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>
844 844
 				</label>
845 845
 
846
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
846
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
847 847
 					echo 'required ';
848
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
848
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
849 849
 			</div>
850 850
 
851 851
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
852 852
 				<label for="give-user-pass-<?php echo $form_id; ?>">
853
-					<?php _e( 'Password', 'give' ); ?>
854
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
853
+					<?php _e('Password', 'give'); ?>
854
+					<?php if (give_logged_in_only($form_id)) { ?>
855 855
 						<span class="give-required-indicator">*</span>
856 856
 					<?php } ?>
857
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
857
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
858 858
 				</label>
859 859
 
860
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
860
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
861 861
 					echo 'required ';
862
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
862
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
863 863
 			</div>
864 864
 
865 865
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
866 866
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
867
-					<?php _e( 'Confirm PW', 'give' ); ?>
868
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
867
+					<?php _e('Confirm PW', 'give'); ?>
868
+					<?php if (give_logged_in_only($form_id)) { ?>
869 869
 						<span class="give-required-indicator">*</span>
870 870
 					<?php } ?>
871
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
871
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
872 872
 				</label>
873 873
 
874
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
874
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
875 875
 					echo 'required ';
876
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
876
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
877 877
 			</div>
878
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
878
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
879 879
 		</fieldset>
880 880
 
881
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
881
+		<?php do_action('give_register_fields_after', $form_id); ?>
882 882
 
883 883
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
884 884
 
885
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
885
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
886 886
 
887 887
 	</fieldset>
888 888
 	<?php
889 889
 	echo ob_get_clean();
890 890
 }
891 891
 
892
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
892
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
893 893
 
894 894
 /**
895 895
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -902,73 +902,73 @@  discard block
 block discarded – undo
902 902
  *
903 903
  * @return string
904 904
  */
905
-function give_get_login_fields( $form_id ) {
905
+function give_get_login_fields($form_id) {
906 906
 
907
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
908
-	$show_register_form = give_show_login_register_option( $form_id );
907
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
908
+	$show_register_form = give_show_login_register_option($form_id);
909 909
 
910 910
 	ob_start();
911 911
 	?>
912 912
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
913
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
914
-			if ( ! give_logged_in_only( $form_id ) ) {
915
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
913
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
914
+			if ( ! give_logged_in_only($form_id)) {
915
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
916 916
 			} ?>
917 917
 		</legend>
918
-		<?php if ( $show_register_form == 'both' ) { ?>
918
+		<?php if ($show_register_form == 'both') { ?>
919 919
 			<p class="give-new-account-link">
920
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
921
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
-					<?php _e( 'Register', 'give' );
923
-					if ( ! give_logged_in_only( $form_id ) ) {
924
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
920
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
921
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
+					<?php _e('Register', 'give');
923
+					if ( ! give_logged_in_only($form_id)) {
924
+						echo ' '.__('or checkout as a guest.', 'give');
925 925
 					} ?>
926 926
 				</a>
927 927
 			</p>
928 928
 			<p class="give-loading-text">
929
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
929
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
930 930
 		<?php } ?>
931
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
931
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
932 932
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
933 933
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
934
-				<?php _e( 'Username', 'give' ); ?>
935
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
934
+				<?php _e('Username', 'give'); ?>
935
+				<?php if (give_logged_in_only($form_id)) { ?>
936 936
 					<span class="give-required-indicator">*</span>
937 937
 				<?php } ?>
938 938
 			</label>
939 939
 
940
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
940
+			<input class="<?php if (give_logged_in_only($form_id)) {
941 941
 				echo 'required ';
942
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
942
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
943 943
 		</div>
944 944
 
945 945
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
946 946
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
947
-				<?php _e( 'Password', 'give' ); ?>
948
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
947
+				<?php _e('Password', 'give'); ?>
948
+				<?php if (give_logged_in_only($form_id)) { ?>
949 949
 					<span class="give-required-indicator">*</span>
950 950
 				<?php } ?>
951 951
 			</label>
952
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
952
+			<input class="<?php if (give_logged_in_only($form_id)) {
953 953
 				echo 'required ';
954
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
954
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
955 955
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
956 956
 		</div>
957 957
 
958 958
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
959
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
960
-			<?php if ( $show_register_form !== 'login' ) { ?>
961
-				<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' ); ?>"/>
959
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
960
+			<?php if ($show_register_form !== 'login') { ?>
961
+				<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'); ?>"/>
962 962
 			<?php } ?>
963 963
 			<span class="give-loading-animation"></span>
964 964
 		</div>
965
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
965
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
966 966
 	</fieldset><!--end #give-login-fields-->
967 967
 	<?php
968 968
 	echo ob_get_clean();
969 969
 }
970 970
 
971
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
971
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
972 972
 
973 973
 /**
974 974
  * Payment Mode Select
@@ -984,49 +984,49 @@  discard block
 block discarded – undo
984 984
  *
985 985
  * @return void
986 986
  */
987
-function give_payment_mode_select( $form_id ) {
987
+function give_payment_mode_select($form_id) {
988 988
 
989 989
 	$gateways = give_get_enabled_payment_gateways();
990 990
 
991
-	do_action( 'give_payment_mode_top', $form_id ); ?>
991
+	do_action('give_payment_mode_top', $form_id); ?>
992 992
 
993 993
 	<fieldset id="give-payment-mode-select">
994
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
994
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
995 995
 		<div id="give-payment-mode-wrap">
996
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
997
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
996
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
997
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
998 998
 			</legend>
999 999
 			<?php
1000 1000
 
1001
-			do_action( 'give_payment_mode_before_gateways' ) ?>
1001
+			do_action('give_payment_mode_before_gateways') ?>
1002 1002
 
1003 1003
 			<ul id="give-gateway-radio-list">
1004
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1005
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1004
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1005
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1006 1006
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1007
-					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 ) . '">';
1008
-					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'] );
1007
+					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).'">';
1008
+					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']);
1009 1009
 					echo '</label></li>';
1010 1010
 				endforeach; ?>
1011 1011
 			</ul>
1012
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
1012
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1013 1013
 		</div>
1014
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1014
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1015 1015
 	</fieldset>
1016 1016
 
1017
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1017
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1018 1018
 
1019 1019
 	<div id="give_purchase_form_wrap">
1020 1020
 
1021
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1021
+		<?php do_action('give_purchase_form', $form_id); ?>
1022 1022
 
1023 1023
 	</div><!-- the checkout fields are loaded into this-->
1024 1024
 
1025
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1025
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1026 1026
 
1027 1027
 }
1028 1028
 
1029
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1029
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1030 1030
 
1031 1031
 
1032 1032
 /**
@@ -1041,35 +1041,35 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @return void
1043 1043
  */
1044
-function give_terms_agreement( $form_id ) {
1044
+function give_terms_agreement($form_id) {
1045 1045
 
1046
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1047
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1048
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1046
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1047
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1048
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1049 1049
 
1050
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1050
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1051 1051
 		<fieldset id="give_terms_agreement">
1052 1052
 			<div id="give_terms" style="display:none;">
1053 1053
 				<?php
1054
-				do_action( 'give_before_terms' );
1055
-				echo wpautop( stripslashes( $terms ) );
1056
-				do_action( 'give_after_terms' );
1054
+				do_action('give_before_terms');
1055
+				echo wpautop(stripslashes($terms));
1056
+				do_action('give_after_terms');
1057 1057
 				?>
1058 1058
 			</div>
1059 1059
 			<div id="give_show_terms">
1060
-				<a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a>
1061
-				<a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1060
+				<a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a>
1061
+				<a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1062 1062
 			</div>
1063 1063
 
1064 1064
 			<label
1065
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1065
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1066 1066
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1067 1067
 		</fieldset>
1068 1068
 		<?php
1069 1069
 	}
1070 1070
 }
1071 1071
 
1072
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1072
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1073 1073
 
1074 1074
 /**
1075 1075
  * Checkout Final Total
@@ -1081,27 +1081,27 @@  discard block
 block discarded – undo
1081 1081
  * @since      1.0
1082 1082
  * @return void
1083 1083
  */
1084
-function give_checkout_final_total( $form_id ) {
1084
+function give_checkout_final_total($form_id) {
1085 1085
 
1086
-	if ( isset( $_POST['give_total'] ) ) {
1087
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1086
+	if (isset($_POST['give_total'])) {
1087
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1088 1088
 	} else {
1089 1089
 		//default total
1090
-		$total = give_get_default_form_amount( $form_id );
1090
+		$total = give_get_default_form_amount($form_id);
1091 1091
 	}
1092 1092
 	//Only proceed if give_total available
1093
-	if ( empty( $total ) ) {
1093
+	if (empty($total)) {
1094 1094
 		return;
1095 1095
 	}
1096 1096
 	?>
1097 1097
 	<p id="give-final-total-wrap" class="form-wrap ">
1098
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1099
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1098
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1099
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1100 1100
 	</p>
1101 1101
 	<?php
1102 1102
 }
1103 1103
 
1104
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1104
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1105 1105
 
1106 1106
 
1107 1107
 /**
@@ -1113,22 +1113,22 @@  discard block
 block discarded – undo
1113 1113
  *
1114 1114
  * @return void
1115 1115
  */
1116
-function give_checkout_submit( $form_id ) {
1116
+function give_checkout_submit($form_id) {
1117 1117
 	?>
1118 1118
 	<fieldset id="give_purchase_submit">
1119
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1119
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1120 1120
 
1121
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1121
+		<?php give_checkout_hidden_fields($form_id); ?>
1122 1122
 
1123
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1123
+		<?php echo give_checkout_button_purchase($form_id); ?>
1124 1124
 
1125
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1125
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1126 1126
 
1127 1127
 	</fieldset>
1128 1128
 	<?php
1129 1129
 }
1130 1130
 
1131
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1131
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1132 1132
 
1133 1133
 
1134 1134
 /**
@@ -1141,17 +1141,17 @@  discard block
 block discarded – undo
1141 1141
  *
1142 1142
  * @return string
1143 1143
  */
1144
-function give_checkout_button_purchase( $form_id ) {
1144
+function give_checkout_button_purchase($form_id) {
1145 1145
 
1146
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1147
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1146
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1147
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1148 1148
 	ob_start(); ?>
1149 1149
 	<div class="give-submit-button-wrap give-clearfix">
1150 1150
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1151 1151
 		<span class="give-loading-animation"></span>
1152 1152
 	</div>
1153 1153
 	<?php
1154
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1154
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1155 1155
 }
1156 1156
 
1157 1157
 /**
@@ -1164,11 +1164,11 @@  discard block
 block discarded – undo
1164 1164
  *
1165 1165
  * @return void
1166 1166
  */
1167
-function give_agree_to_terms_js( $form_id ) {
1167
+function give_agree_to_terms_js($form_id) {
1168 1168
 
1169
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1169
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1170 1170
 
1171
-	if ( $form_option === 'yes' ) {
1171
+	if ($form_option === 'yes') {
1172 1172
 		?>
1173 1173
 		<script type="text/javascript">
1174 1174
 			jQuery(document).ready(function ($) {
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 	}
1185 1185
 }
1186 1186
 
1187
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1187
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1188 1188
 
1189 1189
 /**
1190 1190
  * Show Give Goals
@@ -1197,25 +1197,25 @@  discard block
 block discarded – undo
1197 1197
  * @return mixed
1198 1198
  */
1199 1199
 
1200
-function give_show_goal_progress( $form_id, $args ) {
1200
+function give_show_goal_progress($form_id, $args) {
1201 1201
 
1202
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1203
-	$form        = new Give_Donate_Form( $form_id );
1202
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1203
+	$form        = new Give_Donate_Form($form_id);
1204 1204
 	$goal        = $form->goal;
1205
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1205
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1206 1206
 	$income      = $form->get_earnings();
1207
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1208
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1209
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1207
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1208
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1209
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1210 1210
 
1211 1211
 	//Sanity check - respect shortcode args
1212
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1212
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1213 1213
 		return false;
1214 1214
 	}
1215 1215
 
1216 1216
 	//Sanity check - ensure form has goal set to output
1217
-	if ( empty( $form->ID )
1218
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1217
+	if (empty($form->ID)
1218
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1219 1219
 	     || $goal_option !== 'yes'
1220 1220
 	     || $goal == 0
1221 1221
 	) {
@@ -1223,26 +1223,26 @@  discard block
 block discarded – undo
1223 1223
 		return false;
1224 1224
 	}
1225 1225
 
1226
-	$progress = round( ( $income / $goal ) * 100, 2 );
1226
+	$progress = round(($income / $goal) * 100, 2);
1227 1227
 
1228
-	if ( $income >= $goal ) {
1228
+	if ($income >= $goal) {
1229 1229
 		$progress = 100;
1230 1230
 	}
1231 1231
 
1232 1232
 	$output = '<div class="give-goal-progress">';
1233 1233
 
1234 1234
 	//Goal Progress Text
1235
-	if ( ! empty( $show_text ) ) {
1235
+	if ( ! empty($show_text)) {
1236 1236
 
1237 1237
 		$output .= '<div class="raised">';
1238 1238
 
1239
-		if ( $goal_format !== 'percentage' ) {
1239
+		if ($goal_format !== 'percentage') {
1240 1240
 
1241
-			$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>';
1241
+			$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>';
1242 1242
 
1243
-		} elseif ( $goal_format == 'percentage' ) {
1243
+		} elseif ($goal_format == 'percentage') {
1244 1244
 
1245
-			$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>';
1245
+			$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>';
1246 1246
 
1247 1247
 		}
1248 1248
 
@@ -1251,11 +1251,11 @@  discard block
 block discarded – undo
1251 1251
 	}
1252 1252
 
1253 1253
 	//Goal Progress Bar
1254
-	if ( ! empty( $show_bar ) ) {
1254
+	if ( ! empty($show_bar)) {
1255 1255
 		$output .= '<div class="give-progress-bar">';
1256
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1257
-		if ( ! empty( $color ) ) {
1258
-			$output .= 'background-color:' . $color;
1256
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1257
+		if ( ! empty($color)) {
1258
+			$output .= 'background-color:'.$color;
1259 1259
 		}
1260 1260
 		$output .= '"></span>';
1261 1261
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1263,13 +1263,13 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
 	$output .= '</div><!-- /.goal-progress -->';
1265 1265
 
1266
-	echo apply_filters( 'give_goal_output', $output );
1266
+	echo apply_filters('give_goal_output', $output);
1267 1267
 
1268 1268
 	return false;
1269 1269
 
1270 1270
 }
1271 1271
 
1272
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1272
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1273 1273
 
1274 1274
 /**
1275 1275
  * Adds Actions to Render Form Content
@@ -1281,19 +1281,19 @@  discard block
 block discarded – undo
1281 1281
  *
1282 1282
  * @return void
1283 1283
  */
1284
-function give_form_content( $form_id, $args ) {
1284
+function give_form_content($form_id, $args) {
1285 1285
 
1286
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1286
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1287 1287
 		? $args['show_content']
1288
-		: get_post_meta( $form_id, '_give_content_option', true );
1288
+		: get_post_meta($form_id, '_give_content_option', true);
1289 1289
 
1290
-	if ( $show_content !== 'none' ) {
1290
+	if ($show_content !== 'none') {
1291 1291
 		//add action according to value
1292
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1292
+		add_action($show_content, 'give_form_display_content', 10, 2);
1293 1293
 	}
1294 1294
 }
1295 1295
 
1296
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1296
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1297 1297
 
1298 1298
 /**
1299 1299
  * Renders Post Form Content
@@ -1305,24 +1305,24 @@  discard block
 block discarded – undo
1305 1305
  * @return void
1306 1306
  * @since      1.0
1307 1307
  */
1308
-function give_form_display_content( $form_id, $args ) {
1308
+function give_form_display_content($form_id, $args) {
1309 1309
 
1310
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1311
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1310
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1311
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1312 1312
 		? $args['show_content']
1313
-		: get_post_meta( $form_id, '_give_content_option', true );
1313
+		: get_post_meta($form_id, '_give_content_option', true);
1314 1314
 
1315
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1316
-		$content = apply_filters( 'the_content', $content );
1315
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1316
+		$content = apply_filters('the_content', $content);
1317 1317
 	}
1318 1318
 
1319
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1319
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1320 1320
 
1321
-	echo apply_filters( 'give_form_content_output', $output );
1321
+	echo apply_filters('give_form_content_output', $output);
1322 1322
 
1323 1323
 	//remove action to prevent content output on addition forms on page
1324 1324
 	//@see: https://github.com/WordImpress/Give/issues/634
1325
-	remove_action( $show_content, 'give_form_display_content' );
1325
+	remove_action($show_content, 'give_form_display_content');
1326 1326
 }
1327 1327
 
1328 1328
 
@@ -1335,16 +1335,16 @@  discard block
 block discarded – undo
1335 1335
  *
1336 1336
  * @return void
1337 1337
  */
1338
-function give_checkout_hidden_fields( $form_id ) {
1338
+function give_checkout_hidden_fields($form_id) {
1339 1339
 
1340
-	do_action( 'give_hidden_fields_before', $form_id );
1341
-	if ( is_user_logged_in() ) { ?>
1340
+	do_action('give_hidden_fields_before', $form_id);
1341
+	if (is_user_logged_in()) { ?>
1342 1342
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1343 1343
 	<?php } ?>
1344 1344
 	<input type="hidden" name="give_action" value="purchase"/>
1345
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1345
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1346 1346
 	<?php
1347
-	do_action( 'give_hidden_fields_after', $form_id );
1347
+	do_action('give_hidden_fields_after', $form_id);
1348 1348
 
1349 1349
 }
1350 1350
 
@@ -1359,20 +1359,20 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @return string $content Filtered content
1361 1361
  */
1362
-function give_filter_success_page_content( $content ) {
1362
+function give_filter_success_page_content($content) {
1363 1363
 
1364 1364
 	global $give_options;
1365 1365
 
1366
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1367
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1368
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1366
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1367
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1368
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1369 1369
 		}
1370 1370
 	}
1371 1371
 
1372 1372
 	return $content;
1373 1373
 }
1374 1374
 
1375
-add_filter( 'the_content', 'give_filter_success_page_content' );
1375
+add_filter('the_content', 'give_filter_success_page_content');
1376 1376
 
1377 1377
 
1378 1378
 /**
@@ -1384,14 +1384,14 @@  discard block
 block discarded – undo
1384 1384
 
1385 1385
 function give_test_mode_frontend_warning() {
1386 1386
 
1387
-	$test_mode = give_get_option( 'test_mode' );
1387
+	$test_mode = give_get_option('test_mode');
1388 1388
 
1389
-	if ( $test_mode == 'on' ) {
1390
-		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>';
1389
+	if ($test_mode == 'on') {
1390
+		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>';
1391 1391
 	}
1392 1392
 }
1393 1393
 
1394
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1394
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1395 1395
 
1396 1396
 
1397 1397
 /**
@@ -1401,21 +1401,21 @@  discard block
 block discarded – undo
1401 1401
  * @since       1.4.1
1402 1402
  */
1403 1403
 
1404
-function give_members_only_form( $final_output, $args ) {
1404
+function give_members_only_form($final_output, $args) {
1405 1405
 
1406
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1406
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1407 1407
 
1408 1408
 	//Sanity Check: Must have form_id & not be logged in
1409
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1409
+	if (empty($form_id) || is_user_logged_in()) {
1410 1410
 		return $final_output;
1411 1411
 	}
1412 1412
 
1413 1413
 	//Logged in only and Register / Login set to none
1414
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1414
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1415 1415
 
1416
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1416
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1417 1417
 
1418
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1418
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1419 1419
 
1420 1420
 	}
1421 1421
 
@@ -1423,4 +1423,4 @@  discard block
 block discarded – undo
1423 1423
 
1424 1424
 }
1425 1425
 
1426
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1427 1426
\ No newline at end of file
1427
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1428 1428
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,11 +106,13 @@  discard block
 block discarded – undo
106 106
 			//Print thank you message.
107 107
 			echo "<p class=\"give-from-thankyou-msg\">{$display_thankyou_message}</p>";
108 108
 			?>
109
-		<?php else : ?>
109
+		<?php else {
110
+	: ?>
110 111
 			<?php
111 112
 			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
112 113
 
113 114
 				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
115
+}
114 116
 
115 117
 			} ?>
116 118
 
@@ -781,8 +783,11 @@  discard block
 block discarded – undo
781 783
 					}
782 784
 					?>
783 785
 				</select>
784
-			<?php else : ?>
785
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
786
+			<?php else {
787
+	: ?>
788
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' );
789
+}
790
+?>"/>
786 791
 			<?php endif; ?>
787 792
 		</p>
788 793
 		<?php do_action( 'give_cc_billing_bottom' ); ?>
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   +234 added lines, -234 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,45 +177,45 @@  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 Honeypot First
199
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
200
-		give_set_error( 'invalid_honeypot', __( 'Honeypot field detected. Go away bad bot!', 'give' ) );
199
+	if ( ! empty($_POST['give-honeypot'])) {
200
+		give_set_error('invalid_honeypot', __('Honeypot field detected. Go away bad bot!', 'give'));
201 201
 	}
202 202
 
203 203
 	// Validate agree to terms
204
-	$terms_option = get_post_meta( $form_id, '_give_terms_option', true );
205
-	if ( isset( $terms_option ) && $terms_option === 'yes' ) {
204
+	$terms_option = get_post_meta($form_id, '_give_terms_option', true);
205
+	if (isset($terms_option) && $terms_option === 'yes') {
206 206
 		give_purchase_form_validate_agree_to_terms();
207 207
 	}
208 208
 
209
-	if ( is_user_logged_in() ) {
209
+	if (is_user_logged_in()) {
210 210
 		// Collect logged in user data
211 211
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
212
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
212
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
213 213
 		// Set new user registration as required
214 214
 		$valid_data['need_new_user'] = true;
215 215
 		// Validate new user data
216 216
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
217 217
 		// Check if login validation is needed
218
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
218
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
219 219
 		// Set user login as required
220 220
 		$valid_data['need_user_login'] = true;
221 221
 		// Validate users login info
@@ -240,37 +240,37 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function give_purchase_form_validate_gateway() {
242 242
 
243
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
244
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
245
-	$gateway = give_get_default_gateway( $form_id );
243
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
244
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
245
+	$gateway = give_get_default_gateway($form_id);
246 246
 
247 247
 	// Check if a gateway value is present
248
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
248
+	if ( ! empty($_REQUEST['give-gateway'])) {
249 249
 
250
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
250
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
251 251
 
252 252
 		//Is amount being donated in LIVE mode 0.00? If so, error:
253
-		if ( $amount == 0 && ! give_is_test_mode() ) {
253
+		if ($amount == 0 && ! give_is_test_mode()) {
254 254
 
255
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
255
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
256 256
 
257 257
 		} //Check for a minimum custom amount
258
-		elseif ( ! give_verify_minimum_price() ) {
258
+		elseif ( ! give_verify_minimum_price()) {
259 259
 
260
-			$minimum       = give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) );
261
-			$error_message = __( 'This form has a minimum donation amount of %s', 'give' );
260
+			$minimum       = give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)));
261
+			$error_message = __('This form has a minimum donation amount of %s', 'give');
262 262
 
263
-			give_set_error( 'invalid_donation_minimum', sprintf( $error_message, $minimum ) );
263
+			give_set_error('invalid_donation_minimum', sprintf($error_message, $minimum));
264 264
 
265 265
 		} //Is this test mode zero donation? Let it through but set to manual gateway
266
-		elseif ( $amount == 0 && give_is_test_mode() ) {
266
+		elseif ($amount == 0 && give_is_test_mode()) {
267 267
 
268 268
 			$gateway = 'manual';
269 269
 
270 270
 		} //Check if this gateway is active
271
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
271
+		elseif ( ! give_is_gateway_active($gateway)) {
272 272
 
273
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) );
273
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give'));
274 274
 
275 275
 		}
276 276
 
@@ -289,23 +289,23 @@  discard block
 block discarded – undo
289 289
  */
290 290
 function give_verify_minimum_price() {
291 291
 
292
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
293
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
294
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
295
-	$variable_prices = give_has_variable_prices( $form_id );
292
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
293
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
294
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
295
+	$variable_prices = give_has_variable_prices($form_id);
296 296
 
297
-	if ( $variable_prices && ! empty( $price_id ) ) {
297
+	if ($variable_prices && ! empty($price_id)) {
298 298
 
299
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
299
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
300 300
 
301
-		if ( $price_level_amount == $amount ) {
301
+		if ($price_level_amount == $amount) {
302 302
 			return true;
303 303
 		}
304 304
 	}
305 305
 
306
-	$minimum = give_get_form_minimum_price( $form_id );
306
+	$minimum = give_get_form_minimum_price($form_id);
307 307
 
308
-	if ( $minimum > $amount ) {
308
+	if ($minimum > $amount) {
309 309
 		return false;
310 310
 	}
311 311
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
  */
322 322
 function give_purchase_form_validate_agree_to_terms() {
323 323
 	// Validate agree to terms
324
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
324
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
325 325
 		// User did not agree
326
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) );
326
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give')));
327 327
 	}
328 328
 }
329 329
 
@@ -337,47 +337,47 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @return      array
339 339
  */
340
-function give_purchase_form_required_fields( $form_id ) {
340
+function give_purchase_form_required_fields($form_id) {
341 341
 
342
-	$payment_mode = give_get_chosen_gateway( $form_id );
342
+	$payment_mode = give_get_chosen_gateway($form_id);
343 343
 
344 344
 	$required_fields = array(
345 345
 		'give_email' => array(
346 346
 			'error_id'      => 'invalid_email',
347
-			'error_message' => __( 'Please enter a valid email address', 'give' )
347
+			'error_message' => __('Please enter a valid email address', 'give')
348 348
 		),
349 349
 		'give_first' => array(
350 350
 			'error_id'      => 'invalid_first_name',
351
-			'error_message' => __( 'Please enter your first name', 'give' )
351
+			'error_message' => __('Please enter your first name', 'give')
352 352
 		)
353 353
 	);
354 354
 
355
-	$require_address = give_require_billing_address( $payment_mode );
355
+	$require_address = give_require_billing_address($payment_mode);
356 356
 
357
-	if ( $require_address ) {
358
-		$required_fields['card_address']    = array(
357
+	if ($require_address) {
358
+		$required_fields['card_address'] = array(
359 359
 			'error_id'      => 'invalid_card_address',
360
-			'error_message' => __( 'Please enter your primary billing address', 'give' )
360
+			'error_message' => __('Please enter your primary billing address', 'give')
361 361
 		);
362
-		$required_fields['card_zip']        = array(
362
+		$required_fields['card_zip'] = array(
363 363
 			'error_id'      => 'invalid_zip_code',
364
-			'error_message' => __( 'Please enter your zip / postal code', 'give' )
364
+			'error_message' => __('Please enter your zip / postal code', 'give')
365 365
 		);
366
-		$required_fields['card_city']       = array(
366
+		$required_fields['card_city'] = array(
367 367
 			'error_id'      => 'invalid_city',
368
-			'error_message' => __( 'Please enter your billing city', 'give' )
368
+			'error_message' => __('Please enter your billing city', 'give')
369 369
 		);
370 370
 		$required_fields['billing_country'] = array(
371 371
 			'error_id'      => 'invalid_country',
372
-			'error_message' => __( 'Please select your billing country', 'give' )
372
+			'error_message' => __('Please select your billing country', 'give')
373 373
 		);
374
-		$required_fields['card_state']      = array(
374
+		$required_fields['card_state'] = array(
375 375
 			'error_id'      => 'invalid_state',
376
-			'error_message' => __( 'Please enter billing state / province', 'give' )
376
+			'error_message' => __('Please enter billing state / province', 'give')
377 377
 		);
378 378
 	}
379 379
 
380
-	return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id );
380
+	return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id);
381 381
 
382 382
 }
383 383
 
@@ -390,16 +390,16 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return mixed|void
392 392
  */
393
-function give_require_billing_address( $payment_mode ) {
393
+function give_require_billing_address($payment_mode) {
394 394
 
395 395
 	$return = false;
396 396
 
397
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
397
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
398 398
 		$return = true;
399 399
 	}
400 400
 
401 401
 	// Let payment gateways and other extensions determine if address fields should be required
402
-	return apply_filters( 'give_require_billing_address', $return );
402
+	return apply_filters('give_require_billing_address', $return);
403 403
 
404 404
 }
405 405
 
@@ -413,43 +413,43 @@  discard block
 block discarded – undo
413 413
 function give_purchase_form_validate_logged_in_user() {
414 414
 	global $user_ID;
415 415
 
416
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
416
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
417 417
 
418 418
 	// Start empty array to collect valid user data
419 419
 	$valid_user_data = array(
420 420
 		// Assume there will be errors
421
-		'user_id' => - 1
421
+		'user_id' => -1
422 422
 	);
423 423
 
424 424
 	// Verify there is a user_ID
425
-	if ( $user_ID > 0 ) {
425
+	if ($user_ID > 0) {
426 426
 		// Get the logged in user data
427
-		$user_data = get_userdata( $user_ID );
427
+		$user_data = get_userdata($user_ID);
428 428
 
429 429
 		// Loop through required fields and show error messages
430
-		foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
431
-			if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
432
-				give_set_error( $value['error_id'], $value['error_message'] );
430
+		foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
431
+			if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
432
+				give_set_error($value['error_id'], $value['error_message']);
433 433
 			}
434 434
 		}
435 435
 
436 436
 		// Verify data
437
-		if ( $user_data ) {
437
+		if ($user_data) {
438 438
 			// Collected logged in user data
439 439
 			$valid_user_data = array(
440 440
 				'user_id'    => $user_ID,
441
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
442
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
443
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
441
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
442
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
443
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
444 444
 			);
445 445
 
446
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
447
-				give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
446
+			if ( ! is_email($valid_user_data['user_email'])) {
447
+				give_set_error('email_invalid', __('Invalid email', 'give'));
448 448
 			}
449 449
 
450 450
 		} else {
451 451
 			// Set invalid user error
452
-			give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) );
452
+			give_set_error('invalid_user', __('The user information is invalid', 'give'));
453 453
 		}
454 454
 	}
455 455
 
@@ -467,90 +467,90 @@  discard block
 block discarded – undo
467 467
 function give_purchase_form_validate_new_user() {
468 468
 
469 469
 	$registering_new_user = false;
470
-	$form_id              = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
470
+	$form_id              = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
471 471
 
472 472
 	// Start an empty array to collect valid user data
473 473
 	$valid_user_data = array(
474 474
 		// Assume there will be errors
475
-		'user_id'    => - 1,
475
+		'user_id'    => -1,
476 476
 		// Get first name
477
-		'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '',
477
+		'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '',
478 478
 		// Get last name
479
-		'user_last'  => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '',
479
+		'user_last'  => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '',
480 480
 	);
481 481
 
482 482
 	// Check the new user's credentials against existing ones
483
-	$user_login   = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false;
484
-	$user_email   = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false;
485
-	$user_pass    = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false;
486
-	$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;
483
+	$user_login   = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false;
484
+	$user_email   = isset($_POST['give_email']) ? trim($_POST['give_email']) : false;
485
+	$user_pass    = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false;
486
+	$pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false;
487 487
 
488 488
 	// Loop through required fields and show error messages
489
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
490
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
491
-			give_set_error( $value['error_id'], $value['error_message'] );
489
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
490
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
491
+			give_set_error($value['error_id'], $value['error_message']);
492 492
 		}
493 493
 	}
494 494
 
495 495
 	// Check if we have an username to register
496
-	if ( $user_login && strlen( $user_login ) > 0 ) {
496
+	if ($user_login && strlen($user_login) > 0) {
497 497
 		$registering_new_user = true;
498 498
 
499 499
 		// We have an user name, check if it already exists
500
-		if ( username_exists( $user_login ) ) {
500
+		if (username_exists($user_login)) {
501 501
 			// Username already registered
502
-			give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) );
502
+			give_set_error('username_unavailable', __('Username already taken', 'give'));
503 503
 			// Check if it's valid
504
-		} else if ( ! give_validate_username( $user_login ) ) {
504
+		} else if ( ! give_validate_username($user_login)) {
505 505
 			// Invalid username
506
-			if ( is_multisite() ) {
507
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) );
506
+			if (is_multisite()) {
507
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give'));
508 508
 			} else {
509
-				give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) );
509
+				give_set_error('username_invalid', __('Invalid username', 'give'));
510 510
 			}
511 511
 		} else {
512 512
 			// All the checks have run and it's good to go
513 513
 			$valid_user_data['user_login'] = $user_login;
514 514
 		}
515
-	} elseif ( give_logged_in_only( $form_id ) ) {
516
-		give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation', 'give' ) );
515
+	} elseif (give_logged_in_only($form_id)) {
516
+		give_set_error('registration_required', esc_html__('You must register or login to complete your donation', 'give'));
517 517
 	}
518 518
 
519 519
 	// Check if we have an email to verify
520
-	if ( $user_email && strlen( $user_email ) > 0 ) {
520
+	if ($user_email && strlen($user_email) > 0) {
521 521
 		// Validate email
522
-		if ( ! is_email( $user_email ) ) {
523
-			give_set_error( 'email_invalid', __( 'Sorry, that email is invalid', 'give' ) );
522
+		if ( ! is_email($user_email)) {
523
+			give_set_error('email_invalid', __('Sorry, that email is invalid', 'give'));
524 524
 			// Check if email exists
525
-		} else if ( email_exists( $user_email ) && $registering_new_user ) {
526
-			give_set_error( 'email_used', __( 'Sorry, that email already active for another user', 'give' ) );
525
+		} else if (email_exists($user_email) && $registering_new_user) {
526
+			give_set_error('email_used', __('Sorry, that email already active for another user', 'give'));
527 527
 		} else {
528 528
 			// All the checks have run and it's good to go
529 529
 			$valid_user_data['user_email'] = $user_email;
530 530
 		}
531 531
 	} else {
532 532
 		// No email
533
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
533
+		give_set_error('email_empty', __('Enter an email', 'give'));
534 534
 	}
535 535
 
536 536
 	// Check password
537
-	if ( $user_pass && $pass_confirm ) {
537
+	if ($user_pass && $pass_confirm) {
538 538
 		// Verify confirmation matches
539
-		if ( $user_pass != $pass_confirm ) {
539
+		if ($user_pass != $pass_confirm) {
540 540
 			// Passwords do not match
541
-			give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) );
541
+			give_set_error('password_mismatch', __('Passwords don\'t match', 'give'));
542 542
 		} else {
543 543
 			// All is good to go
544 544
 			$valid_user_data['user_pass'] = $user_pass;
545 545
 		}
546 546
 	} else {
547 547
 		// Password or confirmation missing
548
-		if ( ! $user_pass && $registering_new_user ) {
548
+		if ( ! $user_pass && $registering_new_user) {
549 549
 			// The password is invalid
550
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
551
-		} else if ( ! $pass_confirm && $registering_new_user ) {
550
+			give_set_error('password_empty', __('Enter a password', 'give'));
551
+		} else if ( ! $pass_confirm && $registering_new_user) {
552 552
 			// Confirmation password is invalid
553
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) );
553
+			give_set_error('confirmation_empty', __('Enter the password confirmation', 'give'));
554 554
 		}
555 555
 	}
556 556
 
@@ -569,34 +569,34 @@  discard block
 block discarded – undo
569 569
 	// Start an array to collect valid user data
570 570
 	$valid_user_data = array(
571 571
 		// Assume there will be errors
572
-		'user_id' => - 1
572
+		'user_id' => -1
573 573
 	);
574 574
 
575 575
 	// Username
576
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
577
-		give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) );
576
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
577
+		give_set_error('must_log_in', __('You must login or register to complete your donation', 'give'));
578 578
 
579 579
 		return $valid_user_data;
580 580
 	}
581 581
 
582 582
 	// Get the user by login
583
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
583
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
584 584
 
585 585
 	// Check if user exists
586
-	if ( $user_data ) {
586
+	if ($user_data) {
587 587
 		// Get password
588
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
588
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
589 589
 
590 590
 		// Check user_pass
591
-		if ( $user_pass ) {
591
+		if ($user_pass) {
592 592
 			// Check if password is valid
593
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
593
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
594 594
 				// Incorrect password
595 595
 				give_set_error(
596 596
 					'password_incorrect',
597 597
 					sprintf(
598
-						__( 'The password you entered is incorrect. %sReset Password%s', 'give' ),
599
-						'<a href="' . wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) . '" title="' . __( 'Lost Password', 'give' ) . '">',
598
+						__('The password you entered is incorrect. %sReset Password%s', 'give'),
599
+						'<a href="'.wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]").'" title="'.__('Lost Password', 'give').'">',
600 600
 						'</a>'
601 601
 					)
602 602
 				);
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 			}
615 615
 		} else {
616 616
 			// Empty password
617
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
617
+			give_set_error('password_empty', __('Enter a password', 'give'));
618 618
 		}
619 619
 	} else {
620 620
 		// no username
621
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) );
621
+		give_set_error('username_incorrect', __('The username you entered does not exist', 'give'));
622 622
 	}
623 623
 
624 624
 	return $valid_user_data;
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
  */
634 634
 function give_purchase_form_validate_guest_user() {
635 635
 
636
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
636
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
637 637
 
638 638
 	// Start an array to collect valid user data
639 639
 	$valid_user_data = array(
@@ -642,32 +642,32 @@  discard block
 block discarded – undo
642 642
 	);
643 643
 
644 644
 	// Show error message if user must be logged in
645
-	if ( give_logged_in_only( $form_id ) ) {
646
-		give_set_error( 'logged_in_only', __( 'You must be logged into to donate', 'give' ) );
645
+	if (give_logged_in_only($form_id)) {
646
+		give_set_error('logged_in_only', __('You must be logged into to donate', 'give'));
647 647
 	}
648 648
 
649 649
 	// Get the guest email
650
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
650
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
651 651
 
652 652
 	// Check email
653
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
653
+	if ($guest_email && strlen($guest_email) > 0) {
654 654
 		// Validate email
655
-		if ( ! is_email( $guest_email ) ) {
655
+		if ( ! is_email($guest_email)) {
656 656
 			// Invalid email
657
-			give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
657
+			give_set_error('email_invalid', __('Invalid email', 'give'));
658 658
 		} else {
659 659
 			// All is good to go
660 660
 			$valid_user_data['user_email'] = $guest_email;
661 661
 		}
662 662
 	} else {
663 663
 		// No email
664
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
664
+		give_set_error('email_empty', __('Enter an email', 'give'));
665 665
 	}
666 666
 
667 667
 	// Loop through required fields and show error messages
668
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
669
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
670
-			give_set_error( $value['error_id'], $value['error_message'] );
668
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
669
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
670
+			give_set_error($value['error_id'], $value['error_message']);
671 671
 		}
672 672
 	}
673 673
 
@@ -683,42 +683,42 @@  discard block
 block discarded – undo
683 683
  * @since   1.0
684 684
  * @return  integer
685 685
  */
686
-function give_register_and_login_new_user( $user_data = array() ) {
686
+function give_register_and_login_new_user($user_data = array()) {
687 687
 	// Verify the array
688
-	if ( empty( $user_data ) ) {
689
-		return - 1;
688
+	if (empty($user_data)) {
689
+		return -1;
690 690
 	}
691 691
 
692
-	if ( give_get_errors() ) {
693
-		return - 1;
692
+	if (give_get_errors()) {
693
+		return -1;
694 694
 	}
695 695
 
696
-	$user_args = apply_filters( 'give_insert_user_args', array(
697
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
698
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
699
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
700
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
701
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
702
-		'user_registered' => date( 'Y-m-d H:i:s' ),
703
-		'role'            => get_option( 'default_role' )
704
-	), $user_data );
696
+	$user_args = apply_filters('give_insert_user_args', array(
697
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
698
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
699
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
700
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
701
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
702
+		'user_registered' => date('Y-m-d H:i:s'),
703
+		'role'            => get_option('default_role')
704
+	), $user_data);
705 705
 
706 706
 	// Insert new user
707
-	$user_id = wp_insert_user( $user_args );
707
+	$user_id = wp_insert_user($user_args);
708 708
 
709 709
 	// Validate inserted user
710
-	if ( is_wp_error( $user_id ) ) {
711
-		return - 1;
710
+	if (is_wp_error($user_id)) {
711
+		return -1;
712 712
 	}
713 713
 
714 714
 	// Allow themes and plugins to filter the user data
715
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
715
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
716 716
 
717 717
 	// Allow themes and plugins to hook
718
-	do_action( 'give_insert_user', $user_id, $user_data );
718
+	do_action('give_insert_user', $user_id, $user_data);
719 719
 
720 720
 	// Login new user
721
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
721
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
722 722
 
723 723
 	// Return user id
724 724
 	return $user_id;
@@ -733,27 +733,27 @@  discard block
 block discarded – undo
733 733
  * @since   1.0
734 734
  * @return  array
735 735
  */
736
-function give_get_purchase_form_user( $valid_data = array() ) {
736
+function give_get_purchase_form_user($valid_data = array()) {
737 737
 
738 738
 	// Initialize user
739 739
 	$user    = false;
740
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
740
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
741 741
 
742
-	if ( $is_ajax ) {
742
+	if ($is_ajax) {
743 743
 		// Do not create or login the user during the ajax submission (check for errors only)
744 744
 		return true;
745
-	} else if ( is_user_logged_in() ) {
745
+	} else if (is_user_logged_in()) {
746 746
 		// Set the valid user as the logged in collected data
747 747
 		$user = $valid_data['logged_in_user'];
748
-	} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
748
+	} else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
749 749
 		// New user registration
750
-		if ( $valid_data['need_new_user'] === true ) {
750
+		if ($valid_data['need_new_user'] === true) {
751 751
 			// Set user
752 752
 			$user = $valid_data['new_user_data'];
753 753
 			// Register and login new user
754
-			$user['user_id'] = give_register_and_login_new_user( $user );
754
+			$user['user_id'] = give_register_and_login_new_user($user);
755 755
 			// User login
756
-		} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
756
+		} else if ($valid_data['need_user_login'] === true && ! $is_ajax) {
757 757
 
758 758
 			/*
759 759
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -768,48 +768,48 @@  discard block
 block discarded – undo
768 768
 			// Set user
769 769
 			$user = $valid_data['login_user_data'];
770 770
 			// Login user
771
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
771
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
772 772
 		}
773 773
 	}
774 774
 
775 775
 	// Check guest checkout
776
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
776
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
777 777
 		// Set user
778 778
 		$user = $valid_data['guest_user_data'];
779 779
 	}
780 780
 
781 781
 	// Verify we have an user
782
-	if ( false === $user || empty( $user ) ) {
782
+	if (false === $user || empty($user)) {
783 783
 		// Return false
784 784
 		return false;
785 785
 	}
786 786
 
787 787
 	// Get user first name
788
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
789
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
788
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
789
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
790 790
 	}
791 791
 
792 792
 	// Get user last name
793
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
794
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
793
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
794
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
795 795
 	}
796 796
 
797 797
 	// Get the user's billing address details
798 798
 	$user['address']            = array();
799
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
800
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
801
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
802
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
803
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
804
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
805
-
806
-	if ( empty( $user['address']['country'] ) ) {
799
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
800
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
801
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
802
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
803
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
804
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
805
+
806
+	if (empty($user['address']['country'])) {
807 807
 		$user['address'] = false;
808 808
 	} // Country will always be set if address fields are present
809 809
 
810
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
810
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
811 811
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases
812
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
812
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
813 813
 	}
814 814
 
815 815
 	// Return valid user
@@ -828,16 +828,16 @@  discard block
 block discarded – undo
828 828
 	$card_data = give_get_purchase_cc_info();
829 829
 
830 830
 	// Validate the card zip
831
-	if ( ! empty( $card_data['card_zip'] ) ) {
832
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
833
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) );
831
+	if ( ! empty($card_data['card_zip'])) {
832
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
833
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give'));
834 834
 		}
835 835
 	}
836 836
 
837 837
 	//Ensure no spaces
838
-	if ( ! empty( $card_data['card_number'] ) ) {
839
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs
840
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
838
+	if ( ! empty($card_data['card_number'])) {
839
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs
840
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
841 841
 	}
842 842
 
843 843
 	// This should validate card numbers at some point too
@@ -853,17 +853,17 @@  discard block
 block discarded – undo
853 853
  */
854 854
 function give_get_purchase_cc_info() {
855 855
 	$cc_info                   = array();
856
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
857
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
858
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
859
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
860
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
861
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
862
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
863
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
864
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
865
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
866
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
856
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
857
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
858
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
859
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
860
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
861
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
862
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
863
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
864
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
865
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
866
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
867 867
 
868 868
 	// Return cc info
869 869
 	return $cc_info;
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
  *
880 880
  * @return bool|mixed|void
881 881
  */
882
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
882
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
883 883
 	$ret = false;
884 884
 
885
-	if ( empty( $zip ) || empty( $country_code ) ) {
885
+	if (empty($zip) || empty($country_code)) {
886 886
 		return $ret;
887 887
 	}
888 888
 
889
-	$country_code = strtoupper( $country_code );
889
+	$country_code = strtoupper($country_code);
890 890
 
891 891
 	$zip_regex = array(
892 892
 		"AD" => "AD\d{3}",
@@ -1046,9 +1046,9 @@  discard block
 block discarded – undo
1046 1046
 		"ZM" => "\d{5}"
1047 1047
 	);
1048 1048
 
1049
-	if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) {
1049
+	if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) {
1050 1050
 		$ret = true;
1051 1051
 	}
1052 1052
 
1053
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1053
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1054 1054
 }
1055 1055
\ 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.