Test Failed
Pull Request — master (#2482)
by Devin
05:37
created
includes/misc-functions.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -812,10 +812,10 @@  discard block
 block discarded – undo
812 812
 		}
813 813
 
814 814
 		if ( ! is_int( $params[1] )
815
-		     && ! is_float( $params[1] )
816
-		     && ! is_string( $params[1] )
817
-		     && $params[1] !== null
818
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
815
+			 && ! is_float( $params[1] )
816
+			 && ! is_string( $params[1] )
817
+			 && $params[1] !== null
818
+			 && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
819 819
 		) {
820 820
 			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
821 821
 
@@ -823,10 +823,10 @@  discard block
 block discarded – undo
823 823
 		}
824 824
 
825 825
 		if ( isset( $params[2] )
826
-		     && ! is_int( $params[2] )
827
-		     && ! is_float( $params[2] )
828
-		     && ! is_string( $params[2] )
829
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
826
+			 && ! is_int( $params[2] )
827
+			 && ! is_float( $params[2] )
828
+			 && ! is_string( $params[2] )
829
+			 && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
830 830
 		) {
831 831
 			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
832 832
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
  *
213 213
  * @since 1.8.17
214 214
  *
215
- * @return array|string
215
+ * @return boolean
216 216
  */
217 217
 function give_get_history_session() {
218 218
 	return (bool) Give()->session->get( 'history_access' );
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
  *
686 686
  * @todo  Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828).
687 687
  *
688
- * @return bool
688
+ * @return false|null
689 689
  */
690 690
 function give_donation_metabox_menu() {
691 691
 
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
  * @param int    $id
1085 1085
  * @param string $meta_key
1086 1086
  * @param mixed  $meta_value
1087
- * @param mixed  $prev_value
1087
+ * @param string  $prev_value
1088 1088
  *
1089 1089
  * @return mixed
1090 1090
  */
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @since 1.8.13
1292 1292
  *
1293 1293
  * @param array      $list      List of objects or arrays
1294
- * @param int|string $field     Field from the object to place instead of the entire object
1294
+ * @param string $field     Field from the object to place instead of the entire object
1295 1295
  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
1296 1296
  *                              Default null.
1297 1297
  *
Please login to merge, or discard this patch.
Spacing   +284 added lines, -284 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,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 
40 40
 	global $wp;
41 41
 
42
-	if ( get_option( 'permalink_structure' ) ) {
43
-		$base = trailingslashit( home_url( $wp->request ) );
42
+	if (get_option('permalink_structure')) {
43
+		$base = trailingslashit(home_url($wp->request));
44 44
 	} else {
45
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
46
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
45
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
46
+		$base = remove_query_arg(array('post_type', 'name'), $base);
47 47
 	}
48 48
 
49 49
 	$scheme      = is_ssl() ? 'https' : 'http';
50
-	$current_uri = set_url_scheme( $base, $scheme );
50
+	$current_uri = set_url_scheme($base, $scheme);
51 51
 
52
-	if ( is_front_page() ) {
53
-		$current_uri = home_url( '/' );
52
+	if (is_front_page()) {
53
+		$current_uri = home_url('/');
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $current_uri
62 62
 	 */
63
-	return apply_filters( 'give_get_current_page_url', $current_uri );
63
+	return apply_filters('give_get_current_page_url', $current_uri);
64 64
 
65 65
 }
66 66
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	$gateways = give_get_enabled_payment_gateways();
84 84
 
85
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
85
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
86 86
 		$ret = true;
87
-	} elseif ( count( $gateways ) == 1 ) {
87
+	} elseif (count($gateways) == 1) {
88 88
 		$ret = false;
89
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
89
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
90 90
 		$ret = false;
91 91
 	}
92 92
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param bool $ret
99 99
 	 */
100
-	return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret );
100
+	return (bool) apply_filters('give_is_cc_verify_enabled', $ret);
101 101
 }
102 102
 
103 103
 /**
@@ -109,26 +109,26 @@  discard block
 block discarded – undo
109 109
 function give_get_timezone_id() {
110 110
 
111 111
 	// if site timezone string exists, return it.
112
-	if ( $timezone = get_option( 'timezone_string' ) ) {
112
+	if ($timezone = get_option('timezone_string')) {
113 113
 		return $timezone;
114 114
 	}
115 115
 
116 116
 	// get UTC offset, if it isn't set return UTC.
117
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
117
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
118 118
 		return 'UTC';
119 119
 	}
120 120
 
121 121
 	// attempt to guess the timezone string from the UTC offset.
122
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
122
+	$timezone = timezone_name_from_abbr('', $utc_offset);
123 123
 
124 124
 	// last try, guess timezone string manually.
125
-	if ( $timezone === false ) {
125
+	if ($timezone === false) {
126 126
 
127
-		$is_dst = date( 'I' );
127
+		$is_dst = date('I');
128 128
 
129
-		foreach ( timezone_abbreviations_list() as $abbr ) {
130
-			foreach ( $abbr as $city ) {
131
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
129
+		foreach (timezone_abbreviations_list() as $abbr) {
130
+			foreach ($abbr as $city) {
131
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
132 132
 					return $city['timezone_id'];
133 133
 				}
134 134
 			}
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 
153 153
 	$ip = '127.0.0.1';
154 154
 
155
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
155
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
156 156
 		// check ip from share internet
157 157
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
158
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
158
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
159 159
 		// to check ip is pass from proxy
160 160
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
161
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
161
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
162 162
 		$ip = $_SERVER['REMOTE_ADDR'];
163 163
 	}
164 164
 
165
-	return apply_filters( 'give_get_ip', $ip );
165
+	return apply_filters('give_get_ip', $ip);
166 166
 }
167 167
 
168 168
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @uses  Give()->session->set()
179 179
  */
180
-function give_set_purchase_session( $purchase_data = array() ) {
181
-	Give()->session->set( 'give_purchase', $purchase_data );
182
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
180
+function give_set_purchase_session($purchase_data = array()) {
181
+	Give()->session->set('give_purchase', $purchase_data);
182
+	Give()->session->set('give_email', $purchase_data['user_email']);
183 183
 }
184 184
 
185 185
 /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
  * @return mixed array | false
194 194
  */
195 195
 function give_get_purchase_session() {
196
-	return Give()->session->get( 'give_purchase' );
196
+	return Give()->session->get('give_purchase');
197 197
 }
198 198
 
199 199
 /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
  * @return array|string
205 205
  */
206 206
 function give_get_receipt_session() {
207
-	return Give()->session->get( 'receipt_access' );
207
+	return Give()->session->get('receipt_access');
208 208
 }
209 209
 
210 210
 /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
  * @return array|string
216 216
  */
217 217
 function give_get_history_session() {
218
-	return (bool) Give()->session->get( 'history_access' );
218
+	return (bool) Give()->session->get('history_access');
219 219
 }
220 220
 
221 221
 /**
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return string By default, the name of the form. Then the price level text if any is found.
229 229
  */
230
-function give_payment_gateway_item_title( $payment_data ) {
230
+function give_payment_gateway_item_title($payment_data) {
231 231
 
232
-	$form_id   = intval( $payment_data['post_data']['give-form-id'] );
233
-	$item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : '';
234
-	$price_id  = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
232
+	$form_id   = intval($payment_data['post_data']['give-form-id']);
233
+	$item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : '';
234
+	$price_id  = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
235 235
 
236 236
 
237 237
 	// Verify has variable prices.
238
-	if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) {
238
+	if (give_has_variable_prices($form_id) && ! empty($price_id)) {
239 239
 
240
-		$item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false );
240
+		$item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false);
241 241
 
242 242
 		/**
243 243
 		 * Output donation level text if:
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 		 */
248 248
 		if (
249 249
 			'custom' !== $price_id
250
-			&& ! empty( $item_price_level_text )
250
+			&& ! empty($item_price_level_text)
251 251
 		) {
252 252
 			// Matches a donation level - append level text.
253
-			$item_name .= ' - ' . $item_price_level_text;
253
+			$item_name .= ' - '.$item_price_level_text;
254 254
 		}
255 255
 	}
256 256
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return string
267 267
 	 */
268
-	return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data );
268
+	return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data);
269 269
 }
270 270
 
271 271
 /**
@@ -281,36 +281,36 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @return string
283 283
  */
284
-function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) {
285
-	$form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
284
+function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) {
285
+	$form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
286 286
 
287 287
 	// Form title.
288
-	$summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) );
288
+	$summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give')));
289 289
 
290 290
 	// Form multilevel if applicable.
291
-	if ( isset( $donation_data['post_data']['give-price-id'] ) ) {
292
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
291
+	if (isset($donation_data['post_data']['give-price-id'])) {
292
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
293 293
 	}
294 294
 
295 295
 	// Add Donor's name + email if requested.
296
-	if ( $name_and_email ) {
296
+	if ($name_and_email) {
297 297
 
298 298
 		// First name
299
-		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
300
-			$summary .= ' - ' . $donation_data['user_info']['first_name'];
299
+		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
300
+			$summary .= ' - '.$donation_data['user_info']['first_name'];
301 301
 		}
302 302
 
303
-		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
304
-			$summary .= ' ' . $donation_data['user_info']['last_name'];
303
+		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
304
+			$summary .= ' '.$donation_data['user_info']['last_name'];
305 305
 		}
306 306
 
307
-		$summary .= ' (' . $donation_data['user_email'] . ')';
307
+		$summary .= ' ('.$donation_data['user_email'].')';
308 308
 	}
309 309
 
310 310
 	// Cut the length
311
-	$summary = substr( $summary, 0, $length );
311
+	$summary = substr($summary, 0, $length);
312 312
 
313
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
313
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
314 314
 }
315 315
 
316 316
 
@@ -325,31 +325,31 @@  discard block
 block discarded – undo
325 325
 function give_get_host() {
326 326
 	$host = false;
327 327
 
328
-	if ( defined( 'WPE_APIKEY' ) ) {
328
+	if (defined('WPE_APIKEY')) {
329 329
 		$host = 'WP Engine';
330
-	} elseif ( defined( 'PAGELYBIN' ) ) {
330
+	} elseif (defined('PAGELYBIN')) {
331 331
 		$host = 'Pagely';
332
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
332
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
333 333
 		$host = 'ICDSoft';
334
-	} elseif ( DB_HOST == 'mysqlv5' ) {
334
+	} elseif (DB_HOST == 'mysqlv5') {
335 335
 		$host = 'NetworkSolutions';
336
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
336
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
337 337
 		$host = 'iPage';
338
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
338
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
339 339
 		$host = 'IPower';
340
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
340
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
341 341
 		$host = 'MediaTemple Grid';
342
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
342
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
343 343
 		$host = 'pair Networks';
344
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
344
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
345 345
 		$host = 'Rackspace Cloud';
346
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
346
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
347 347
 		$host = 'SysFix.eu Power Hosting';
348
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
348
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
349 349
 		$host = 'Flywheel';
350 350
 	} else {
351 351
 		// Adding a general fallback for data gathering
352
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
352
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
353 353
 	}
354 354
 
355 355
 	return $host;
@@ -365,67 +365,67 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return bool true if host matches, false if not
367 367
  */
368
-function give_is_host( $host = false ) {
368
+function give_is_host($host = false) {
369 369
 
370 370
 	$return = false;
371 371
 
372
-	if ( $host ) {
373
-		$host = str_replace( ' ', '', strtolower( $host ) );
372
+	if ($host) {
373
+		$host = str_replace(' ', '', strtolower($host));
374 374
 
375
-		switch ( $host ) {
375
+		switch ($host) {
376 376
 			case 'wpengine':
377
-				if ( defined( 'WPE_APIKEY' ) ) {
377
+				if (defined('WPE_APIKEY')) {
378 378
 					$return = true;
379 379
 				}
380 380
 				break;
381 381
 			case 'pagely':
382
-				if ( defined( 'PAGELYBIN' ) ) {
382
+				if (defined('PAGELYBIN')) {
383 383
 					$return = true;
384 384
 				}
385 385
 				break;
386 386
 			case 'icdsoft':
387
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
387
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
388 388
 					$return = true;
389 389
 				}
390 390
 				break;
391 391
 			case 'networksolutions':
392
-				if ( DB_HOST == 'mysqlv5' ) {
392
+				if (DB_HOST == 'mysqlv5') {
393 393
 					$return = true;
394 394
 				}
395 395
 				break;
396 396
 			case 'ipage':
397
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
397
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
398 398
 					$return = true;
399 399
 				}
400 400
 				break;
401 401
 			case 'ipower':
402
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
402
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
403 403
 					$return = true;
404 404
 				}
405 405
 				break;
406 406
 			case 'mediatemplegrid':
407
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
407
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
408 408
 					$return = true;
409 409
 				}
410 410
 				break;
411 411
 			case 'pairnetworks':
412
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
412
+				if (strpos(DB_HOST, '.pair.com') !== false) {
413 413
 					$return = true;
414 414
 				}
415 415
 				break;
416 416
 			case 'rackspacecloud':
417
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
417
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
418 418
 					$return = true;
419 419
 				}
420 420
 				break;
421 421
 			case 'sysfix.eu':
422 422
 			case 'sysfix.eupowerhosting':
423
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
423
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
424 424
 					$return = true;
425 425
 				}
426 426
 				break;
427 427
 			case 'flywheel':
428
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
428
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
429 429
 					$return = true;
430 430
 				}
431 431
 				break;
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
  * @param string $replacement Optional. The function that should have been called.
459 459
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
460 460
  */
461
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
461
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
462 462
 
463 463
 	/**
464 464
 	 * Fires while give deprecated function call occurs.
@@ -471,19 +471,19 @@  discard block
 block discarded – undo
471 471
 	 * @param string $replacement Optional. The function that should have been called.
472 472
 	 * @param string $version     The plugin version that deprecated the function.
473 473
 	 */
474
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
474
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
475 475
 
476
-	$show_errors = current_user_can( 'manage_options' );
476
+	$show_errors = current_user_can('manage_options');
477 477
 
478 478
 	// Allow plugin to filter the output error trigger.
479
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
480
-		if ( ! is_null( $replacement ) ) {
481
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
482
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
479
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
480
+		if ( ! is_null($replacement)) {
481
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
482
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
483 483
 			// Alternatively we could dump this to a file.
484 484
 		} else {
485
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
486
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
485
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
486
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
487 487
 			// Alternatively we could dump this to a file.
488 488
 		}
489 489
 	}
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
  * @return string $post_id
498 498
  */
499 499
 function give_get_admin_post_id() {
500
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
501
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
500
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
501
+	if ( ! $post_id && isset($_POST['post_id'])) {
502 502
 		$post_id = $_POST['post_id'];
503 503
 	}
504 504
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
  * @return string Arg separator output
513 513
  */
514 514
 function give_get_php_arg_separator_output() {
515
-	return ini_get( 'arg_separator.output' );
515
+	return ini_get('arg_separator.output');
516 516
 }
517 517
 
518 518
 
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
  *
528 528
  * @return string Short month name
529 529
  */
530
-function give_month_num_to_name( $n ) {
531
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
530
+function give_month_num_to_name($n) {
531
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
532 532
 
533
-	return date_i18n( 'M', $timestamp );
533
+	return date_i18n('M', $timestamp);
534 534
 }
535 535
 
536 536
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
  *
544 544
  * @return bool Whether or not function is disabled.
545 545
  */
546
-function give_is_func_disabled( $function ) {
547
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
546
+function give_is_func_disabled($function) {
547
+	$disabled = explode(',', ini_get('disable_functions'));
548 548
 
549
-	return in_array( $function, $disabled );
549
+	return in_array($function, $disabled);
550 550
 }
551 551
 
552 552
 /**
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 function give_get_newsletter() {
558 558
 	?>
559 559
 
560
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
560
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
561 561
 
562 562
 	<div class="give-newsletter-form-wrap">
563 563
 
@@ -565,33 +565,33 @@  discard block
 block discarded – undo
565 565
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
566 566
 		      target="_blank" novalidate>
567 567
 			<div class="give-newsletter-confirmation">
568
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
568
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
569 569
 			</div>
570 570
 
571 571
 			<table class="form-table give-newsletter-form">
572 572
 				<tr valign="middle">
573 573
 					<td>
574 574
 						<label for="mce-EMAIL"
575
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
575
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
576 576
 						<input type="email" name="EMAIL" id="mce-EMAIL"
577
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
577
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
578 578
 						       class="required email" value="">
579 579
 					</td>
580 580
 					<td>
581 581
 						<label for="mce-FNAME"
582
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
582
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
583 583
 						<input type="text" name="FNAME" id="mce-FNAME"
584
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
584
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
585 585
 					</td>
586 586
 					<td>
587 587
 						<label for="mce-LNAME"
588
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
588
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
589 589
 						<input type="text" name="LNAME" id="mce-LNAME"
590
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
590
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
591 591
 					</td>
592 592
 					<td>
593 593
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
594
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
594
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
595 595
 					</td>
596 596
 				</tr>
597 597
 			</table>
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return string
646 646
  */
647
-function give_svg_icons( $icon ) {
647
+function give_svg_icons($icon) {
648 648
 
649 649
 	// Store your SVGs in an associative array
650 650
 	$svgs = array(
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	);
657 657
 
658 658
 	// Return the chosen icon's SVG string
659
-	return $svgs[ $icon ];
659
+	return $svgs[$icon];
660 660
 }
661 661
 
662 662
 /**
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
  *
669 669
  * @return mixed
670 670
  */
671
-function modify_nav_menu_meta_box_object( $post_type ) {
672
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
673
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
671
+function modify_nav_menu_meta_box_object($post_type) {
672
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
673
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
674 674
 	}
675 675
 
676 676
 	return $post_type;
677 677
 }
678 678
 
679
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
679
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
680 680
 
681 681
 /**
682 682
  * Show Donation Forms Post Type in Appearance > Menus by default on fresh install.
@@ -695,35 +695,35 @@  discard block
 block discarded – undo
695 695
 	// Proceed, if current screen is navigation menus.
696 696
 	if (
697 697
 		'nav-menus' === $screen->id &&
698
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) ) &&
699
-		! get_user_option( 'give_is_donation_forms_menu_updated' )
698
+		give_is_setting_enabled(give_get_option('forms_singular')) &&
699
+		! get_user_option('give_is_donation_forms_menu_updated')
700 700
 	) {
701 701
 
702 702
 		// Return false, if it fails to retrieve hidden meta box list and is not admin.
703 703
 		if (
704 704
 			! is_admin() ||
705
-			( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) )
705
+			( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))
706 706
 		) {
707 707
 			return false;
708 708
 		}
709 709
 
710 710
 		// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
711
-		if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
711
+		if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
712 712
 			return false;
713 713
 		}
714 714
 
715 715
 		// Exclude 'Donation Form' value from hidden meta box's list.
716
-		$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
716
+		$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
717 717
 
718 718
 		// Get current user ID.
719 719
 		$user = wp_get_current_user();
720 720
 
721
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
722
-		update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true );
721
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
722
+		update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true);
723 723
 	}
724 724
 }
725 725
 
726
-add_action( 'current_screen', 'give_donation_metabox_menu' );
726
+add_action('current_screen', 'give_donation_metabox_menu');
727 727
 
728 728
 /**
729 729
  * Array_column backup usage
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
  * @license    https://opensource.org/licenses/MIT MIT
737 737
  */
738 738
 
739
-if ( ! function_exists( 'array_column' ) ) {
739
+if ( ! function_exists('array_column')) {
740 740
 	/**
741 741
 	 * Returns the values from a single column of the input array, identified by
742 742
 	 * the $columnKey.
@@ -755,53 +755,53 @@  discard block
 block discarded – undo
755 755
 	 *
756 756
 	 * @return array
757 757
 	 */
758
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
758
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
759 759
 		// Using func_get_args() in order to check for proper number of
760 760
 		// parameters and trigger errors exactly as the built-in array_column()
761 761
 		// does in PHP 5.5.
762 762
 		$argc   = func_num_args();
763 763
 		$params = func_get_args();
764 764
 
765
-		if ( $argc < 2 ) {
766
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
765
+		if ($argc < 2) {
766
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
767 767
 
768 768
 			return null;
769 769
 		}
770 770
 
771
-		if ( ! is_array( $params[0] ) ) {
772
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
771
+		if ( ! is_array($params[0])) {
772
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
773 773
 
774 774
 			return null;
775 775
 		}
776 776
 
777
-		if ( ! is_int( $params[1] )
778
-		     && ! is_float( $params[1] )
779
-		     && ! is_string( $params[1] )
777
+		if ( ! is_int($params[1])
778
+		     && ! is_float($params[1])
779
+		     && ! is_string($params[1])
780 780
 		     && $params[1] !== null
781
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
781
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
782 782
 		) {
783
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
783
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
784 784
 
785 785
 			return false;
786 786
 		}
787 787
 
788
-		if ( isset( $params[2] )
789
-		     && ! is_int( $params[2] )
790
-		     && ! is_float( $params[2] )
791
-		     && ! is_string( $params[2] )
792
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
788
+		if (isset($params[2])
789
+		     && ! is_int($params[2])
790
+		     && ! is_float($params[2])
791
+		     && ! is_string($params[2])
792
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
793 793
 		) {
794
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
794
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
795 795
 
796 796
 			return false;
797 797
 		}
798 798
 
799 799
 		$paramsInput     = $params[0];
800
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
800
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
801 801
 
802 802
 		$paramsIndexKey = null;
803
-		if ( isset( $params[2] ) ) {
804
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
803
+		if (isset($params[2])) {
804
+			if (is_float($params[2]) || is_int($params[2])) {
805 805
 				$paramsIndexKey = (int) $params[2];
806 806
 			} else {
807 807
 				$paramsIndexKey = (string) $params[2];
@@ -810,26 +810,26 @@  discard block
 block discarded – undo
810 810
 
811 811
 		$resultArray = array();
812 812
 
813
-		foreach ( $paramsInput as $row ) {
813
+		foreach ($paramsInput as $row) {
814 814
 			$key    = $value = null;
815 815
 			$keySet = $valueSet = false;
816 816
 
817
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
817
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
818 818
 				$keySet = true;
819
-				$key    = (string) $row[ $paramsIndexKey ];
819
+				$key    = (string) $row[$paramsIndexKey];
820 820
 			}
821 821
 
822
-			if ( $paramsColumnKey === null ) {
822
+			if ($paramsColumnKey === null) {
823 823
 				$valueSet = true;
824 824
 				$value    = $row;
825
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
825
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
826 826
 				$valueSet = true;
827
-				$value    = $row[ $paramsColumnKey ];
827
+				$value    = $row[$paramsColumnKey];
828 828
 			}
829 829
 
830
-			if ( $valueSet ) {
831
-				if ( $keySet ) {
832
-					$resultArray[ $key ] = $value;
830
+			if ($valueSet) {
831
+				if ($keySet) {
832
+					$resultArray[$key] = $value;
833 833
 				} else {
834 834
 					$resultArray[] = $value;
835 835
 				}
@@ -849,54 +849,54 @@  discard block
 block discarded – undo
849 849
  *
850 850
  * @return bool Whether the receipt is visible or not.
851 851
  */
852
-function give_can_view_receipt( $payment_key = '' ) {
852
+function give_can_view_receipt($payment_key = '') {
853 853
 
854 854
 	$return = false;
855 855
 
856
-	if ( empty( $payment_key ) ) {
856
+	if (empty($payment_key)) {
857 857
 		return $return;
858 858
 	}
859 859
 
860 860
 	global $give_receipt_args;
861 861
 
862
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
862
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
863 863
 
864
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
864
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
865 865
 
866
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
866
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
867 867
 
868
-	if ( is_user_logged_in() ) {
869
-		if ( $user_id === (int) get_current_user_id() ) {
868
+	if (is_user_logged_in()) {
869
+		if ($user_id === (int) get_current_user_id()) {
870 870
 			$return = true;
871
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
871
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
872 872
 			$return = true;
873
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
873
+		} elseif (current_user_can('view_give_sensitive_data')) {
874 874
 			$return = true;
875 875
 		}
876 876
 	}
877 877
 
878 878
 	// Check whether it is purchase session?
879 879
 	$purchase_session = give_get_purchase_session();
880
-	if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) {
881
-		if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) {
880
+	if ( ! empty($purchase_session) && ! is_user_logged_in()) {
881
+		if ($purchase_session['purchase_key'] === $payment_meta['key']) {
882 882
 			$return = true;
883 883
 		}
884 884
 	}
885 885
 
886 886
 	// Check whether it is receipt access session?
887 887
 	$receipt_session = give_get_receipt_session();
888
-	if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) {
889
-		if ( $receipt_session === $payment_meta['key'] ) {
888
+	if ( ! empty($receipt_session) && ! is_user_logged_in()) {
889
+		if ($receipt_session === $payment_meta['key']) {
890 890
 			$return = true;
891 891
 		}
892 892
 	}
893 893
 
894 894
 	// Check whether it is history access session?
895
-	if ( true === give_get_history_session() ) {
895
+	if (true === give_get_history_session()) {
896 896
 		$return = true;
897 897
 	}
898 898
 
899
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
899
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
900 900
 
901 901
 }
902 902
 
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
  *
906 906
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
907 907
  */
908
-if ( ! function_exists( 'cal_days_in_month' ) ) {
908
+if ( ! function_exists('cal_days_in_month')) {
909 909
 	/**
910 910
 	 * cal_days_in_month
911 911
 	 *
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 *
916 916
 	 * @return bool|string
917 917
 	 */
918
-	function cal_days_in_month( $calendar, $month, $year ) {
919
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
918
+	function cal_days_in_month($calendar, $month, $year) {
919
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
920 920
 	}
921 921
 }
922 922
 
@@ -935,42 +935,42 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function give_get_plugins() {
937 937
 	$plugins             = get_plugins();
938
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
938
+	$active_plugin_paths = (array) get_option('active_plugins', array());
939 939
 
940
-	if ( is_multisite() ) {
941
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
942
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
940
+	if (is_multisite()) {
941
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
942
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
943 943
 	}
944 944
 
945
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
945
+	foreach ($plugins as $plugin_path => $plugin_data) {
946 946
 		// Is plugin active?
947
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
948
-			$plugins[ $plugin_path ]['Status'] = 'active';
947
+		if (in_array($plugin_path, $active_plugin_paths)) {
948
+			$plugins[$plugin_path]['Status'] = 'active';
949 949
 		} else {
950
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
950
+			$plugins[$plugin_path]['Status'] = 'inactive';
951 951
 		}
952 952
 
953
-		$dirname = strtolower( dirname( $plugin_path ) );
953
+		$dirname = strtolower(dirname($plugin_path));
954 954
 
955 955
 		// Is plugin a Give add-on by WordImpress?
956
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
956
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
957 957
 			// Plugin is a Give-addon.
958
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
958
+			$plugins[$plugin_path]['Type'] = 'add-on';
959 959
 
960 960
 			// Get license info from database.
961
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
962
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
963
-			$license_active = get_option( $db_option );
961
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
962
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
963
+			$license_active = get_option($db_option);
964 964
 
965 965
 			// Does a valid license exist?
966
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
967
-				$plugins[ $plugin_path ]['License'] = true;
966
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
967
+				$plugins[$plugin_path]['License'] = true;
968 968
 			} else {
969
-				$plugins[ $plugin_path ]['License'] = false;
969
+				$plugins[$plugin_path]['License'] = false;
970 970
 			}
971 971
 		} else {
972 972
 			// Plugin is not a Give add-on.
973
-			$plugins[ $plugin_path ]['Type'] = 'other';
973
+			$plugins[$plugin_path]['Type'] = 'other';
974 974
 		}
975 975
 	}
976 976
 
@@ -987,16 +987,16 @@  discard block
 block discarded – undo
987 987
  *
988 988
  * @return bool
989 989
  */
990
-function give_is_terms_enabled( $form_id ) {
991
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
990
+function give_is_terms_enabled($form_id) {
991
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
992 992
 
993 993
 	if (
994
-		give_is_setting_enabled( $form_option, 'global' )
995
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
994
+		give_is_setting_enabled($form_option, 'global')
995
+		&& give_is_setting_enabled(give_get_option('terms'))
996 996
 	) {
997 997
 		return true;
998 998
 
999
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
999
+	} elseif (give_is_setting_enabled($form_option)) {
1000 1000
 		return true;
1001 1001
 
1002 1002
 	} else {
@@ -1021,10 +1021,10 @@  discard block
 block discarded – undo
1021 1021
  *
1022 1022
  * @return WP_Error|bool
1023 1023
  */
1024
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1024
+function give_delete_donation_stats($date_range = '', $args = array()) {
1025 1025
 
1026 1026
 	// Delete all cache.
1027
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1027
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1028 1028
 
1029 1029
 	/**
1030 1030
 	 * Fire the action when donation stats delete.
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 	 * @param string|array $date_range
1035 1035
 	 * @param array        $args
1036 1036
 	 */
1037
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1037
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1038 1038
 
1039 1039
 	return $status;
1040 1040
 }
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
  *
1053 1053
  * @return mixed
1054 1054
  */
1055
-function give_get_meta( $id, $meta_key, $single = false, $default = false ) {
1055
+function give_get_meta($id, $meta_key, $single = false, $default = false) {
1056 1056
 	/**
1057 1057
 	 * Filter the meta value
1058 1058
 	 *
@@ -1060,14 +1060,14 @@  discard block
 block discarded – undo
1060 1060
 	 */
1061 1061
 	$meta_value = apply_filters(
1062 1062
 		'give_get_meta',
1063
-		get_post_meta( $id, $meta_key, $single ),
1063
+		get_post_meta($id, $meta_key, $single),
1064 1064
 		$id,
1065 1065
 		$meta_key,
1066 1066
 		$default
1067 1067
 	);
1068 1068
 
1069 1069
 	if (
1070
-		( empty( $meta_key ) || empty( $meta_value ) )
1070
+		(empty($meta_key) || empty($meta_value))
1071 1071
 		&& $default
1072 1072
 	) {
1073 1073
 		$meta_value = $default;
@@ -1088,15 +1088,15 @@  discard block
 block discarded – undo
1088 1088
  *
1089 1089
  * @return mixed
1090 1090
  */
1091
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1092
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1091
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1092
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1093 1093
 
1094 1094
 	/**
1095 1095
 	 * Filter the meta value update status
1096 1096
 	 *
1097 1097
 	 * @since 1.8.8
1098 1098
 	 */
1099
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1099
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1100 1100
 }
1101 1101
 
1102 1102
 /**
@@ -1110,15 +1110,15 @@  discard block
 block discarded – undo
1110 1110
  *
1111 1111
  * @return mixed
1112 1112
  */
1113
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1114
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1113
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1114
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1115 1115
 
1116 1116
 	/**
1117 1117
 	 * Filter the meta value delete status
1118 1118
 	 *
1119 1119
 	 * @since 1.8.8
1120 1120
 	 */
1121
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1121
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1122 1122
 }
1123 1123
 
1124 1124
 /**
@@ -1130,15 +1130,15 @@  discard block
 block discarded – undo
1130 1130
  *
1131 1131
  * @return bool                   If the action has been added to the completed actions array
1132 1132
  */
1133
-function give_has_upgrade_completed( $upgrade_action = '' ) {
1133
+function give_has_upgrade_completed($upgrade_action = '') {
1134 1134
 
1135
-	if ( empty( $upgrade_action ) ) {
1135
+	if (empty($upgrade_action)) {
1136 1136
 		return false;
1137 1137
 	}
1138 1138
 
1139 1139
 	$completed_upgrades = give_get_completed_upgrades();
1140 1140
 
1141
-	return in_array( $upgrade_action, $completed_upgrades );
1141
+	return in_array($upgrade_action, $completed_upgrades);
1142 1142
 
1143 1143
 }
1144 1144
 
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
1151 1151
  */
1152 1152
 function give_maybe_resume_upgrade() {
1153
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
1154
-	if ( empty( $doing_upgrade ) ) {
1153
+	$doing_upgrade = get_option('give_doing_upgrade', false);
1154
+	if (empty($doing_upgrade)) {
1155 1155
 		return false;
1156 1156
 	}
1157 1157
 
@@ -1167,9 +1167,9 @@  discard block
 block discarded – undo
1167 1167
  *
1168 1168
  * @return bool                   If the function was successfully added
1169 1169
  */
1170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
1170
+function give_set_upgrade_complete($upgrade_action = '') {
1171 1171
 
1172
-	if ( empty( $upgrade_action ) ) {
1172
+	if (empty($upgrade_action)) {
1173 1173
 		return false;
1174 1174
 	}
1175 1175
 
@@ -1177,16 +1177,16 @@  discard block
 block discarded – undo
1177 1177
 	$completed_upgrades[] = $upgrade_action;
1178 1178
 
1179 1179
 	// Remove any blanks, and only show uniques.
1180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
1180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
1181 1181
 
1182 1182
 	/**
1183 1183
 	 * Fire the action when any upgrade set to complete.
1184 1184
 	 *
1185 1185
 	 * @since 1.8.12
1186 1186
 	 */
1187
-	do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );
1187
+	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades);
1188 1188
 
1189
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
1189
+	return update_option('give_completed_upgrades', $completed_upgrades);
1190 1190
 }
1191 1191
 
1192 1192
 /**
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
  * @return array The array of completed upgrades
1197 1197
  */
1198 1198
 function give_get_completed_upgrades() {
1199
-	return (array) get_option( 'give_completed_upgrades' );
1199
+	return (array) get_option('give_completed_upgrades');
1200 1200
 }
1201 1201
 
1202 1202
 /**
@@ -1206,21 +1206,21 @@  discard block
 block discarded – undo
1206 1206
  *
1207 1207
  * @param \WP_Query
1208 1208
  */
1209
-function give_remove_pages_from_search( $query ) {
1210
-	if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
1211
-		$transaction_failed = give_get_option( 'failure_page', 0 );
1212
-		$success_page       = give_get_option( 'success_page', 0 );
1209
+function give_remove_pages_from_search($query) {
1210
+	if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) {
1211
+		$transaction_failed = give_get_option('failure_page', 0);
1212
+		$success_page       = give_get_option('success_page', 0);
1213 1213
 		$args               = apply_filters(
1214 1214
 			'give_remove_pages_from_search', array(
1215 1215
 			$transaction_failed,
1216 1216
 			$success_page,
1217 1217
 		), $query
1218 1218
 		);
1219
-		$query->set( 'post__not_in', $args );
1219
+		$query->set('post__not_in', $args);
1220 1220
 	}
1221 1221
 }
1222 1222
 
1223
-add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 );
1223
+add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1);
1224 1224
 
1225 1225
 /**
1226 1226
  * Inserts a new key/value before a key in the array.
@@ -1236,14 +1236,14 @@  discard block
 block discarded – undo
1236 1236
  *
1237 1237
  * @see   array_insert_before()
1238 1238
  */
1239
-function give_array_insert_before( $key, array &$array, $new_key, $new_value ) {
1240
-	if ( array_key_exists( $key, $array ) ) {
1239
+function give_array_insert_before($key, array &$array, $new_key, $new_value) {
1240
+	if (array_key_exists($key, $array)) {
1241 1241
 		$new = array();
1242
-		foreach ( $array as $k => $value ) {
1243
-			if ( $k === $key ) {
1244
-				$new[ $new_key ] = $new_value;
1242
+		foreach ($array as $k => $value) {
1243
+			if ($k === $key) {
1244
+				$new[$new_key] = $new_value;
1245 1245
 			}
1246
-			$new[ $k ] = $value;
1246
+			$new[$k] = $value;
1247 1247
 		}
1248 1248
 
1249 1249
 		return $new;
@@ -1266,13 +1266,13 @@  discard block
 block discarded – undo
1266 1266
  *
1267 1267
  * @see   array_insert_before()
1268 1268
  */
1269
-function give_array_insert_after( $key, array &$array, $new_key, $new_value ) {
1270
-	if ( array_key_exists( $key, $array ) ) {
1269
+function give_array_insert_after($key, array &$array, $new_key, $new_value) {
1270
+	if (array_key_exists($key, $array)) {
1271 1271
 		$new = array();
1272
-		foreach ( $array as $k => $value ) {
1273
-			$new[ $k ] = $value;
1274
-			if ( $k === $key ) {
1275
-				$new[ $new_key ] = $new_value;
1272
+		foreach ($array as $k => $value) {
1273
+			$new[$k] = $value;
1274
+			if ($k === $key) {
1275
+				$new[$new_key] = $new_value;
1276 1276
 			}
1277 1277
 		}
1278 1278
 
@@ -1299,21 +1299,21 @@  discard block
 block discarded – undo
1299 1299
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
1300 1300
  *               `$list` will be preserved in the results.
1301 1301
  */
1302
-function give_list_pluck( $list, $field, $index_key = null ) {
1302
+function give_list_pluck($list, $field, $index_key = null) {
1303 1303
 
1304
-	if ( ! $index_key ) {
1304
+	if ( ! $index_key) {
1305 1305
 		/*
1306 1306
 		 * This is simple. Could at some point wrap array_column()
1307 1307
 		 * if we knew we had an array of arrays.
1308 1308
 		 */
1309
-		foreach ( $list as $key => $value ) {
1310
-			if ( is_object( $value ) ) {
1311
-				if ( isset( $value->$field ) ) {
1312
-					$list[ $key ] = $value->$field;
1309
+		foreach ($list as $key => $value) {
1310
+			if (is_object($value)) {
1311
+				if (isset($value->$field)) {
1312
+					$list[$key] = $value->$field;
1313 1313
 				}
1314 1314
 			} else {
1315
-				if ( isset( $value[ $field ] ) ) {
1316
-					$list[ $key ] = $value[ $field ];
1315
+				if (isset($value[$field])) {
1316
+					$list[$key] = $value[$field];
1317 1317
 				}
1318 1318
 			}
1319 1319
 		}
@@ -1326,18 +1326,18 @@  discard block
 block discarded – undo
1326 1326
 	 * to the end of the stack. This is how array_column() behaves.
1327 1327
 	 */
1328 1328
 	$newlist = array();
1329
-	foreach ( $list as $value ) {
1330
-		if ( is_object( $value ) ) {
1331
-			if ( isset( $value->$index_key ) ) {
1332
-				$newlist[ $value->$index_key ] = $value->$field;
1329
+	foreach ($list as $value) {
1330
+		if (is_object($value)) {
1331
+			if (isset($value->$index_key)) {
1332
+				$newlist[$value->$index_key] = $value->$field;
1333 1333
 			} else {
1334 1334
 				$newlist[] = $value->$field;
1335 1335
 			}
1336 1336
 		} else {
1337
-			if ( isset( $value[ $index_key ] ) ) {
1338
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
1337
+			if (isset($value[$index_key])) {
1338
+				$newlist[$value[$index_key]] = $value[$field];
1339 1339
 			} else {
1340
-				$newlist[] = $value[ $field ];
1340
+				$newlist[] = $value[$field];
1341 1341
 			}
1342 1342
 		}
1343 1343
 	}
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
  *
1361 1361
  * @return int|false Meta ID on success, false on failure.
1362 1362
  */
1363
-function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) {
1364
-	return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique );
1363
+function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) {
1364
+	return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique);
1365 1365
 }
1366 1366
 
1367 1367
 /**
@@ -1379,8 +1379,8 @@  discard block
 block discarded – undo
1379 1379
  *
1380 1380
  * @return bool True on success, false on failure.
1381 1381
  */
1382
-function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) {
1383
-	return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value );
1382
+function delete_donor_meta($donor_id, $meta_key, $meta_value = '') {
1383
+	return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value);
1384 1384
 }
1385 1385
 
1386 1386
 /**
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
1396 1396
  *  is true.
1397 1397
  */
1398
-function get_donor_meta( $donor_id, $key = '', $single = false ) {
1399
-	return get_metadata( 'give_customer', $donor_id, $key, $single );
1398
+function get_donor_meta($donor_id, $key = '', $single = false) {
1399
+	return get_metadata('give_customer', $donor_id, $key, $single);
1400 1400
 }
1401 1401
 
1402 1402
 /**
@@ -1413,8 +1413,8 @@  discard block
 block discarded – undo
1413 1413
  *
1414 1414
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
1415 1415
  */
1416
-function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) {
1417
-	return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value );
1416
+function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') {
1417
+	return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value);
1418 1418
 }
1419 1419
 
1420 1420
 /*
@@ -1424,15 +1424,15 @@  discard block
 block discarded – undo
1424 1424
  *
1425 1425
  * @param int $form_id Form id of which recalculation needs to be done.
1426 1426
  */
1427
-function give_recount_form_income_donation( $form_id = false ) {
1427
+function give_recount_form_income_donation($form_id = false) {
1428 1428
 	// Check if form id is not empty.
1429
-	if ( ! empty( $form_id ) ) {
1429
+	if ( ! empty($form_id)) {
1430 1430
 		/**
1431 1431
 		 * Filter to modify payment status.
1432 1432
 		 *
1433 1433
 		 * @since 1.8.13
1434 1434
 		 */
1435
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
1435
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
1436 1436
 
1437 1437
 		/**
1438 1438
 		 * Filter to modify args of payment query before recalculating the form total
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 			'give_recount_form_stats_args', array(
1444 1444
 				'give_forms'     => $form_id,
1445 1445
 				'status'         => $accepted_statuses,
1446
-				'posts_per_page' => - 1,
1446
+				'posts_per_page' => -1,
1447 1447
 				'fields'         => 'ids',
1448 1448
 			)
1449 1449
 		);
@@ -1453,28 +1453,28 @@  discard block
 block discarded – undo
1453 1453
 			'earnings' => 0,
1454 1454
 		);
1455 1455
 
1456
-		$payments = new Give_Payments_Query( $args );
1456
+		$payments = new Give_Payments_Query($args);
1457 1457
 		$payments = $payments->get_payments();
1458 1458
 
1459
-		if ( $payments ) {
1460
-			foreach ( $payments as $payment ) {
1459
+		if ($payments) {
1460
+			foreach ($payments as $payment) {
1461 1461
 				// Ensure acceptible status only
1462
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1462
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
1463 1463
 					continue;
1464 1464
 				}
1465 1465
 
1466 1466
 				// Ensure only payments for this form are counted
1467
-				if ( $payment->form_id != $form_id ) {
1467
+				if ($payment->form_id != $form_id) {
1468 1468
 					continue;
1469 1469
 				}
1470 1470
 
1471
-				$totals['sales'] ++;
1471
+				$totals['sales']++;
1472 1472
 				$totals['earnings'] += $payment->total;
1473 1473
 
1474 1474
 			}
1475 1475
 		}
1476
-		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1477
-		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
1476
+		give_update_meta($form_id, '_give_form_sales', $totals['sales']);
1477
+		give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
1478 1478
 	}// End if().
1479 1479
 }
1480 1480
 
@@ -1487,18 +1487,18 @@  discard block
 block discarded – undo
1487 1487
  *
1488 1488
  * @return string
1489 1489
  */
1490
-function give_get_attribute_str( $attributes ) {
1490
+function give_get_attribute_str($attributes) {
1491 1491
 	$attribute_str = '';
1492 1492
 
1493
-	if ( empty( $attributes ) ) {
1493
+	if (empty($attributes)) {
1494 1494
 		return $attribute_str;
1495 1495
 	}
1496 1496
 
1497
-	foreach ( $attributes as $tag => $value ) {
1497
+	foreach ($attributes as $tag => $value) {
1498 1498
 		$attribute_str .= " {$tag}=\"{$value}\"";
1499 1499
 	}
1500 1500
 
1501
-	return trim( $attribute_str );
1501
+	return trim($attribute_str);
1502 1502
 }
1503 1503
 
1504 1504
 /**
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 function give_get_wp_upload_dir() {
1512 1512
 	$wp_upload_dir = wp_upload_dir();
1513 1513
 
1514
-	return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false );
1514
+	return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false);
1515 1515
 }
1516 1516
 
1517 1517
 /**
@@ -1523,15 +1523,15 @@  discard block
 block discarded – undo
1523 1523
  *
1524 1524
  * @return string/bool $file_contents File content
1525 1525
  */
1526
-function give_get_core_settings_json( $file_name ) {
1526
+function give_get_core_settings_json($file_name) {
1527 1527
 	$upload_dir = give_get_wp_upload_dir();
1528
-	$file_path  = $upload_dir . '/' . $file_name;
1528
+	$file_path  = $upload_dir.'/'.$file_name;
1529 1529
 
1530
-	if ( is_wp_error( $file_path ) || empty( $file_path ) ) {
1531
-		Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) );
1530
+	if (is_wp_error($file_path) || empty($file_path)) {
1531
+		Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give'));
1532 1532
 	}
1533 1533
 
1534
-	$file_contents = file_get_contents( $file_path );
1534
+	$file_contents = file_get_contents($file_path);
1535 1535
 
1536 1536
 	return $file_contents;
1537 1537
 }
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
  * @return int $country The two letter country code for the site's base country
1545 1545
  */
1546 1546
 function give_get_limit_display_donations() {
1547
-	return give_get_option( 'limit_display_donations', 1 );
1547
+	return give_get_option('limit_display_donations', 1);
1548 1548
 }
1549 1549
 
1550 1550
 /**
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
  * @since 1.8.17
1554 1554
  */
1555 1555
 function give_donation_history_table_end() {
1556
-	$email = Give()->session->get( 'give_email' );
1556
+	$email = Give()->session->get('give_email');
1557 1557
 	?>
1558 1558
 	<tfoot>
1559 1559
 	<tr>
@@ -1562,16 +1562,16 @@  discard block
 block discarded – undo
1562 1562
 				<div class="give-security-column give-security-description-wrap">
1563 1563
 					<?php
1564 1564
 					echo sprintf(
1565
-						__( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ),
1565
+						__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'),
1566 1566
 						$email
1567 1567
 					);
1568 1568
 					?>
1569 1569
 				</div>
1570 1570
 				<div class="give-security-column give-security-button-wrap">
1571 1571
 					<a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn">
1572
-						<?php _e( 'Confirm Email', 'give' ); ?>
1572
+						<?php _e('Confirm Email', 'give'); ?>
1573 1573
 					</a>
1574
-					<span><?php _e( 'Email Sent!', 'give' ); ?></span>
1574
+					<span><?php _e('Email Sent!', 'give'); ?></span>
1575 1575
 				</div>
1576 1576
 			</div>
1577 1577
 		</td>
Please login to merge, or discard this patch.
includes/forms/template.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
  *
1471 1471
  * @param  int $form_id The form ID.
1472 1472
  *
1473
- * @return bool
1473
+ * @return false|null
1474 1474
  */
1475 1475
 function give_terms_agreement( $form_id ) {
1476 1476
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
  * @param  int   $form_id The form ID.
1648 1648
  * @param  array $args    An array of form arguments.
1649 1649
  *
1650
- * @return mixed
1650
+ * @return boolean
1651 1651
  */
1652 1652
 function give_show_goal_progress( $form_id, $args ) {
1653 1653
 
@@ -1667,7 +1667,7 @@  discard block
 block discarded – undo
1667 1667
  *
1668 1668
  * @since  1.8
1669 1669
  *
1670
- * @param  $form_id
1670
+ * @param  integer $form_id
1671 1671
  * @param  $args
1672 1672
  *
1673 1673
  * @return mixed|string
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
  * @param  int   $form_id The form ID.
1709 1709
  * @param  array $args    An array of form arguments.
1710 1710
  *
1711
- * @return void|bool
1711
+ * @return false|null
1712 1712
  */
1713 1713
 function give_form_content( $form_id, $args ) {
1714 1714
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
 			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
942 942
 		    >
943 943
 			    <?php
944
-			    foreach ( $countries as $country_code => $country ) {
945
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
946
-			    }
947
-			    ?>
944
+				foreach ( $countries as $country_code => $country ) {
945
+					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
946
+				}
947
+				?>
948 948
 		    </select>
949 949
 	    </p>
950 950
 
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 		    <label for="card_address" class="give-label">
953 953
 			    <?php esc_html_e( 'Address 1', 'give' ); ?>
954 954
 			    <?php
955
-			    if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
955
+				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
956 956
 				    <span class="give-required-indicator">*</span>
957 957
 			    <?php endif; ?>
958 958
 			    <span class="give-tooltip give-icon give-icon-question"
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 		    <label for="card_state" class="give-label">
1017 1017
 			    <span class="state-label-text"><?php echo $label; ?></span>
1018 1018
 			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1019
-				    ?>
1019
+					?>
1020 1020
 				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1021 1021
 			    <?php endif; ?>
1022 1022
 			    <span class="give-tooltip give-icon give-icon-question"
@@ -1024,17 +1024,17 @@  discard block
 block discarded – undo
1024 1024
 		    </label>
1025 1025
 		    <?php
1026 1026
 
1027
-		    if ( ! empty( $states ) ) : ?>
1027
+			if ( ! empty( $states ) ) : ?>
1028 1028
 			    <select
1029 1029
 				    name="card_state"
1030 1030
 				    id="card_state"
1031 1031
 				    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1032 1032
 				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1033 1033
 				    <?php
1034
-				    foreach ( $states as $state_code => $state ) {
1035
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1036
-				    }
1037
-				    ?>
1034
+					foreach ( $states as $state_code => $state ) {
1035
+						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1036
+					}
1037
+					?>
1038 1038
 			    </select>
1039 1039
 		    <?php else : ?>
1040 1040
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
Please login to merge, or discard this patch.
Spacing   +415 added lines, -416 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,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation 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 = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = 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 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103
-				( isset( $args['show_title'] ) && $args['show_title'] == true )
104
-				&& ! doing_action( 'give_single_form_summary' )
103
+				(isset($args['show_title']) && $args['show_title'] == true)
104
+				&& ! doing_action('give_single_form_summary')
105 105
 			) {
106 106
 				echo $form_title;
107 107
 			}
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 			 * @param array            $args    An array of form arguments.
116 116
 			 * @param Give_Donate_Form $form    Form object.
117 117
 			 */
118
-			do_action( 'give_pre_form', $form->ID, $args, $form );
118
+			do_action('give_pre_form', $form->ID, $args, $form);
119 119
 
120 120
 			// Set form html tags.
121 121
 			$form_html_tags = array(
122 122
 				'id'     => "give-form-{$form_id}",
123 123
 				'class'  => $form_classes,
124
-				'action' => esc_url_raw( $form_action ),
124
+				'action' => esc_url_raw($form_action),
125 125
 			);
126 126
 
127 127
 			/**
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 			 * @param array            $form_html_tags Array of form html tags.
133 133
 			 * @param Give_Donate_Form $form           Form object.
134 134
 			 */
135
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
135
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
136 136
 			?>
137 137
 
138
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
138
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
139 139
 
140 140
 				<!-- The following field is for robots only, invisible to humans: -->
141 141
 				<span class="give-hidden" style="display: none !important;">
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				 * @param array            $args    An array of form arguments.
156 156
 				 * @param Give_Donate_Form $form    Form object.
157 157
 				 */
158
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
158
+				do_action('give_donation_form_top', $form->ID, $args, $form);
159 159
 
160 160
 				/**
161 161
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				 * @param array            $args    An array of form arguments.
167 167
 				 * @param Give_Donate_Form $form    Form object.
168 168
 				 */
169
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
169
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
170 170
 
171 171
 				/**
172 172
 				 * Fires while outputting donation form, after all other fields.
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				 * @param array            $args    An array of form arguments.
178 178
 				 * @param Give_Donate_Form $form    Form object.
179 179
 				 */
180
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
180
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
181 181
 
182 182
 				?>
183 183
 			</form>
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 			 * @param array            $args    An array of form arguments.
193 193
 			 * @param Give_Donate_Form $form    Form object.
194 194
 			 */
195
-			do_action( 'give_post_form', $form->ID, $args, $form );
195
+			do_action('give_post_form', $form->ID, $args, $form);
196 196
 
197 197
 		}
198 198
 		?>
199 199
 
200
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
200
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
201 201
 	<?php
202 202
 
203 203
 	/**
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param int   $form_id The form ID.
209 209
 	 * @param array $args    An array of form arguments.
210 210
 	 */
211
-	do_action( 'give_post_form_output', $form->ID, $args );
211
+	do_action('give_post_form_output', $form->ID, $args);
212 212
 
213 213
 	$final_output = ob_get_clean();
214 214
 
215
-	echo apply_filters( 'give_donate_form', $final_output, $args );
215
+	echo apply_filters('give_donate_form', $final_output, $args);
216 216
 }
217 217
 
218 218
 /**
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return string
231 231
  */
232
-function give_show_purchase_form( $form_id ) {
232
+function give_show_purchase_form($form_id) {
233 233
 
234
-	$payment_mode = give_get_chosen_gateway( $form_id );
234
+	$payment_mode = give_get_chosen_gateway($form_id);
235 235
 
236
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
236
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
237 237
 		$form_id = $_POST['give_form_id'];
238 238
 	}
239 239
 
@@ -242,33 +242,33 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @since 1.7
244 244
 	 */
245
-	do_action( 'give_payment_fields_top', $form_id );
245
+	do_action('give_payment_fields_top', $form_id);
246 246
 
247
-	if ( give_can_checkout() && isset( $form_id ) ) {
247
+	if (give_can_checkout() && isset($form_id)) {
248 248
 
249 249
 		/**
250 250
 		 * Fires while displaying donation form, before registration login.
251 251
 		 *
252 252
 		 * @since 1.7
253 253
 		 */
254
-		do_action( 'give_donation_form_before_register_login', $form_id );
254
+		do_action('give_donation_form_before_register_login', $form_id);
255 255
 
256 256
 		/**
257 257
 		 * Fire when register/login form fields render.
258 258
 		 *
259 259
 		 * @since 1.7
260 260
 		 */
261
-		do_action( 'give_donation_form_register_login_fields', $form_id );
261
+		do_action('give_donation_form_register_login_fields', $form_id);
262 262
 
263 263
 		/**
264 264
 		 * Fire when credit card form fields render.
265 265
 		 *
266 266
 		 * @since 1.7
267 267
 		 */
268
-		do_action( 'give_donation_form_before_cc_form', $form_id );
268
+		do_action('give_donation_form_before_cc_form', $form_id);
269 269
 
270 270
 		// Load the credit card form and allow gateways to load their own if they wish.
271
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
271
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
272 272
 			/**
273 273
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
274 274
 			 *
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			 *
277 277
 			 * @param int $form_id The form ID.
278 278
 			 */
279
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
279
+			do_action("give_{$payment_mode}_cc_form", $form_id);
280 280
 		} else {
281 281
 			/**
282 282
 			 * Fires while displaying donation form, credit card form fields.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			 *
286 286
 			 * @param int $form_id The form ID.
287 287
 			 */
288
-			do_action( 'give_cc_form', $form_id );
288
+			do_action('give_cc_form', $form_id);
289 289
 		}
290 290
 
291 291
 		/**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		 *
294 294
 		 * @since 1.7
295 295
 		 */
296
-		do_action( 'give_donation_form_after_cc_form', $form_id );
296
+		do_action('give_donation_form_after_cc_form', $form_id);
297 297
 
298 298
 	} else {
299 299
 		/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @since 1.7
303 303
 		 */
304
-		do_action( 'give_donation_form_no_access', $form_id );
304
+		do_action('give_donation_form_no_access', $form_id);
305 305
 
306 306
 	}
307 307
 
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @since 1.7
312 312
 	 */
313
-	do_action( 'give_payment_fields_bottom', $form_id );
313
+	do_action('give_payment_fields_bottom', $form_id);
314 314
 }
315 315
 
316
-add_action( 'give_donation_form', 'give_show_purchase_form' );
316
+add_action('give_donation_form', 'give_show_purchase_form');
317 317
 
318 318
 /**
319 319
  * Give Show Login/Register Form Fields.
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @return void
326 326
  */
327
-function give_show_register_login_fields( $form_id ) {
327
+function give_show_register_login_fields($form_id) {
328 328
 
329
-	$show_register_form = give_show_login_register_option( $form_id );
329
+	$show_register_form = give_show_login_register_option($form_id);
330 330
 
331
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
331
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
332 332
 		?>
333 333
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
334 334
 			<?php
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			 *
338 338
 			 * @since 1.7
339 339
 			 */
340
-			do_action( 'give_donation_form_register_fields', $form_id );
340
+			do_action('give_donation_form_register_fields', $form_id);
341 341
 			?>
342 342
 		</div>
343 343
 		<?php
344
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
344
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
345 345
 		?>
346 346
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
347 347
 			<?php
@@ -350,23 +350,23 @@  discard block
 block discarded – undo
350 350
 			 *
351 351
 			 * @since 1.7
352 352
 			 */
353
-			do_action( 'give_donation_form_login_fields', $form_id );
353
+			do_action('give_donation_form_login_fields', $form_id);
354 354
 			?>
355 355
 		</div>
356 356
 		<?php
357 357
 	endif;
358 358
 
359
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
359
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
360 360
 		/**
361 361
 		 * Fire when user info render.
362 362
 		 *
363 363
 		 * @since 1.7
364 364
 		 */
365
-		do_action( 'give_donation_form_after_user_info', $form_id );
365
+		do_action('give_donation_form_after_user_info', $form_id);
366 366
 	}
367 367
 }
368 368
 
369
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
369
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
370 370
 
371 371
 /**
372 372
  * Donation Amount Field.
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return void
383 383
  */
384
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
384
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
385 385
 
386 386
 	$give_options        = give_get_settings();
387
-	$variable_pricing    = give_has_variable_prices( $form_id );
388
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
389
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
390
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
391
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
392
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
393
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
387
+	$variable_pricing    = give_has_variable_prices($form_id);
388
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
389
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
390
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
391
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
392
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
393
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
394 394
 
395 395
 	/**
396 396
 	 * Fires while displaying donation form, before donation level fields.
@@ -400,20 +400,20 @@  discard block
 block discarded – undo
400 400
 	 * @param int   $form_id The form ID.
401 401
 	 * @param array $args    An array of form arguments.
402 402
 	 */
403
-	do_action( 'give_before_donation_levels', $form_id, $args );
403
+	do_action('give_before_donation_levels', $form_id, $args);
404 404
 
405 405
 	//Set Price, No Custom Amount Allowed means hidden price field
406
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
406
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
407 407
 		?>
408
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
408
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
409 409
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
410 410
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
411 411
 		<div class="set-price give-donation-amount form-row-wide">
412
-			<?php if ( $currency_position == 'before' ) {
412
+			<?php if ($currency_position == 'before') {
413 413
 				echo $currency_output;
414 414
 			} ?>
415 415
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
416
-			<?php if ( $currency_position == 'after' ) {
416
+			<?php if ($currency_position == 'after') {
417 417
 				echo $currency_output;
418 418
 			} ?>
419 419
 		</div>
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 		?>
424 424
 		<div class="give-total-wrap">
425 425
 			<div class="give-donation-amount form-row-wide">
426
-				<?php if ( $currency_position == 'before' ) {
426
+				<?php if ($currency_position == 'before') {
427 427
 					echo $currency_output;
428 428
 				} ?>
429
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
429
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
430 430
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
431 431
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
432
-				<?php if ( $currency_position == 'after' ) {
432
+				<?php if ($currency_position == 'after') {
433 433
 					echo $currency_output;
434 434
 				} ?>
435 435
 			</div>
@@ -444,16 +444,16 @@  discard block
 block discarded – undo
444 444
 	 * @param int   $form_id The form ID.
445 445
 	 * @param array $args    An array of form arguments.
446 446
 	 */
447
-	do_action( 'give_after_donation_amount', $form_id, $args );
447
+	do_action('give_after_donation_amount', $form_id, $args);
448 448
 
449 449
 	//Custom Amount Text
450
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
450
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
451 451
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
452 452
 	<?php }
453 453
 
454 454
 	//Output Variable Pricing Levels.
455
-	if ( $variable_pricing ) {
456
-		give_output_levels( $form_id );
455
+	if ($variable_pricing) {
456
+		give_output_levels($form_id);
457 457
 	}
458 458
 
459 459
 	/**
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 	 * @param int   $form_id The form ID.
465 465
 	 * @param array $args    An array of form arguments.
466 466
 	 */
467
-	do_action( 'give_after_donation_levels', $form_id, $args );
467
+	do_action('give_after_donation_levels', $form_id, $args);
468 468
 }
469 469
 
470
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
470
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
471 471
 
472 472
 /**
473 473
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -478,30 +478,30 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @return string Donation levels.
480 480
  */
481
-function give_output_levels( $form_id ) {
481
+function give_output_levels($form_id) {
482 482
 
483 483
 	//Get variable pricing.
484
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
485
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
486
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
487
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
488
-	if ( empty( $custom_amount_text ) ) {
489
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
484
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
485
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
486
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
487
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
488
+	if (empty($custom_amount_text)) {
489
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
490 490
 	}
491 491
 
492 492
 	$output = '';
493 493
 
494
-	switch ( $display_style ) {
494
+	switch ($display_style) {
495 495
 		case 'buttons':
496 496
 
497 497
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
498 498
 
499
-			foreach ( $prices as $price ) {
500
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
501
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
499
+			foreach ($prices as $price) {
500
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
501
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
502 502
 
503 503
 				$output .= '<li>';
504
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
504
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
505 505
 				$output .= $level_text;
506 506
 				$output .= '</button>';
507 507
 				$output .= '</li>';
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			}
510 510
 
511 511
 			//Custom Amount.
512
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
512
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
513 513
 				$output .= '<li>';
514 514
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
515 515
 				$output .= $custom_amount_text;
@@ -525,22 +525,22 @@  discard block
 block discarded – undo
525 525
 
526 526
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
527 527
 
528
-			foreach ( $prices as $price ) {
529
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
530
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
528
+			foreach ($prices as $price) {
529
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
530
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
531 531
 
532 532
 				$output .= '<li>';
533
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
534
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
533
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
534
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
535 535
 				$output .= '</li>';
536 536
 
537 537
 			}
538 538
 
539 539
 			//Custom Amount.
540
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
540
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
541 541
 				$output .= '<li>';
542 542
 				$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">';
543
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
543
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
544 544
 				$output .= '</li>';
545 545
 			}
546 546
 
@@ -550,23 +550,23 @@  discard block
 block discarded – undo
550 550
 
551 551
 		case 'dropdown':
552 552
 
553
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
554
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
553
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
554
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
555 555
 
556 556
 			//first loop through prices.
557
-			foreach ( $prices as $price ) {
558
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
559
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
557
+			foreach ($prices as $price) {
558
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
559
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
560 560
 
561
-				$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'], array( 'sanitize' => false ) ) . '">';
561
+				$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'], array('sanitize' => false)).'">';
562 562
 				$output .= $level_text;
563 563
 				$output .= '</option>';
564 564
 
565 565
 			}
566 566
 
567 567
 			//Custom Amount.
568
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
569
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
568
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
569
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
570 570
 			}
571 571
 
572 572
 			$output .= '</select>';
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			break;
575 575
 	}
576 576
 
577
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
577
+	echo apply_filters('give_form_level_output', $output, $form_id);
578 578
 }
579 579
 
580 580
 /**
@@ -589,27 +589,27 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return string Checkout button.
591 591
  */
592
-function give_display_checkout_button( $form_id, $args ) {
592
+function give_display_checkout_button($form_id, $args) {
593 593
 
594
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
594
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
595 595
 		? $args['display_style']
596
-		: give_get_meta( $form_id, '_give_payment_display', true );
596
+		: give_get_meta($form_id, '_give_payment_display', true);
597 597
 
598
-	if ( 'button' === $display_option ) {
598
+	if ('button' === $display_option) {
599 599
 		$display_option = 'modal';
600
-	} elseif ( $display_option === 'onpage' ) {
600
+	} elseif ($display_option === 'onpage') {
601 601
 		return '';
602 602
 	}
603 603
 
604
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
605
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
604
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
605
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
606 606
 
607
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
607
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
608 608
 
609
-	echo apply_filters( 'give_display_checkout_button', $output );
609
+	echo apply_filters('give_display_checkout_button', $output);
610 610
 }
611 611
 
612
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
612
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
613 613
 
614 614
 /**
615 615
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -620,57 +620,57 @@  discard block
 block discarded – undo
620 620
  *
621 621
  * @return void
622 622
  */
623
-function give_user_info_fields( $form_id ) {
623
+function give_user_info_fields($form_id) {
624 624
 	// Get user info.
625
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
625
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
626 626
 
627 627
 	/**
628 628
 	 * Fire before user personal information fields
629 629
 	 *
630 630
 	 * @since 1.7
631 631
 	 */
632
-	do_action( 'give_donation_form_before_personal_info', $form_id );
632
+	do_action('give_donation_form_before_personal_info', $form_id);
633 633
 	?>
634 634
 	<fieldset id="give_checkout_user_info">
635
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
635
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
636 636
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
637 637
 			<label class="give-label" for="give-first">
638
-				<?php esc_html_e( 'First Name', 'give' ); ?>
639
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
638
+				<?php esc_html_e('First Name', 'give'); ?>
639
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
640 640
 					<span class="give-required-indicator">*</span>
641 641
 				<?php endif ?>
642 642
 				<span class="give-tooltip give-icon give-icon-question"
643
-					  data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
643
+					  data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
644 644
 			</label>
645 645
 			<input
646 646
 					class="give-input required"
647 647
 					type="text"
648 648
 					name="give_first"
649
-					placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
649
+					placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
650 650
 					id="give-first"
651
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
652
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
651
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
652
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
653 653
 			/>
654 654
 		</p>
655 655
 
656 656
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
657 657
 			<label class="give-label" for="give-last">
658
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
659
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
658
+				<?php esc_html_e('Last Name', 'give'); ?>
659
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
660 660
 					<span class="give-required-indicator">*</span>
661 661
 				<?php endif ?>
662 662
 				<span class="give-tooltip give-icon give-icon-question"
663
-					  data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
663
+					  data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
664 664
 			</label>
665 665
 
666 666
 			<input
667
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
667
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
668 668
 					type="text"
669 669
 					name="give_last"
670 670
 					id="give-last"
671
-					placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
672
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
673
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
671
+					placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
672
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
673
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
674 674
 			/>
675 675
 		</p>
676 676
 
@@ -680,26 +680,26 @@  discard block
 block discarded – undo
680 680
 		 *
681 681
 		 * @since 1.7
682 682
 		 */
683
-		do_action( 'give_donation_form_before_email', $form_id );
683
+		do_action('give_donation_form_before_email', $form_id);
684 684
 		?>
685 685
 		<p id="give-email-wrap" class="form-row form-row-wide">
686 686
 			<label class="give-label" for="give-email">
687
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
688
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
687
+				<?php esc_html_e('Email Address', 'give'); ?>
688
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
689 689
 					<span class="give-required-indicator">*</span>
690 690
 				<?php } ?>
691 691
 				<span class="give-tooltip give-icon give-icon-question"
692
-					  data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
692
+					  data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
693 693
 			</label>
694 694
 
695 695
 			<input
696 696
 					class="give-input required"
697 697
 					type="email"
698 698
 					name="give_email"
699
-					placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
699
+					placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
700 700
 					id="give-email"
701
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
702
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
701
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
702
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
703 703
 			/>
704 704
 
705 705
 		</p>
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @since 1.7
711 711
 		 */
712
-		do_action( 'give_donation_form_after_email', $form_id );
712
+		do_action('give_donation_form_after_email', $form_id);
713 713
 
714 714
 		/**
715 715
 		 * Fire after personal email field
716 716
 		 *
717 717
 		 * @since 1.7
718 718
 		 */
719
-		do_action( 'give_donation_form_user_info', $form_id );
719
+		do_action('give_donation_form_user_info', $form_id);
720 720
 		?>
721 721
 	</fieldset>
722 722
 	<?php
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @since 1.7
727 727
 	 */
728
-	do_action( 'give_donation_form_after_personal_info', $form_id );
728
+	do_action('give_donation_form_after_personal_info', $form_id);
729 729
 }
730 730
 
731
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
732
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
731
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
732
+add_action('give_register_fields_before', 'give_user_info_fields');
733 733
 
734 734
 /**
735 735
  * Renders the credit card info form.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return void
742 742
  */
743
-function give_get_cc_form( $form_id ) {
743
+function give_get_cc_form($form_id) {
744 744
 
745 745
 	ob_start();
746 746
 
@@ -751,53 +751,53 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @param int $form_id The form ID.
753 753
 	 */
754
-	do_action( 'give_before_cc_fields', $form_id );
754
+	do_action('give_before_cc_fields', $form_id);
755 755
 	?>
756 756
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
757
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
758
-		<?php if ( is_ssl() ) : ?>
757
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
758
+		<?php if (is_ssl()) : ?>
759 759
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
760 760
 				<span class="give-icon padlock"></span>
761
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
761
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
762 762
 			</div>
763 763
 		<?php endif; ?>
764 764
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
765 765
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
766
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
766
+				<?php esc_html_e('Card Number', 'give'); ?>
767 767
 				<span class="give-required-indicator">*</span>
768 768
 				<span class="give-tooltip give-icon give-icon-question"
769
-					  data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
769
+					  data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
770 770
 				<span class="card-type"></span>
771 771
 			</label>
772 772
 
773 773
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
774
-				   class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
774
+				   class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
775 775
 				   required aria-required="true"/>
776 776
 		</p>
777 777
 
778 778
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
779 779
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
780
-				<?php esc_html_e( 'CVC', 'give' ); ?>
780
+				<?php esc_html_e('CVC', 'give'); ?>
781 781
 				<span class="give-required-indicator">*</span>
782 782
 				<span class="give-tooltip give-icon give-icon-question"
783
-					  data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
783
+					  data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
784 784
 			</label>
785 785
 
786 786
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
787
-				   class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
787
+				   class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
788 788
 				   required aria-required="true"/>
789 789
 		</p>
790 790
 
791 791
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
792 792
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
793
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
793
+				<?php esc_html_e('Name on the Card', 'give'); ?>
794 794
 				<span class="give-required-indicator">*</span>
795 795
 				<span class="give-tooltip give-icon give-icon-question"
796
-					  data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
796
+					  data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
797 797
 			</label>
798 798
 
799 799
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
800
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
800
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
801 801
 				   required aria-required="true"/>
802 802
 		</p>
803 803
 		<?php
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
 		 *
809 809
 		 * @param int $form_id The form ID.
810 810
 		 */
811
-		do_action( 'give_before_cc_expiration' );
811
+		do_action('give_before_cc_expiration');
812 812
 		?>
813 813
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
814 814
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
815
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
815
+				<?php esc_html_e('Expiration', 'give'); ?>
816 816
 				<span class="give-required-indicator">*</span>
817 817
 				<span class="give-tooltip give-icon give-icon-question"
818
-					  data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
818
+					  data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
819 819
 			</label>
820 820
 
821 821
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 				   class="card-expiry-year"/>
825 825
 
826 826
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
827
-				   class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
827
+				   class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
828 828
 				   required aria-required="true"/>
829 829
 		</p>
830 830
 		<?php
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 		 *
836 836
 		 * @param int $form_id The form ID.
837 837
 		 */
838
-		do_action( 'give_after_cc_expiration', $form_id );
838
+		do_action('give_after_cc_expiration', $form_id);
839 839
 		?>
840 840
 	</fieldset>
841 841
 	<?php
@@ -846,12 +846,12 @@  discard block
 block discarded – undo
846 846
 	 *
847 847
 	 * @param int $form_id The form ID.
848 848
 	 */
849
-	do_action( 'give_after_cc_fields', $form_id );
849
+	do_action('give_after_cc_fields', $form_id);
850 850
 
851 851
 	echo ob_get_clean();
852 852
 }
853 853
 
854
-add_action( 'give_cc_form', 'give_get_cc_form' );
854
+add_action('give_cc_form', 'give_get_cc_form');
855 855
 
856 856
 /**
857 857
  * Outputs the default credit card address fields.
@@ -862,24 +862,24 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return void
864 864
  */
865
-function give_default_cc_address_fields( $form_id ) {
865
+function give_default_cc_address_fields($form_id) {
866 866
 	// Get user info.
867
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
867
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
868 868
 
869 869
 	$logged_in = is_user_logged_in();
870 870
 
871
-	if ( $logged_in ) {
872
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
871
+	if ($logged_in) {
872
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
873 873
 	}
874
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
875
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
876
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
877
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
874
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
875
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
876
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
877
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
878 878
 
879 879
 	ob_start();
880 880
 	?>
881 881
 	<fieldset id="give_cc_address" class="cc-address">
882
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
882
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
883 883
 		<?php
884 884
 		/**
885 885
 		 * Fires while rendering credit card billing form, before address fields.
@@ -888,36 +888,36 @@  discard block
 block discarded – undo
888 888
 		 *
889 889
 		 * @param int $form_id The form ID.
890 890
 		 */
891
-		do_action( 'give_cc_billing_top' );
891
+		do_action('give_cc_billing_top');
892 892
 
893 893
 		// For Country.
894 894
 		$selected_country = give_get_country();
895
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
895
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
896 896
 			$selected_country = $give_user_info['billing_country'];
897 897
 		}
898 898
 		$countries = give_get_country_list();
899 899
 
900 900
 		// For state
901 901
 		$selected_state = '';
902
-		if ( $selected_country === give_get_country() ) {
902
+		if ($selected_country === give_get_country()) {
903 903
 			// Get defalut selected state by admin.
904 904
 			$selected_state = give_get_state();
905 905
 		}
906 906
 		// Get the last payment made by user states.
907
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
907
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
908 908
 			$selected_state = $give_user_info['card_state'];
909 909
 		}
910 910
 		// Get the country code
911
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
911
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
912 912
 			$selected_country = $give_user_info['billing_country'];
913 913
 		}
914
-		$label        = __( 'State', 'give' );
914
+		$label        = __('State', 'give');
915 915
 		$states_label = give_get_states_label();
916 916
 		// Check if $country code exists in the array key for states label.
917
-		if ( array_key_exists( $selected_country, $states_label ) ) {
918
-			$label = $states_label[ $selected_country ];
917
+		if (array_key_exists($selected_country, $states_label)) {
918
+			$label = $states_label[$selected_country];
919 919
 		}
920
-		$states = give_get_states( $selected_country );
920
+		$states = give_get_states($selected_country);
921 921
 		// Get the country list that do not have any states init.
922 922
 		$no_states_country = give_no_states_country_list();
923 923
 		// Get the country list that does not require states.
@@ -926,23 +926,23 @@  discard block
 block discarded – undo
926 926
 		?>
927 927
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
928 928
 		    <label for="billing_country" class="give-label">
929
-			    <?php esc_html_e( 'Country', 'give' ); ?>
930
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
929
+			    <?php esc_html_e('Country', 'give'); ?>
930
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
931 931
 				    <span class="give-required-indicator">*</span>
932 932
 			    <?php endif; ?>
933 933
 			    <span class="give-tooltip give-icon give-icon-question"
934
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
934
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
935 935
 		    </label>
936 936
 
937 937
 		    <select
938 938
 				    name="billing_country"
939 939
 				    id="billing_country"
940
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
941
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
940
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
941
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
942 942
 		    >
943 943
 			    <?php
944
-			    foreach ( $countries as $country_code => $country ) {
945
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
944
+			    foreach ($countries as $country_code => $country) {
945
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
946 946
 			    }
947 947
 			    ?>
948 948
 		    </select>
@@ -950,89 +950,89 @@  discard block
 block discarded – undo
950 950
 
951 951
 	    <p id="give-card-address-wrap" class="form-row form-row-wide">
952 952
 		    <label for="card_address" class="give-label">
953
-			    <?php esc_html_e( 'Address 1', 'give' ); ?>
953
+			    <?php esc_html_e('Address 1', 'give'); ?>
954 954
 			    <?php
955
-			    if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
955
+			    if (give_field_is_required('card_address', $form_id)) : ?>
956 956
 				    <span class="give-required-indicator">*</span>
957 957
 			    <?php endif; ?>
958 958
 			    <span class="give-tooltip give-icon give-icon-question"
959
-			          data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
959
+			          data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
960 960
 		    </label>
961 961
 
962 962
 		    <input
963 963
 				    type="text"
964 964
 				    id="card_address"
965 965
 				    name="card_address"
966
-				    class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
967
-				    placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
968
-				    value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
969
-			    <?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
966
+				    class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
967
+				    placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
968
+				    value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
969
+			    <?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
970 970
 		    />
971 971
 	    </p>
972 972
 
973 973
 	    <p id="give-card-address-2-wrap" class="form-row form-row-wide">
974 974
 		    <label for="card_address_2" class="give-label">
975
-			    <?php esc_html_e( 'Address 2', 'give' ); ?>
976
-			    <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
975
+			    <?php esc_html_e('Address 2', 'give'); ?>
976
+			    <?php if (give_field_is_required('card_address_2', $form_id)) : ?>
977 977
 				    <span class="give-required-indicator">*</span>
978 978
 			    <?php endif; ?>
979 979
 			    <span class="give-tooltip give-icon give-icon-question"
980
-			          data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
980
+			          data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
981 981
 		    </label>
982 982
 
983 983
 		    <input
984 984
 				    type="text"
985 985
 				    id="card_address_2"
986 986
 				    name="card_address_2"
987
-				    class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
988
-				    placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
989
-				    value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
990
-			    <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
987
+				    class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
988
+				    placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
989
+				    value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
990
+			    <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
991 991
 		    />
992 992
 	    </p>
993 993
 
994 994
 	    <p id="give-card-city-wrap" class="form-row form-row-wide">
995 995
 		    <label for="card_city" class="give-label">
996
-			    <?php esc_html_e( 'City', 'give' ); ?>
997
-			    <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
996
+			    <?php esc_html_e('City', 'give'); ?>
997
+			    <?php if (give_field_is_required('card_city', $form_id)) : ?>
998 998
 				    <span class="give-required-indicator">*</span>
999 999
 			    <?php endif; ?>
1000 1000
 			    <span class="give-tooltip give-icon give-icon-question"
1001
-			          data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
1001
+			          data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
1002 1002
 		    </label>
1003 1003
 		    <input
1004 1004
 				    type="text"
1005 1005
 				    id="card_city"
1006 1006
 				    name="card_city"
1007
-				    class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1008
-				    placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
1009
-				    value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1010
-			    <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1007
+				    class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1008
+				    placeholder="<?php esc_attr_e('City', 'give'); ?>"
1009
+				    value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1010
+			    <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1011 1011
 		    />
1012 1012
 	    </p>
1013 1013
 
1014 1014
 	    <p id="give-card-state-wrap"
1015
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?>">
1015
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?>">
1016 1016
 		    <label for="card_state" class="give-label">
1017 1017
 			    <span class="state-label-text"><?php echo $label; ?></span>
1018
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1018
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1019 1019
 				    ?>
1020
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1020
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1021 1021
 			    <?php endif; ?>
1022 1022
 			    <span class="give-tooltip give-icon give-icon-question"
1023
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1023
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1024 1024
 		    </label>
1025 1025
 		    <?php
1026 1026
 
1027
-		    if ( ! empty( $states ) ) : ?>
1027
+		    if ( ! empty($states)) : ?>
1028 1028
 			    <select
1029 1029
 				    name="card_state"
1030 1030
 				    id="card_state"
1031
-				    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1032
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1031
+				    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1032
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1033 1033
 				    <?php
1034
-				    foreach ( $states as $state_code => $state ) {
1035
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1034
+				    foreach ($states as $state_code => $state) {
1035
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1036 1036
 				    }
1037 1037
 				    ?>
1038 1038
 			    </select>
@@ -1042,14 +1042,14 @@  discard block
 block discarded – undo
1042 1042
 		    <?php endif; ?>
1043 1043
 	    </p>
1044 1044
 
1045
-	    <p id="give-card-zip-wrap" class="form-row <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'form-row-wide' : 'form-row-last'; ?> form-row-responsive">
1045
+	    <p id="give-card-zip-wrap" class="form-row <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'form-row-wide' : 'form-row-last'; ?> form-row-responsive">
1046 1046
 		    <label for="card_zip" class="give-label">
1047
-			    <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
1048
-			    <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1047
+			    <?php esc_html_e('Zip / Postal Code', 'give'); ?>
1048
+			    <?php if (give_field_is_required('card_zip', $form_id)) : ?>
1049 1049
 				    <span class="give-required-indicator">*</span>
1050 1050
 			    <?php endif; ?>
1051 1051
 			    <span class="give-tooltip give-icon give-icon-question"
1052
-			          data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
1052
+			          data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
1053 1053
 		    </label>
1054 1054
 
1055 1055
 		    <input
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
 				    size="4"
1058 1058
 				    id="card_zip"
1059 1059
 				    name="card_zip"
1060
-				    class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1061
-				    placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
1062
-				    value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1063
-			    <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1060
+				    class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1061
+				    placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
1062
+				    value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1063
+			    <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1064 1064
 		    />
1065 1065
 	    </p>
1066 1066
 
@@ -1072,14 +1072,14 @@  discard block
 block discarded – undo
1072 1072
 		 *
1073 1073
 		 * @param int $form_id The form ID.
1074 1074
 		 */
1075
-		do_action( 'give_cc_billing_bottom' );
1075
+		do_action('give_cc_billing_bottom');
1076 1076
 		?>
1077 1077
 	</fieldset>
1078 1078
 	<?php
1079 1079
 	echo ob_get_clean();
1080 1080
 }
1081 1081
 
1082
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1082
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1083 1083
 
1084 1084
 
1085 1085
 /**
@@ -1092,24 +1092,24 @@  discard block
 block discarded – undo
1092 1092
  *
1093 1093
  * @return string
1094 1094
  */
1095
-function give_get_register_fields( $form_id ) {
1095
+function give_get_register_fields($form_id) {
1096 1096
 
1097 1097
 	global $user_ID;
1098 1098
 
1099
-	if ( is_user_logged_in() ) {
1100
-		$user_data = get_userdata( $user_ID );
1099
+	if (is_user_logged_in()) {
1100
+		$user_data = get_userdata($user_ID);
1101 1101
 	}
1102 1102
 
1103
-	$show_register_form = give_show_login_register_option( $form_id );
1103
+	$show_register_form = give_show_login_register_option($form_id);
1104 1104
 
1105 1105
 	ob_start(); ?>
1106 1106
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1107 1107
 
1108
-		<?php if ( $show_register_form == 'both' ) { ?>
1108
+		<?php if ($show_register_form == 'both') { ?>
1109 1109
 			<div class="give-login-account-wrap">
1110
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1111
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1112
-					   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1110
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1111
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1112
+					   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1113 1113
 				</p>
1114 1114
 				<p class="give-loading-text">
1115 1115
 					<span class="give-loading-animation"></span>
@@ -1125,15 +1125,15 @@  discard block
 block discarded – undo
1125 1125
 		 *
1126 1126
 		 * @param int $form_id The form ID.
1127 1127
 		 */
1128
-		do_action( 'give_register_fields_before', $form_id );
1128
+		do_action('give_register_fields_before', $form_id);
1129 1129
 		?>
1130 1130
 
1131 1131
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1132 1132
 			<legend>
1133 1133
 				<?php
1134
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1135
-				if ( ! give_logged_in_only( $form_id ) ) {
1136
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1134
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1135
+				if ( ! give_logged_in_only($form_id)) {
1136
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1137 1137
 				}
1138 1138
 				?>
1139 1139
 			</legend>
@@ -1145,54 +1145,54 @@  discard block
 block discarded – undo
1145 1145
 			 *
1146 1146
 			 * @param int $form_id The form ID.
1147 1147
 			 */
1148
-			do_action( 'give_register_account_fields_before', $form_id );
1148
+			do_action('give_register_account_fields_before', $form_id);
1149 1149
 			?>
1150 1150
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>"
1151 1151
 				 class="form-row form-row-one-third form-row-first form-row-responsive">
1152 1152
 				<label for="give-user-login-<?php echo $form_id; ?>">
1153
-					<?php esc_html_e( 'Username', 'give' ); ?>
1154
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1153
+					<?php esc_html_e('Username', 'give'); ?>
1154
+					<?php if (give_logged_in_only($form_id)) { ?>
1155 1155
 						<span class="give-required-indicator">*</span>
1156 1156
 					<?php } ?>
1157 1157
 					<span class="give-tooltip give-icon give-icon-question"
1158
-						  data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1158
+						  data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1159 1159
 				</label>
1160 1160
 
1161 1161
 				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1162 1162
 					   type="text"
1163
-					   placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1163
+					   placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1164 1164
 			</div>
1165 1165
 
1166 1166
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1167 1167
 				 class="form-row form-row-one-third form-row-responsive">
1168 1168
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1169
-					<?php esc_html_e( 'Password', 'give' ); ?>
1170
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1169
+					<?php esc_html_e('Password', 'give'); ?>
1170
+					<?php if (give_logged_in_only($form_id)) { ?>
1171 1171
 						<span class="give-required-indicator">*</span>
1172 1172
 					<?php } ?>
1173 1173
 					<span class="give-tooltip give-icon give-icon-question"
1174
-						  data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1174
+						  data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1175 1175
 				</label>
1176 1176
 
1177 1177
 				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1178
-					   placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1179
-					   type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1178
+					   placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1179
+					   type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1180 1180
 			</div>
1181 1181
 
1182 1182
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1183 1183
 				 class="give-register-password form-row form-row-one-third form-row-responsive">
1184 1184
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1185
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1186
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1185
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1186
+					<?php if (give_logged_in_only($form_id)) { ?>
1187 1187
 						<span class="give-required-indicator">*</span>
1188 1188
 					<?php } ?>
1189 1189
 					<span class="give-tooltip give-icon give-icon-question"
1190
-						  data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1190
+						  data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1191 1191
 				</label>
1192 1192
 
1193 1193
 				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1194
-					   class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1195
-					   type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1194
+					   class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1195
+					   type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1196 1196
 			</div>
1197 1197
 			<?php
1198 1198
 			/**
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 			 *
1203 1203
 			 * @param int $form_id The form ID.
1204 1204
 			 */
1205
-			do_action( 'give_register_account_fields_after', $form_id );
1205
+			do_action('give_register_account_fields_after', $form_id);
1206 1206
 			?>
1207 1207
 		</fieldset>
1208 1208
 
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 		 *
1215 1215
 		 * @param int $form_id The form ID.
1216 1216
 		 */
1217
-		do_action( 'give_register_fields_after', $form_id );
1217
+		do_action('give_register_fields_after', $form_id);
1218 1218
 		?>
1219 1219
 
1220 1220
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 		 *
1226 1226
 		 * @since 1.7
1227 1227
 		 */
1228
-		do_action( 'give_donation_form_user_info', $form_id );
1228
+		do_action('give_donation_form_user_info', $form_id);
1229 1229
 		?>
1230 1230
 
1231 1231
 	</fieldset>
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 	echo ob_get_clean();
1234 1234
 }
1235 1235
 
1236
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1236
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1237 1237
 
1238 1238
 /**
1239 1239
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1246,27 +1246,27 @@  discard block
 block discarded – undo
1246 1246
  *
1247 1247
  * @return string
1248 1248
  */
1249
-function give_get_login_fields( $form_id ) {
1249
+function give_get_login_fields($form_id) {
1250 1250
 
1251
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1252
-	$show_register_form = give_show_login_register_option( $form_id );
1251
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1252
+	$show_register_form = give_show_login_register_option($form_id);
1253 1253
 
1254 1254
 	ob_start();
1255 1255
 	?>
1256 1256
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1257
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1258
-			if ( ! give_logged_in_only( $form_id ) ) {
1259
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1257
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1258
+			if ( ! give_logged_in_only($form_id)) {
1259
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1260 1260
 			} ?>
1261 1261
 		</legend>
1262
-		<?php if ( $show_register_form == 'both' ) { ?>
1262
+		<?php if ($show_register_form == 'both') { ?>
1263 1263
 			<p class="give-new-account-link">
1264
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1265
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1264
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1265
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1266 1266
 				   data-action="give_checkout_register">
1267
-					<?php esc_html_e( 'Register', 'give' );
1268
-					if ( ! give_logged_in_only( $form_id ) ) {
1269
-						echo ' ' . esc_html__( 'and donate as a guest &raquo;', 'give' );
1267
+					<?php esc_html_e('Register', 'give');
1268
+					if ( ! give_logged_in_only($form_id)) {
1269
+						echo ' '.esc_html__('and donate as a guest &raquo;', 'give');
1270 1270
 					} ?>
1271 1271
 				</a>
1272 1272
 			</p>
@@ -1282,49 +1282,49 @@  discard block
 block discarded – undo
1282 1282
 		 *
1283 1283
 		 * @param int $form_id The form ID.
1284 1284
 		 */
1285
-		do_action( 'give_checkout_login_fields_before', $form_id );
1285
+		do_action('give_checkout_login_fields_before', $form_id);
1286 1286
 		?>
1287 1287
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1288 1288
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1289
-				<?php esc_html_e( 'Username', 'give' ); ?>
1290
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1289
+				<?php esc_html_e('Username', 'give'); ?>
1290
+				<?php if (give_logged_in_only($form_id)) { ?>
1291 1291
 					<span class="give-required-indicator">*</span>
1292 1292
 				<?php } ?>
1293 1293
 			</label>
1294 1294
 
1295
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1295
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1296 1296
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1297
-				   placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1297
+				   placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1298 1298
 		</div>
1299 1299
 
1300 1300
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1301 1301
 			 class="give_login_password form-row form-row-last form-row-responsive">
1302 1302
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1303
-				<?php esc_html_e( 'Password', 'give' ); ?>
1304
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1303
+				<?php esc_html_e('Password', 'give'); ?>
1304
+				<?php if (give_logged_in_only($form_id)) { ?>
1305 1305
 					<span class="give-required-indicator">*</span>
1306 1306
 				<?php } ?>
1307 1307
 			</label>
1308
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1308
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1309 1309
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1310
-				   placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1310
+				   placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1311 1311
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1312 1312
 		</div>
1313 1313
 
1314 1314
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1315 1315
 			 <span class="give-forgot-password ">
1316 1316
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1317
-					target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1317
+					target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1318 1318
 			 </span>
1319 1319
 		</div>
1320 1320
 
1321 1321
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1322 1322
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1323
-				   value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1324
-			<?php if ( $show_register_form !== 'login' ) { ?>
1323
+				   value="<?php esc_attr_e('Login', 'give'); ?>"/>
1324
+			<?php if ($show_register_form !== 'login') { ?>
1325 1325
 				<input type="button" data-action="give_cancel_login"
1326 1326
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1327
-					   value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1327
+					   value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1328 1328
 			<?php } ?>
1329 1329
 			<span class="give-loading-animation"></span>
1330 1330
 		</div>
@@ -1336,14 +1336,14 @@  discard block
 block discarded – undo
1336 1336
 		 *
1337 1337
 		 * @param int $form_id The form ID.
1338 1338
 		 */
1339
-		do_action( 'give_checkout_login_fields_after', $form_id );
1339
+		do_action('give_checkout_login_fields_after', $form_id);
1340 1340
 		?>
1341 1341
 	</fieldset><!--end #give-login-fields-->
1342 1342
 	<?php
1343 1343
 	echo ob_get_clean();
1344 1344
 }
1345 1345
 
1346
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1346
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1347 1347
 
1348 1348
 /**
1349 1349
  * Payment Mode Select.
@@ -1359,9 +1359,9 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @return void
1361 1361
  */
1362
-function give_payment_mode_select( $form_id ) {
1362
+function give_payment_mode_select($form_id) {
1363 1363
 
1364
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1364
+	$gateways = give_get_enabled_payment_gateways($form_id);
1365 1365
 
1366 1366
 	/**
1367 1367
 	 * Fires while selecting payment gateways, before the fields.
@@ -1370,10 +1370,10 @@  discard block
 block discarded – undo
1370 1370
 	 *
1371 1371
 	 * @param int $form_id The form ID.
1372 1372
 	 */
1373
-	do_action( 'give_payment_mode_top', $form_id );
1373
+	do_action('give_payment_mode_top', $form_id);
1374 1374
 	?>
1375 1375
 
1376
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1376
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1377 1377
 		echo 'style="display: none;"';
1378 1378
 	} ?>>
1379 1379
 		<?php
@@ -1384,10 +1384,10 @@  discard block
 block discarded – undo
1384 1384
 		 *
1385 1385
 		 * @param int $form_id The form ID.
1386 1386
 		 */
1387
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1387
+		do_action('give_payment_mode_before_gateways_wrap');
1388 1388
 		?>
1389 1389
 		<legend
1390
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1390
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1391 1391
 			<span class="give-loading-text"><span
1392 1392
 						class="give-loading-animation"></span>
1393 1393
             </span>
@@ -1400,26 +1400,26 @@  discard block
 block discarded – undo
1400 1400
 			 *
1401 1401
 			 * @since 1.7
1402 1402
 			 */
1403
-			do_action( 'give_payment_mode_before_gateways' )
1403
+			do_action('give_payment_mode_before_gateways')
1404 1404
 			?>
1405 1405
 			<ul id="give-gateway-radio-list">
1406 1406
 				<?php
1407 1407
 				/**
1408 1408
 				 * Loop through the active payment gateways.
1409 1409
 				 */
1410
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1410
+				$selected_gateway = give_get_chosen_gateway($form_id);
1411 1411
 
1412
-				foreach ( $gateways as $gateway_id => $gateway ) :
1412
+				foreach ($gateways as $gateway_id => $gateway) :
1413 1413
 					//Determine the default gateway.
1414
-					$checked = checked( $gateway_id, $selected_gateway, false );
1414
+					$checked = checked($gateway_id, $selected_gateway, false);
1415 1415
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1416 1416
 					<li<?php echo $checked_class ?>>
1417 1417
 						<input type="radio" name="payment-mode" class="give-gateway"
1418
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1419
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1420
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1418
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1419
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1420
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1421 1421
 							   class="give-gateway-option"
1422
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1422
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1423 1423
 					</li>
1424 1424
 					<?php
1425 1425
 				endforeach;
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 			 *
1432 1432
 			 * @since 1.7
1433 1433
 			 */
1434
-			do_action( 'give_payment_mode_after_gateways' );
1434
+			do_action('give_payment_mode_after_gateways');
1435 1435
 			?>
1436 1436
 		</div>
1437 1437
 		<?php
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 		 *
1443 1443
 		 * @param int $form_id The form ID.
1444 1444
 		 */
1445
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1445
+		do_action('give_payment_mode_after_gateways_wrap');
1446 1446
 		?>
1447 1447
 	</fieldset>
1448 1448
 
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 	 *
1455 1455
 	 * @param int $form_id The form ID.
1456 1456
 	 */
1457
-	do_action( 'give_payment_mode_bottom', $form_id );
1457
+	do_action('give_payment_mode_bottom', $form_id);
1458 1458
 	?>
1459 1459
 
1460 1460
 	<div id="give_purchase_form_wrap">
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 		 *
1466 1466
 		 * @since 1.7
1467 1467
 		 */
1468
-		do_action( 'give_donation_form', $form_id );
1468
+		do_action('give_donation_form', $form_id);
1469 1469
 		?>
1470 1470
 
1471 1471
 	</div>
@@ -1476,10 +1476,10 @@  discard block
 block discarded – undo
1476 1476
 	 *
1477 1477
 	 * @since 1.7
1478 1478
 	 */
1479
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1479
+	do_action('give_donation_form_wrap_bottom', $form_id);
1480 1480
 }
1481 1481
 
1482
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1482
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1483 1483
 
1484 1484
 /**
1485 1485
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1492,31 +1492,31 @@  discard block
 block discarded – undo
1492 1492
  *
1493 1493
  * @return bool
1494 1494
  */
1495
-function give_terms_agreement( $form_id ) {
1496
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1495
+function give_terms_agreement($form_id) {
1496
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1497 1497
 
1498 1498
 	// Bailout if per form and global term and conditions is not setup.
1499 1499
 	if (
1500
-		give_is_setting_enabled( $form_option, 'global' )
1501
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1500
+		give_is_setting_enabled($form_option, 'global')
1501
+		&& give_is_setting_enabled(give_get_option('terms'))
1502 1502
 	) {
1503
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1504
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1505
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1503
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1504
+		$terms         = $terms = give_get_option('agreement_text', '');
1505
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1506 1506
 
1507
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1508
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1509
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1510
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1507
+	} elseif (give_is_setting_enabled($form_option)) {
1508
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1509
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1510
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1511 1511
 
1512 1512
 	} else {
1513 1513
 		return false;
1514 1514
 	}
1515 1515
 
1516 1516
 	// Bailout: Check if term and conditions text is empty or not.
1517
-	if ( empty( $terms ) ) {
1518
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1519
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1517
+	if (empty($terms)) {
1518
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1519
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1520 1520
 		}
1521 1521
 
1522 1522
 		return false;
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 
1525 1525
 	?>
1526 1526
 	<fieldset id="give_terms_agreement">
1527
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1527
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1528 1528
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1529 1529
 			<?php
1530 1530
 			/**
@@ -1532,22 +1532,22 @@  discard block
 block discarded – undo
1532 1532
 			 *
1533 1533
 			 * @since 1.0
1534 1534
 			 */
1535
-			do_action( 'give_before_terms' );
1535
+			do_action('give_before_terms');
1536 1536
 
1537
-			echo wpautop( stripslashes( $terms ) );
1537
+			echo wpautop(stripslashes($terms));
1538 1538
 			/**
1539 1539
 			 * Fires while rendering terms of agreement, after the fields.
1540 1540
 			 *
1541 1541
 			 * @since 1.0
1542 1542
 			 */
1543
-			do_action( 'give_after_terms' );
1543
+			do_action('give_after_terms');
1544 1544
 			?>
1545 1545
 		</div>
1546 1546
 		<div id="give_show_terms">
1547 1547
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1548
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1548
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1549 1549
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1550
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1550
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1551 1551
 		</div>
1552 1552
 
1553 1553
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	<?php
1559 1559
 }
1560 1560
 
1561
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1561
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1562 1562
 
1563 1563
 /**
1564 1564
  * Checkout Final Total.
@@ -1571,31 +1571,30 @@  discard block
 block discarded – undo
1571 1571
  *
1572 1572
  * @return void
1573 1573
  */
1574
-function give_checkout_final_total( $form_id ) {
1574
+function give_checkout_final_total($form_id) {
1575 1575
 
1576
-	$total = isset( $_POST['give_total'] ) ?
1577
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1578
-		give_get_default_form_amount( $form_id );
1576
+	$total = isset($_POST['give_total']) ?
1577
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1579 1578
 
1580 1579
 
1581 1580
 	//Only proceed if give_total available.
1582
-	if ( empty( $total ) ) {
1581
+	if (empty($total)) {
1583 1582
 		return;
1584 1583
 	}
1585 1584
 	?>
1586 1585
 	<p id="give-final-total-wrap" class="form-wrap ">
1587 1586
 		<span class="give-donation-total-label">
1588
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1587
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1589 1588
 		</span>
1590 1589
 		<span class="give-final-total-amount"
1591
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1592
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), give_get_currency( $form_id ) ); ?>
1590
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1591
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), give_get_currency($form_id)); ?>
1593 1592
 		</span>
1594 1593
 	</p>
1595 1594
 	<?php
1596 1595
 }
1597 1596
 
1598
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1597
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1599 1598
 
1600 1599
 /**
1601 1600
  * Renders the Checkout Submit section.
@@ -1606,7 +1605,7 @@  discard block
 block discarded – undo
1606 1605
  *
1607 1606
  * @return void
1608 1607
  */
1609
-function give_checkout_submit( $form_id ) {
1608
+function give_checkout_submit($form_id) {
1610 1609
 	?>
1611 1610
 	<fieldset id="give_purchase_submit">
1612 1611
 		<?php
@@ -1615,24 +1614,24 @@  discard block
 block discarded – undo
1615 1614
 		 *
1616 1615
 		 * @since 1.7
1617 1616
 		 */
1618
-		do_action( 'give_donation_form_before_submit', $form_id );
1617
+		do_action('give_donation_form_before_submit', $form_id);
1619 1618
 
1620
-		give_checkout_hidden_fields( $form_id );
1619
+		give_checkout_hidden_fields($form_id);
1621 1620
 
1622
-		echo give_get_donation_form_submit_button( $form_id );
1621
+		echo give_get_donation_form_submit_button($form_id);
1623 1622
 
1624 1623
 		/**
1625 1624
 		 * Fire after donation form submit.
1626 1625
 		 *
1627 1626
 		 * @since 1.7
1628 1627
 		 */
1629
-		do_action( 'give_donation_form_after_submit', $form_id );
1628
+		do_action('give_donation_form_after_submit', $form_id);
1630 1629
 		?>
1631 1630
 	</fieldset>
1632 1631
 	<?php
1633 1632
 }
1634 1633
 
1635
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1634
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1636 1635
 
1637 1636
 /**
1638 1637
  * Give Donation form submit button.
@@ -1643,10 +1642,10 @@  discard block
 block discarded – undo
1643 1642
  *
1644 1643
  * @return string
1645 1644
  */
1646
-function give_get_donation_form_submit_button( $form_id ) {
1645
+function give_get_donation_form_submit_button($form_id) {
1647 1646
 
1648
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1649
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1647
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1648
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1650 1649
 	ob_start();
1651 1650
 	?>
1652 1651
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1655,7 +1654,7 @@  discard block
 block discarded – undo
1655 1654
 		<span class="give-loading-animation"></span>
1656 1655
 	</div>
1657 1656
 	<?php
1658
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1657
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1659 1658
 }
1660 1659
 
1661 1660
 /**
@@ -1670,17 +1669,17 @@  discard block
 block discarded – undo
1670 1669
  *
1671 1670
  * @return mixed
1672 1671
  */
1673
-function give_show_goal_progress( $form_id, $args ) {
1672
+function give_show_goal_progress($form_id, $args) {
1674 1673
 
1675 1674
 	ob_start();
1676
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1675
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1677 1676
 
1678
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1677
+	echo apply_filters('give_goal_output', ob_get_clean());
1679 1678
 
1680 1679
 	return true;
1681 1680
 }
1682 1681
 
1683
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1682
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1684 1683
 
1685 1684
 
1686 1685
 /**
@@ -1693,10 +1692,10 @@  discard block
 block discarded – undo
1693 1692
  *
1694 1693
  * @return mixed|string
1695 1694
  */
1696
-function give_get_form_content_placement( $form_id, $args ) {
1695
+function give_get_form_content_placement($form_id, $args) {
1697 1696
 	$show_content = '';
1698 1697
 
1699
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1698
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1700 1699
 		// Content positions.
1701 1700
 		$content_placement = array(
1702 1701
 			'above' => 'give_pre_form',
@@ -1704,18 +1703,18 @@  discard block
 block discarded – undo
1704 1703
 		);
1705 1704
 
1706 1705
 		// Check if content position already decoded.
1707
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1706
+		if (in_array($args['show_content'], $content_placement)) {
1708 1707
 			return $args['show_content'];
1709 1708
 		}
1710 1709
 
1711
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1710
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1712 1711
 
1713
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1714
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1712
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1713
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1715 1714
 
1716
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1715
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1717 1716
 		// Backward compatibility for _give_content_option for v18.
1718
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1717
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1719 1718
 	}
1720 1719
 
1721 1720
 	return $show_content;
@@ -1731,20 +1730,20 @@  discard block
 block discarded – undo
1731 1730
  *
1732 1731
  * @return void|bool
1733 1732
  */
1734
-function give_form_content( $form_id, $args ) {
1733
+function give_form_content($form_id, $args) {
1735 1734
 
1736
-	$show_content = give_get_form_content_placement( $form_id, $args );
1735
+	$show_content = give_get_form_content_placement($form_id, $args);
1737 1736
 
1738 1737
 	// Bailout.
1739
-	if ( empty( $show_content ) ) {
1738
+	if (empty($show_content)) {
1740 1739
 		return false;
1741 1740
 	}
1742 1741
 
1743 1742
 	// Add action according to value.
1744
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1743
+	add_action($show_content, 'give_form_display_content', 10, 2);
1745 1744
 }
1746 1745
 
1747
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1746
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1748 1747
 
1749 1748
 /**
1750 1749
  * Renders Post Form Content.
@@ -1758,22 +1757,22 @@  discard block
 block discarded – undo
1758 1757
  *
1759 1758
  * @return void
1760 1759
  */
1761
-function give_form_display_content( $form_id, $args ) {
1760
+function give_form_display_content($form_id, $args) {
1762 1761
 
1763
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1764
-	$show_content = give_get_form_content_placement( $form_id, $args );
1762
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1763
+	$show_content = give_get_form_content_placement($form_id, $args);
1765 1764
 
1766
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1767
-		$content = apply_filters( 'the_content', $content );
1765
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1766
+		$content = apply_filters('the_content', $content);
1768 1767
 	}
1769 1768
 
1770
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1769
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1771 1770
 
1772
-	echo apply_filters( 'give_form_content_output', $output );
1771
+	echo apply_filters('give_form_content_output', $output);
1773 1772
 
1774 1773
 	//remove action to prevent content output on addition forms on page.
1775 1774
 	//@see: https://github.com/WordImpress/Give/issues/634.
1776
-	remove_action( $show_content, 'give_form_display_content' );
1775
+	remove_action($show_content, 'give_form_display_content');
1777 1776
 }
1778 1777
 
1779 1778
 /**
@@ -1785,7 +1784,7 @@  discard block
 block discarded – undo
1785 1784
  *
1786 1785
  * @return void
1787 1786
  */
1788
-function give_checkout_hidden_fields( $form_id ) {
1787
+function give_checkout_hidden_fields($form_id) {
1789 1788
 
1790 1789
 	/**
1791 1790
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1794,13 +1793,13 @@  discard block
 block discarded – undo
1794 1793
 	 *
1795 1794
 	 * @param int $form_id The form ID.
1796 1795
 	 */
1797
-	do_action( 'give_hidden_fields_before', $form_id );
1796
+	do_action('give_hidden_fields_before', $form_id);
1798 1797
 
1799
-	if ( is_user_logged_in() ) { ?>
1798
+	if (is_user_logged_in()) { ?>
1800 1799
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1801 1800
 	<?php } ?>
1802 1801
 	<input type="hidden" name="give_action" value="purchase"/>
1803
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1802
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1804 1803
 	<?php
1805 1804
 	/**
1806 1805
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1809,7 +1808,7 @@  discard block
 block discarded – undo
1809 1808
 	 *
1810 1809
 	 * @param int $form_id The form ID.
1811 1810
 	 */
1812
-	do_action( 'give_hidden_fields_after', $form_id );
1811
+	do_action('give_hidden_fields_after', $form_id);
1813 1812
 
1814 1813
 }
1815 1814
 
@@ -1824,20 +1823,20 @@  discard block
 block discarded – undo
1824 1823
  *
1825 1824
  * @return string $content Filtered content.
1826 1825
  */
1827
-function give_filter_success_page_content( $content ) {
1826
+function give_filter_success_page_content($content) {
1828 1827
 
1829 1828
 	$give_options = give_get_settings();
1830 1829
 
1831
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1832
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1833
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1830
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1831
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1832
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1834 1833
 		}
1835 1834
 	}
1836 1835
 
1837 1836
 	return $content;
1838 1837
 }
1839 1838
 
1840
-add_filter( 'the_content', 'give_filter_success_page_content' );
1839
+add_filter('the_content', 'give_filter_success_page_content');
1841 1840
 
1842 1841
 /**
1843 1842
  * Test Mode Frontend Warning.
@@ -1848,12 +1847,12 @@  discard block
 block discarded – undo
1848 1847
  */
1849 1848
 function give_test_mode_frontend_warning() {
1850 1849
 
1851
-	if ( give_is_test_mode() ) {
1852
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1850
+	if (give_is_test_mode()) {
1851
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1853 1852
 	}
1854 1853
 }
1855 1854
 
1856
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1855
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1857 1856
 
1858 1857
 /**
1859 1858
  * Members-only Form.
@@ -1867,21 +1866,21 @@  discard block
 block discarded – undo
1867 1866
  *
1868 1867
  * @return string
1869 1868
  */
1870
-function give_members_only_form( $final_output, $args ) {
1869
+function give_members_only_form($final_output, $args) {
1871 1870
 
1872
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1871
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1873 1872
 
1874 1873
 	//Sanity Check: Must have form_id & not be logged in.
1875
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1874
+	if (empty($form_id) || is_user_logged_in()) {
1876 1875
 		return $final_output;
1877 1876
 	}
1878 1877
 
1879 1878
 	//Logged in only and Register / Login set to none.
1880
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1879
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1881 1880
 
1882
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1881
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1883 1882
 
1884
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1883
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1885 1884
 
1886 1885
 	}
1887 1886
 
@@ -1889,7 +1888,7 @@  discard block
 block discarded – undo
1889 1888
 
1890 1889
 }
1891 1890
 
1892
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1891
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1893 1892
 
1894 1893
 
1895 1894
 /**
@@ -1901,25 +1900,25 @@  discard block
 block discarded – undo
1901 1900
  * @param array            $args
1902 1901
  * @param Give_Donate_Form $form
1903 1902
  */
1904
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1903
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1905 1904
 	?>
1906 1905
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1907
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1906
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1908 1907
 	<input type="hidden" name="give-current-url"
1909
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1910
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1908
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1909
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1911 1910
 	<input type="hidden" name="give-form-minimum"
1912
-		   value="<?php echo give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ); ?>"/>
1911
+		   value="<?php echo give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)); ?>"/>
1913 1912
 	<?php
1914 1913
 
1915 1914
 	// Price ID hidden field for variable (multi-level) donation forms.
1916
-	if ( give_has_variable_prices( $form_id ) ) {
1915
+	if (give_has_variable_prices($form_id)) {
1917 1916
 		// Get default selected price ID.
1918
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1917
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1919 1918
 		$price_id = 0;
1920 1919
 		//loop through prices.
1921
-		foreach ( $prices as $price ) {
1922
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1920
+		foreach ($prices as $price) {
1921
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1923 1922
 				$price_id = $price['_give_id']['level_id'];
1924 1923
 			};
1925 1924
 		}
@@ -1932,7 +1931,7 @@  discard block
 block discarded – undo
1932 1931
 	}
1933 1932
 }
1934 1933
 
1935
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1934
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1936 1935
 
1937 1936
 /**
1938 1937
  * Add currency settings on donation form.
@@ -1944,20 +1943,20 @@  discard block
 block discarded – undo
1944 1943
  *
1945 1944
  * @return array
1946 1945
  */
1947
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
1948
-	$form_currency     = give_get_currency( $form->ID );
1949
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1946
+function __give_form_add_currency_settings($form_html_tags, $form) {
1947
+	$form_currency     = give_get_currency($form->ID);
1948
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
1950 1949
 
1951 1950
 	// Check if currency exist.
1952
-	if ( empty( $currency_settings ) ) {
1951
+	if (empty($currency_settings)) {
1953 1952
 		return $form_html_tags;
1954 1953
 	}
1955 1954
 
1956
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
1955
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
1957 1956
 	$form_html_tags['data-currency_code']   = $form_currency;
1958 1957
 
1959
-	if ( ! empty( $currency_settings ) ) {
1960
-		foreach ( $currency_settings as $key => $value ) {
1958
+	if ( ! empty($currency_settings)) {
1959
+		foreach ($currency_settings as $key => $value) {
1961 1960
 			$form_html_tags["data-{$key}"] = $value;
1962 1961
 		}
1963 1962
 	}
@@ -1965,4 +1964,4 @@  discard block
 block discarded – undo
1965 1964
 	return $form_html_tags;
1966 1965
 }
1967 1966
 
1968
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
1967
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param $url
74 74
 	 *
75
-	 * @return mixed
75
+	 * @return string
76 76
 	 */
77 77
 	public function give_update_cmb_meta_box_url( $url ) {
78 78
 		// Path to Give's CMB
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
  * @since      1.3.5
936 936
  *
937 937
  * @param $array
938
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
938
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
939 939
  * @param $insert   |array a valid array of options to insert
940 940
  *
941 941
  * @return array
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @since 1.0
975 975
  *
976 976
  * @param array $field_arr
977
- * @param array $saved_values
977
+ * @param string|boolean $saved_values
978 978
  *
979 979
  * @return void
980 980
  */
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  * @since  1.0
1010 1010
  *
1011 1011
  * @param  array $field_arr
1012
- * @param  array $saved_value
1012
+ * @param  string|boolean $saved_value
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
  * @params $string text
1164 1164
  * @params $filter array
1165 1165
  *
1166
- * @return text $string
1166
+ * @return string $string
1167 1167
  */
1168 1168
 function give_slug_to_title( $string, $filters = array() ) {
1169 1169
 
Please login to merge, or discard this patch.
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 	public function __construct() {
44 44
 
45 45
 		// Custom CMB2 Settings Fields
46
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
47
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
48
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
49
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
50
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
51
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
52
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
53
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
46
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
47
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
48
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
49
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
50
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
51
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
52
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
53
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
54 54
 	}
55 55
 
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @since  1.0
61 61
 	 */
62 62
 	public function init() {
63
-		register_setting( $this->key, $this->key );
63
+		register_setting($this->key, $this->key);
64 64
 
65 65
 	}
66 66
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed
76 76
 	 */
77
-	public function give_update_cmb_meta_box_url( $url ) {
77
+	public function give_update_cmb_meta_box_url($url) {
78 78
 		// Path to Give's CMB
79
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
79
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
80 80
 	}
81 81
 
82 82
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function give_get_settings_tabs() {
90 90
 
91
-		$settings = $this->give_settings( null );
91
+		$settings = $this->give_settings(null);
92 92
 
93 93
 		$tabs             = array();
94
-		$tabs['general']  = __( 'General', 'give' );
95
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
96
-		$tabs['display']  = __( 'Display Options', 'give' );
97
-		$tabs['emails']   = __( 'Emails', 'give' );
94
+		$tabs['general']  = __('General', 'give');
95
+		$tabs['gateways'] = __('Payment Gateways', 'give');
96
+		$tabs['display']  = __('Display Options', 'give');
97
+		$tabs['emails']   = __('Emails', 'give');
98 98
 
99
-		if ( ! empty( $settings['addons']['fields'] ) ) {
100
-			$tabs['addons'] = __( 'Add-ons', 'give' );
99
+		if ( ! empty($settings['addons']['fields'])) {
100
+			$tabs['addons'] = __('Add-ons', 'give');
101 101
 		}
102 102
 
103
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
104
-			$tabs['licenses'] = __( 'Licenses', 'give' );
103
+		if ( ! empty($settings['licenses']['fields'])) {
104
+			$tabs['licenses'] = __('Licenses', 'give');
105 105
 		}
106 106
 
107
-		$tabs['advanced']    = __( 'Advanced', 'give' );
108
-		$tabs['api']         = __( 'API', 'give' );
109
-		$tabs['system_info'] = __( 'System Info', 'give' );
107
+		$tabs['advanced']    = __('Advanced', 'give');
108
+		$tabs['api']         = __('API', 'give');
109
+		$tabs['system_info'] = __('System Info', 'give');
110 110
 
111
-		return apply_filters( 'give_settings_tabs', $tabs );
111
+		return apply_filters('give_settings_tabs', $tabs);
112 112
 	}
113 113
 
114 114
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function admin_page_display() {
121 121
 
122
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
122
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
123 123
 
124 124
 		?>
125 125
 
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 
130 130
 			<h2 class="nav-tab-wrapper">
131 131
 				<?php
132
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
132
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
133 133
 
134
-					$tab_url = esc_url( add_query_arg( array(
134
+					$tab_url = esc_url(add_query_arg(array(
135 135
 						'settings-updated' => false,
136 136
 						'tab'              => $tab_id,
137
-					) ) );
137
+					)));
138 138
 
139 139
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
140 140
 
141
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
141
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
142 142
 
143 143
 				}
144 144
 				?>
145 145
 			</h2>
146 146
 
147
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
147
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
148 148
 
149 149
 		</div><!-- .wrap -->
150 150
 
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return string
168 168
 	 */
169
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
169
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
170 170
 
171 171
 		// only modify the give settings form
172
-		if ( 'give_settings' == $object_id ) {
172
+		if ('give_settings' == $object_id) {
173 173
 
174
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
174
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
175 175
 
176 176
 		}
177 177
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return array
190 190
 	 */
191
-	public function give_settings( $active_tab ) {
191
+	public function give_settings($active_tab) {
192 192
 
193 193
 		$give_settings = array(
194 194
 			/**
@@ -196,99 +196,99 @@  discard block
 block discarded – undo
196 196
 			 */
197 197
 			'general'     => array(
198 198
 				'id'         => 'general_settings',
199
-				'give_title' => __( 'General Settings', 'give' ),
200
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
201
-				'fields'     => apply_filters( 'give_settings_general', array(
199
+				'give_title' => __('General Settings', 'give'),
200
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
201
+				'fields'     => apply_filters('give_settings_general', array(
202 202
 						array(
203
-							'name' => __( 'General Settings', 'give' ),
203
+							'name' => __('General Settings', 'give'),
204 204
 							'desc' => '',
205 205
 							'type' => 'give_title',
206 206
 							'id'   => 'give_title_general_settings_1',
207 207
 						),
208 208
 						array(
209
-							'name'    => __( 'Success Page', 'give' ),
209
+							'name'    => __('Success Page', 'give'),
210 210
 							/* translators: %s: [give_receipt] */
211
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
211
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
212 212
 							'id'      => 'success_page',
213 213
 							'type'    => 'select',
214
-							'options' => give_cmb2_get_post_options( array(
214
+							'options' => give_cmb2_get_post_options(array(
215 215
 								'post_type'   => 'page',
216 216
 								'numberposts' => 999,
217
-							) ),
217
+							)),
218 218
 						),
219 219
 						array(
220
-							'name'    => __( 'Failed Donation Page', 'give' ),
221
-							'desc'    => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
220
+							'name'    => __('Failed Donation Page', 'give'),
221
+							'desc'    => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
222 222
 							'id'      => 'failure_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226 226
 								'numberposts' => 999,
227
-							) ),
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => __( 'Donation History Page', 'give' ),
230
+							'name'    => __('Donation History Page', 'give'),
231 231
 							/* translators: %s: [donation_history] */
232
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
232
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
233 233
 							'id'      => 'history_page',
234 234
 							'type'    => 'select',
235
-							'options' => give_cmb2_get_post_options( array(
235
+							'options' => give_cmb2_get_post_options(array(
236 236
 								'post_type'   => 'page',
237 237
 								'numberposts' => 999,
238
-							) ),
238
+							)),
239 239
 						),
240 240
 						array(
241
-							'name'    => __( 'Base Country', 'give' ),
242
-							'desc'    => __( 'The country your site operates from.', 'give' ),
241
+							'name'    => __('Base Country', 'give'),
242
+							'desc'    => __('The country your site operates from.', 'give'),
243 243
 							'id'      => 'base_country',
244 244
 							'type'    => 'select',
245 245
 							'options' => give_get_country_list(),
246 246
 						),
247 247
 						array(
248
-							'name' => __( 'Currency Settings', 'give' ),
248
+							'name' => __('Currency Settings', 'give'),
249 249
 							'desc' => '',
250 250
 							'type' => 'give_title',
251 251
 							'id'   => 'give_title_general_settings_2',
252 252
 						),
253 253
 						array(
254
-							'name'    => __( 'Currency', 'give' ),
255
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
254
+							'name'    => __('Currency', 'give'),
255
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
256 256
 							'id'      => 'currency',
257 257
 							'type'    => 'select',
258 258
 							'options' => give_get_currencies(),
259 259
 							'default' => 'USD',
260 260
 						),
261 261
 						array(
262
-							'name'    => __( 'Currency Position', 'give' ),
263
-							'desc'    => __( 'The position of the currency symbol.', 'give' ),
262
+							'name'    => __('Currency Position', 'give'),
263
+							'desc'    => __('The position of the currency symbol.', 'give'),
264 264
 							'id'      => 'currency_position',
265 265
 							'type'    => 'select',
266 266
 							'options' => array(
267 267
 								/* translators: %s: currency symbol */
268
-								'before' => sprintf( __( 'Before - %s&#x200e;10', 'give' ), give_currency_symbol( give_get_currency() ) ),
268
+								'before' => sprintf(__('Before - %s&#x200e;10', 'give'), give_currency_symbol(give_get_currency())),
269 269
 								/* translators: %s: currency symbol */
270
-								'after'  => sprintf( __( 'After - 10%s&#x200f;', 'give' ), give_currency_symbol( give_get_currency() ) ),
270
+								'after'  => sprintf(__('After - 10%s&#x200f;', 'give'), give_currency_symbol(give_get_currency())),
271 271
 							),
272 272
 							'default' => 'before',
273 273
 						),
274 274
 						array(
275
-							'name'            => __( 'Thousands Separator', 'give' ),
276
-							'desc'            => __( 'The symbol (usually , or .) to separate thousands.', 'give' ),
275
+							'name'            => __('Thousands Separator', 'give'),
276
+							'desc'            => __('The symbol (usually , or .) to separate thousands.', 'give'),
277 277
 							'id'              => 'thousands_separator',
278 278
 							'type'            => 'text_small',
279 279
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
280 280
 							'default'         => ',',
281 281
 						),
282 282
 						array(
283
-							'name'    => __( 'Decimal Separator', 'give' ),
284
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
283
+							'name'    => __('Decimal Separator', 'give'),
284
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
285 285
 							'id'      => 'decimal_separator',
286 286
 							'type'    => 'text_small',
287 287
 							'default' => '.',
288 288
 						),
289 289
 						array(
290
-							'name'            => __( 'Number of Decimals', 'give' ),
291
-							'desc'            => __( 'The number of decimal points displayed in amounts.', 'give' ),
290
+							'name'            => __('Number of Decimals', 'give'),
291
+							'desc'            => __('The number of decimal points displayed in amounts.', 'give'),
292 292
 							'id'              => 'number_decimals',
293 293
 							'type'            => 'text_small',
294 294
 							'default'         => 2,
@@ -302,83 +302,83 @@  discard block
 block discarded – undo
302 302
 			 */
303 303
 			'gateways'    => array(
304 304
 				'id'         => 'payment_gateways',
305
-				'give_title' => __( 'Payment Gateways', 'give' ),
306
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
307
-				'fields'     => apply_filters( 'give_settings_gateways', array(
305
+				'give_title' => __('Payment Gateways', 'give'),
306
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
307
+				'fields'     => apply_filters('give_settings_gateways', array(
308 308
 						array(
309
-							'name' => __( 'Gateways Settings', 'give' ),
309
+							'name' => __('Gateways Settings', 'give'),
310 310
 							'desc' => '',
311 311
 							'id'   => 'give_title_gateway_settings_1',
312 312
 							'type' => 'give_title',
313 313
 						),
314 314
 						array(
315
-							'name' => __( 'Test Mode', 'give' ),
316
-							'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
315
+							'name' => __('Test Mode', 'give'),
316
+							'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
317 317
 							'id'   => 'test_mode',
318 318
 							'type' => 'checkbox',
319 319
 						),
320 320
 						array(
321
-							'name' => __( 'Enabled Gateways', 'give' ),
322
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
321
+							'name' => __('Enabled Gateways', 'give'),
322
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
323 323
 							'id'   => 'gateways',
324 324
 							'type' => 'enabled_gateways',
325 325
 						),
326 326
 						array(
327
-							'name' => __( 'Default Gateway', 'give' ),
328
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
327
+							'name' => __('Default Gateway', 'give'),
328
+							'desc' => __('The gateway that will be selected by default.', 'give'),
329 329
 							'id'   => 'default_gateway',
330 330
 							'type' => 'default_gateway',
331 331
 						),
332 332
 						array(
333
-							'name' => __( 'PayPal Standard', 'give' ),
333
+							'name' => __('PayPal Standard', 'give'),
334 334
 							'desc' => '',
335 335
 							'type' => 'give_title',
336 336
 							'id'   => 'give_title_gateway_settings_2',
337 337
 						),
338 338
 						array(
339
-							'name' => __( 'PayPal Email', 'give' ),
340
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
339
+							'name' => __('PayPal Email', 'give'),
340
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
341 341
 							'id'   => 'paypal_email',
342 342
 							'type' => 'text_email',
343 343
 						),
344 344
 						array(
345
-							'name' => __( 'PayPal Page Style', 'give' ),
346
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
345
+							'name' => __('PayPal Page Style', 'give'),
346
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
347 347
 							'id'   => 'paypal_page_style',
348 348
 							'type' => 'text',
349 349
 						),
350 350
 						array(
351
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
352
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
351
+							'name'    => __('PayPal Transaction Type', 'give'),
352
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
353 353
 							'id'      => 'paypal_button_type',
354 354
 							'type'    => 'radio_inline',
355 355
 							'options' => array(
356
-								'donation' => __( 'Donation', 'give' ),
357
-								'standard' => __( 'Standard Transaction', 'give' ),
356
+								'donation' => __('Donation', 'give'),
357
+								'standard' => __('Standard Transaction', 'give'),
358 358
 							),
359 359
 							'default' => 'donation',
360 360
 						),
361 361
 						array(
362
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
363
-							'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
362
+							'name' => __('Disable PayPal IPN Verification', 'give'),
363
+							'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
364 364
 							'id'   => 'disable_paypal_verification',
365 365
 							'type' => 'checkbox',
366 366
 						),
367 367
 						array(
368
-							'name' => __( 'Offline Donations', 'give' ),
368
+							'name' => __('Offline Donations', 'give'),
369 369
 							'desc' => '',
370 370
 							'type' => 'give_title',
371 371
 							'id'   => 'give_title_gateway_settings_3',
372 372
 						),
373 373
 						array(
374
-							'name' => __( 'Collect Billing Details', 'give' ),
375
-							'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
374
+							'name' => __('Collect Billing Details', 'give'),
375
+							'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
376 376
 							'id'   => 'give_offline_donation_enable_billing_fields',
377 377
 							'type' => 'checkbox',
378 378
 						),
379 379
 						array(
380
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
381
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
380
+							'name'    => __('Offline Donation Instructions', 'give'),
381
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
382 382
 							'id'      => 'global_offline_donation_content',
383 383
 							'default' => give_get_default_offline_donation_content(),
384 384
 							'type'    => 'wysiwyg',
@@ -387,15 +387,15 @@  discard block
 block discarded – undo
387 387
 							),
388 388
 						),
389 389
 						array(
390
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
391
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
390
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
391
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
392 392
 							'id'      => 'offline_donation_subject',
393
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
393
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
394 394
 							'type'    => 'text',
395 395
 						),
396 396
 						array(
397
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
398
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
397
+							'name'    => __('Offline Donation Email Instructions', 'give'),
398
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
399 399
 							'id'      => 'global_offline_donation_email',
400 400
 							'default' => give_get_default_offline_donation_email_content(),
401 401
 							'type'    => 'wysiwyg',
@@ -409,104 +409,104 @@  discard block
 block discarded – undo
409 409
 			/** Display Settings */
410 410
 			'display'     => array(
411 411
 				'id'         => 'display_settings',
412
-				'give_title' => __( 'Display Settings', 'give' ),
413
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
414
-				'fields'     => apply_filters( 'give_settings_display', array(
412
+				'give_title' => __('Display Settings', 'give'),
413
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
414
+				'fields'     => apply_filters('give_settings_display', array(
415 415
 						array(
416
-							'name' => __( 'Display Settings', 'give' ),
416
+							'name' => __('Display Settings', 'give'),
417 417
 							'desc' => '',
418 418
 							'id'   => 'give_title_display_settings_1',
419 419
 							'type' => 'give_title',
420 420
 						),
421 421
 						array(
422
-							'name' => __( 'Disable CSS', 'give' ),
423
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
422
+							'name' => __('Disable CSS', 'give'),
423
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
424 424
 							'id'   => 'disable_css',
425 425
 							'type' => 'checkbox',
426 426
 						),
427 427
 						array(
428
-							'name' => __( 'Enable Floating Labels', 'give' ),
428
+							'name' => __('Enable Floating Labels', 'give'),
429 429
 							/* translators: %s: http://docs.givewp.com/form-floating-labels */
430
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array(
430
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array(
431 431
 								'a' => array(
432 432
 									'href'   => array(),
433 433
 									'target' => array(),
434 434
 								),
435
-							) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
435
+							)), esc_url('http://docs.givewp.com/form-floating-labels')),
436 436
 							'id'   => 'floatlabels',
437 437
 							'type' => 'checkbox',
438 438
 						),
439 439
 						array(
440
-							'name' => __( 'Disable Welcome Screen', 'give' ),
440
+							'name' => __('Disable Welcome Screen', 'give'),
441 441
 							/* translators: %s: about page URL */
442
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array(
442
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array(
443 443
 								'a' => array(
444 444
 									'href'   => array(),
445 445
 									'target' => array(),
446 446
 								),
447
-							) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							)), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox',
450 450
 						),
451 451
 						array(
452
-							'name' => __( 'Post Types', 'give' ),
452
+							'name' => __('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title',
456 456
 						),
457 457
 						array(
458
-							'name' => __( 'Disable Form Single Views', 'give' ),
459
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => __('Disable Form Single Views', 'give'),
459
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox',
462 462
 						),
463 463
 						array(
464
-							'name' => __( 'Disable Form Archives', 'give' ),
465
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => __('Disable Form Archives', 'give'),
465
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox',
468 468
 						),
469 469
 						array(
470
-							'name' => __( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => __('Disable Form Excerpts', 'give'),
471
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox',
474 474
 						),
475 475
 						array(
476
-							'name'    => __( 'Featured Image Size', 'give' ),
477
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
476
+							'name'    => __('Featured Image Size', 'give'),
477
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
478 478
 							'id'      => 'featured_image_size',
479 479
 							'type'    => 'select',
480 480
 							'default' => 'large',
481 481
 							'options' => give_get_featured_image_sizes(),
482 482
 						),
483 483
 						array(
484
-							'name' => __( 'Disable Form Featured Image', 'give' ),
485
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
484
+							'name' => __('Disable Form Featured Image', 'give'),
485
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
486 486
 							'id'   => 'disable_form_featured_img',
487 487
 							'type' => 'checkbox',
488 488
 						),
489 489
 						array(
490
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
491
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
490
+							'name' => __('Disable Single Form Sidebar', 'give'),
491
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
492 492
 							'id'   => 'disable_form_sidebar',
493 493
 							'type' => 'checkbox',
494 494
 						),
495 495
 						array(
496
-							'name' => __( 'Taxonomies', 'give' ),
496
+							'name' => __('Taxonomies', 'give'),
497 497
 							'desc' => '',
498 498
 							'id'   => 'give_title_display_settings_3',
499 499
 							'type' => 'give_title',
500 500
 						),
501 501
 						array(
502
-							'name' => __( 'Enable Form Categories', 'give' ),
503
-							'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
502
+							'name' => __('Enable Form Categories', 'give'),
503
+							'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'),
504 504
 							'id'   => 'categories',
505 505
 							'type' => 'checkbox',
506 506
 						),
507 507
 						array(
508
-							'name' => __( 'Enable Form Tags', 'give' ),
509
-							'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
508
+							'name' => __('Enable Form Tags', 'give'),
509
+							'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'),
510 510
 							'id'   => 'tags',
511 511
 							'type' => 'checkbox',
512 512
 						),
@@ -519,101 +519,101 @@  discard block
 block discarded – undo
519 519
 			 */
520 520
 			'emails'      => array(
521 521
 				'id'         => 'email_settings',
522
-				'give_title' => __( 'Email Settings', 'give' ),
523
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
524
-				'fields'     => apply_filters( 'give_settings_emails', array(
522
+				'give_title' => __('Email Settings', 'give'),
523
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
524
+				'fields'     => apply_filters('give_settings_emails', array(
525 525
 						array(
526
-							'name' => __( 'Email Settings', 'give' ),
526
+							'name' => __('Email Settings', 'give'),
527 527
 							'desc' => '',
528 528
 							'id'   => 'give_title_email_settings_1',
529 529
 							'type' => 'give_title',
530 530
 						),
531 531
 						array(
532 532
 							'id'      => 'email_template',
533
-							'name'    => __( 'Email Template', 'give' ),
534
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
533
+							'name'    => __('Email Template', 'give'),
534
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
535 535
 							'type'    => 'select',
536 536
 							'options' => give_get_email_templates(),
537 537
 						),
538 538
 						array(
539 539
 							'id'   => 'email_logo',
540
-							'name' => __( 'Logo', 'give' ),
541
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
540
+							'name' => __('Logo', 'give'),
541
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
542 542
 							'type' => 'file',
543 543
 						),
544 544
 						array(
545 545
 							'id'      => 'from_name',
546
-							'name'    => __( 'From Name', 'give' ),
547
-							'desc'    => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ),
548
-							'default' => get_bloginfo( 'name' ),
546
+							'name'    => __('From Name', 'give'),
547
+							'desc'    => __('The name that appears in the "From" field in donation receipt emails.', 'give'),
548
+							'default' => get_bloginfo('name'),
549 549
 							'type'    => 'text',
550 550
 						),
551 551
 						array(
552 552
 							'id'      => 'from_email',
553
-							'name'    => __( 'From Email', 'give' ),
554
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
555
-							'default' => get_bloginfo( 'admin_email' ),
553
+							'name'    => __('From Email', 'give'),
554
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
555
+							'default' => get_bloginfo('admin_email'),
556 556
 							'type'    => 'text',
557 557
 						),
558 558
 						array(
559
-							'name' => __( 'Donation Receipt', 'give' ),
559
+							'name' => __('Donation Receipt', 'give'),
560 560
 							'desc' => '',
561 561
 							'id'   => 'give_title_email_settings_2',
562 562
 							'type' => 'give_title',
563 563
 						),
564 564
 						array(
565 565
 							'id'      => 'donation_subject',
566
-							'name'    => __( 'Donation Email Subject', 'give' ),
567
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
568
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
566
+							'name'    => __('Donation Email Subject', 'give'),
567
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
568
+							'default' => esc_attr__('Donation Receipt', 'give'),
569 569
 							'type'    => 'text',
570 570
 						),
571 571
 						array(
572 572
 							'id'      => 'donation_receipt',
573
-							'name'    => __( 'Donation Receipt', 'give' ),
573
+							'name'    => __('Donation Receipt', 'give'),
574 574
 							'desc'    => sprintf(
575 575
 							/* translators: %s: emails tags list */
576
-								__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
577
-								'<br/>' . give_get_emails_tags_list()
576
+								__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
577
+								'<br/>'.give_get_emails_tags_list()
578 578
 							),
579 579
 							'type'    => 'wysiwyg',
580 580
 							'default' => give_get_default_donation_receipt_email(),
581 581
 						),
582 582
 						array(
583
-							'name' => __( 'New Donation Notification', 'give' ),
583
+							'name' => __('New Donation Notification', 'give'),
584 584
 							'desc' => '',
585 585
 							'id'   => 'give_title_email_settings_3',
586 586
 							'type' => 'give_title',
587 587
 						),
588 588
 						array(
589 589
 							'id'      => 'donation_notification_subject',
590
-							'name'    => __( 'Donation Notification Subject', 'give' ),
591
-							'desc'    => __( 'Enter the subject line for the donation notification email.', 'give' ),
590
+							'name'    => __('Donation Notification Subject', 'give'),
591
+							'desc'    => __('Enter the subject line for the donation notification email.', 'give'),
592 592
 							'type'    => 'text',
593
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
593
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give'),
594 594
 						),
595 595
 						array(
596 596
 							'id'      => 'donation_notification',
597
-							'name'    => __( 'Donation Notification', 'give' ),
597
+							'name'    => __('Donation Notification', 'give'),
598 598
 							'desc'    => sprintf(
599 599
 							/* translators: %s: emails tags list */
600
-								__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
601
-								'<br/>' . give_get_emails_tags_list()
600
+								__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
601
+								'<br/>'.give_get_emails_tags_list()
602 602
 							),
603 603
 							'type'    => 'wysiwyg',
604 604
 							'default' => give_get_default_donation_notification_email(),
605 605
 						),
606 606
 						array(
607 607
 							'id'      => 'admin_notice_emails',
608
-							'name'    => __( 'Donation Notification Emails', 'give' ),
609
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
608
+							'name'    => __('Donation Notification Emails', 'give'),
609
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
610 610
 							'type'    => 'textarea',
611
-							'default' => get_bloginfo( 'admin_email' ),
611
+							'default' => get_bloginfo('admin_email'),
612 612
 						),
613 613
 						array(
614 614
 							'id'   => 'disable_admin_notices',
615
-							'name' => __( 'Disable Admin Notifications', 'give' ),
616
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
615
+							'name' => __('Disable Admin Notifications', 'give'),
616
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
617 617
 							'type' => 'checkbox',
618 618
 						),
619 619
 					)
@@ -622,99 +622,99 @@  discard block
 block discarded – undo
622 622
 			/** Extension Settings */
623 623
 			'addons'      => array(
624 624
 				'id'         => 'addons',
625
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
626
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
627
-				'fields'     => apply_filters( 'give_settings_addons', array()
625
+				'give_title' => __('Give Add-ons Settings', 'give'),
626
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
627
+				'fields'     => apply_filters('give_settings_addons', array()
628 628
 				),
629 629
 			),
630 630
 			/** Licenses Settings */
631 631
 			'licenses'    => array(
632 632
 				'id'         => 'licenses',
633
-				'give_title' => __( 'Give Licenses', 'give' ),
634
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
635
-				'fields'     => apply_filters( 'give_settings_licenses', array()
633
+				'give_title' => __('Give Licenses', 'give'),
634
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
635
+				'fields'     => apply_filters('give_settings_licenses', array()
636 636
 				),
637 637
 			),
638 638
 			/** Advanced Options */
639 639
 			'advanced'    => array(
640 640
 				'id'         => 'advanced_options',
641
-				'give_title' => __( 'Advanced Options', 'give' ),
642
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
643
-				'fields'     => apply_filters( 'give_settings_advanced', array(
641
+				'give_title' => __('Advanced Options', 'give'),
642
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
643
+				'fields'     => apply_filters('give_settings_advanced', array(
644 644
 						array(
645
-							'name' => __( 'Access Control', 'give' ),
645
+							'name' => __('Access Control', 'give'),
646 646
 							'desc' => '',
647 647
 							'id'   => 'give_title_session_control_1',
648 648
 							'type' => 'give_title',
649 649
 						),
650 650
 						array(
651 651
 							'id'      => 'session_lifetime',
652
-							'name'    => __( 'Session Lifetime', 'give' ),
653
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
652
+							'name'    => __('Session Lifetime', 'give'),
653
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
654 654
 							'type'    => 'select',
655 655
 							'options' => array(
656
-								'86400'  => __( '24 Hours', 'give' ),
657
-								'172800' => __( '48 Hours', 'give' ),
658
-								'259200' => __( '72 Hours', 'give' ),
659
-								'604800' => __( '1 Week', 'give' ),
656
+								'86400'  => __('24 Hours', 'give'),
657
+								'172800' => __('48 Hours', 'give'),
658
+								'259200' => __('72 Hours', 'give'),
659
+								'604800' => __('1 Week', 'give'),
660 660
 							),
661 661
 						),
662 662
 						array(
663
-							'name' => __( 'Email Access', 'give' ),
664
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
663
+							'name' => __('Email Access', 'give'),
664
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
665 665
 							'id'   => 'email_access',
666 666
 							'type' => 'checkbox',
667 667
 						),
668 668
 						array(
669 669
 							'id'      => 'recaptcha_key',
670
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
670
+							'name'    => __('reCAPTCHA Site Key', 'give'),
671 671
 							/* translators: %s: https://www.google.com/recaptcha/ */
672
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
672
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
673 673
 							'default' => '',
674 674
 							'type'    => 'text',
675 675
 						),
676 676
 						array(
677 677
 							'id'      => 'recaptcha_secret',
678
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
679
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
678
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
679
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
680 680
 							'default' => '',
681 681
 							'type'    => 'text',
682 682
 						),
683 683
 						array(
684
-							'name' => __( 'Data Control', 'give' ),
684
+							'name' => __('Data Control', 'give'),
685 685
 							'desc' => '',
686 686
 							'id'   => 'give_title_data_control_2',
687 687
 							'type' => 'give_title',
688 688
 						),
689 689
 						array(
690
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
691
-							'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
690
+							'name' => __('Remove All Data on Uninstall?', 'give'),
691
+							'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'),
692 692
 							'id'   => 'uninstall_on_delete',
693 693
 							'type' => 'checkbox',
694 694
 						),
695 695
 						array(
696
-							'name' => __( 'Filter Control', 'give' ),
696
+							'name' => __('Filter Control', 'give'),
697 697
 							'desc' => '',
698 698
 							'id'   => 'give_title_filter_control',
699 699
 							'type' => 'give_title',
700 700
 						),
701 701
 						array(
702 702
 							/* translators: %s: the_content */
703
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
703
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
704 704
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
705
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
705
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
706 706
 							'id'   => 'disable_the_content_filter',
707 707
 							'type' => 'checkbox',
708 708
 						),
709 709
 						array(
710
-							'name' => __( 'Script Loading', 'give' ),
710
+							'name' => __('Script Loading', 'give'),
711 711
 							'desc' => '',
712 712
 							'id'   => 'give_title_script_control',
713 713
 							'type' => 'give_title',
714 714
 						),
715 715
 						array(
716
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
717
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
716
+							'name' => __('Load Scripts in Footer?', 'give'),
717
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
718 718
 							'id'   => 'scripts_footer',
719 719
 							'type' => 'checkbox',
720 720
 						),
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
 			/** API Settings */
725 725
 			'api'         => array(
726 726
 				'id'         => 'api',
727
-				'give_title' => __( 'API', 'give' ),
728
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
727
+				'give_title' => __('API', 'give'),
728
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
729 729
 				'show_names' => false, // Hide field names on the left
730
-				'fields'     => apply_filters( 'give_settings_system', array(
730
+				'fields'     => apply_filters('give_settings_system', array(
731 731
 						array(
732 732
 							'id'   => 'api',
733
-							'name' => __( 'API', 'give' ),
733
+							'name' => __('API', 'give'),
734 734
 							'type' => 'api',
735 735
 						),
736 736
 					)
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 			/** Licenses Settings */
740 740
 			'system_info' => array(
741 741
 				'id'         => 'system_info',
742
-				'give_title' => __( 'System Info', 'give' ),
743
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key ) ),
744
-				'fields'     => apply_filters( 'give_settings_system', array(
742
+				'give_title' => __('System Info', 'give'),
743
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key)),
744
+				'fields'     => apply_filters('give_settings_system', array(
745 745
 						array(
746 746
 							'id'   => 'system-info-textarea',
747
-							'name' => __( 'System Info', 'give' ),
748
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
747
+							'name' => __('System Info', 'give'),
748
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
749 749
 							'type' => 'system_info',
750 750
 						),
751 751
 					)
@@ -753,15 +753,15 @@  discard block
 block discarded – undo
753 753
 			),
754 754
 		);
755 755
 
756
-		$give_settings = apply_filters( 'give_registered_settings', $give_settings );
756
+		$give_settings = apply_filters('give_registered_settings', $give_settings);
757 757
 
758 758
 		// Return all settings array if no active tab
759
-		if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) {
759
+		if (empty($active_tab) || ! isset($give_settings[$active_tab])) {
760 760
 			return $give_settings;
761 761
 		}
762 762
 
763 763
 		// Add other tabs and settings fields as needed
764
-		return $give_settings[ $active_tab ];
764
+		return $give_settings[$active_tab];
765 765
 
766 766
 	}
767 767
 
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	public function settings_notices() {
772 772
 
773
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
773
+		if ( ! isset($_POST['give_settings_saved'])) {
774 774
 			return;
775 775
 		}
776 776
 
777
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
777
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
778 778
 
779 779
 	}
780 780
 
@@ -789,14 +789,14 @@  discard block
 block discarded – undo
789 789
 	 * @return mixed         Field value or exception is thrown.
790 790
 	 * @throws Exception     Throws an exception if the field is invalid.
791 791
 	 */
792
-	public function __get( $field ) {
792
+	public function __get($field) {
793 793
 
794 794
 		// Allowed fields to retrieve
795
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
795
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
796 796
 			return $this->{$field};
797 797
 		}
798 798
 
799
-		throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) );
799
+		throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field));
800 800
 	}
801 801
 
802 802
 
@@ -815,12 +815,12 @@  discard block
 block discarded – undo
815 815
  *
816 816
  * @return mixed        Option value
817 817
  */
818
-function give_get_option( $key = '', $default = false ) {
818
+function give_get_option($key = '', $default = false) {
819 819
 	$give_options = give_get_settings();
820
-	$value        = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
821
-	$value        = apply_filters( 'give_get_option', $value, $key, $default );
820
+	$value        = ! empty($give_options[$key]) ? $give_options[$key] : $default;
821
+	$value        = apply_filters('give_get_option', $value, $key, $default);
822 822
 
823
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
823
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
824 824
 }
825 825
 
826 826
 
@@ -838,33 +838,33 @@  discard block
 block discarded – undo
838 838
  *
839 839
  * @return boolean True if updated, false if not.
840 840
  */
841
-function give_update_option( $key = '', $value = false ) {
841
+function give_update_option($key = '', $value = false) {
842 842
 
843 843
 	// If no key, exit
844
-	if ( empty( $key ) ) {
844
+	if (empty($key)) {
845 845
 		return false;
846 846
 	}
847 847
 
848
-	if ( empty( $value ) ) {
849
-		$remove_option = give_delete_option( $key );
848
+	if (empty($value)) {
849
+		$remove_option = give_delete_option($key);
850 850
 
851 851
 		return $remove_option;
852 852
 	}
853 853
 
854 854
 	// First let's grab the current settings
855
-	$options = get_option( 'give_settings' );
855
+	$options = get_option('give_settings');
856 856
 
857 857
 	// Let's let devs alter that value coming in
858
-	$value = apply_filters( 'give_update_option', $value, $key );
858
+	$value = apply_filters('give_update_option', $value, $key);
859 859
 
860 860
 	// Next let's try to update the value
861
-	$options[ $key ] = $value;
862
-	$did_update      = update_option( 'give_settings', $options );
861
+	$options[$key] = $value;
862
+	$did_update      = update_option('give_settings', $options);
863 863
 
864 864
 	// If it updated, let's update the global variable
865
-	if ( $did_update ) {
865
+	if ($did_update) {
866 866
 		global $give_options;
867
-		$give_options[ $key ] = $value;
867
+		$give_options[$key] = $value;
868 868
 	}
869 869
 
870 870
 	return $did_update;
@@ -883,25 +883,25 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return boolean True if updated, false if not.
885 885
  */
886
-function give_delete_option( $key = '' ) {
886
+function give_delete_option($key = '') {
887 887
 
888 888
 	// If no key, exit
889
-	if ( empty( $key ) ) {
889
+	if (empty($key)) {
890 890
 		return false;
891 891
 	}
892 892
 
893 893
 	// First let's grab the current settings
894
-	$options = get_option( 'give_settings' );
894
+	$options = get_option('give_settings');
895 895
 
896 896
 	// Next let's try to update the value
897
-	if ( isset( $options[ $key ] ) ) {
898
-		unset( $options[ $key ] );
897
+	if (isset($options[$key])) {
898
+		unset($options[$key]);
899 899
 	}
900 900
 
901
-	$did_update = update_option( 'give_settings', $options );
901
+	$did_update = update_option('give_settings', $options);
902 902
 
903 903
 	// If it updated, let's update the global variable
904
-	if ( $did_update ) {
904
+	if ($did_update) {
905 905
 		global $give_options;
906 906
 		$give_options = $options;
907 907
 	}
@@ -920,9 +920,9 @@  discard block
 block discarded – undo
920 920
  */
921 921
 function give_get_settings() {
922 922
 
923
-	$settings = get_option( 'give_settings' );
923
+	$settings = get_option('give_settings');
924 924
 
925
-	return (array) apply_filters( 'give_get_settings', $settings );
925
+	return (array) apply_filters('give_get_settings', $settings);
926 926
 
927 927
 }
928 928
 
@@ -940,25 +940,25 @@  discard block
 block discarded – undo
940 940
  *
941 941
  * @return array
942 942
  */
943
-function give_settings_array_insert( $array, $position, $insert ) {
944
-	if ( is_int( $position ) ) {
945
-		array_splice( $array, $position, 0, $insert );
943
+function give_settings_array_insert($array, $position, $insert) {
944
+	if (is_int($position)) {
945
+		array_splice($array, $position, 0, $insert);
946 946
 	} else {
947 947
 
948
-		foreach ( $array as $index => $subarray ) {
949
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
948
+		foreach ($array as $index => $subarray) {
949
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
950 950
 				$pos = $index;
951 951
 			}
952 952
 		}
953 953
 
954
-		if ( ! isset( $pos ) ) {
954
+		if ( ! isset($pos)) {
955 955
 			return $array;
956 956
 		}
957 957
 
958 958
 		$array = array_merge(
959
-			array_slice( $array, 0, $pos ),
959
+			array_slice($array, 0, $pos),
960 960
 			$insert,
961
-			array_slice( $array, $pos )
961
+			array_slice($array, $pos)
962 962
 		);
963 963
 	}
964 964
 
@@ -978,23 +978,23 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) {
981
+function give_enabled_gateways_callback($field_arr, $saved_values = array()) {
982 982
 
983 983
 	$id       = $field_arr['id'];
984
-	$gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() );
984
+	$gateways = give_get_ordered_payment_gateways(give_get_payment_gateways());
985 985
 
986 986
 	echo '<ul class="give-checklist-fields give-payment-gatways-list">';
987 987
 
988
-	foreach ( $gateways as $key => $option ) :
988
+	foreach ($gateways as $key => $option) :
989 989
 
990
-		if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) {
990
+		if (is_array($saved_values) && array_key_exists($key, $saved_values)) {
991 991
 			$enabled = '1';
992 992
 		} else {
993 993
 			$enabled = null;
994 994
 		}
995 995
 
996
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
997
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
996
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
997
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
998 998
 
999 999
 	endforeach;
1000 1000
 
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
  *
1014 1014
  * @return void
1015 1015
  */
1016
-function give_default_gateway_callback( $field_arr, $saved_value ) {
1016
+function give_default_gateway_callback($field_arr, $saved_value) {
1017 1017
 	$id          = $field_arr['id'];
1018 1018
 	$gateways    = give_get_enabled_payment_gateways();
1019
-	$saved_value = give_get_default_gateway( null );
1019
+	$saved_value = give_get_default_gateway(null);
1020 1020
 
1021
-	echo '<select class="give-select" name="' . $id . '" id="' . $id . '">';
1021
+	echo '<select class="give-select" name="'.$id.'" id="'.$id.'">';
1022 1022
 
1023
-	foreach ( $gateways as $key => $option ) :
1024
-		$selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : '';
1025
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1023
+	foreach ($gateways as $key => $option) :
1024
+		$selected = isset($saved_value) ? selected($key, $saved_value, false) : '';
1025
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1026 1026
 	endforeach;
1027 1027
 
1028 1028
 	echo '</select>';
@@ -1040,13 +1040,13 @@  discard block
 block discarded – undo
1040 1040
  *
1041 1041
  * @return void
1042 1042
  */
1043
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1043
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1044 1044
 
1045 1045
 	$id                = $field_type_object->field->args['id'];
1046 1046
 	$title             = $field_type_object->field->args['name'];
1047 1047
 	$field_description = $field_type_object->field->args['desc'];
1048 1048
 
1049
-	echo '<hr>' . $field_description;
1049
+	echo '<hr>'.$field_description;
1050 1050
 
1051 1051
 }
1052 1052
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
  *
1062 1062
  * @return void
1063 1063
  */
1064
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1064
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1065 1065
 
1066 1066
 	$id                = $field_type_object->field->args['id'];
1067 1067
 	$title             = $field_type_object->field->args['name'];
@@ -1080,25 +1080,25 @@  discard block
 block discarded – undo
1080 1080
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1081 1081
  * @return array An array of options that matches the CMB2 options array
1082 1082
  */
1083
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1083
+function give_cmb2_get_post_options($query_args, $force = false) {
1084 1084
 
1085
-	$post_options = array( '' => '' ); // Blank option
1085
+	$post_options = array('' => ''); // Blank option
1086 1086
 
1087
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1087
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1088 1088
 		return $post_options;
1089 1089
 	}
1090 1090
 
1091
-	$args = wp_parse_args( $query_args, array(
1091
+	$args = wp_parse_args($query_args, array(
1092 1092
 		'post_type'   => 'page',
1093 1093
 		'numberposts' => 10,
1094
-	) );
1094
+	));
1095 1095
 
1096
-	$posts = get_posts( $args );
1096
+	$posts = get_posts($args);
1097 1097
 
1098
-	if ( $posts ) {
1099
-		foreach ( $posts as $post ) {
1098
+	if ($posts) {
1099
+		foreach ($posts as $post) {
1100 1100
 
1101
-			$post_options[ $post->ID ] = $post->post_title;
1101
+			$post_options[$post->ID] = $post->post_title;
1102 1102
 
1103 1103
 		}
1104 1104
 	}
@@ -1123,33 +1123,33 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 	$sizes            = array();
1125 1125
 	$get_sizes        = get_intermediate_image_sizes();
1126
-	$core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
1126
+	$core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large');
1127 1127
 
1128 1128
 
1129 1129
 	// This will help us to filter special characters from a string
1130
-	$filter_slug_items = array( '_', '-' );
1130
+	$filter_slug_items = array('_', '-');
1131 1131
 
1132
-	foreach ( $get_sizes as $_size ) {
1132
+	foreach ($get_sizes as $_size) {
1133 1133
 
1134 1134
 		// Converting image size slug to title case
1135
-		$sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items );
1135
+		$sizes[$_size] = give_slug_to_title($_size, $filter_slug_items);
1136 1136
 
1137
-		if ( in_array( $_size, $core_image_sizes ) ) {
1138
-			$sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1139
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1140
-			$sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}";
1137
+		if (in_array($_size, $core_image_sizes)) {
1138
+			$sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1139
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1140
+			$sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}";
1141 1141
 		}
1142 1142
 
1143 1143
 		// Based on the above image height check, label the respective resolution as responsive
1144
-		if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) {
1145
-			$sizes[ $_size ] .= ' - responsive';
1144
+		if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) {
1145
+			$sizes[$_size] .= ' - responsive';
1146 1146
 		}
1147 1147
 
1148
-		$sizes[ $_size ] .= ')';
1148
+		$sizes[$_size] .= ')';
1149 1149
 
1150 1150
 	}
1151 1151
 
1152
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1152
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1153 1153
 }
1154 1154
 
1155 1155
 
@@ -1165,14 +1165,14 @@  discard block
 block discarded – undo
1165 1165
  *
1166 1166
  * @return text $string
1167 1167
  */
1168
-function give_slug_to_title( $string, $filters = array() ) {
1168
+function give_slug_to_title($string, $filters = array()) {
1169 1169
 
1170
-	foreach ( $filters as $filter_item ) {
1171
-		$string = str_replace( $filter_item, ' ', $string );
1170
+	foreach ($filters as $filter_item) {
1171
+		$string = str_replace($filter_item, ' ', $string);
1172 1172
 	}
1173 1173
 
1174 1174
 	// Return updated string after converting it to title case
1175
-	return ucwords( $string );
1175
+	return ucwords($string);
1176 1176
 
1177 1177
 }
1178 1178
 
@@ -1188,18 +1188,18 @@  discard block
 block discarded – undo
1188 1188
  *
1189 1189
  * @return void
1190 1190
  */
1191
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1191
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1192 1192
 	/* @var CMB2_Types $field_type_object */
1193 1193
 
1194 1194
 	$id                 = $field_type_object->field->args['id'];
1195 1195
 	$field_description  = $field_type_object->field->args['desc'];
1196 1196
 	$license            = $field_type_object->field->args['options']['license'];
1197 1197
 	$license_key        = $escaped_value;
1198
-	$is_license_key     = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1199
-	$is_valid_license   = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1198
+	$is_license_key     = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1199
+	$is_valid_license   = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1200 1200
 	$shortname          = $field_type_object->field->args['options']['shortname'];
1201 1201
 	$field_classes      = 'regular-text give-license-field';
1202
-	$type               = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1202
+	$type               = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1203 1203
 	$custom_html        = '';
1204 1204
 	$messages           = array();
1205 1205
 	$class              = '';
@@ -1211,83 +1211,83 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1213 1213
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1214
-	if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1214
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1215 1215
 		$is_license_key = false;
1216 1216
 	}
1217 1217
 
1218 1218
 	// Check if current license is part of subscription or not.
1219
-	$subscriptions = get_option( 'give_subscriptions' );
1219
+	$subscriptions = get_option('give_subscriptions');
1220 1220
 
1221
-	if ( $is_license_key && $subscriptions ) {
1222
-		foreach ( $subscriptions as $subscription ) {
1223
-			if ( in_array( $license_key, $subscription['licenses'] ) ) {
1221
+	if ($is_license_key && $subscriptions) {
1222
+		foreach ($subscriptions as $subscription) {
1223
+			if (in_array($license_key, $subscription['licenses'])) {
1224 1224
 				$is_in_subscription = $subscription['id'];
1225 1225
 				break;
1226 1226
 			}
1227 1227
 		}
1228 1228
 	}
1229 1229
 
1230
-	if ( $is_license_key ) {
1230
+	if ($is_license_key) {
1231 1231
 
1232
-		if ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1232
+		if (empty($license->success) && property_exists($license, 'error')) {
1233 1233
 
1234 1234
 			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1235
-			switch ( $license->error ) {
1235
+			switch ($license->error) {
1236 1236
 				case 'expired' :
1237 1237
 					$class          = $license->error;
1238 1238
 					$messages[]     = sprintf(
1239
-						__( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1240
-						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1241
-						$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1239
+						__('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1240
+						date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1241
+						$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1242 1242
 					);
1243
-					$license_status = 'license-' . $class;
1243
+					$license_status = 'license-'.$class;
1244 1244
 					break;
1245 1245
 
1246 1246
 				case 'missing' :
1247 1247
 					$class          = $license->error;
1248 1248
 					$messages[]     = sprintf(
1249
-						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1250
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1249
+						__('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1250
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1251 1251
 					);
1252
-					$license_status = 'license-' . $class;
1252
+					$license_status = 'license-'.$class;
1253 1253
 					break;
1254 1254
 
1255 1255
 				case 'invalid' :
1256 1256
 					$class          = $license->error;
1257 1257
 					$messages[]     = sprintf(
1258
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1258
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1259 1259
 						$addon_name,
1260
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1260
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1261 1261
 					);
1262
-					$license_status = 'license-' . $class;
1262
+					$license_status = 'license-'.$class;
1263 1263
 					break;
1264 1264
 
1265 1265
 				case 'site_inactive' :
1266 1266
 					$class          = $license->error;
1267 1267
 					$messages[]     = sprintf(
1268
-						__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1268
+						__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1269 1269
 						$addon_name,
1270
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1270
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1271 1271
 					);
1272
-					$license_status = 'license-' . $class;
1272
+					$license_status = 'license-'.$class;
1273 1273
 					break;
1274 1274
 
1275 1275
 				case 'item_name_mismatch' :
1276 1276
 					$class          = $license->error;
1277
-					$messages[]     = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name );
1278
-					$license_status = 'license-' . $class;
1277
+					$messages[]     = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name);
1278
+					$license_status = 'license-'.$class;
1279 1279
 					break;
1280 1280
 
1281 1281
 				case 'no_activations_left':
1282 1282
 					$class          = $license->error;
1283
-					$messages[]     = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1284
-					$license_status = 'license-' . $class;
1283
+					$messages[]     = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1284
+					$license_status = 'license-'.$class;
1285 1285
 					break;
1286 1286
 
1287 1287
 				default:
1288 1288
 					$class          = $license->error;
1289 1289
 					$messages[]     = sprintf(
1290
-						__( 'Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give' ),
1290
+						__('Your license is not activated. Please <a href="%3$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs. %2$sError Code: %1$s.', 'give'),
1291 1291
 						$license->error,
1292 1292
 						'<br/>',
1293 1293
 						"{$account_page_link}?utm_campaign=admin&utm_source=licenses&utm_medium={$license->error}"
@@ -1296,74 +1296,74 @@  discard block
 block discarded – undo
1296 1296
 					break;
1297 1297
 			}
1298 1298
 
1299
-		} elseif ( $is_in_subscription ) {
1299
+		} elseif ($is_in_subscription) {
1300 1300
 
1301
-			$subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] );
1302
-			$subscription_status  = __( 'renew', 'give' );
1301
+			$subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1302
+			$subscription_status  = __('renew', 'give');
1303 1303
 
1304
-			if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) {
1305
-				$subscription_status = __( 'expire', 'give' );
1304
+			if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1305
+				$subscription_status = __('expire', 'give');
1306 1306
 			}
1307 1307
 
1308
-			if ( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1309
-				$messages[]     = sprintf(
1310
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1311
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1312
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1313
-					$checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1308
+			if ($subscription_expires < current_time('timestamp', 1)) {
1309
+				$messages[] = sprintf(
1310
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1311
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1312
+					$subscriptions[$is_in_subscription]['payment_id'],
1313
+					$checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1314 1314
 				);
1315 1315
 				$license_status = 'license-expired';
1316
-			} elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1316
+			} elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1317 1317
 				$messages[]     = sprintf(
1318
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ),
1319
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1320
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1318
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'),
1319
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1320
+					$subscriptions[$is_in_subscription]['payment_id'],
1321 1321
 					$subscription_status,
1322
-					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) )
1322
+					human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1323 1323
 				);
1324 1324
 				$license_status = 'license-expires-soon';
1325 1325
 			} else {
1326 1326
 				$messages[]     = sprintf(
1327
-					__( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ),
1328
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1329
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1327
+					__('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'),
1328
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1329
+					$subscriptions[$is_in_subscription]['payment_id'],
1330 1330
 					$subscription_status,
1331
-					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) )
1331
+					date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1332 1332
 				);
1333 1333
 				$license_status = 'license-expiration-date';
1334 1334
 			}
1335 1335
 
1336
-		} elseif ( empty( $license->success ) ) {
1336
+		} elseif (empty($license->success)) {
1337 1337
 			$class          = 'invalid';
1338 1338
 			$messages[]     = sprintf(
1339
-				__( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1339
+				__('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1340 1340
 				$addon_name,
1341
-				$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1341
+				$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1342 1342
 			);
1343
-			$license_status = 'license-' . $class;
1343
+			$license_status = 'license-'.$class;
1344 1344
 
1345 1345
 		} else {
1346
-			switch ( $license->license ) {
1346
+			switch ($license->license) {
1347 1347
 				case 'valid' :
1348 1348
 				default:
1349 1349
 					$class      = 'valid';
1350
-					$now        = current_time( 'timestamp' );
1351
-					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1350
+					$now        = current_time('timestamp');
1351
+					$expiration = strtotime($license->expires, current_time('timestamp'));
1352 1352
 
1353
-					if ( 'lifetime' === $license->expires ) {
1354
-						$messages[]     = __( 'License key never expires.', 'give' );
1353
+					if ('lifetime' === $license->expires) {
1354
+						$messages[]     = __('License key never expires.', 'give');
1355 1355
 						$license_status = 'license-lifetime-notice';
1356
-					} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1356
+					} elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1357 1357
 						$messages[]     = sprintf(
1358
-							__( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1359
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1360
-							$checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1358
+							__('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1359
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1360
+							$checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1361 1361
 						);
1362 1362
 						$license_status = 'license-expires-soon';
1363 1363
 					} else {
1364 1364
 						$messages[]     = sprintf(
1365
-							__( 'Your license key expires on %s.', 'give' ),
1366
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1365
+							__('Your license key expires on %s.', 'give'),
1366
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1367 1367
 						);
1368 1368
 						$license_status = 'license-expiration-date';
1369 1369
 					}
@@ -1371,15 +1371,15 @@  discard block
 block discarded – undo
1371 1371
 			}
1372 1372
 		}
1373 1373
 	} else {
1374
-		$messages[]     = sprintf(
1375
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1374
+		$messages[] = sprintf(
1375
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1376 1376
 			$addon_name
1377 1377
 		);
1378 1378
 		$license_status = 'inactive';
1379 1379
 	}
1380 1380
 
1381 1381
 	// Add class for input field if license is active.
1382
-	if ( $is_valid_license ) {
1382
+	if ($is_valid_license) {
1383 1383
 		$field_classes .= ' give-license-active';
1384 1384
 	}
1385 1385
 
@@ -1387,33 +1387,33 @@  discard block
 block discarded – undo
1387 1387
 	$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">";
1388 1388
 
1389 1389
 	// If license is active so show deactivate button.
1390
-	if ( $is_valid_license ) {
1390
+	if ($is_valid_license) {
1391 1391
 		// Get input field html.
1392 1392
 		$input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">";
1393 1393
 
1394
-		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1394
+		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1395 1395
 
1396 1396
 	}
1397 1397
 
1398 1398
 	// Field description.
1399
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1399
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1400 1400
 
1401 1401
 	// If no messages found then inform user that to get updated in future register yourself.
1402
-	if ( empty( $messages ) ) {
1403
-		$messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) );
1402
+	if (empty($messages)) {
1403
+		$messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give'));
1404 1404
 	}
1405 1405
 
1406
-	foreach ( $messages as $message ) {
1407
-		$custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">';
1408
-		$custom_html .= '<p>' . $message . '</p>';
1406
+	foreach ($messages as $message) {
1407
+		$custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">';
1408
+		$custom_html .= '<p>'.$message.'</p>';
1409 1409
 		$custom_html .= '</div>';
1410 1410
 	}
1411 1411
 
1412 1412
 	// Field html.
1413
-	$custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object );
1413
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1414 1414
 
1415 1415
 	// Nonce.
1416
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1416
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1417 1417
 
1418 1418
 	// Print field html.
1419 1419
 	echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>";
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
  */
1429 1429
 function give_api_callback() {
1430 1430
 
1431
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1431
+	if ( ! current_user_can('manage_give_settings')) {
1432 1432
 		return;
1433 1433
 	}
1434 1434
 
@@ -1437,9 +1437,9 @@  discard block
 block discarded – undo
1437 1437
 	 *
1438 1438
 	 * @since 1.0
1439 1439
 	 */
1440
-	do_action( 'give_tools_api_keys_before' );
1440
+	do_action('give_tools_api_keys_before');
1441 1441
 
1442
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1442
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1443 1443
 
1444 1444
 	$api_keys_table = new Give_API_Keys_Table();
1445 1445
 	$api_keys_table->prepare_items();
@@ -1448,9 +1448,9 @@  discard block
 block discarded – undo
1448 1448
 	<span class="cmb2-metabox-description api-description">
1449 1449
 		<?php echo sprintf(
1450 1450
 		/* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */
1451
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1452
-			esc_url( 'http://docs.givewp.com/api' ),
1453
-			esc_url( 'http://docs.givewp.com/addon-zapier' )
1451
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1452
+			esc_url('http://docs.givewp.com/api'),
1453
+			esc_url('http://docs.givewp.com/addon-zapier')
1454 1454
 		); ?>
1455 1455
 	</span>
1456 1456
 	<?php
@@ -1460,10 +1460,10 @@  discard block
 block discarded – undo
1460 1460
 	 *
1461 1461
 	 * @since 1.0
1462 1462
 	 */
1463
-	do_action( 'give_tools_api_keys_after' );
1463
+	do_action('give_tools_api_keys_after');
1464 1464
 }
1465 1465
 
1466
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1466
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1467 1467
 
1468 1468
 /**
1469 1469
  * Hook Callback
@@ -1476,7 +1476,7 @@  discard block
 block discarded – undo
1476 1476
  *
1477 1477
  * @return void
1478 1478
  */
1479
-function give_hook_callback( $args ) {
1479
+function give_hook_callback($args) {
1480 1480
 
1481 1481
 	$id = $args['id'];
1482 1482
 
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 	 *
1486 1486
 	 * @since 1.0
1487 1487
 	 */
1488
-	do_action( "give_{$id}" );
1488
+	do_action("give_{$id}");
1489 1489
 
1490 1490
 }
1491 1491
 
@@ -1500,19 +1500,19 @@  discard block
 block discarded – undo
1500 1500
  *
1501 1501
  * @return bool
1502 1502
  */
1503
-function give_is_setting_enabled( $value, $compare_with = null ) {
1504
-	if ( ! is_null( $compare_with ) ) {
1503
+function give_is_setting_enabled($value, $compare_with = null) {
1504
+	if ( ! is_null($compare_with)) {
1505 1505
 
1506
-		if ( is_array( $compare_with ) ) {
1506
+		if (is_array($compare_with)) {
1507 1507
 			// Output.
1508
-			return in_array( $value, $compare_with );
1508
+			return in_array($value, $compare_with);
1509 1509
 		}
1510 1510
 
1511 1511
 		// Output.
1512
-		return ( $value === $compare_with );
1512
+		return ($value === $compare_with);
1513 1513
 	}
1514 1514
 
1515 1515
 	// Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled
1516 1516
 	// Output.
1517
-	return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false );
1517
+	return (in_array($value, array('enabled', 'on', 'yes')) ? true : false);
1518 1518
 }
1519 1519
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * Get donor email html.
492 492
 	 *
493
-	 * @param object $payment Contains all the data of the payment.
493
+	 * @param Give_Payment $payment Contains all the data of the payment.
494 494
 	 *
495 495
 	 * @access public
496 496
 	 * @since  1.0
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	/**
514 514
 	 * Get Row Actions
515 515
 	 *
516
-	 * @param object $payment Payment Data.
516
+	 * @param Give_Payment $payment Payment Data.
517 517
 	 *
518 518
 	 * @since 1.6
519 519
 	 *
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	/**
566 566
 	 *  Get payment status html.
567 567
 	 *
568
-	 * @param object $payment Contains all the data of the payment.
568
+	 * @param Give_Payment $payment Contains all the data of the payment.
569 569
 	 *
570 570
 	 * @access public
571 571
 	 * @since  1.0
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	/**
616 616
 	 * Get donor html.
617 617
 	 *
618
-	 * @param object $payment Contains all the data of the payment.
618
+	 * @param Give_Payment $payment Contains all the data of the payment.
619 619
 	 *
620 620
 	 * @access public
621 621
 	 * @since  1.0
Please login to merge, or discard this patch.
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 		// Set parent defaults.
137 137
 		parent::__construct(
138 138
 			array(
139
-				'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
140
-				'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
141
-				'ajax'     => false,                              // Does this table support ajax?
139
+				'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
140
+				'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
141
+				'ajax'     => false, // Does this table support ajax?
142 142
 			)
143 143
 		);
144 144
 
145 145
 		$this->process_bulk_action();
146 146
 		$this->get_payment_counts();
147
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
147
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,31 +153,31 @@  discard block
 block discarded – undo
153 153
 	 * @return void
154 154
 	 */
155 155
 	public function advanced_filters() {
156
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
157
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
158
-		$status     = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
159
-		$donor      = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : '';
160
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
161
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
156
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
157
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
158
+		$status     = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '';
159
+		$donor      = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : '';
160
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '';
161
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
162 162
 		?>
163 163
 		<div id="give-payment-filters" class="give-filters">
164
-			<?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?>
164
+			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?>
165 165
 			<div id="give-payment-date-filters">
166 166
 				<div class="give-filter give-filter-half">
167 167
 					<label for="start-date"
168
-						   class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label>
168
+						   class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label>
169 169
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
170 170
 						   value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
171 171
 				</div>
172 172
 				<div class="give-filter give-filter-half">
173
-					<label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label>
173
+					<label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label>
174 174
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
175 175
 						   value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
176 176
 				</div>
177 177
 			</div>
178 178
 			<div id="give-payment-form-filter" class="give-filter">
179 179
 				<label for="give-donation-forms-filter"
180
-					   class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label>
180
+					   class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label>
181 181
 				<?php
182 182
 				// Filter Donations by Donation Forms.
183 183
 				echo Give()->html->forms_dropdown(
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
 						'class'    => 'give-donation-forms-filter',
188 188
 						'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
189 189
 						'chosen'   => true,
190
-						'number'   => - 1,
190
+						'number'   => -1,
191 191
 					)
192 192
 				);
193 193
 				?>
194 194
 			</div>
195 195
 
196
-			<?php if ( ! empty( $status ) ) : ?>
197
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
196
+			<?php if ( ! empty($status)) : ?>
197
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
198 198
 			<?php endif; ?>
199 199
 
200 200
 			<div class="give-filter">
201
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
201
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
202 202
 				<?php
203 203
 				// Clear active filters button.
204
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) :
204
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) :
205 205
 				?>
206
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
207
-					   class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a>
206
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
207
+					   class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a>
208 208
 				<?php endif; ?>
209 209
 			</div>
210 210
 		</div>
@@ -223,18 +223,18 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	public function search_box( $text, $input_id ) {
227
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
226
+	public function search_box($text, $input_id) {
227
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
228 228
 			return;
229 229
 		}
230 230
 
231
-		$input_id = $input_id . '-search-input';
231
+		$input_id = $input_id.'-search-input';
232 232
 
233
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
234
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
233
+		if ( ! empty($_REQUEST['orderby'])) {
234
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
235 235
 		}
236
-		if ( ! empty( $_REQUEST['order'] ) ) {
237
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
236
+		if ( ! empty($_REQUEST['order'])) {
237
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
238 238
 		}
239 239
 		?>
240 240
 		<div class="give-filter give-filter-search" role="search">
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			 *
247 247
 			 * @since 1.7
248 248
 			 */
249
-			do_action( 'give_payment_history_search' );
249
+			do_action('give_payment_history_search');
250 250
 			?>
251 251
 			<label class="screen-reader-text" for="<?php echo $input_id; ?>"><?php echo $text; ?>:</label>
252 252
 			<input type="search" id="<?php echo $input_id; ?>" name="s" value="<?php _admin_search_query(); ?>" />
@@ -272,52 +272,52 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function get_views() {
274 274
 
275
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
275
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
276 276
 		$views   = array();
277 277
 		$tabs    = array(
278 278
 			'all'         => array(
279 279
 				'total_count',
280
-				__( 'All', 'give' ),
280
+				__('All', 'give'),
281 281
 			),
282 282
 			'publish'     => array(
283 283
 				'complete_count',
284
-				__( 'Completed', 'give' ),
284
+				__('Completed', 'give'),
285 285
 			),
286 286
 			'pending'     => array(
287 287
 				'pending_count',
288
-				__( 'Pending', 'give' ),
288
+				__('Pending', 'give'),
289 289
 			),
290 290
 			'processing'  => array(
291 291
 				'processing_count',
292
-				__( 'Processing', 'give' ),
292
+				__('Processing', 'give'),
293 293
 			),
294 294
 			'refunded'    => array(
295 295
 				'refunded_count',
296
-				__( 'Refunded', 'give' ),
296
+				__('Refunded', 'give'),
297 297
 			),
298 298
 			'revoked'     => array(
299 299
 				'revoked_count',
300
-				__( 'Revoked', 'give' ),
300
+				__('Revoked', 'give'),
301 301
 			),
302 302
 			'failed'      => array(
303 303
 				'failed_count',
304
-				__( 'Failed', 'give' ),
304
+				__('Failed', 'give'),
305 305
 			),
306 306
 			'cancelled'   => array(
307 307
 				'cancelled_count',
308
-				__( 'Cancelled', 'give' ),
308
+				__('Cancelled', 'give'),
309 309
 			),
310 310
 			'abandoned'   => array(
311 311
 				'abandoned_count',
312
-				__( 'Abandoned', 'give' ),
312
+				__('Abandoned', 'give'),
313 313
 			),
314 314
 			'preapproval' => array(
315 315
 				'preapproval_count',
316
-				__( 'Preapproval Pending', 'give' ),
316
+				__('Preapproval Pending', 'give'),
317 317
 			),
318 318
 		);
319 319
 
320
-		foreach ( $tabs as $key => $tab ) {
320
+		foreach ($tabs as $key => $tab) {
321 321
 			$count_key = $tab[0];
322 322
 			$name      = $tab[1];
323 323
 			$count     = $this->$count_key;
@@ -332,26 +332,26 @@  discard block
 block discarded – undo
332 332
 			 *
333 333
 			 * @since 1.8.12
334 334
 			 */
335
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
335
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
336 336
 
337
-				$views[ $key ] = sprintf(
337
+				$views[$key] = sprintf(
338 338
 					'<a href="%s" %s >%s&nbsp;<span class="count">(%s)</span></a>',
339 339
 					esc_url(
340
-						( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg(
340
+						('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(
341 341
 							array(
342 342
 								'status' => $key,
343 343
 								'paged'  => false,
344
-							), admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' )
344
+							), admin_url('edit.php?post_type=give_forms&page=give-payment-history')
345 345
 						)
346 346
 					),
347
-					( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',
347
+					(('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '',
348 348
 					$name,
349 349
 					$count
350 350
 				);
351 351
 			}
352 352
 		}
353 353
 
354
-		return apply_filters( 'give_payments_table_views', $views, $this );
354
+		return apply_filters('give_payments_table_views', $views, $this);
355 355
 	}
356 356
 
357 357
 	/**
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
 	public function get_columns() {
366 366
 		$columns = array(
367 367
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
368
-			'donation'      => __( 'Donation', 'give' ),
369
-			'donation_form' => __( 'Donation Form', 'give' ),
370
-			'status'        => __( 'Status', 'give' ),
371
-			'date'          => __( 'Date', 'give' ),
372
-			'amount'        => __( 'Amount', 'give' ),
368
+			'donation'      => __('Donation', 'give'),
369
+			'donation_form' => __('Donation Form', 'give'),
370
+			'status'        => __('Status', 'give'),
371
+			'date'          => __('Date', 'give'),
372
+			'amount'        => __('Amount', 'give'),
373 373
 		);
374 374
 
375
-		if ( current_user_can( 'view_give_payments' ) ) {
376
-			$columns['details'] = __( 'Details', 'give' );
375
+		if (current_user_can('view_give_payments')) {
376
+			$columns['details'] = __('Details', 'give');
377 377
 		}
378 378
 
379
-		return apply_filters( 'give_payments_table_columns', $columns );
379
+		return apply_filters('give_payments_table_columns', $columns);
380 380
 	}
381 381
 
382 382
 	/**
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	public function get_sortable_columns() {
391 391
 		$columns = array(
392
-			'donation'      => array( 'ID', true ),
393
-			'donation_form' => array( 'donation_form', false ),
394
-			'status'        => array( 'status', false ),
395
-			'amount'        => array( 'amount', false ),
396
-			'date'          => array( 'date', false ),
392
+			'donation'      => array('ID', true),
393
+			'donation_form' => array('donation_form', false),
394
+			'status'        => array('status', false),
395
+			'amount'        => array('amount', false),
396
+			'date'          => array('date', false),
397 397
 		);
398 398
 
399
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
399
+		return apply_filters('give_payments_table_sortable_columns', $columns);
400 400
 	}
401 401
 
402 402
 	/**
@@ -422,69 +422,69 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @return string Column Name
424 424
 	 */
425
-	public function column_default( $payment, $column_name ) {
425
+	public function column_default($payment, $column_name) {
426 426
 
427
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) );
428
-		$row_actions         = $this->get_row_actions( $payment );
427
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details')));
428
+		$row_actions         = $this->get_row_actions($payment);
429 429
 		$value = '';
430 430
 
431
-		switch ( $column_name ) {
431
+		switch ($column_name) {
432 432
 			case 'donation':
433
-				if ( current_user_can( 'view_give_payments' ) ) {
434
-					$value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, __( 'by', 'give' ), $this->get_donor( $payment ) );
433
+				if (current_user_can('view_give_payments')) {
434
+					$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf(__('View Donation #%s', 'give'), $payment->ID), $payment->ID, __('by', 'give'), $this->get_donor($payment));
435 435
 				} else {
436
-					$value = sprintf( '#%1$s ' . __( 'by', 'give' ) . ' %2$s <br/>', $payment->ID, $this->get_donor( $payment ) );
436
+					$value = sprintf('#%1$s '.__('by', 'give').' %2$s <br/>', $payment->ID, $this->get_donor($payment));
437 437
 				}
438
-				$value .= $this->get_donor_email( $payment );
439
-				$value .= $this->row_actions( $row_actions );
438
+				$value .= $this->get_donor_email($payment);
439
+				$value .= $this->row_actions($row_actions);
440 440
 				break;
441 441
 
442 442
 			case 'amount':
443
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
443
+				$amount = ! empty($payment->total) ? $payment->total : 0;
444 444
 				$value  = give_currency_filter(
445 445
 					give_format_amount(
446 446
 						$amount, array(
447 447
 							'sanitize'    => false,
448 448
 							'donation_id' => $payment->ID,
449 449
 						)
450
-					), give_get_payment_currency_code( $payment->ID )
450
+					), give_get_payment_currency_code($payment->ID)
451 451
 				);
452
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
452
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
453 453
 				break;
454 454
 
455 455
 			case 'donation_form':
456
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
457
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
458
-				$level      = give_get_payment_form_title( $payment->meta, true );
456
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
457
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
458
+				$level      = give_get_payment_form_title($payment->meta, true);
459 459
 
460
-				if ( ! empty( $level ) ) {
460
+				if ( ! empty($level)) {
461 461
 					$value .= $level;
462 462
 				}
463 463
 
464 464
 				break;
465 465
 
466 466
 			case 'date':
467
-				$date  = strtotime( $payment->date );
468
-				$value = date_i18n( give_date_format(), $date );
467
+				$date  = strtotime($payment->date);
468
+				$value = date_i18n(give_date_format(), $date);
469 469
 				break;
470 470
 
471 471
 			case 'status':
472
-				$value = $this->get_payment_status( $payment );
472
+				$value = $this->get_payment_status($payment);
473 473
 				break;
474 474
 
475 475
 			case 'details':
476
-				if ( current_user_can( 'view_give_payments' ) ) {
477
-					$value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ) );
476
+				if (current_user_can('view_give_payments')) {
477
+					$value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(__('View Donation #%s', 'give'), $payment->ID));
478 478
 				}
479 479
 				break;
480 480
 
481 481
 			default:
482
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
482
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
483 483
 				break;
484 484
 
485 485
 		}// End switch().
486 486
 
487
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
487
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
488 488
 	}
489 489
 
490 490
 	/**
@@ -497,17 +497,17 @@  discard block
 block discarded – undo
497 497
 	 *
498 498
 	 * @return string Data shown in the Email column
499 499
 	 */
500
-	public function get_donor_email( $payment ) {
500
+	public function get_donor_email($payment) {
501 501
 
502
-		$email = give_get_payment_user_email( $payment->ID );
502
+		$email = give_get_payment_user_email($payment->ID);
503 503
 
504
-		if ( empty( $email ) ) {
505
-			$email = __( '(unknown)', 'give' );
504
+		if (empty($email)) {
505
+			$email = __('(unknown)', 'give');
506 506
 		}
507 507
 
508
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>';
508
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>';
509 509
 
510
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
510
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
511 511
 	}
512 512
 
513 513
 	/**
@@ -519,18 +519,18 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @return array $actions
521 521
 	 */
522
-	function get_row_actions( $payment ) {
522
+	function get_row_actions($payment) {
523 523
 
524 524
 		$actions = array();
525
-		$email   = give_get_payment_user_email( $payment->ID );
525
+		$email   = give_get_payment_user_email($payment->ID);
526 526
 
527 527
 		// Add search term string back to base URL.
528
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
529
-		if ( ! empty( $search_terms ) ) {
530
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
528
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
529
+		if ( ! empty($search_terms)) {
530
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
531 531
 		}
532 532
 
533
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
533
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
534 534
 
535 535
 			$actions['email_links'] = sprintf(
536 536
 				'<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(
@@ -540,12 +540,12 @@  discard block
 block discarded – undo
540 540
 							'purchase_id' => $payment->ID,
541 541
 						), $this->base_url
542 542
 					), 'give_payment_nonce'
543
-				), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' )
543
+				), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give')
544 544
 			);
545 545
 
546 546
 		}
547 547
 
548
-		if ( current_user_can( 'view_give_payments' ) ) {
548
+		if (current_user_can('view_give_payments')) {
549 549
 			$actions['delete'] = sprintf(
550 550
 				'<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(
551 551
 					add_query_arg(
@@ -554,11 +554,11 @@  discard block
 block discarded – undo
554 554
 							'purchase_id' => $payment->ID,
555 555
 						), $this->base_url
556 556
 					), 'give_donation_nonce'
557
-				), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' )
557
+				), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give')
558 558
 			);
559 559
 		}
560 560
 
561
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
561
+		return apply_filters('give_payment_row_actions', $actions, $payment);
562 562
 	}
563 563
 
564 564
 
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 * @return string Data shown in the Email column
574 574
 	 */
575
-	function get_payment_status( $payment ) {
576
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
577
-		if ( 'test' === $payment->mode ) {
578
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . __( 'This donation was made in test mode.', 'give' ) . '">' . __( 'Test', 'give' ) . '</span>';
575
+	function get_payment_status($payment) {
576
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
577
+		if ('test' === $payment->mode) {
578
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.__('This donation was made in test mode.', 'give').'">'.__('Test', 'give').'</span>';
579 579
 		}
580 580
 
581
-		if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) {
582
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . __( 'This donation was imported.', 'give' ) . '">' . __( 'Import', 'give' ) . '</span>';
581
+		if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) {
582
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.__('This donation was imported.', 'give').'">'.__('Import', 'give').'</span>';
583 583
 		}
584 584
 
585 585
 		return $value;
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 *
596 596
 	 * @return string Displays a checkbox.
597 597
 	 */
598
-	public function column_cb( $payment ) {
599
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
598
+	public function column_cb($payment) {
599
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
600 600
 	}
601 601
 
602 602
 	/**
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 *
609 609
 	 * @return string Displays a checkbox.
610 610
 	 */
611
-	public function get_payment_id( $payment ) {
612
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
611
+	public function get_payment_id($payment) {
612
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
613 613
 	}
614 614
 
615 615
 	/**
@@ -622,32 +622,32 @@  discard block
 block discarded – undo
622 622
 	 *
623 623
 	 * @return string Data shown in the User column
624 624
 	 */
625
-	public function get_donor( $payment ) {
625
+	public function get_donor($payment) {
626 626
 
627
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
628
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
629
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
627
+		$donor_id           = give_get_payment_donor_id($payment->ID);
628
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
629
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
630 630
 
631 631
 		$value = '';
632
-		if ( ! empty( $donor_id ) ) {
632
+		if ( ! empty($donor_id)) {
633 633
 
634 634
 			// Check whether the donor name and WP_User name is same or not.
635
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
636
-				$value .= $donor_billing_name . ' (';
635
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
636
+				$value .= $donor_billing_name.' (';
637 637
 			}
638 638
 
639
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
639
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
640 640
 
641 641
 			// Check whether the donor name and WP_User name is same or not.
642
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
642
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
643 643
 				$value .= ')';
644 644
 			}
645 645
 		} else {
646
-			$email  = give_get_payment_user_email( $payment->ID );
647
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>';
646
+			$email  = give_get_payment_user_email($payment->ID);
647
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>';
648 648
 		}
649 649
 
650
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
650
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
651 651
 	}
652 652
 
653 653
 	/**
@@ -660,20 +660,20 @@  discard block
 block discarded – undo
660 660
 	 */
661 661
 	public function get_bulk_actions() {
662 662
 		$actions = array(
663
-			'delete'                 => __( 'Delete', 'give' ),
664
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
665
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
666
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
667
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
668
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
669
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
670
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
671
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
672
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
673
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
663
+			'delete'                 => __('Delete', 'give'),
664
+			'set-status-publish'     => __('Set To Completed', 'give'),
665
+			'set-status-pending'     => __('Set To Pending', 'give'),
666
+			'set-status-processing'  => __('Set To Processing', 'give'),
667
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
668
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
669
+			'set-status-failed'      => __('Set To Failed', 'give'),
670
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
671
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
672
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
673
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
674 674
 		);
675 675
 
676
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
676
+		return apply_filters('give_payments_table_bulk_actions', $actions);
677 677
 	}
678 678
 
679 679
 	/**
@@ -685,63 +685,63 @@  discard block
 block discarded – undo
685 685
 	 * @return void
686 686
 	 */
687 687
 	public function process_bulk_action() {
688
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
688
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
689 689
 		$action = $this->current_action();
690 690
 
691
-		if ( ! is_array( $ids ) ) {
692
-			$ids = array( $ids );
691
+		if ( ! is_array($ids)) {
692
+			$ids = array($ids);
693 693
 		}
694 694
 
695
-		if ( empty( $action ) ) {
695
+		if (empty($action)) {
696 696
 			return;
697 697
 		}
698 698
 
699
-		foreach ( $ids as $id ) {
699
+		foreach ($ids as $id) {
700 700
 
701 701
 			// Detect when a bulk action is being triggered.
702
-			switch ( $this->current_action() ) {
702
+			switch ($this->current_action()) {
703 703
 
704 704
 				case 'delete':
705
-					give_delete_donation( $id );
705
+					give_delete_donation($id);
706 706
 					break;
707 707
 
708 708
 				case 'set-status-publish':
709
-					give_update_payment_status( $id, 'publish' );
709
+					give_update_payment_status($id, 'publish');
710 710
 					break;
711 711
 
712 712
 				case 'set-status-pending':
713
-					give_update_payment_status( $id, 'pending' );
713
+					give_update_payment_status($id, 'pending');
714 714
 					break;
715 715
 
716 716
 				case 'set-status-processing':
717
-					give_update_payment_status( $id, 'processing' );
717
+					give_update_payment_status($id, 'processing');
718 718
 					break;
719 719
 
720 720
 				case 'set-status-refunded':
721
-					give_update_payment_status( $id, 'refunded' );
721
+					give_update_payment_status($id, 'refunded');
722 722
 					break;
723 723
 				case 'set-status-revoked':
724
-					give_update_payment_status( $id, 'revoked' );
724
+					give_update_payment_status($id, 'revoked');
725 725
 					break;
726 726
 
727 727
 				case 'set-status-failed':
728
-					give_update_payment_status( $id, 'failed' );
728
+					give_update_payment_status($id, 'failed');
729 729
 					break;
730 730
 
731 731
 				case 'set-status-cancelled':
732
-					give_update_payment_status( $id, 'cancelled' );
732
+					give_update_payment_status($id, 'cancelled');
733 733
 					break;
734 734
 
735 735
 				case 'set-status-abandoned':
736
-					give_update_payment_status( $id, 'abandoned' );
736
+					give_update_payment_status($id, 'abandoned');
737 737
 					break;
738 738
 
739 739
 				case 'set-status-preapproval':
740
-					give_update_payment_status( $id, 'preapproval' );
740
+					give_update_payment_status($id, 'preapproval');
741 741
 					break;
742 742
 
743 743
 				case 'resend-receipt':
744
-					give_email_donation_receipt( $id, false );
744
+					give_email_donation_receipt($id, false);
745 745
 					break;
746 746
 			}// End switch().
747 747
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 			 *
754 754
 			 * @since 1.7
755 755
 			 */
756
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
756
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
757 757
 		}// End foreach().
758 758
 
759 759
 	}
@@ -770,32 +770,32 @@  discard block
 block discarded – undo
770 770
 
771 771
 		$args = array();
772 772
 
773
-		if ( isset( $_GET['user'] ) ) {
774
-			$args['user'] = urldecode( $_GET['user'] );
775
-		} elseif ( isset( $_GET['donor'] ) ) {
776
-			$args['donor'] = absint( $_GET['donor'] );
777
-		} elseif ( isset( $_GET['s'] ) ) {
778
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
779
-			if ( $is_user ) {
780
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
781
-				unset( $args['s'] );
773
+		if (isset($_GET['user'])) {
774
+			$args['user'] = urldecode($_GET['user']);
775
+		} elseif (isset($_GET['donor'])) {
776
+			$args['donor'] = absint($_GET['donor']);
777
+		} elseif (isset($_GET['s'])) {
778
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
779
+			if ($is_user) {
780
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
781
+				unset($args['s']);
782 782
 			} else {
783
-				$args['s'] = sanitize_text_field( $_GET['s'] );
783
+				$args['s'] = sanitize_text_field($_GET['s']);
784 784
 			}
785 785
 		}
786 786
 
787
-		if ( ! empty( $_GET['start-date'] ) ) {
788
-			$args['start-date'] = urldecode( $_GET['start-date'] );
787
+		if ( ! empty($_GET['start-date'])) {
788
+			$args['start-date'] = urldecode($_GET['start-date']);
789 789
 		}
790 790
 
791
-		if ( ! empty( $_GET['end-date'] ) ) {
792
-			$args['end-date'] = urldecode( $_GET['end-date'] );
791
+		if ( ! empty($_GET['end-date'])) {
792
+			$args['end-date'] = urldecode($_GET['end-date']);
793 793
 		}
794 794
 
795
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
796
-		$args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
795
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
796
+		$args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
797 797
 
798
-		$payment_count           = give_count_payments( $args );
798
+		$payment_count           = give_count_payments($args);
799 799
 		$this->complete_count    = $payment_count->publish;
800 800
 		$this->pending_count     = $payment_count->pending;
801 801
 		$this->processing_count  = $payment_count->processing;
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		$this->abandoned_count   = $payment_count->abandoned;
807 807
 		$this->preapproval_count = $payment_count->preapproval;
808 808
 
809
-		foreach ( $payment_count as $count ) {
809
+		foreach ($payment_count as $count) {
810 810
 			$this->total_count += $count;
811 811
 		}
812 812
 
@@ -824,29 +824,29 @@  discard block
 block discarded – undo
824 824
 	public function payments_data() {
825 825
 
826 826
 		$per_page   = $this->per_page;
827
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
828
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
829
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
830
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
831
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
832
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
833
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
834
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
835
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
836
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
837
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
838
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
839
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
840
-		$gateway    = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null;
841
-
842
-		if ( ! empty( $search ) ) {
827
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
828
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
829
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
830
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
831
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
832
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
833
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
834
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
835
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
836
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
837
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
838
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
839
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
840
+		$gateway    = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null;
841
+
842
+		if ( ! empty($search)) {
843 843
 			$status = 'any'; // Force all payment statuses when searching.
844 844
 		}
845 845
 
846 846
 		$args = array(
847 847
 			'output'     => 'payments',
848 848
 			'number'     => $per_page,
849
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
849
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
850 850
 			'orderby'    => $orderby,
851 851
 			'order'      => $order,
852 852
 			'user'       => $user,
@@ -863,12 +863,12 @@  discard block
 block discarded – undo
863 863
 			'give_forms' => $form_id,
864 864
 		);
865 865
 
866
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
866
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
867 867
 			$args['search_in_notes'] = true;
868
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
868
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
869 869
 		}
870 870
 
871
-		$p_query = new Give_Payments_Query( $args );
871
+		$p_query = new Give_Payments_Query($args);
872 872
 
873 873
 		return $p_query->get_payments();
874 874
 
@@ -889,17 +889,17 @@  discard block
 block discarded – undo
889 889
 	 */
890 890
 	public function prepare_items() {
891 891
 
892
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
892
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
893 893
 
894 894
 		$columns  = $this->get_columns();
895 895
 		$hidden   = array(); // No hidden columns.
896 896
 		$sortable = $this->get_sortable_columns();
897 897
 		$data     = $this->payments_data();
898
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
898
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
899 899
 
900
-		$this->_column_headers = array( $columns, $hidden, $sortable );
900
+		$this->_column_headers = array($columns, $hidden, $sortable);
901 901
 
902
-		switch ( $status ) {
902
+		switch ($status) {
903 903
 			case 'publish':
904 904
 				$total_items = $this->complete_count;
905 905
 				break;
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
 				break;
933 933
 			default:
934 934
 				// Retrieve the count of the non-default-Give status.
935
-				$count       = wp_count_posts( 'give_payment' );
936
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
935
+				$count       = wp_count_posts('give_payment');
936
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
937 937
 				break;
938 938
 		}
939 939
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 				// We have to calculate the total number of items.
946 946
 				'per_page'    => $this->per_page,
947 947
 				// We have to determine how many items to show on a page.
948
-				'total_pages' => ceil( $total_items / $this->per_page ),
948
+				'total_pages' => ceil($total_items / $this->per_page),
949 949
 			// We have to calculate the total number of pages.
950 950
 			)
951 951
 		);
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -521,7 +521,7 @@
 block discarded – undo
521 521
  *
522 522
  * @since 1.8.17
523 523
  *
524
- * @return bool
524
+ * @return false|null
525 525
  */
526 526
 function give_confirm_email_for_donation_access() {
527 527
 
Please login to merge, or discard this patch.
Spacing   +126 added lines, -126 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
 
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed.
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
37 37
 			}
38 38
 		} else {
39 39
 
40
-			if ( 'on' === $airplane->check_status() ) {
40
+			if ('on' === $airplane->check_status()) {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( Give_Cache::get( '_give_ajax_works', true ) ) {
48
+	if (Give_Cache::get('_give_ajax_works', true)) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		),
58 58
 	);
59 59
 
60
-	$ajax = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax = wp_remote_post(give_get_ajax_url(), $params);
61 61
 
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
84 84
 		}
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true );
87
+	if ($works) {
88
+		Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  * @return string
101 101
  */
102 102
 function give_get_ajax_url() {
103
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
103
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
104 104
 
105 105
 	$current_url = give_get_current_page_url();
106
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
106
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
107 107
 
108
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
109
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
108
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
109
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
110 110
 	}
111 111
 
112
-	return apply_filters( 'give_ajax_url', $ajax_url );
112
+	return apply_filters('give_ajax_url', $ajax_url);
113 113
 }
114 114
 
115 115
 /**
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @since 1.7
127 127
 	 */
128
-	do_action( 'give_donation_form_login_fields' );
128
+	do_action('give_donation_form_login_fields');
129 129
 
130 130
 	give_die();
131 131
 }
132 132
 
133
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
133
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
134 134
 
135 135
 /**
136 136
  * Load Checkout Fields
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * @return void
141 141
  */
142 142
 function give_load_checkout_fields() {
143
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
143
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
144 144
 
145 145
 	ob_start();
146 146
 
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @since 1.7
151 151
 	 */
152
-	do_action( 'give_donation_form_register_login_fields', $form_id );
152
+	do_action('give_donation_form_register_login_fields', $form_id);
153 153
 
154 154
 	$fields = ob_get_clean();
155 155
 
156
-	wp_send_json( array(
157
-		'fields' => wp_json_encode( $fields ),
158
-		'submit' => wp_json_encode( give_get_donation_form_submit_button( $form_id ) ),
159
-	) );
156
+	wp_send_json(array(
157
+		'fields' => wp_json_encode($fields),
158
+		'submit' => wp_json_encode(give_get_donation_form_submit_button($form_id)),
159
+	));
160 160
 }
161 161
 
162
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
163
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
162
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
163
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
164 164
 
165 165
 /**
166 166
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
  * @return void
171 171
  */
172 172
 function give_ajax_get_form_title() {
173
-	if ( isset( $_POST['form_id'] ) ) {
174
-		$title = get_the_title( $_POST['form_id'] );
175
-		if ( $title ) {
173
+	if (isset($_POST['form_id'])) {
174
+		$title = get_the_title($_POST['form_id']);
175
+		if ($title) {
176 176
 			echo $title;
177 177
 		} else {
178 178
 			echo 'fail';
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	give_die();
182 182
 }
183 183
 
184
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
185
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
184
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
185
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
186 186
 
187 187
 /**
188 188
  * Retrieve a states drop down
@@ -196,41 +196,41 @@  discard block
 block discarded – undo
196 196
 	$show_field     = true;
197 197
 	$states_require = true;
198 198
 	// Get the Country code from the $_POST.
199
-	$country = sanitize_text_field( $_POST['country'] );
199
+	$country = sanitize_text_field($_POST['country']);
200 200
 
201 201
 	// Get the field name from the $_POST.
202
-	$field_name = sanitize_text_field( $_POST['field_name'] );
202
+	$field_name = sanitize_text_field($_POST['field_name']);
203 203
 
204
-	$label        = __( 'State', 'give' );
204
+	$label        = __('State', 'give');
205 205
 	$states_label = give_get_states_label();
206 206
 
207 207
 	$default_state = '';
208
-	if ( $country === give_get_country() ) {
208
+	if ($country === give_get_country()) {
209 209
 		$default_state = give_get_state();
210 210
 	}
211 211
 
212 212
 	// Check if $country code exists in the array key for states label.
213
-	if ( array_key_exists( $country, $states_label ) ) {
214
-		$label = $states_label[ $country ];
213
+	if (array_key_exists($country, $states_label)) {
214
+		$label = $states_label[$country];
215 215
 	}
216 216
 
217
-	if ( empty( $country ) ) {
217
+	if (empty($country)) {
218 218
 		$country = give_get_country();
219 219
 	}
220 220
 
221
-	$states = give_get_states( $country );
222
-	if ( ! empty( $states ) ) {
223
-		$args         = array(
221
+	$states = give_get_states($country);
222
+	if ( ! empty($states)) {
223
+		$args = array(
224 224
 			'name'             => $field_name,
225 225
 			'id'               => $field_name,
226
-			'class'            => $field_name . '  give-select',
226
+			'class'            => $field_name.'  give-select',
227 227
 			'options'          => $states,
228 228
 			'show_option_all'  => false,
229 229
 			'show_option_none' => false,
230 230
 			'placeholder'      => $label,
231 231
 			'selected'         => $default_state,
232 232
 		);
233
-		$data         = Give()->html->select( $args );
233
+		$data         = Give()->html->select($args);
234 234
 		$states_found = true;
235 235
 	} else {
236 236
 		$data = 'nostates';
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$no_states_country = give_no_states_country_list();
240 240
 
241 241
 		// Check if $country code exists in the array key.
242
-		if ( array_key_exists( $country, $no_states_country ) ) {
242
+		if (array_key_exists($country, $no_states_country)) {
243 243
 			$show_field = false;
244 244
 		}
245 245
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$states_not_required_country_list = give_states_not_required_country_list();
248 248
 
249 249
 		// Check if $country code exists in the array key.
250
-		if ( array_key_exists( $country, $states_not_required_country_list ) ) {
250
+		if (array_key_exists($country, $states_not_required_country_list)) {
251 251
 			$states_require = false;
252 252
 		}
253 253
 	}
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 		'data'           => $data,
261 261
 		'default_state'  => $default_state,
262 262
 	);
263
-	wp_send_json( $response );
263
+	wp_send_json($response);
264 264
 }
265 265
 
266
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
267
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
266
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
267
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
268 268
 
269 269
 /**
270 270
  * Retrieve donation forms via AJAX for chosen dropdown search field.
@@ -276,19 +276,19 @@  discard block
 block discarded – undo
276 276
 function give_ajax_form_search() {
277 277
 	global $wpdb;
278 278
 
279
-	$search   = esc_sql( sanitize_text_field( $_GET['s'] ) );
280
-	$excludes = ( isset( $_GET['current_id'] ) ? (array) $_GET['current_id'] : array() );
279
+	$search   = esc_sql(sanitize_text_field($_GET['s']));
280
+	$excludes = (isset($_GET['current_id']) ? (array) $_GET['current_id'] : array());
281 281
 
282 282
 	$results = array();
283
-	if ( current_user_can( 'edit_give_forms' ) ) {
284
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
283
+	if (current_user_can('edit_give_forms')) {
284
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
285 285
 	} else {
286
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
286
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
287 287
 	}
288 288
 
289
-	if ( $items ) {
289
+	if ($items) {
290 290
 
291
-		foreach ( $items as $item ) {
291
+		foreach ($items as $item) {
292 292
 
293 293
 			$results[] = array(
294 294
 				'id'   => $item->ID,
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 
300 300
 		$items[] = array(
301 301
 			'id'   => 0,
302
-			'name' => __( 'No forms found.', 'give' ),
302
+			'name' => __('No forms found.', 'give'),
303 303
 		);
304 304
 
305 305
 	}
306 306
 
307
-	echo json_encode( $results );
307
+	echo json_encode($results);
308 308
 
309 309
 	give_die();
310 310
 }
311 311
 
312
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
313
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
312
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
313
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
314 314
 
315 315
 /**
316 316
  * Search the donors database via Ajax
@@ -322,38 +322,38 @@  discard block
 block discarded – undo
322 322
 function give_ajax_donor_search() {
323 323
 	global $wpdb;
324 324
 
325
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
325
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
326 326
 	$results = array();
327
-	if ( ! current_user_can( 'view_give_reports' ) ) {
327
+	if ( ! current_user_can('view_give_reports')) {
328 328
 		$donors = array();
329 329
 	} else {
330
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
330
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
331 331
 	}
332 332
 
333
-	if ( $donors ) {
333
+	if ($donors) {
334 334
 
335
-		foreach ( $donors as $donor ) {
335
+		foreach ($donors as $donor) {
336 336
 
337 337
 			$results[] = array(
338 338
 				'id'   => $donor->id,
339
-				'name' => $donor->name . ' (' . $donor->email . ')',
339
+				'name' => $donor->name.' ('.$donor->email.')',
340 340
 			);
341 341
 		}
342 342
 	} else {
343 343
 
344 344
 		$donors[] = array(
345 345
 			'id'   => 0,
346
-			'name' => __( 'No donors found.', 'give' ),
346
+			'name' => __('No donors found.', 'give'),
347 347
 		);
348 348
 
349 349
 	}
350 350
 
351
-	echo json_encode( $results );
351
+	echo json_encode($results);
352 352
 
353 353
 	give_die();
354 354
 }
355 355
 
356
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
356
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
357 357
 
358 358
 
359 359
 /**
@@ -365,39 +365,39 @@  discard block
 block discarded – undo
365 365
  */
366 366
 function give_ajax_search_users() {
367 367
 
368
-	if ( current_user_can( 'manage_give_settings' ) ) {
368
+	if (current_user_can('manage_give_settings')) {
369 369
 
370
-		$search = esc_sql( sanitize_text_field( $_GET['s'] ) );
370
+		$search = esc_sql(sanitize_text_field($_GET['s']));
371 371
 
372 372
 		$get_users_args = array(
373 373
 			'number' => 9999,
374
-			'search' => $search . '*',
374
+			'search' => $search.'*',
375 375
 		);
376 376
 
377
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
377
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
378 378
 
379
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search );
379
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search);
380 380
 		$results     = array();
381 381
 
382
-		if ( $found_users ) {
382
+		if ($found_users) {
383 383
 
384
-			foreach ( $found_users as $user ) {
384
+			foreach ($found_users as $user) {
385 385
 
386 386
 				$results[] = array(
387 387
 					'id'   => $user->ID,
388
-					'name' => esc_html( $user->user_login . ' (' . $user->user_email . ')' ),
388
+					'name' => esc_html($user->user_login.' ('.$user->user_email.')'),
389 389
 				);
390 390
 			}
391 391
 		} else {
392 392
 
393 393
 			$results[] = array(
394 394
 				'id'   => 0,
395
-				'name' => __( 'No users found.', 'give' ),
395
+				'name' => __('No users found.', 'give'),
396 396
 			);
397 397
 
398 398
 		}
399 399
 
400
-		echo json_encode( $results );
400
+		echo json_encode($results);
401 401
 
402 402
 	}// End if().
403 403
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
 }
407 407
 
408
-add_action( 'wp_ajax_give_user_search', 'give_ajax_search_users' );
408
+add_action('wp_ajax_give_user_search', 'give_ajax_search_users');
409 409
 
410 410
 
411 411
 /**
@@ -417,32 +417,32 @@  discard block
 block discarded – undo
417 417
  */
418 418
 function give_check_for_form_price_variations() {
419 419
 
420
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
421
-		die( '-1' );
420
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
421
+		die('-1');
422 422
 	}
423 423
 
424
-	$form_id = intval( $_POST['form_id'] );
425
-	$form    = get_post( $form_id );
424
+	$form_id = intval($_POST['form_id']);
425
+	$form    = get_post($form_id);
426 426
 
427
-	if ( 'give_forms' != $form->post_type ) {
428
-		die( '-2' );
427
+	if ('give_forms' != $form->post_type) {
428
+		die('-2');
429 429
 	}
430 430
 
431
-	if ( give_has_variable_prices( $form_id ) ) {
432
-		$variable_prices = give_get_variable_prices( $form_id );
431
+	if (give_has_variable_prices($form_id)) {
432
+		$variable_prices = give_get_variable_prices($form_id);
433 433
 
434
-		if ( $variable_prices ) {
434
+		if ($variable_prices) {
435 435
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
436 436
 
437
-			if ( isset( $_POST['all_prices'] ) ) {
438
-				$ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>';
437
+			if (isset($_POST['all_prices'])) {
438
+				$ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>';
439 439
 			}
440 440
 
441
-			foreach ( $variable_prices as $key => $price ) {
441
+			foreach ($variable_prices as $key => $price) {
442 442
 
443
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) );
443
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)));
444 444
 
445
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
445
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
446 446
 			}
447 447
 			$ajax_response .= '</select>';
448 448
 			echo $ajax_response;
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	give_die();
453 453
 }
454 454
 
455
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
455
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
456 456
 
457 457
 
458 458
 /**
@@ -463,28 +463,28 @@  discard block
 block discarded – undo
463 463
  * @return void
464 464
  */
465 465
 function give_check_for_form_price_variations_html() {
466
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
466
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
467 467
 		wp_die();
468 468
 	}
469 469
 
470
-	$form_id    = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : false;
471
-	$payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : false;
472
-	if ( empty( $form_id ) || empty( $payment_id ) ) {
470
+	$form_id    = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : false;
471
+	$payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : false;
472
+	if (empty($form_id) || empty($payment_id)) {
473 473
 		wp_die();
474 474
 	}
475 475
 
476
-	$form = get_post( $form_id );
477
-	if ( ! empty( $form->post_type ) && 'give_forms' != $form->post_type ) {
476
+	$form = get_post($form_id);
477
+	if ( ! empty($form->post_type) && 'give_forms' != $form->post_type) {
478 478
 		wp_die();
479 479
 	}
480 480
 
481
-	if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) {
482
-		esc_html_e( 'n/a', 'give' );
481
+	if ( ! give_has_variable_prices($form_id) || ! $form_id) {
482
+		esc_html_e('n/a', 'give');
483 483
 	} else {
484 484
 		$prices_atts = array();
485
-		if ( $variable_prices = give_get_variable_prices( $form_id ) ) {
486
-			foreach ( $variable_prices as $variable_price ) {
487
-				$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
485
+		if ($variable_prices = give_get_variable_prices($form_id)) {
486
+			foreach ($variable_prices as $variable_price) {
487
+				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
488 488
 			}
489 489
 		}
490 490
 
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 			'chosen'           => true,
496 496
 			'show_option_all'  => '',
497 497
 			'show_option_none' => '',
498
-			'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
498
+			'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
499 499
 		);
500 500
 
501
-		if ( $payment_id ) {
501
+		if ($payment_id) {
502 502
 			// Payment object.
503
-			$payment = new Give_Payment( $payment_id );
503
+			$payment = new Give_Payment($payment_id);
504 504
 
505 505
 			// Payment meta.
506 506
 			$payment_meta                               = $payment->get_meta();
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
 		}
509 509
 
510 510
 		// Render variable prices select tag html.
511
-		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
511
+		give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
512 512
 	}
513 513
 
514 514
 	give_die();
515 515
 }
516 516
 
517
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
517
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
518 518
 
519 519
 /**
520 520
  * Send Confirmation Email For Complete Donation History Access.
@@ -526,24 +526,24 @@  discard block
 block discarded – undo
526 526
 function give_confirm_email_for_donation_access() {
527 527
 
528 528
 	// Verify Security using Nonce.
529
-	if ( ! check_ajax_referer( 'give_ajax_nonce', 'nonce' ) ) {
529
+	if ( ! check_ajax_referer('give_ajax_nonce', 'nonce')) {
530 530
 		return false;
531 531
 	}
532 532
 
533 533
 	// Bail Out, if email is empty.
534
-	if ( empty( $_POST['email'] ) ) {
534
+	if (empty($_POST['email'])) {
535 535
 		return false;
536 536
 	}
537 537
 
538
-	$donor = Give()->donors->get_donor_by( 'email', $_POST['email'] );
539
-	if ( Give()->email_access->can_send_email( $donor->id ) ) {
538
+	$donor = Give()->donors->get_donor_by('email', $_POST['email']);
539
+	if (Give()->email_access->can_send_email($donor->id)) {
540 540
 		$return     = array();
541
-		$email_sent = Give()->email_access->send_email( $donor->id, $donor->email );
541
+		$email_sent = Give()->email_access->send_email($donor->id, $donor->email);
542 542
 
543
-		if ( ! $email_sent ) {
543
+		if ( ! $email_sent) {
544 544
 			$return['status']  = 'error';
545 545
 			$return['message'] = Give()->notices->print_frontend_notice(
546
-				__( 'Unable to send email. Please try again.', 'give' ),
546
+				__('Unable to send email. Please try again.', 'give'),
547 547
 				false,
548 548
 				'error'
549 549
 			);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 
552 552
 		$return['status']  = 'success';
553 553
 		$return['message'] = Give()->notices->print_frontend_notice(
554
-			__( 'Please check your email and click on the link to access your complete donation history.', 'give' ),
554
+			__('Please check your email and click on the link to access your complete donation history.', 'give'),
555 555
 			false,
556 556
 			'success'
557 557
 		);
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
 		$return['status']  = 'error';
563 563
 		$return['message'] = Give()->notices->print_frontend_notice(
564 564
 			sprintf(
565
-				__( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
566
-				sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
565
+				__('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'),
566
+				sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value)
567 567
 			),
568 568
 			false,
569 569
 			'error'
570 570
 		);
571 571
 	}
572 572
 
573
-	echo json_encode( $return );
573
+	echo json_encode($return);
574 574
 	give_die();
575 575
 }
576 576
 
577
-add_action( 'wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access' );
578 577
\ No newline at end of file
578
+add_action('wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access');
579 579
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-email-access.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@
 block discarded – undo
242 242
 	 * @since  1.0
243 243
 	 * @access public
244 244
 	 *
245
-	 * @return bool
245
+	 * @return boolean|null
246 246
 	 */
247 247
 	public function check_for_token() {
248 248
 
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 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
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function __construct() {
107 107
 
108 108
 		// get it started
109
-		add_action( 'init', array( $this, 'init' ) );
109
+		add_action('init', array($this, 'init'));
110 110
 	}
111 111
 
112 112
 	/**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	public function init() {
123 123
 
124 124
 		// Bail Out, if user is logged in.
125
-		if ( is_user_logged_in() ) {
125
+		if (is_user_logged_in()) {
126 126
 			return;
127 127
 		}
128 128
 
129 129
 		// Are db columns setup?
130
-		$is_setup = give_get_option( 'email_access_installed' );
131
-		if ( empty( $is_setup ) ) {
130
+		$is_setup = give_get_option('email_access_installed');
131
+		if (empty($is_setup)) {
132 132
 			$this->create_columns();
133 133
 		}
134 134
 
135 135
 		// Timeouts.
136
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
137
-		$this->limit_throttle   = apply_filters( 'give_nl_limit_throttle', 3 );
138
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
136
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
137
+		$this->limit_throttle   = apply_filters('give_nl_limit_throttle', 3);
138
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
139 139
 
140 140
 		// Setup login.
141 141
 		$this->check_for_token();
142 142
 
143
-		if ( $this->token_exists ) {
144
-			add_filter( 'give_can_view_receipt', '__return_true' );
145
-			add_filter( 'give_user_pending_verification', '__return_false' );
146
-			add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
143
+		if ($this->token_exists) {
144
+			add_filter('give_can_view_receipt', '__return_true');
145
+			add_filter('give_user_pending_verification', '__return_false');
146
+			add_filter('give_get_users_donations_args', array($this, 'users_donations_args'));
147 147
 		}
148 148
 
149 149
 	}
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return bool
160 160
 	 */
161
-	public function can_send_email( $donor_id ) {
161
+	public function can_send_email($donor_id) {
162 162
 
163
-		$donor = Give()->donors->get_donor_by( 'id', $donor_id );
163
+		$donor = Give()->donors->get_donor_by('id', $donor_id);
164 164
 
165
-		if ( is_object( $donor ) && count( $donor ) > 0 ) {
165
+		if (is_object($donor) && count($donor) > 0) {
166 166
 
167
-			$email_throttle_count = (int) give_get_meta( $donor_id, '_give_email_throttle_count', true );
167
+			$email_throttle_count = (int) give_get_meta($donor_id, '_give_email_throttle_count', true);
168 168
 
169 169
 			$cache_key = "give_cache_email_throttle_limit_exhausted_{$donor_id}";
170 170
 			if (
171 171
 				$email_throttle_count < $this->limit_throttle &&
172
-				true !== Give_Cache::get( $cache_key )
172
+				true !== Give_Cache::get($cache_key)
173 173
 			) {
174
-				give_update_meta( $donor_id, '_give_email_throttle_count', $email_throttle_count + 1 );
174
+				give_update_meta($donor_id, '_give_email_throttle_count', $email_throttle_count + 1);
175 175
 			} else {
176
-				give_update_meta( $donor_id, '_give_email_throttle_count', 0 );
177
-				Give_Cache::set( $cache_key, true, $this->verify_throttle );
176
+				give_update_meta($donor_id, '_give_email_throttle_count', 0);
177
+				Give_Cache::set($cache_key, true, $this->verify_throttle);
178 178
 				return false;
179 179
 			}
180 180
 
@@ -194,45 +194,45 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return bool
196 196
 	 */
197
-	public function send_email( $customer_id, $email ) {
197
+	public function send_email($customer_id, $email) {
198 198
 
199
-		$verify_key = wp_generate_password( 20, false );
199
+		$verify_key = wp_generate_password(20, false);
200 200
 
201 201
 		// Generate a new verify key
202
-		$this->set_verify_key( $customer_id, $email, $verify_key );
202
+		$this->set_verify_key($customer_id, $email, $verify_key);
203 203
 
204
-		$access_url = add_query_arg( array(
204
+		$access_url = add_query_arg(array(
205 205
 			'give_nl' => $verify_key,
206
-		), give_get_history_page_uri() );
206
+		), give_get_history_page_uri());
207 207
 
208
-		if ( ! empty( $_GET['payment_key'] ) ) {
209
-			$access_url = add_query_arg( array(
210
-				'payment_key' => give_clean( $_GET['payment_key'] ),
211
-			), $access_url );
208
+		if ( ! empty($_GET['payment_key'])) {
209
+			$access_url = add_query_arg(array(
210
+				'payment_key' => give_clean($_GET['payment_key']),
211
+			), $access_url);
212 212
 		}
213 213
 
214 214
 		// Nice subject and message.
215
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ) );
215
+		$subject = apply_filters('give_email_access_token_subject', sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')));
216 216
 
217 217
 		$message = sprintf(
218
-			__( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ),
219
-			get_bloginfo( 'url' ),
220
-			get_bloginfo( 'admin_email' )
221
-		) . "\n\n";
218
+			__('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'),
219
+			get_bloginfo('url'),
220
+			get_bloginfo('admin_email')
221
+		)."\n\n";
222 222
 		$message .= sprintf(
223
-			__( '<a href="%s" target="_blank">%s</a>', 'give' ),
224
-			esc_url( $access_url ),
225
-			__( 'View your donation history &raquo;', 'give' )
226
-		) . "\n\n";
223
+			__('<a href="%s" target="_blank">%s</a>', 'give'),
224
+			esc_url($access_url),
225
+			__('View your donation history &raquo;', 'give')
226
+		)."\n\n";
227 227
 		$message .= "\n\n";
228
-		$message .= __( 'Sincerely,', 'give' ) . "\n";
229
-		$message .= get_bloginfo( 'name' ) . "\n";
228
+		$message .= __('Sincerely,', 'give')."\n";
229
+		$message .= get_bloginfo('name')."\n";
230 230
 
231
-		$message = apply_filters( 'give_email_access_token_message', $message );
231
+		$message = apply_filters('give_email_access_token_message', $message);
232 232
 
233 233
 		// Send the email.
234
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Confirm Email', 'give' ) ) );
235
-		return Give()->emails->send( $email, $subject, $message );
234
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Confirm Email', 'give')));
235
+		return Give()->emails->send($email, $subject, $message);
236 236
 
237 237
 	}
238 238
 
@@ -246,28 +246,28 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function check_for_token() {
248 248
 
249
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
249
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
250 250
 
251 251
 		// Check for cookie.
252
-		if ( empty( $token ) ) {
253
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
252
+		if (empty($token)) {
253
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
254 254
 		}
255 255
 
256 256
 		// Must have a token.
257
-		if ( ! empty( $token ) ) {
257
+		if ( ! empty($token)) {
258 258
 
259
-			if ( ! $this->is_valid_token( $token ) ) {
260
-				if ( ! $this->is_valid_verify_key( $token ) ) {
259
+			if ( ! $this->is_valid_token($token)) {
260
+				if ( ! $this->is_valid_verify_key($token)) {
261 261
 					return false;
262 262
 				}
263 263
 			}
264 264
 
265 265
 			// Set Receipt Access Session.
266
-			Give()->session->set( 'receipt_access', true );
266
+			Give()->session->set('receipt_access', true);
267 267
 			$this->token_exists = true;
268 268
 			// Set cookie.
269
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
270
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
269
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
270
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
271 271
 
272 272
 			return true;
273 273
 		}
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return bool
285 285
 	 */
286
-	public function is_valid_token( $token ) {
286
+	public function is_valid_token($token) {
287 287
 
288 288
 		global $wpdb;
289 289
 
290 290
 		// Make sure token isn't expired.
291
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
291
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
292 292
 
293 293
 		$email = $wpdb->get_var(
294
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
294
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
295 295
 		);
296 296
 
297
-		if ( ! empty( $email ) ) {
297
+		if ( ! empty($email)) {
298 298
 			$this->token_email = $email;
299 299
 			$this->token       = $token;
300 300
 			return true;
301 301
 		}
302 302
 
303 303
 		// Set error only if email access form isn't being submitted.
304
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
305
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) );
304
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
305
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give')));
306 306
 		}
307 307
 
308 308
 		return false;
@@ -321,25 +321,25 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return void
323 323
 	 */
324
-	public function set_verify_key( $customer_id, $email, $verify_key ) {
324
+	public function set_verify_key($customer_id, $email, $verify_key) {
325 325
 		global $wpdb;
326 326
 
327
-		$now = date( 'Y-m-d H:i:s' );
327
+		$now = date('Y-m-d H:i:s');
328 328
 
329 329
 		// Insert or update?
330 330
 		$row_id = (int) $wpdb->get_var(
331
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
331
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
332 332
 		);
333 333
 
334 334
 		// Update.
335
-		if ( ! empty( $row_id ) ) {
335
+		if ( ! empty($row_id)) {
336 336
 			$wpdb->query(
337
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
337
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
338 338
 			);
339 339
 		} // Insert.
340 340
 		else {
341 341
 			$wpdb->query(
342
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
342
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
343 343
 			);
344 344
 		}
345 345
 	}
@@ -354,21 +354,21 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool
356 356
 	 */
357
-	public function is_valid_verify_key( $token ) {
357
+	public function is_valid_verify_key($token) {
358 358
 		/* @var WPDB $wpdb */
359 359
 		global $wpdb;
360 360
 
361 361
 		// See if the verify_key exists.
362 362
 		$row = $wpdb->get_row(
363
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
363
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
364 364
 		);
365 365
 
366
-		$now = date( 'Y-m-d H:i:s' );
366
+		$now = date('Y-m-d H:i:s');
367 367
 
368 368
 		// Set token and remove verify key.
369
-		if ( ! empty( $row ) ) {
369
+		if ( ! empty($row)) {
370 370
 			$wpdb->query(
371
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
371
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
372 372
 			);
373 373
 
374 374
 			$this->token_email = $row->email;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return mixed
394 394
 	 */
395
-	public function users_donations_args( $args ) {
395
+	public function users_donations_args($args) {
396 396
 		$args['user'] = $this->token_email;
397 397
 
398 398
 		return $args;
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 		global $wpdb;
414 414
 
415 415
 		// Create columns in customers table
416
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
416
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
417 417
 
418 418
 		// Columns added properly
419
-		if ( $query ) {
420
-			give_update_option( 'email_access_installed', 1 );
419
+		if ($query) {
420
+			give_update_option('email_access_installed', 1);
421 421
 		}
422 422
 
423 423
 	}
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @since  1.0
302 302
  * @since  1.8.16 Add security check
303 303
  *
304
- * @return bool
304
+ * @return false|null
305 305
  */
306 306
 function give_listen_for_failed_payments() {
307 307
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
  *
750 750
  * @param int $form_id ID number of the form to retrieve the minimum price for
751 751
  *
752
- * @return mixed string|int Minimum price of the form
752
+ * @return string string|int Minimum price of the form
753 753
  */
754 754
 function give_get_form_minimum_price( $form_id = 0 ) {
755 755
 
Please login to merge, or discard this patch.
Spacing   +216 added lines, -217 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -373,14 +372,14 @@  discard block
 block discarded – undo
373 372
  *
374 373
  * @return void
375 374
  */
376
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
375
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
377 376
 	global $give_logs;
378 377
 
379 378
 	$log_data = array(
380 379
 		'post_parent'   => $give_form_id,
381 380
 		'log_type'      => 'sale',
382
-		'post_date'     => isset( $donation_date ) ? $donation_date : null,
383
-		'post_date_gmt' => isset( $donation_date ) ? $donation_date : null,
381
+		'post_date'     => isset($donation_date) ? $donation_date : null,
382
+		'post_date_gmt' => isset($donation_date) ? $donation_date : null,
384 383
 	);
385 384
 
386 385
 	$log_meta = array(
@@ -388,7 +387,7 @@  discard block
 block discarded – undo
388 387
 		'price_id'   => (int) $price_id,
389 388
 	);
390 389
 
391
-	$give_logs->insert_log( $log_data, $log_meta );
390
+	$give_logs->insert_log($log_data, $log_meta);
392 391
 }
393 392
 
394 393
 
@@ -402,11 +401,11 @@  discard block
 block discarded – undo
402 401
  *
403 402
  * @return bool|int
404 403
  */
405
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
404
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
406 405
 	$quantity = (int) $quantity;
407
-	$form     = new Give_Donate_Form( $form_id );
406
+	$form     = new Give_Donate_Form($form_id);
408 407
 
409
-	return $form->increase_sales( $quantity );
408
+	return $form->increase_sales($quantity);
410 409
 }
411 410
 
412 411
 /**
@@ -419,11 +418,11 @@  discard block
 block discarded – undo
419 418
  *
420 419
  * @return bool|int
421 420
  */
422
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
421
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
423 422
 	$quantity = (int) $quantity;
424
-	$form     = new Give_Donate_Form( $form_id );
423
+	$form     = new Give_Donate_Form($form_id);
425 424
 
426
-	return $form->decrease_sales( $quantity );
425
+	return $form->decrease_sales($quantity);
427 426
 }
428 427
 
429 428
 /**
@@ -436,10 +435,10 @@  discard block
 block discarded – undo
436 435
  *
437 436
  * @return bool|int
438 437
  */
439
-function give_increase_earnings( $give_form_id = 0, $amount ) {
440
-	$form = new Give_Donate_Form( $give_form_id );
438
+function give_increase_earnings($give_form_id = 0, $amount) {
439
+	$form = new Give_Donate_Form($give_form_id);
441 440
 
442
-	return $form->increase_earnings( $amount );
441
+	return $form->increase_earnings($amount);
443 442
 }
444 443
 
445 444
 /**
@@ -454,11 +453,11 @@  discard block
 block discarded – undo
454 453
  *
455 454
  * @return bool|int
456 455
  */
457
-function give_decrease_form_earnings( $form_id = 0, $amount ) {
456
+function give_decrease_form_earnings($form_id = 0, $amount) {
458 457
 
459
-	$form = new Give_Donate_Form( $form_id );
458
+	$form = new Give_Donate_Form($form_id);
460 459
 
461
-	return $form->decrease_earnings( $amount );
460
+	return $form->decrease_earnings($amount);
462 461
 }
463 462
 
464 463
 
@@ -471,15 +470,15 @@  discard block
 block discarded – undo
471 470
  *
472 471
  * @return int $earnings Earnings for a certain form
473 472
  */
474
-function give_get_form_earnings_stats( $form_id = 0 ) {
475
-	$give_form = new Give_Donate_Form( $form_id );
473
+function give_get_form_earnings_stats($form_id = 0) {
474
+	$give_form = new Give_Donate_Form($form_id);
476 475
 
477 476
 	/**
478 477
 	 * Filter the form earnings
479 478
 	 *
480 479
 	 * @since 1.8.17
481 480
 	 */
482
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
481
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
483 482
 }
484 483
 
485 484
 
@@ -492,8 +491,8 @@  discard block
 block discarded – undo
492 491
  *
493 492
  * @return int $sales Amount of sales for a certain form
494 493
  */
495
-function give_get_form_sales_stats( $give_form_id = 0 ) {
496
-	$give_form = new Give_Donate_Form( $give_form_id );
494
+function give_get_form_sales_stats($give_form_id = 0) {
495
+	$give_form = new Give_Donate_Form($give_form_id);
497 496
 
498 497
 	return $give_form->sales;
499 498
 }
@@ -508,16 +507,16 @@  discard block
 block discarded – undo
508 507
  *
509 508
  * @return float $sales Average monthly sales
510 509
  */
511
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
512
-	$sales        = give_get_form_sales_stats( $form_id );
513
-	$release_date = get_post_field( 'post_date', $form_id );
510
+function give_get_average_monthly_form_sales($form_id = 0) {
511
+	$sales        = give_get_form_sales_stats($form_id);
512
+	$release_date = get_post_field('post_date', $form_id);
514 513
 
515
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
514
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
516 515
 
517
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
516
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
518 517
 
519
-	if ( $months > 0 ) {
520
-		$sales = ( $sales / $months );
518
+	if ($months > 0) {
519
+		$sales = ($sales / $months);
521 520
 	}
522 521
 
523 522
 	return $sales;
@@ -533,16 +532,16 @@  discard block
 block discarded – undo
533 532
  *
534 533
  * @return float $earnings Average monthly earnings
535 534
  */
536
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
537
-	$earnings     = give_get_form_earnings_stats( $form_id );
538
-	$release_date = get_post_field( 'post_date', $form_id );
535
+function give_get_average_monthly_form_earnings($form_id = 0) {
536
+	$earnings     = give_get_form_earnings_stats($form_id);
537
+	$release_date = get_post_field('post_date', $form_id);
539 538
 
540
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
539
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
541 540
 
542
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
541
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
543 542
 
544
-	if ( $months > 0 ) {
545
-		$earnings = ( $earnings / $months );
543
+	if ($months > 0) {
544
+		$earnings = ($earnings / $months);
546 545
 	}
547 546
 
548 547
 	return $earnings < 0 ? 0 : $earnings;
@@ -563,27 +562,27 @@  discard block
 block discarded – undo
563 562
  *
564 563
  * @return string $price_name Name of the price option
565 564
  */
566
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
565
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
567 566
 
568
-	$prices     = give_get_variable_prices( $form_id );
567
+	$prices     = give_get_variable_prices($form_id);
569 568
 	$price_name = '';
570 569
 
571
-	if ( false === $prices ) {
570
+	if (false === $prices) {
572 571
 		return $price_name;
573 572
 	}
574 573
 
575
-	foreach ( $prices as $price ) {
574
+	foreach ($prices as $price) {
576 575
 
577
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
576
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
578 577
 
579
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
580
-			$price_fallback = $use_fallback ? give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), '', true ) : '';
581
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
578
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
579
+			$price_fallback = $use_fallback ? give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), '', true) : '';
580
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
582 581
 
583 582
 		}
584 583
 	}
585 584
 
586
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
585
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
587 586
 }
588 587
 
589 588
 
@@ -597,25 +596,25 @@  discard block
 block discarded – undo
597 596
  *
598 597
  * @return string $range A fully formatted price range
599 598
  */
600
-function give_price_range( $form_id = 0, $formatted = true ) {
601
-	$low        = give_get_lowest_price_option( $form_id );
602
-	$high       = give_get_highest_price_option( $form_id );
603
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
599
+function give_price_range($form_id = 0, $formatted = true) {
600
+	$low        = give_get_lowest_price_option($form_id);
601
+	$high       = give_get_highest_price_option($form_id);
602
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
604 603
 
605 604
 	$range = sprintf(
606 605
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
607 606
 		'asc' === $order_type ? 'low' : 'high',
608
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
607
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
609 608
 		'asc' === $order_type ? 'high' : 'low',
610
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
609
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
611 610
 
612 611
 	);
613 612
 
614
-	if ( ! $formatted ) {
615
-		$range = wp_strip_all_tags( $range );
613
+	if ( ! $formatted) {
614
+		$range = wp_strip_all_tags($range);
616 615
 	}
617 616
 
618
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
617
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
619 618
 }
620 619
 
621 620
 
@@ -630,35 +629,35 @@  discard block
 block discarded – undo
630 629
  *
631 630
  * @return int ID of the lowest price
632 631
  */
633
-function give_get_lowest_price_id( $form_id = 0 ) {
632
+function give_get_lowest_price_id($form_id = 0) {
634 633
 
635
-	if ( empty( $form_id ) ) {
634
+	if (empty($form_id)) {
636 635
 		$form_id = get_the_ID();
637 636
 	}
638 637
 
639
-	if ( ! give_has_variable_prices( $form_id ) ) {
640
-		return give_get_form_price( $form_id );
638
+	if ( ! give_has_variable_prices($form_id)) {
639
+		return give_get_form_price($form_id);
641 640
 	}
642 641
 
643
-	$prices = give_get_variable_prices( $form_id );
642
+	$prices = give_get_variable_prices($form_id);
644 643
 
645 644
 	$min = $min_id = 0;
646 645
 
647
-	if ( ! empty( $prices ) ) {
646
+	if ( ! empty($prices)) {
648 647
 
649
-		foreach ( $prices as $key => $price ) {
648
+		foreach ($prices as $key => $price) {
650 649
 
651
-			if ( empty( $price['_give_amount'] ) ) {
650
+			if (empty($price['_give_amount'])) {
652 651
 				continue;
653 652
 			}
654 653
 
655
-			if ( ! isset( $min ) ) {
654
+			if ( ! isset($min)) {
656 655
 				$min = $price['_give_amount'];
657 656
 			} else {
658
-				$min = min( $min, $price['_give_amount'] );
657
+				$min = min($min, $price['_give_amount']);
659 658
 			}
660 659
 
661
-			if ( $price['_give_amount'] == $min ) {
660
+			if ($price['_give_amount'] == $min) {
662 661
 				$min_id = $price['_give_id']['level_id'];
663 662
 			}
664 663
 		}
@@ -676,22 +675,22 @@  discard block
 block discarded – undo
676 675
  *
677 676
  * @return float Amount of the lowest price
678 677
  */
679
-function give_get_lowest_price_option( $form_id = 0 ) {
680
-	if ( empty( $form_id ) ) {
678
+function give_get_lowest_price_option($form_id = 0) {
679
+	if (empty($form_id)) {
681 680
 		$form_id = get_the_ID();
682 681
 	}
683 682
 
684
-	if ( ! give_has_variable_prices( $form_id ) ) {
685
-		return give_get_form_price( $form_id );
683
+	if ( ! give_has_variable_prices($form_id)) {
684
+		return give_get_form_price($form_id);
686 685
 	}
687 686
 
688
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
687
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
689 688
 		// Backward compatibility.
690
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
691
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
689
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
690
+		$low    = ! empty($prices) ? min($prices) : 0;
692 691
 	}
693 692
 
694
-	return give_maybe_sanitize_amount( $low );
693
+	return give_maybe_sanitize_amount($low);
695 694
 }
696 695
 
697 696
 /**
@@ -703,23 +702,23 @@  discard block
 block discarded – undo
703 702
  *
704 703
  * @return float Amount of the highest price
705 704
  */
706
-function give_get_highest_price_option( $form_id = 0 ) {
705
+function give_get_highest_price_option($form_id = 0) {
707 706
 
708
-	if ( empty( $form_id ) ) {
707
+	if (empty($form_id)) {
709 708
 		$form_id = get_the_ID();
710 709
 	}
711 710
 
712
-	if ( ! give_has_variable_prices( $form_id ) ) {
713
-		return give_get_form_price( $form_id );
711
+	if ( ! give_has_variable_prices($form_id)) {
712
+		return give_get_form_price($form_id);
714 713
 	}
715 714
 
716
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
715
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
717 716
 		// Backward compatibility.
718
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
719
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
717
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
718
+		$high   = ! empty($prices) ? max($prices) : 0;
720 719
 	}
721 720
 
722
-	return give_maybe_sanitize_amount( $high );
721
+	return give_maybe_sanitize_amount($high);
723 722
 }
724 723
 
725 724
 /**
@@ -731,15 +730,15 @@  discard block
 block discarded – undo
731 730
  *
732 731
  * @return mixed string|int Price of the form
733 732
  */
734
-function give_get_form_price( $form_id = 0 ) {
733
+function give_get_form_price($form_id = 0) {
735 734
 
736
-	if ( empty( $form_id ) ) {
735
+	if (empty($form_id)) {
737 736
 		return false;
738 737
 	}
739 738
 
740
-	$form = new Give_Donate_Form( $form_id );
739
+	$form = new Give_Donate_Form($form_id);
741 740
 
742
-	return $form->__get( 'price' );
741
+	return $form->__get('price');
743 742
 }
744 743
 
745 744
 /**
@@ -751,13 +750,13 @@  discard block
 block discarded – undo
751 750
  *
752 751
  * @return mixed string|int Minimum price of the form
753 752
  */
754
-function give_get_form_minimum_price( $form_id = 0 ) {
753
+function give_get_form_minimum_price($form_id = 0) {
755 754
 
756
-	if ( empty( $form_id ) ) {
755
+	if (empty($form_id)) {
757 756
 		return false;
758 757
 	}
759 758
 
760
-	$form = new Give_Donate_Form( $form_id );
759
+	$form = new Give_Donate_Form($form_id);
761 760
 
762 761
 	return $form->get_minimum_price();
763 762
 
@@ -774,48 +773,48 @@  discard block
 block discarded – undo
774 773
  *
775 774
  * @return int $formatted_price
776 775
  */
777
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
776
+function give_price($form_id = 0, $echo = true, $price_id = false) {
778 777
 	$price = 0;
779 778
 
780
-	if ( empty( $form_id ) ) {
779
+	if (empty($form_id)) {
781 780
 		$form_id = get_the_ID();
782 781
 	}
783 782
 
784
-	if ( give_has_variable_prices( $form_id ) ) {
783
+	if (give_has_variable_prices($form_id)) {
785 784
 
786
-		$prices = give_get_variable_prices( $form_id );
785
+		$prices = give_get_variable_prices($form_id);
787 786
 
788
-		if ( false !== $price_id ) {
787
+		if (false !== $price_id) {
789 788
 
790 789
 			// loop through multi-prices to see which is default
791
-			foreach ( $prices as $price ) {
790
+			foreach ($prices as $price) {
792 791
 				// this is the default price
793
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
792
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
794 793
 					$price = (float) $price['_give_amount'];
795 794
 				};
796 795
 			}
797 796
 		} else {
798 797
 
799
-			$price = give_get_lowest_price_option( $form_id );
798
+			$price = give_get_lowest_price_option($form_id);
800 799
 		}
801 800
 	} else {
802 801
 
803
-		$price = give_get_form_price( $form_id );
802
+		$price = give_get_form_price($form_id);
804 803
 	}
805 804
 
806
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
807
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
808
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
805
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
806
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
807
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
809 808
 
810
-	if ( $echo ) {
809
+	if ($echo) {
811 810
 		echo $formatted_price;
812 811
 	} else {
813 812
 		return $formatted_price;
814 813
 	}
815 814
 }
816 815
 
817
-add_filter( 'give_form_price', 'give_format_amount', 10 );
818
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
816
+add_filter('give_form_price', 'give_format_amount', 10);
817
+add_filter('give_form_price', 'give_currency_filter', 20);
819 818
 
820 819
 
821 820
 /**
@@ -828,19 +827,19 @@  discard block
 block discarded – undo
828 827
  *
829 828
  * @return float $amount Amount of the price option
830 829
  */
831
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
832
-	$prices = give_get_variable_prices( $form_id );
830
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
831
+	$prices = give_get_variable_prices($form_id);
833 832
 
834 833
 	$amount = 0.00;
835 834
 
836
-	foreach ( $prices as $price ) {
837
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
838
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
835
+	foreach ($prices as $price) {
836
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
837
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
839 838
 			break;
840 839
 		};
841 840
 	}
842 841
 
843
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
842
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
844 843
 }
845 844
 
846 845
 /**
@@ -852,13 +851,13 @@  discard block
 block discarded – undo
852 851
  *
853 852
  * @return mixed string|int Goal of the form
854 853
  */
855
-function give_get_form_goal( $form_id = 0 ) {
854
+function give_get_form_goal($form_id = 0) {
856 855
 
857
-	if ( empty( $form_id ) ) {
856
+	if (empty($form_id)) {
858 857
 		return false;
859 858
 	}
860 859
 
861
-	$form = new Give_Donate_Form( $form_id );
860
+	$form = new Give_Donate_Form($form_id);
862 861
 
863 862
 	return $form->goal;
864 863
 
@@ -874,27 +873,27 @@  discard block
 block discarded – undo
874 873
  *
875 874
  * @return string $formatted_goal
876 875
  */
877
-function give_goal( $form_id = 0, $echo = true ) {
876
+function give_goal($form_id = 0, $echo = true) {
878 877
 
879
-	if ( empty( $form_id ) ) {
878
+	if (empty($form_id)) {
880 879
 		$form_id = get_the_ID();
881 880
 	}
882 881
 
883
-	$goal = give_get_form_goal( $form_id );
882
+	$goal = give_get_form_goal($form_id);
884 883
 
885
-	$goal           = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
886
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
887
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
884
+	$goal           = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
885
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
886
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
888 887
 
889
-	if ( $echo ) {
888
+	if ($echo) {
890 889
 		echo $formatted_goal;
891 890
 	} else {
892 891
 		return $formatted_goal;
893 892
 	}
894 893
 }
895 894
 
896
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
897
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
895
+add_filter('give_form_goal', 'give_format_amount', 10);
896
+add_filter('give_form_goal', 'give_currency_filter', 20);
898 897
 
899 898
 
900 899
 /**
@@ -906,15 +905,15 @@  discard block
 block discarded – undo
906 905
  *
907 906
  * @return bool  $ret Whether or not the logged_in_only setting is set
908 907
  */
909
-function give_logged_in_only( $form_id ) {
908
+function give_logged_in_only($form_id) {
910 909
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
911 910
 	// Otherwise it is member only donation form.
912
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
913
-	$val = ! empty( $val ) ? $val : 'enabled';
911
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
912
+	$val = ! empty($val) ? $val : 'enabled';
914 913
 
915
-	$ret = ! give_is_setting_enabled( $val );
914
+	$ret = ! give_is_setting_enabled($val);
916 915
 
917
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
916
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
918 917
 }
919 918
 
920 919
 
@@ -927,11 +926,11 @@  discard block
 block discarded – undo
927 926
  *
928 927
  * @return string
929 928
  */
930
-function give_show_login_register_option( $form_id ) {
929
+function give_show_login_register_option($form_id) {
931 930
 
932
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
931
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
933 932
 
934
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
933
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
935 934
 
936 935
 }
937 936
 
@@ -947,12 +946,12 @@  discard block
 block discarded – undo
947 946
  *
948 947
  * @return array
949 948
  */
950
-function _give_get_prefill_form_field_values( $form_id ) {
949
+function _give_get_prefill_form_field_values($form_id) {
951 950
 	$logged_in_donor_info = array();
952 951
 
953
-	if ( is_user_logged_in() ) :
954
-		$donor_data    = get_userdata( get_current_user_id() );
955
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
952
+	if (is_user_logged_in()) :
953
+		$donor_data    = get_userdata(get_current_user_id());
954
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
956 955
 
957 956
 		$logged_in_donor_info = array(
958 957
 			// First name.
@@ -965,42 +964,42 @@  discard block
 block discarded – undo
965 964
 			'give_email'      => $donor_data->user_email,
966 965
 
967 966
 			// Street address 1.
968
-			'card_address'    => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
967
+			'card_address'    => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
969 968
 
970 969
 			// Street address 2.
971
-			'card_address_2'  => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
970
+			'card_address_2'  => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
972 971
 
973 972
 			// Country.
974
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
973
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
975 974
 
976 975
 			// State.
977
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
976
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
978 977
 
979 978
 			// City.
980
-			'card_city'       => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
979
+			'card_city'       => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
981 980
 
982 981
 			// Zipcode
983
-			'card_zip'        => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ),
982
+			'card_zip'        => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''),
984 983
 		);
985 984
 	endif;
986 985
 
987 986
 	// Bailout: Auto fill form field values only form form which donor is donating.
988 987
 	if (
989
-		empty( $_GET['form-id'] )
988
+		empty($_GET['form-id'])
990 989
 		|| ! $form_id
991
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
990
+		|| ($form_id !== absint($_GET['form-id']))
992 991
 	) {
993 992
 		return $logged_in_donor_info;
994 993
 	}
995 994
 
996 995
 	// Get purchase data.
997
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
996
+	$give_purchase_data = Give()->session->get('give_purchase');
998 997
 
999 998
 	// Get donor info from form data.
1000
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
999
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1001 1000
 		? array()
1002 1001
 		: $give_purchase_data['post_data'];
1003 1002
 
1004 1003
 	// Output.
1005
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1004
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1006 1005
 }
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @param string $user_login Username
181 181
  * @param string $user_pass  Password
182 182
  *
183
- * @return bool
183
+ * @return false|null
184 184
  */
185 185
 function give_log_user_in( $user_id, $user_login, $user_pass ) {
186 186
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @param array $data Data sent from the register form
223 223
  *
224
- * @return bool
224
+ * @return false|null
225 225
  */
226 226
 function give_process_register_form( $data ) {
227 227
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
  *
308 308
  * @since 1.8.17
309 309
  *
310
- * @return bool
310
+ * @return boolean|null
311 311
  */
312 312
 function give_email_access_login() {
313 313
 
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 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
 
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
30
-	if ( empty( $login_redirect ) ) {
31
-		$login_redirect = add_query_arg( 'give-login-success', 'true', give_get_current_page_url() );
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30
+	if (empty($login_redirect)) {
31
+		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
32 32
 	}
33 33
 
34
-	if ( empty( $logout_redirect ) ) {
35
-		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
34
+	if (empty($logout_redirect)) {
35
+		$logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
36 36
 	}
37 37
 
38 38
 	// Add user_logout action to logout url.
39 39
 	$logout_redirect = add_query_arg(
40 40
 		array(
41 41
 			'give_action'          => 'user_logout',
42
-			'give_logout_nonce'    => wp_create_nonce( 'give-logout-nonce' ),
43
-			'give_logout_redirect' => urlencode( $logout_redirect ),
42
+			'give_logout_nonce'    => wp_create_nonce('give-logout-nonce'),
43
+			'give_logout_redirect' => urlencode($logout_redirect),
44 44
 		),
45
-		home_url( '/' )
45
+		home_url('/')
46 46
 	);
47 47
 
48 48
 	ob_start();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		)
56 56
 	);
57 57
 
58
-	return apply_filters( 'give_login_form', ob_get_clean() );
58
+	return apply_filters('give_login_form', ob_get_clean());
59 59
 }
60 60
 
61 61
 /**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string Register form
70 70
  */
71
-function give_register_form( $redirect = '' ) {
72
-	if ( empty( $redirect ) ) {
71
+function give_register_form($redirect = '') {
72
+	if (empty($redirect)) {
73 73
 		$redirect = give_get_current_page_url();
74 74
 	}
75 75
 
76 76
 	ob_start();
77 77
 
78
-	if ( ! is_user_logged_in() ) {
78
+	if ( ! is_user_logged_in()) {
79 79
 		give_get_template(
80 80
 			'shortcode-register',
81 81
 			array(
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 	}
86 86
 
87
-	return apply_filters( 'give_register_form', ob_get_clean() );
87
+	return apply_filters('give_register_form', ob_get_clean());
88 88
 }
89 89
 
90 90
 /**
@@ -96,40 +96,40 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @return void
98 98
  */
99
-function give_process_login_form( $data ) {
100
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
99
+function give_process_login_form($data) {
100
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
101 101
 
102 102
 		// Set Receipt Access Session.
103
-		if ( ! empty( $_GET['payment_key'] ) ) {
104
-			Give()->session->set( 'receipt_access', true );
103
+		if ( ! empty($_GET['payment_key'])) {
104
+			Give()->session->set('receipt_access', true);
105 105
 		}
106 106
 
107
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
108
-		if ( ! $user_data ) {
109
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
107
+		$user_data = get_user_by('login', $data['give_user_login']);
108
+		if ( ! $user_data) {
109
+			$user_data = get_user_by('email', $data['give_user_login']);
110 110
 		}
111
-		if ( $user_data ) {
111
+		if ($user_data) {
112 112
 			$user_ID    = $user_data->ID;
113 113
 			$user_email = $user_data->user_email;
114
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_ID ) ) {
115
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
114
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_ID)) {
115
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
116 116
 			} else {
117
-				give_set_error( 'password_incorrect', __( 'The password you entered is incorrect.', 'give' ) );
117
+				give_set_error('password_incorrect', __('The password you entered is incorrect.', 'give'));
118 118
 			}
119 119
 		} else {
120
-			give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
120
+			give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
121 121
 		}
122 122
 		// Check for errors and redirect if none present
123 123
 		$errors = give_get_errors();
124
-		if ( ! $errors ) {
125
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
126
-			wp_redirect( $redirect );
124
+		if ( ! $errors) {
125
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
126
+			wp_redirect($redirect);
127 127
 			give_die();
128 128
 		}
129 129
 	}
130 130
 }
131 131
 
132
-add_action( 'give_user_login', 'give_process_login_form' );
132
+add_action('give_user_login', 'give_process_login_form');
133 133
 
134 134
 
135 135
 /**
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
  *
142 142
  * @return void
143 143
  */
144
-function give_process_user_logout( $data ) {
145
-	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
144
+function give_process_user_logout($data) {
145
+	if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
146 146
 
147 147
 		// Prevent occurring of any custom action on wp_logout.
148
-		remove_all_actions( 'wp_logout' );
148
+		remove_all_actions('wp_logout');
149 149
 
150 150
 		/**
151 151
 		 * Fires before processing user logout.
152 152
 		 *
153 153
 		 * @since 1.0
154 154
 		 */
155
-		do_action( 'give_before_user_logout' );
155
+		do_action('give_before_user_logout');
156 156
 
157 157
 		// Logout user.
158 158
 		wp_logout();
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.0
164 164
 		 */
165
-		do_action( 'give_after_user_logout' );
165
+		do_action('give_after_user_logout');
166 166
 
167
-		wp_redirect( $data['give_logout_redirect'] );
167
+		wp_redirect($data['give_logout_redirect']);
168 168
 		give_die();
169 169
 	}
170 170
 }
171 171
 
172
-add_action( 'give_user_logout', 'give_process_user_logout' );
172
+add_action('give_user_logout', 'give_process_user_logout');
173 173
 
174 174
 /**
175 175
  * Log User In
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return bool
184 184
  */
185
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
185
+function give_log_user_in($user_id, $user_login, $user_pass) {
186 186
 
187
-	if ( $user_id < 1 ) {
187
+	if ($user_id < 1) {
188 188
 		return false;
189 189
 	}
190 190
 
191
-	wp_set_auth_cookie( $user_id );
192
-	wp_set_current_user( $user_id, $user_login );
191
+	wp_set_auth_cookie($user_id);
192
+	wp_set_current_user($user_id, $user_login);
193 193
 
194 194
 	/**
195 195
 	 * Fires after the user has successfully logged in.
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $user_login Username.
200 200
 	 * @param WP_User $$user      WP_User object of the logged-in user.
201 201
 	 */
202
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
202
+	do_action('wp_login', $user_login, get_userdata($user_id));
203 203
 
204 204
 	/**
205 205
 	 * Fires after give user has successfully logged in.
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param string $user_login Username.
211 211
 	 * @param string $user_pass  User password.
212 212
 	 */
213
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
213
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
214 214
 }
215 215
 
216 216
 
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return bool
225 225
  */
226
-function give_process_register_form( $data ) {
226
+function give_process_register_form($data) {
227 227
 
228
-	if ( is_user_logged_in() ) {
228
+	if (is_user_logged_in()) {
229 229
 		return false;
230 230
 	}
231 231
 
232
-	if ( empty( $_POST['give_register_submit'] ) ) {
232
+	if (empty($_POST['give_register_submit'])) {
233 233
 		return false;
234 234
 	}
235 235
 
@@ -238,38 +238,38 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @since 1.0
240 240
 	 */
241
-	do_action( 'give_pre_process_register_form' );
241
+	do_action('give_pre_process_register_form');
242 242
 
243
-	if ( empty( $data['give_user_login'] ) ) {
244
-		give_set_error( 'empty_username', esc_html__( 'Invalid username.', 'give' ) );
243
+	if (empty($data['give_user_login'])) {
244
+		give_set_error('empty_username', esc_html__('Invalid username.', 'give'));
245 245
 	}
246 246
 
247
-	if ( username_exists( $data['give_user_login'] ) ) {
248
-		give_set_error( 'username_unavailable', esc_html__( 'Username already taken.', 'give' ) );
247
+	if (username_exists($data['give_user_login'])) {
248
+		give_set_error('username_unavailable', esc_html__('Username already taken.', 'give'));
249 249
 	}
250 250
 
251
-	if ( ! validate_username( $data['give_user_login'] ) ) {
252
-		give_set_error( 'username_invalid', esc_html__( 'Invalid username.', 'give' ) );
251
+	if ( ! validate_username($data['give_user_login'])) {
252
+		give_set_error('username_invalid', esc_html__('Invalid username.', 'give'));
253 253
 	}
254 254
 
255
-	if ( email_exists( $data['give_user_email'] ) ) {
256
-		give_set_error( 'email_unavailable', esc_html__( 'Email address already taken.', 'give' ) );
255
+	if (email_exists($data['give_user_email'])) {
256
+		give_set_error('email_unavailable', esc_html__('Email address already taken.', 'give'));
257 257
 	}
258 258
 
259
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
260
-		give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
259
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
260
+		give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
261 261
 	}
262 262
 
263
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
264
-		give_set_error( 'payment_email_invalid', esc_html__( 'Invalid payment email.', 'give' ) );
263
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
264
+		give_set_error('payment_email_invalid', esc_html__('Invalid payment email.', 'give'));
265 265
 	}
266 266
 
267
-	if ( empty( $_POST['give_user_pass'] ) ) {
268
-		give_set_error( 'empty_password', esc_html__( 'Please enter a password.', 'give' ) );
267
+	if (empty($_POST['give_user_pass'])) {
268
+		give_set_error('empty_password', esc_html__('Please enter a password.', 'give'));
269 269
 	}
270 270
 
271
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
272
-		give_set_error( 'password_mismatch', esc_html__( 'Passwords don\'t match.', 'give' ) );
271
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
272
+		give_set_error('password_mismatch', esc_html__('Passwords don\'t match.', 'give'));
273 273
 	}
274 274
 
275 275
 	/**
@@ -277,29 +277,29 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @since 1.0
279 279
 	 */
280
-	do_action( 'give_process_register_form' );
280
+	do_action('give_process_register_form');
281 281
 
282 282
 	// Check for errors and redirect if none present
283 283
 	$errors = give_get_errors();
284 284
 
285
-	if ( empty( $errors ) ) {
285
+	if (empty($errors)) {
286 286
 
287
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
287
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
288 288
 
289
-		give_register_and_login_new_user( array(
289
+		give_register_and_login_new_user(array(
290 290
 			'user_login'      => $data['give_user_login'],
291 291
 			'user_pass'       => $data['give_user_pass'],
292 292
 			'user_email'      => $data['give_user_email'],
293
-			'user_registered' => date( 'Y-m-d H:i:s' ),
294
-			'role'            => get_option( 'default_role' ),
295
-		) );
293
+			'user_registered' => date('Y-m-d H:i:s'),
294
+			'role'            => get_option('default_role'),
295
+		));
296 296
 
297
-		wp_redirect( $redirect );
297
+		wp_redirect($redirect);
298 298
 		give_die();
299 299
 	}
300 300
 }
301 301
 
302
-add_action( 'give_user_register', 'give_process_register_form' );
302
+add_action('give_user_register', 'give_process_register_form');
303 303
 
304 304
 
305 305
 /**
@@ -312,23 +312,23 @@  discard block
 block discarded – undo
312 312
 function give_email_access_login() {
313 313
 
314 314
 	// Verify nonce.
315
-	if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'give' ) ) {
315
+	if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce($_POST['_wpnonce'], 'give')) {
316 316
 		return false;
317 317
 	}
318 318
 
319 319
 	// Need email to proceed.
320
-	$email = isset( $_POST['give_email'] ) ? give_clean( $_POST['give_email'] ) : '';
321
-	if ( empty( $email ) ) {
322
-		give_set_error( 'give_empty_email', __( 'Please enter the email address you used for your donation.', 'give' ) );
320
+	$email = isset($_POST['give_email']) ? give_clean($_POST['give_email']) : '';
321
+	if (empty($email)) {
322
+		give_set_error('give_empty_email', __('Please enter the email address you used for your donation.', 'give'));
323 323
 	}
324 324
 
325
-	$recaptcha_key    = give_get_option( 'recaptcha_key' );
326
-	$recaptcha_secret = give_get_option( 'recaptcha_secret' );
327
-	$enable_recaptcha = ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false;
328
-	$access_token     = ! empty( $_GET['payment_key'] ) ? $_GET['payment_key'] : '';
325
+	$recaptcha_key    = give_get_option('recaptcha_key');
326
+	$recaptcha_secret = give_get_option('recaptcha_secret');
327
+	$enable_recaptcha = ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false;
328
+	$access_token     = ! empty($_GET['payment_key']) ? $_GET['payment_key'] : '';
329 329
 
330 330
 	// Use reCAPTCHA.
331
-	if ( $enable_recaptcha ) {
331
+	if ($enable_recaptcha) {
332 332
 
333 333
 		$args = array(
334 334
 			'secret'   => $recaptcha_secret,
@@ -336,43 +336,43 @@  discard block
 block discarded – undo
336 336
 			'remoteip' => $_POST['give_ip'],
337 337
 		);
338 338
 
339
-		if ( ! empty( $args['response'] ) ) {
340
-			$request = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
339
+		if ( ! empty($args['response'])) {
340
+			$request = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array(
341 341
 				'body' => $args,
342
-			) );
343
-			if ( ! is_wp_error( $request ) || 200 == wp_remote_retrieve_response_code( $request ) ) {
342
+			));
343
+			if ( ! is_wp_error($request) || 200 == wp_remote_retrieve_response_code($request)) {
344 344
 
345
-				$response = json_decode( $request['body'], true );
345
+				$response = json_decode($request['body'], true);
346 346
 
347 347
 				// reCAPTCHA fail.
348
-				if ( ! $response['success'] ) {
349
-					give_set_error( 'give_recaptcha_test_failed', apply_filters( 'give_recaptcha_test_failed_message', __( 'reCAPTCHA test failed.', 'give' ) ) );
348
+				if ( ! $response['success']) {
349
+					give_set_error('give_recaptcha_test_failed', apply_filters('give_recaptcha_test_failed_message', __('reCAPTCHA test failed.', 'give')));
350 350
 				}
351 351
 			} else {
352 352
 
353 353
 				// Connection issue.
354
-				give_set_error( 'give_recaptcha_connection_issue', apply_filters( 'give_recaptcha_connection_issue_message', __( 'Unable to connect to reCAPTCHA server.', 'give' ) ) );
354
+				give_set_error('give_recaptcha_connection_issue', apply_filters('give_recaptcha_connection_issue_message', __('Unable to connect to reCAPTCHA server.', 'give')));
355 355
 
356 356
 			}  // End if().
357 357
 		} else {
358 358
 
359
-			give_set_error( 'give_recaptcha_failed', apply_filters( 'give_recaptcha_failed_message', __( 'It looks like the reCAPTCHA test has failed.', 'give' ) ) );
359
+			give_set_error('give_recaptcha_failed', apply_filters('give_recaptcha_failed_message', __('It looks like the reCAPTCHA test has failed.', 'give')));
360 360
 
361 361
 		}  // End if().
362 362
 	}  // End if().
363 363
 
364 364
 	// If no errors or only expired token key error - then send email.
365
-	if ( ! give_get_errors() ) {
365
+	if ( ! give_get_errors()) {
366 366
 
367
-		$donor = Give()->donors->get_donor_by( 'email', $email );
367
+		$donor = Give()->donors->get_donor_by('email', $email);
368 368
 
369 369
 		Give()->email_access->init();
370 370
 
371 371
 		// Verify that donor object is present and donor is connected with its user profile or not.
372
-		if ( is_object( $donor ) ) {
372
+		if (is_object($donor)) {
373 373
 
374 374
 			// Verify that email can be sent.
375
-			if ( ! Give()->email_access->can_send_email( $donor->id ) ) {
375
+			if ( ! Give()->email_access->can_send_email($donor->id)) {
376 376
 
377 377
 				$_POST['email-access-exhausted'] = true;
378 378
 
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
 
381 381
 			} else {
382 382
 				// Send the email. Requests not
383
-				$email_sent = Give()->email_access->send_email( $donor->id, $donor->email );
383
+				$email_sent = Give()->email_access->send_email($donor->id, $donor->email);
384 384
 
385
-				if ( ! $email_sent ) {
386
-					give_set_error( 'give_email_access_send_issue', __( 'Unable to send email. Please try again.', 'give' ) );
385
+				if ( ! $email_sent) {
386
+					give_set_error('give_email_access_send_issue', __('Unable to send email. Please try again.', 'give'));
387 387
 					return false;
388 388
 				}
389 389
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
 		} else {
396 396
 
397
-			give_set_error( 'give-no-donations', __( 'We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give' ) );
397
+			give_set_error('give-no-donations', __('We were unable to find any donations associated with the email address provided. Please try again using another email.', 'give'));
398 398
 
399 399
 		}  // End if().
400 400
 
@@ -402,4 +402,4 @@  discard block
 block discarded – undo
402 402
 
403 403
 }
404 404
 
405
-add_action( 'give_email_access_form_login', 'give_email_access_login' );
406 405
\ No newline at end of file
406
+add_action('give_email_access_form_login', 'give_email_access_login');
407 407
\ No newline at end of file
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @param  int|bool $payment_id A given payment
393 393
 	 *
394
-	 * @return mixed void|false
394
+	 * @return false|null void|false
395 395
 	 */
396 396
 	public function __construct( $payment_id = false ) {
397 397
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @param  string|bool $note The note to add
1117 1117
 	 *
1118
-	 * @return bool           If the note was specified or not
1118
+	 * @return false|null           If the note was specified or not
1119 1119
 	 */
1120 1120
 	public function add_note( $note = false ) {
1121 1121
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Spacing   +287 added lines, -287 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
 
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return mixed void|false
395 395
 	 */
396
-	public function __construct( $payment_id = false ) {
396
+	public function __construct($payment_id = false) {
397 397
 
398
-		if ( empty( $payment_id ) ) {
398
+		if (empty($payment_id)) {
399 399
 			return false;
400 400
 		}
401 401
 
402
-		$this->setup_payment( $payment_id );
402
+		$this->setup_payment($payment_id);
403 403
 	}
404 404
 
405 405
 	/**
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @return mixed        The value.
414 414
 	 */
415
-	public function __get( $key ) {
415
+	public function __get($key) {
416 416
 
417
-		if ( method_exists( $this, 'get_' . $key ) ) {
417
+		if (method_exists($this, 'get_'.$key)) {
418 418
 
419
-			$value = call_user_func( array( $this, 'get_' . $key ) );
419
+			$value = call_user_func(array($this, 'get_'.$key));
420 420
 
421 421
 		} else {
422 422
 
@@ -438,18 +438,18 @@  discard block
 block discarded – undo
438 438
 	 * @param  string $key   The property name
439 439
 	 * @param  mixed  $value The value of the property
440 440
 	 */
441
-	public function __set( $key, $value ) {
442
-		$ignore = array( '_ID' );
441
+	public function __set($key, $value) {
442
+		$ignore = array('_ID');
443 443
 
444
-		if ( 'status' === $key ) {
444
+		if ('status' === $key) {
445 445
 			$this->old_status = $this->status;
446 446
 		}
447 447
 
448
-		if ( ! in_array( $key, $ignore ) ) {
449
-			$this->pending[ $key ] = $value;
448
+		if ( ! in_array($key, $ignore)) {
449
+			$this->pending[$key] = $value;
450 450
 		}
451 451
 
452
-		if ( '_ID' !== $key ) {
452
+		if ('_ID' !== $key) {
453 453
 			$this->$key = $value;
454 454
 		}
455 455
 	}
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 	 *
465 465
 	 * @return boolean|null       If the item is set or not
466 466
 	 */
467
-	public function __isset( $name ) {
468
-		if ( property_exists( $this, $name ) ) {
469
-			return false === empty( $this->$name );
467
+	public function __isset($name) {
468
+		if (property_exists($this, $name)) {
469
+			return false === empty($this->$name);
470 470
 		} else {
471 471
 			return null;
472 472
 		}
@@ -482,20 +482,20 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @return bool            If the setup was successful or not
484 484
 	 */
485
-	private function setup_payment( $payment_id ) {
485
+	private function setup_payment($payment_id) {
486 486
 		$this->pending = array();
487 487
 
488
-		if ( empty( $payment_id ) ) {
488
+		if (empty($payment_id)) {
489 489
 			return false;
490 490
 		}
491 491
 
492
-		$payment = get_post( $payment_id );
492
+		$payment = get_post($payment_id);
493 493
 
494
-		if ( ! $payment || is_wp_error( $payment ) ) {
494
+		if ( ! $payment || is_wp_error($payment)) {
495 495
 			return false;
496 496
 		}
497 497
 
498
-		if ( 'give_payment' !== $payment->post_type ) {
498
+		if ('give_payment' !== $payment->post_type) {
499 499
 			return false;
500 500
 		}
501 501
 
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
 		 * @param Give_Payment $this       Payment object.
510 510
 		 * @param int          $payment_id The ID of the payment.
511 511
 		 */
512
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
512
+		do_action('give_pre_setup_payment', $this, $payment_id);
513 513
 
514 514
 		// Primary Identifier.
515
-		$this->ID = absint( $payment_id );
515
+		$this->ID = absint($payment_id);
516 516
 
517 517
 		// Protected ID that can never be changed.
518
-		$this->_ID = absint( $payment_id );
518
+		$this->_ID = absint($payment_id);
519 519
 
520 520
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
521 521
 		$this->payment_meta = $this->get_meta();
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		$this->parent_payment = $payment->post_parent;
532 532
 
533 533
 		$all_payment_statuses  = give_get_payment_statuses();
534
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
534
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
535 535
 
536 536
 		// Currency Based.
537 537
 		$this->total    = $this->setup_total();
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		 * @param Give_Payment $this       Payment object.
571 571
 		 * @param int          $payment_id The ID of the payment.
572 572
 		 */
573
-		do_action( 'give_setup_payment', $this, $payment_id );
573
+		do_action('give_setup_payment', $this, $payment_id);
574 574
 
575 575
 		return true;
576 576
 	}
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 	 *
589 589
 	 * @return void
590 590
 	 */
591
-	public function update_payment_setup( $payment_id ) {
592
-		$this->setup_payment( $payment_id );
591
+	public function update_payment_setup($payment_id) {
592
+		$this->setup_payment($payment_id);
593 593
 	}
594 594
 
595 595
 	/**
@@ -604,24 +604,24 @@  discard block
 block discarded – undo
604 604
 
605 605
 		// Construct the payment title.
606 606
 		$payment_title = '';
607
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
608
-			$payment_title = $this->first_name . ' ' . $this->last_name;
609
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
607
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
608
+			$payment_title = $this->first_name.' '.$this->last_name;
609
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
610 610
 			$payment_title = $this->first_name;
611
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
611
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
612 612
 			$payment_title = $this->email;
613 613
 		}
614 614
 
615 615
 		// Set Key.
616
-		if ( empty( $this->key ) ) {
616
+		if (empty($this->key)) {
617 617
 
618
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
619
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
618
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
619
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
620 620
 			$this->pending['key'] = $this->key;
621 621
 		}
622 622
 
623 623
 		// Set IP.
624
-		if ( empty( $this->ip ) ) {
624
+		if (empty($this->ip)) {
625 625
 
626 626
 			$this->ip            = give_get_ip();
627 627
 			$this->pending['ip'] = $this->ip;
@@ -648,19 +648,19 @@  discard block
 block discarded – undo
648 648
 			'status'       => $this->status,
649 649
 		);
650 650
 
651
-		$args = apply_filters( 'give_insert_payment_args', array(
651
+		$args = apply_filters('give_insert_payment_args', array(
652 652
 			'post_title'    => $payment_title,
653 653
 			'post_status'   => $this->status,
654 654
 			'post_type'     => 'give_payment',
655
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
656
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
655
+			'post_date'     => ! empty($this->date) ? $this->date : null,
656
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
657 657
 			'post_parent'   => $this->parent_payment,
658
-		), $payment_data );
658
+		), $payment_data);
659 659
 
660 660
 		// Create a blank payment
661
-		$payment_id = wp_insert_post( $args );
661
+		$payment_id = wp_insert_post($args);
662 662
 
663
-		if ( ! empty( $payment_id ) ) {
663
+		if ( ! empty($payment_id)) {
664 664
 
665 665
 			$this->ID  = $payment_id;
666 666
 			$this->_ID = $payment_id;
@@ -672,40 +672,40 @@  discard block
 block discarded – undo
672 672
 			 *
673 673
 			 * @since 1.8.13
674 674
 			 */
675
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
675
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
676 676
 
677
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
678
-				$donor = new Give_Donor( get_current_user_id(), true );
677
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
678
+				$donor = new Give_Donor(get_current_user_id(), true);
679 679
 
680 680
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
681
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
682
-					$donor->add_email( $this->email );
681
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
682
+					$donor->add_email($this->email);
683 683
 				}
684 684
 			}
685 685
 
686
-			if ( empty( $donor->id ) ) {
687
-				$donor = new Give_Donor( $this->email );
686
+			if (empty($donor->id)) {
687
+				$donor = new Give_Donor($this->email);
688 688
 			}
689 689
 
690
-			if ( empty( $donor->id ) ) {
690
+			if (empty($donor->id)) {
691 691
 
692 692
 				$donor_data = array(
693
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
693
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
694 694
 					'email'   => $this->email,
695 695
 					'user_id' => $this->user_id,
696 696
 				);
697 697
 
698
-				$donor->create( $donor_data );
698
+				$donor->create($donor_data);
699 699
 
700 700
 			}
701 701
 
702 702
 			$this->customer_id            = $donor->id;
703 703
 			$this->pending['customer_id'] = $this->customer_id;
704
-			$donor->attach_payment( $this->ID, false );
704
+			$donor->attach_payment($this->ID, false);
705 705
 
706
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
706
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
707 707
 
708
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
708
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
709 709
 			$this->new = true;
710 710
 		}// End if().
711 711
 
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
 		$saved = false;
728 728
 
729 729
 		// Must have an ID.
730
-		if ( empty( $this->ID ) ) {
730
+		if (empty($this->ID)) {
731 731
 
732 732
 			$payment_id = $this->insert_payment();
733 733
 
734
-			if ( false === $payment_id ) {
734
+			if (false === $payment_id) {
735 735
 				$saved = false;
736 736
 			} else {
737 737
 				$this->ID = $payment_id;
@@ -739,42 +739,42 @@  discard block
 block discarded – undo
739 739
 		}
740 740
 
741 741
 		// Set ID if not matching.
742
-		if ( $this->ID !== $this->_ID ) {
742
+		if ($this->ID !== $this->_ID) {
743 743
 			$this->ID = $this->_ID;
744 744
 		}
745 745
 
746 746
 		// If we have something pending, let's save it.
747
-		if ( ! empty( $this->pending ) ) {
747
+		if ( ! empty($this->pending)) {
748 748
 
749 749
 			$total_increase = 0;
750 750
 			$total_decrease = 0;
751 751
 
752
-			foreach ( $this->pending as $key => $value ) {
752
+			foreach ($this->pending as $key => $value) {
753 753
 
754
-				switch ( $key ) {
754
+				switch ($key) {
755 755
 
756 756
 					case 'donations':
757 757
 						// Update totals for pending donations.
758
-						foreach ( $this->pending[ $key ] as $item ) {
758
+						foreach ($this->pending[$key] as $item) {
759 759
 
760
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
761
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
760
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
761
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
762 762
 
763
-							switch ( $item['action'] ) {
763
+							switch ($item['action']) {
764 764
 
765 765
 								case 'add':
766 766
 
767 767
 									$price = $item['price'];
768 768
 
769
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
769
+									if ('publish' === $this->status || 'complete' === $this->status) {
770 770
 
771 771
 										// Add donation to logs.
772
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
773
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
772
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
773
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
774 774
 
775
-										$form = new Give_Donate_Form( $item['id'] );
776
-										$form->increase_sales( $quantity );
777
-										$form->increase_earnings( $price );
775
+										$form = new Give_Donate_Form($item['id']);
776
+										$form->increase_sales($quantity);
777
+										$form->increase_earnings($price);
778 778
 
779 779
 										$total_increase += $price;
780 780
 									}
@@ -799,15 +799,15 @@  discard block
 block discarded – undo
799 799
 										),
800 800
 									);
801 801
 
802
-									$found_logs = get_posts( $log_args );
803
-									foreach ( $found_logs as $log ) {
804
-										wp_delete_post( $log->ID, true );
802
+									$found_logs = get_posts($log_args);
803
+									foreach ($found_logs as $log) {
804
+										wp_delete_post($log->ID, true);
805 805
 									}
806 806
 
807
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
808
-										$form = new Give_Donate_Form( $item['id'] );
809
-										$form->decrease_sales( $quantity );
810
-										$form->decrease_earnings( $item['amount'] );
807
+									if ('publish' === $this->status || 'complete' === $this->status) {
808
+										$form = new Give_Donate_Form($item['id']);
809
+										$form->decrease_sales($quantity);
810
+										$form->decrease_earnings($item['amount']);
811 811
 
812 812
 										$total_decrease += $item['amount'];
813 813
 									}
@@ -818,44 +818,44 @@  discard block
 block discarded – undo
818 818
 						break;
819 819
 
820 820
 					case 'status':
821
-						$this->update_status( $this->status );
821
+						$this->update_status($this->status);
822 822
 						break;
823 823
 
824 824
 					case 'gateway':
825
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
825
+						$this->update_meta('_give_payment_gateway', $this->gateway);
826 826
 						break;
827 827
 
828 828
 					case 'mode':
829
-						$this->update_meta( '_give_payment_mode', $this->mode );
829
+						$this->update_meta('_give_payment_mode', $this->mode);
830 830
 						break;
831 831
 
832 832
 					case 'transaction_id':
833
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
833
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
834 834
 						break;
835 835
 
836 836
 					case 'ip':
837
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
837
+						$this->update_meta('_give_payment_user_ip', $this->ip);
838 838
 						break;
839 839
 
840 840
 					case 'customer_id':
841
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
841
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
842 842
 						break;
843 843
 
844 844
 					case 'user_id':
845
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
845
+						$this->update_meta('_give_payment_user_id', $this->user_id);
846 846
 						$this->user_info['id'] = $this->user_id;
847 847
 						break;
848 848
 
849 849
 					case 'form_title':
850
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
850
+						$this->update_meta('_give_payment_form_title', $this->form_title);
851 851
 						break;
852 852
 
853 853
 					case 'form_id':
854
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
854
+						$this->update_meta('_give_payment_form_id', $this->form_id);
855 855
 						break;
856 856
 
857 857
 					case 'price_id':
858
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
858
+						$this->update_meta('_give_payment_price_id', $this->price_id);
859 859
 						break;
860 860
 
861 861
 					case 'first_name':
@@ -871,15 +871,15 @@  discard block
 block discarded – undo
871 871
 						break;
872 872
 
873 873
 					case 'email':
874
-						$this->update_meta( '_give_payment_user_email', $this->email );
874
+						$this->update_meta('_give_payment_user_email', $this->email);
875 875
 						break;
876 876
 
877 877
 					case 'key':
878
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
878
+						$this->update_meta('_give_payment_purchase_key', $this->key);
879 879
 						break;
880 880
 
881 881
 					case 'number':
882
-						$this->update_meta( '_give_payment_number', $this->number );
882
+						$this->update_meta('_give_payment_number', $this->number);
883 883
 						break;
884 884
 
885 885
 					case 'date':
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
 							'edit_date' => true,
890 890
 						);
891 891
 
892
-						wp_update_post( $args );
892
+						wp_update_post($args);
893 893
 						break;
894 894
 
895 895
 					case 'completed_date':
896
-						$this->update_meta( '_give_completed_date', $this->completed_date );
896
+						$this->update_meta('_give_completed_date', $this->completed_date);
897 897
 						break;
898 898
 
899 899
 					case 'parent_payment':
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 							'post_parent' => $this->parent_payment,
903 903
 						);
904 904
 
905
-						wp_update_post( $args );
905
+						wp_update_post($args);
906 906
 						break;
907 907
 
908 908
 					default:
@@ -913,33 +913,33 @@  discard block
 block discarded – undo
913 913
 						 *
914 914
 						 * @param Give_Payment $this Payment object.
915 915
 						 */
916
-						do_action( 'give_payment_save', $this, $key );
916
+						do_action('give_payment_save', $this, $key);
917 917
 						break;
918 918
 				}// End switch().
919 919
 			}// End foreach().
920 920
 
921
-			if ( 'pending' !== $this->status ) {
921
+			if ('pending' !== $this->status) {
922 922
 
923
-				$donor = new Give_Donor( $this->customer_id );
923
+				$donor = new Give_Donor($this->customer_id);
924 924
 
925 925
 				$total_change = $total_increase - $total_decrease;
926
-				if ( $total_change < 0 ) {
926
+				if ($total_change < 0) {
927 927
 
928
-					$total_change = - ( $total_change );
928
+					$total_change = - ($total_change);
929 929
 					// Decrease the donor's donation stats.
930
-					$donor->decrease_value( $total_change );
931
-					give_decrease_total_earnings( $total_change );
930
+					$donor->decrease_value($total_change);
931
+					give_decrease_total_earnings($total_change);
932 932
 
933
-				} elseif ( $total_change > 0 ) {
933
+				} elseif ($total_change > 0) {
934 934
 
935 935
 					// Increase the donor's donation stats.
936
-					$donor->increase_value( $total_change );
937
-					give_increase_total_earnings( $total_change );
936
+					$donor->increase_value($total_change);
937
+					give_increase_total_earnings($total_change);
938 938
 
939 939
 				}
940 940
 			}
941 941
 
942
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
942
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
943 943
 
944 944
 			$new_meta = array(
945 945
 				'form_title' => $this->form_title,
@@ -950,12 +950,12 @@  discard block
 block discarded – undo
950 950
 			);
951 951
 
952 952
 			$meta        = $this->get_meta();
953
-			$merged_meta = array_merge( $meta, $new_meta );
953
+			$merged_meta = array_merge($meta, $new_meta);
954 954
 
955 955
 			// Only save the payment meta if it's changed.
956
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
957
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
958
-				if ( false !== $updated ) {
956
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
957
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
958
+				if (false !== $updated) {
959 959
 					$saved = true;
960 960
 				}
961 961
 			}
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
 			$saved         = true;
965 965
 		}// End if().
966 966
 
967
-		if ( true === $saved ) {
968
-			$this->setup_payment( $this->ID );
967
+		if (true === $saved) {
968
+			$this->setup_payment($this->ID);
969 969
 		}
970 970
 
971 971
 		return $saved;
@@ -983,12 +983,12 @@  discard block
 block discarded – undo
983 983
 	 *
984 984
 	 * @return bool           True when successful, false otherwise
985 985
 	 */
986
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
986
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
987 987
 
988
-		$donation = new Give_Donate_Form( $form_id );
988
+		$donation = new Give_Donate_Form($form_id);
989 989
 
990 990
 		// Bail if this post isn't a give donation form.
991
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
991
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
992 992
 			return false;
993 993
 		}
994 994
 
@@ -998,59 +998,59 @@  discard block
 block discarded – undo
998 998
 			'price_id' => false,
999 999
 		);
1000 1000
 
1001
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1001
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1002 1002
 
1003 1003
 		// Allow overriding the price.
1004
-		if ( false !== $args['price'] ) {
1004
+		if (false !== $args['price']) {
1005 1005
 			$donation_amount = $args['price'];
1006 1006
 		} else {
1007 1007
 
1008 1008
 			// Deal with variable pricing.
1009
-			if ( give_has_variable_prices( $donation->ID ) ) {
1010
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1009
+			if (give_has_variable_prices($donation->ID)) {
1010
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1011 1011
 				$donation_amount = '';
1012 1012
 				// Loop through prices.
1013
-				foreach ( $prices as $price ) {
1013
+				foreach ($prices as $price) {
1014 1014
 					// Find a match between price_id and level_id.
1015 1015
 					// First verify array keys exists THEN make the match.
1016
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1016
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1017 1017
 					     && $args['price_id'] == $price['_give_id']['level_id']
1018 1018
 					) {
1019 1019
 						$donation_amount = $price['_give_amount'];
1020 1020
 					}
1021 1021
 				}
1022 1022
 				// Fallback to the lowest price point.
1023
-				if ( $donation_amount == '' ) {
1024
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1025
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1023
+				if ($donation_amount == '') {
1024
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1025
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1026 1026
 				}
1027 1027
 			} else {
1028 1028
 				// Simple form price.
1029
-				$donation_amount = give_get_form_price( $donation->ID );
1029
+				$donation_amount = give_get_form_price($donation->ID);
1030 1030
 			}
1031 1031
 		}
1032 1032
 
1033 1033
 		// Sanitizing the price here so we don't have a dozen calls later.
1034
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1035
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1034
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1035
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1036 1036
 
1037 1037
 		// Add Options.
1038 1038
 		$default_options = array();
1039
-		if ( false !== $args['price_id'] ) {
1039
+		if (false !== $args['price_id']) {
1040 1040
 			$default_options['price_id'] = (int) $args['price_id'];
1041 1041
 		}
1042
-		$options = wp_parse_args( $options, $default_options );
1042
+		$options = wp_parse_args($options, $default_options);
1043 1043
 
1044 1044
 		// Do not allow totals to go negative.
1045
-		if ( $total < 0 ) {
1045
+		if ($total < 0) {
1046 1046
 			$total = 0;
1047 1047
 		}
1048 1048
 
1049 1049
 		$donation = array(
1050 1050
 			'name'     => $donation->post_title,
1051 1051
 			'id'       => $donation->ID,
1052
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1053
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1052
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1053
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1054 1054
 			'price_id' => $args['price_id'],
1055 1055
 			'action'   => 'add',
1056 1056
 			'options'  => $options,
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
 		$this->pending['donations'][] = $donation;
1060 1060
 
1061
-		$this->increase_subtotal( $total );
1061
+		$this->increase_subtotal($total);
1062 1062
 
1063 1063
 		return true;
1064 1064
 
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 	 *
1076 1076
 	 * @return bool           If the item was removed or not
1077 1077
 	 */
1078
-	public function remove_donation( $form_id, $args = array() ) {
1078
+	public function remove_donation($form_id, $args = array()) {
1079 1079
 
1080 1080
 		// Set some defaults.
1081 1081
 		$defaults = array(
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 			'price'    => false,
1084 1084
 			'price_id' => false,
1085 1085
 		);
1086
-		$args     = wp_parse_args( $args, $defaults );
1086
+		$args = wp_parse_args($args, $defaults);
1087 1087
 
1088
-		$form = new Give_Donate_Form( $form_id );
1088
+		$form = new Give_Donate_Form($form_id);
1089 1089
 
1090 1090
 		// Bail if this post isn't a valid give donation form.
1091
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1091
+		if ( ! $form || $form->post_type !== 'give_forms') {
1092 1092
 			return false;
1093 1093
 		}
1094 1094
 
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 		$this->pending['donations'][] = $pending_args;
1103 1103
 
1104
-		$this->decrease_subtotal( $this->total );
1104
+		$this->decrease_subtotal($this->total);
1105 1105
 
1106 1106
 		return true;
1107 1107
 	}
@@ -1117,13 +1117,13 @@  discard block
 block discarded – undo
1117 1117
 	 *
1118 1118
 	 * @return bool           If the note was specified or not
1119 1119
 	 */
1120
-	public function add_note( $note = false ) {
1120
+	public function add_note($note = false) {
1121 1121
 		// Bail if no note specified.
1122
-		if ( ! $note ) {
1122
+		if ( ! $note) {
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 
1126
-		give_insert_payment_note( $this->ID, $note );
1126
+		give_insert_payment_note($this->ID, $note);
1127 1127
 	}
1128 1128
 
1129 1129
 	/**
@@ -1136,8 +1136,8 @@  discard block
 block discarded – undo
1136 1136
 	 *
1137 1137
 	 * @return void
1138 1138
 	 */
1139
-	private function increase_subtotal( $amount = 0.00 ) {
1140
-		$amount         = (float) $amount;
1139
+	private function increase_subtotal($amount = 0.00) {
1140
+		$amount = (float) $amount;
1141 1141
 		$this->subtotal += $amount;
1142 1142
 
1143 1143
 		$this->recalculate_total();
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
 	 *
1154 1154
 	 * @return void
1155 1155
 	 */
1156
-	private function decrease_subtotal( $amount = 0.00 ) {
1157
-		$amount         = (float) $amount;
1156
+	private function decrease_subtotal($amount = 0.00) {
1157
+		$amount = (float) $amount;
1158 1158
 		$this->subtotal -= $amount;
1159 1159
 
1160
-		if ( $this->subtotal < 0 ) {
1160
+		if ($this->subtotal < 0) {
1161 1161
 			$this->subtotal = 0;
1162 1162
 		}
1163 1163
 
@@ -1186,24 +1186,24 @@  discard block
 block discarded – undo
1186 1186
 	 *
1187 1187
 	 * @return bool   $updated Returns if the status was successfully updated.
1188 1188
 	 */
1189
-	public function update_status( $status = false ) {
1189
+	public function update_status($status = false) {
1190 1190
 
1191 1191
 		// standardize the 'complete(d)' status.
1192
-		if ( $status == 'completed' || $status == 'complete' ) {
1192
+		if ($status == 'completed' || $status == 'complete') {
1193 1193
 			$status = 'publish';
1194 1194
 		}
1195 1195
 
1196
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1196
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1197 1197
 
1198
-		if ( $old_status === $status ) {
1198
+		if ($old_status === $status) {
1199 1199
 			return false; // Don't permit status changes that aren't changes.
1200 1200
 		}
1201 1201
 
1202
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1202
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1203 1203
 
1204 1204
 		$updated = false;
1205 1205
 
1206
-		if ( $do_change ) {
1206
+		if ($do_change) {
1207 1207
 
1208 1208
 			/**
1209 1209
 			 * Fires before changing payment status.
@@ -1214,21 +1214,21 @@  discard block
 block discarded – undo
1214 1214
 			 * @param string $status     The new status.
1215 1215
 			 * @param string $old_status The old status.
1216 1216
 			 */
1217
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1217
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1218 1218
 
1219 1219
 			$update_fields = array(
1220 1220
 				'ID'          => $this->ID,
1221 1221
 				'post_status' => $status,
1222
-				'edit_date'   => current_time( 'mysql' ),
1222
+				'edit_date'   => current_time('mysql'),
1223 1223
 			);
1224 1224
 
1225
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1225
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1226 1226
 
1227 1227
 			$all_payment_statuses  = give_get_payment_statuses();
1228
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1228
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1229 1229
 
1230 1230
 			// Process any specific status functions.
1231
-			switch ( $status ) {
1231
+			switch ($status) {
1232 1232
 				case 'refunded':
1233 1233
 					$this->process_refund();
1234 1234
 					break;
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 			 * @param string $status     The new status.
1256 1256
 			 * @param string $old_status The old status.
1257 1257
 			 */
1258
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1258
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1259 1259
 
1260 1260
 		}// End if().
1261 1261
 
@@ -1290,41 +1290,41 @@  discard block
 block discarded – undo
1290 1290
 	 *
1291 1291
 	 * @return mixed             The value from the post meta
1292 1292
 	 */
1293
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1293
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1294 1294
 
1295
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1295
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1296 1296
 
1297
-		if ( $meta_key === '_give_payment_meta' ) {
1297
+		if ($meta_key === '_give_payment_meta') {
1298 1298
 			$meta = (array) $meta;
1299 1299
 
1300
-			if ( empty( $meta['key'] ) ) {
1300
+			if (empty($meta['key'])) {
1301 1301
 				$meta['key'] = $this->setup_payment_key();
1302 1302
 			}
1303 1303
 
1304
-			if ( empty( $meta['form_title'] ) ) {
1304
+			if (empty($meta['form_title'])) {
1305 1305
 				$meta['form_title'] = $this->setup_form_title();
1306 1306
 			}
1307 1307
 
1308
-			if ( empty( $meta['email'] ) ) {
1308
+			if (empty($meta['email'])) {
1309 1309
 				$meta['email'] = $this->setup_email();
1310 1310
 			}
1311 1311
 
1312
-			if ( empty( $meta['date'] ) ) {
1313
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1312
+			if (empty($meta['date'])) {
1313
+				$meta['date'] = get_post_field('post_date', $this->ID);
1314 1314
 			}
1315 1315
 		}
1316 1316
 
1317
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1317
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1318 1318
 
1319 1319
 		// Security check.
1320
-		if ( is_serialized( $meta ) ) {
1321
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1322
-			if ( ! empty( $matches ) ) {
1320
+		if (is_serialized($meta)) {
1321
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1322
+			if ( ! empty($matches)) {
1323 1323
 				$meta = array();
1324 1324
 			}
1325 1325
 		}
1326 1326
 
1327
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1327
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1328 1328
 	}
1329 1329
 
1330 1330
 	/**
@@ -1339,23 +1339,23 @@  discard block
 block discarded – undo
1339 1339
 	 *
1340 1340
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1341 1341
 	 */
1342
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1343
-		if ( empty( $meta_key ) ) {
1342
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1343
+		if (empty($meta_key)) {
1344 1344
 			return false;
1345 1345
 		}
1346 1346
 
1347
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1347
+		if ($meta_key == 'key' || $meta_key == 'date') {
1348 1348
 
1349 1349
 			$current_meta              = $this->get_meta();
1350
-			$current_meta[ $meta_key ] = $meta_value;
1350
+			$current_meta[$meta_key] = $meta_value;
1351 1351
 
1352 1352
 			$meta_key   = '_give_payment_meta';
1353 1353
 			$meta_value = $current_meta;
1354 1354
 
1355
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1355
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1356 1356
 
1357
-			$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1358
-			give_update_meta( $this->ID, '_give_payment_user_email', $meta_value );
1357
+			$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1358
+			give_update_meta($this->ID, '_give_payment_user_email', $meta_value);
1359 1359
 
1360 1360
 			$current_meta                       = $this->get_meta();
1361 1361
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1365,9 +1365,9 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
 		}
1367 1367
 
1368
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1368
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1369 1369
 
1370
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1370
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1371 1371
 	}
1372 1372
 
1373 1373
 	/**
@@ -1382,14 +1382,14 @@  discard block
 block discarded – undo
1382 1382
 		$process_refund = true;
1383 1383
 
1384 1384
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1385
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1385
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1386 1386
 			$process_refund = false;
1387 1387
 		}
1388 1388
 
1389 1389
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1390
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1390
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1391 1391
 
1392
-		if ( false === $process_refund ) {
1392
+		if (false === $process_refund) {
1393 1393
 			return;
1394 1394
 		}
1395 1395
 
@@ -1400,13 +1400,13 @@  discard block
 block discarded – undo
1400 1400
 		 *
1401 1401
 		 * @param Give_Payment $this Payment object.
1402 1402
 		 */
1403
-		do_action( 'give_pre_refund_payment', $this );
1403
+		do_action('give_pre_refund_payment', $this);
1404 1404
 
1405
-		$decrease_earnings       = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1406
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1407
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1405
+		$decrease_earnings       = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1406
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1407
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1408 1408
 
1409
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count );
1409
+		$this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count);
1410 1410
 		$this->delete_sales_logs();
1411 1411
 
1412 1412
 		// @todo: Refresh only range related stat cache
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		 *
1420 1420
 		 * @param Give_Payment $this Payment object.
1421 1421
 		 */
1422
-		do_action( 'give_post_refund_payment', $this );
1422
+		do_action('give_post_refund_payment', $this);
1423 1423
 	}
1424 1424
 
1425 1425
 	/**
@@ -1446,26 +1446,26 @@  discard block
 block discarded – undo
1446 1446
 		$process_pending = true;
1447 1447
 
1448 1448
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1449
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1449
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1450 1450
 			$process_pending = false;
1451 1451
 		}
1452 1452
 
1453 1453
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1454
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1454
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1455 1455
 
1456
-		if ( false === $process_pending ) {
1456
+		if (false === $process_pending) {
1457 1457
 			return;
1458 1458
 		}
1459 1459
 
1460
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_pending', true, $this );
1461
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_pending', true, $this );
1462
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this );
1460
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_pending', true, $this);
1461
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_pending', true, $this);
1462
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this);
1463 1463
 
1464
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1464
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1465 1465
 		$this->delete_sales_logs();
1466 1466
 
1467 1467
 		$this->completed_date = false;
1468
-		$this->update_meta( '_give_completed_date', '' );
1468
+		$this->update_meta('_give_completed_date', '');
1469 1469
 
1470 1470
 		// @todo: Refresh only range related stat cache
1471 1471
 		give_delete_donation_stats();
@@ -1483,26 +1483,26 @@  discard block
 block discarded – undo
1483 1483
 		$process_cancelled = true;
1484 1484
 
1485 1485
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1486
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1486
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1487 1487
 			$process_cancelled = false;
1488 1488
 		}
1489 1489
 
1490 1490
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1491
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1491
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1492 1492
 
1493
-		if ( false === $process_cancelled ) {
1493
+		if (false === $process_cancelled) {
1494 1494
 			return;
1495 1495
 		}
1496 1496
 
1497
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this );
1498
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this );
1499
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this );
1497
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_cancelled', true, $this);
1498
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_cancelled', true, $this);
1499
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this);
1500 1500
 
1501
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1501
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1502 1502
 		$this->delete_sales_logs();
1503 1503
 
1504 1504
 		$this->completed_date = false;
1505
-		$this->update_meta( '_give_completed_date', '' );
1505
+		$this->update_meta('_give_completed_date', '');
1506 1506
 
1507 1507
 		// @todo: Refresh only range related stat cache
1508 1508
 		give_delete_donation_stats();
@@ -1518,26 +1518,26 @@  discard block
 block discarded – undo
1518 1518
 		$process_revoked = true;
1519 1519
 
1520 1520
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1521
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1521
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1522 1522
 			$process_revoked = false;
1523 1523
 		}
1524 1524
 
1525 1525
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1526
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1526
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1527 1527
 
1528
-		if ( false === $process_revoked ) {
1528
+		if (false === $process_revoked) {
1529 1529
 			return;
1530 1530
 		}
1531 1531
 
1532
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_revoked', true, $this );
1533
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this );
1534
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this );
1532
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_revoked', true, $this);
1533
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_revoked', true, $this);
1534
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this);
1535 1535
 
1536
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1536
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1537 1537
 		$this->delete_sales_logs();
1538 1538
 
1539 1539
 		$this->completed_date = false;
1540
-		$this->update_meta( '_give_completed_date', '' );
1540
+		$this->update_meta('_give_completed_date', '');
1541 1541
 
1542 1542
 		// @todo: Refresh only range related stat cache
1543 1543
 		give_delete_donation_stats();
@@ -1555,25 +1555,25 @@  discard block
 block discarded – undo
1555 1555
 	 *
1556 1556
 	 * @return void
1557 1557
 	 */
1558
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1558
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1559 1559
 
1560
-		give_undo_donation( $this->ID );
1560
+		give_undo_donation($this->ID);
1561 1561
 
1562 1562
 		// Decrease store earnings.
1563
-		if ( true === $alter_store_earnings ) {
1564
-			give_decrease_total_earnings( $this->total );
1563
+		if (true === $alter_store_earnings) {
1564
+			give_decrease_total_earnings($this->total);
1565 1565
 		}
1566 1566
 
1567 1567
 		// Decrement the stats for the donor.
1568
-		if ( ! empty( $this->customer_id ) ) {
1568
+		if ( ! empty($this->customer_id)) {
1569 1569
 
1570
-			$donor = new Give_Donor( $this->customer_id );
1570
+			$donor = new Give_Donor($this->customer_id);
1571 1571
 
1572
-			if ( true === $alter_customer_value ) {
1573
-				$donor->decrease_value( $this->total );
1572
+			if (true === $alter_customer_value) {
1573
+				$donor->decrease_value($this->total);
1574 1574
 			}
1575 1575
 
1576
-			if ( true === $alter_customer_purchase_count ) {
1576
+			if (true === $alter_customer_purchase_count) {
1577 1577
 				$donor->decrease_donation_count();
1578 1578
 			}
1579 1579
 		}
@@ -1622,13 +1622,13 @@  discard block
 block discarded – undo
1622 1622
 	 * @return string The date the payment was completed
1623 1623
 	 */
1624 1624
 	private function setup_completed_date() {
1625
-		$payment = get_post( $this->ID );
1625
+		$payment = get_post($this->ID);
1626 1626
 
1627
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1627
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1628 1628
 			return false; // This payment was never completed.
1629 1629
 		}
1630 1630
 
1631
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1631
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1632 1632
 
1633 1633
 		return $date;
1634 1634
 	}
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 	 * @return string The payment mode
1643 1643
 	 */
1644 1644
 	private function setup_mode() {
1645
-		return $this->get_meta( '_give_payment_mode' );
1645
+		return $this->get_meta('_give_payment_mode');
1646 1646
 	}
1647 1647
 
1648 1648
 	/**
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 	 * @return bool The payment import
1655 1655
 	 */
1656 1656
 	private function setup_import() {
1657
-		return (bool) $this->get_meta( '_give_payment_import' );
1657
+		return (bool) $this->get_meta('_give_payment_import');
1658 1658
 	}
1659 1659
 
1660 1660
 	/**
@@ -1666,18 +1666,18 @@  discard block
 block discarded – undo
1666 1666
 	 * @return float The payment total
1667 1667
 	 */
1668 1668
 	private function setup_total() {
1669
-		$amount = $this->get_meta( '_give_payment_total', true );
1669
+		$amount = $this->get_meta('_give_payment_total', true);
1670 1670
 
1671
-		if ( empty( $amount ) && '0.00' != $amount ) {
1672
-			$meta = $this->get_meta( '_give_payment_meta', true );
1673
-			$meta = maybe_unserialize( $meta );
1671
+		if (empty($amount) && '0.00' != $amount) {
1672
+			$meta = $this->get_meta('_give_payment_meta', true);
1673
+			$meta = maybe_unserialize($meta);
1674 1674
 
1675
-			if ( isset( $meta['amount'] ) ) {
1675
+			if (isset($meta['amount'])) {
1676 1676
 				$amount = $meta['amount'];
1677 1677
 			}
1678 1678
 		}
1679 1679
 
1680
-		return round( (float) $amount, give_get_price_decimals( $this->ID ) );
1680
+		return round((float) $amount, give_get_price_decimals($this->ID));
1681 1681
 	}
1682 1682
 
1683 1683
 	/**
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	 * @return string The currency for the payment
1704 1704
 	 */
1705 1705
 	private function setup_currency() {
1706
-		$currency = ! empty( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency( $this->form_id, $this ), $this );
1706
+		$currency = ! empty($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency($this->form_id, $this), $this);
1707 1707
 
1708 1708
 		return $currency;
1709 1709
 	}
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	 * @return string The gateway
1718 1718
 	 */
1719 1719
 	private function setup_gateway() {
1720
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1720
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1721 1721
 
1722 1722
 		return $gateway;
1723 1723
 	}
@@ -1731,11 +1731,11 @@  discard block
 block discarded – undo
1731 1731
 	 * @return string The donation ID
1732 1732
 	 */
1733 1733
 	private function setup_transaction_id() {
1734
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1734
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1735 1735
 
1736
-		if ( empty( $transaction_id ) ) {
1736
+		if (empty($transaction_id)) {
1737 1737
 			$gateway        = $this->gateway;
1738
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1738
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1739 1739
 		}
1740 1740
 
1741 1741
 		return $transaction_id;
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 	 * @return string The IP address for the payment
1751 1751
 	 */
1752 1752
 	private function setup_ip() {
1753
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1753
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1754 1754
 
1755 1755
 		return $ip;
1756 1756
 	}
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 	 * @return int The Donor ID.
1765 1765
 	 */
1766 1766
 	private function setup_donor_id() {
1767
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
1767
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
1768 1768
 
1769 1769
 		return $customer_id;
1770 1770
 	}
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 	 * @return int The User ID
1779 1779
 	 */
1780 1780
 	private function setup_user_id() {
1781
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
1781
+		$user_id = $this->get_meta('_give_payment_user_id', true);
1782 1782
 
1783 1783
 		return $user_id;
1784 1784
 	}
@@ -1792,10 +1792,10 @@  discard block
 block discarded – undo
1792 1792
 	 * @return string The email address for the payment.
1793 1793
 	 */
1794 1794
 	private function setup_email() {
1795
-		$email = $this->get_meta( '_give_payment_user_email', true );
1795
+		$email = $this->get_meta('_give_payment_user_email', true);
1796 1796
 
1797
-		if ( empty( $email ) && $this->customer_id ) {
1798
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1797
+		if (empty($email) && $this->customer_id) {
1798
+			$email = Give()->donors->get_column('email', $this->customer_id);
1799 1799
 		}
1800 1800
 
1801 1801
 		return $email;
@@ -1815,23 +1815,23 @@  discard block
 block discarded – undo
1815 1815
 			'last_name'  => $this->last_name,
1816 1816
 		);
1817 1817
 
1818
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1818
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1819 1819
 
1820
-		if ( is_serialized( $user_info ) ) {
1821
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1822
-			if ( ! empty( $matches ) ) {
1820
+		if (is_serialized($user_info)) {
1821
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1822
+			if ( ! empty($matches)) {
1823 1823
 				$user_info = array();
1824 1824
 			}
1825 1825
 		}
1826 1826
 
1827
-		$user_info = wp_parse_args( $user_info, $defaults );
1827
+		$user_info = wp_parse_args($user_info, $defaults);
1828 1828
 
1829
-		if ( empty( $user_info ) ) {
1829
+		if (empty($user_info)) {
1830 1830
 			// Get the donor, but only if it's been created.
1831
-			$donor = new Give_Donor( $this->customer_id );
1831
+			$donor = new Give_Donor($this->customer_id);
1832 1832
 
1833
-			if ( $donor->id > 0 ) {
1834
-				$name      = explode( ' ', $donor->name, 2 );
1833
+			if ($donor->id > 0) {
1834
+				$name      = explode(' ', $donor->name, 2);
1835 1835
 				$user_info = array(
1836 1836
 					'first_name' => $name[0],
1837 1837
 					'last_name'  => $name[1],
@@ -1841,29 +1841,29 @@  discard block
 block discarded – undo
1841 1841
 			}
1842 1842
 		} else {
1843 1843
 			// Get the donor, but only if it's been created.
1844
-			$donor = new Give_Donor( $this->customer_id );
1845
-			if ( $donor->id > 0 ) {
1846
-				foreach ( $user_info as $key => $value ) {
1847
-					if ( ! empty( $value ) ) {
1844
+			$donor = new Give_Donor($this->customer_id);
1845
+			if ($donor->id > 0) {
1846
+				foreach ($user_info as $key => $value) {
1847
+					if ( ! empty($value)) {
1848 1848
 						continue;
1849 1849
 					}
1850 1850
 
1851
-					switch ( $key ) {
1851
+					switch ($key) {
1852 1852
 						case 'first_name':
1853
-							$name = explode( ' ', $donor->name, 2 );
1853
+							$name = explode(' ', $donor->name, 2);
1854 1854
 
1855
-							$user_info[ $key ] = $name[0];
1855
+							$user_info[$key] = $name[0];
1856 1856
 							break;
1857 1857
 
1858 1858
 						case 'last_name':
1859
-							$name      = explode( ' ', $donor->name, 2 );
1860
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
1859
+							$name      = explode(' ', $donor->name, 2);
1860
+							$last_name = ! empty($name[1]) ? $name[1] : '';
1861 1861
 
1862
-							$user_info[ $key ] = $last_name;
1862
+							$user_info[$key] = $last_name;
1863 1863
 							break;
1864 1864
 
1865 1865
 						case 'email':
1866
-							$user_info[ $key ] = $donor->email;
1866
+							$user_info[$key] = $donor->email;
1867 1867
 							break;
1868 1868
 					}
1869 1869
 				}
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 	 */
1885 1885
 	private function setup_address() {
1886 1886
 
1887
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
1887
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
1888 1888
 			'line1'   => '',
1889 1889
 			'line2'   => '',
1890 1890
 			'city'    => '',
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
 	 */
1907 1907
 	private function setup_form_title() {
1908 1908
 
1909
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1909
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1910 1910
 
1911 1911
 		return $form_id;
1912 1912
 	}
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
 	 */
1922 1922
 	private function setup_form_id() {
1923 1923
 
1924
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1924
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1925 1925
 
1926 1926
 		return $form_id;
1927 1927
 	}
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 	 * @return int The Form Price ID.
1936 1936
 	 */
1937 1937
 	private function setup_price_id() {
1938
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1938
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1939 1939
 
1940 1940
 		return $price_id;
1941 1941
 	}
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 	 * @return string The Payment Key.
1950 1950
 	 */
1951 1951
 	private function setup_payment_key() {
1952
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1952
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1953 1953
 
1954 1954
 		return $key;
1955 1955
 	}
@@ -1965,11 +1965,11 @@  discard block
 block discarded – undo
1965 1965
 	private function setup_payment_number() {
1966 1966
 		$number = $this->ID;
1967 1967
 
1968
-		if ( give_get_option( 'enable_sequential' ) ) {
1968
+		if (give_get_option('enable_sequential')) {
1969 1969
 
1970
-			$number = $this->get_meta( '_give_payment_number', true );
1970
+			$number = $this->get_meta('_give_payment_number', true);
1971 1971
 
1972
-			if ( ! $number ) {
1972
+			if ( ! $number) {
1973 1973
 
1974 1974
 				$number = $this->ID;
1975 1975
 
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 	 * @return array The payment object as an array.
1988 1988
 	 */
1989 1989
 	public function array_convert() {
1990
-		return get_object_vars( $this );
1990
+		return get_object_vars($this);
1991 1991
 	}
1992 1992
 
1993 1993
 
@@ -2000,7 +2000,7 @@  discard block
 block discarded – undo
2000 2000
 	 * @return bool
2001 2001
 	 */
2002 2002
 	public function is_completed() {
2003
-		return ( 'publish' === $this->status && $this->completed_date );
2003
+		return ('publish' === $this->status && $this->completed_date);
2004 2004
 	}
2005 2005
 
2006 2006
 	/**
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
 	 * @return string Date payment was completed.
2013 2013
 	 */
2014 2014
 	private function get_completed_date() {
2015
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2015
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2016 2016
 	}
2017 2017
 
2018 2018
 	/**
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 	 * @return float Payment subtotal.
2025 2025
 	 */
2026 2026
 	private function get_subtotal() {
2027
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2027
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2028 2028
 	}
2029 2029
 
2030 2030
 	/**
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 	 * @return string Payment currency code.
2037 2037
 	 */
2038 2038
 	private function get_currency() {
2039
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2039
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
 	 * @return string Gateway used.
2049 2049
 	 */
2050 2050
 	private function get_gateway() {
2051
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2051
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2052 2052
 	}
2053 2053
 
2054 2054
 	/**
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
 	 * @return string Donation ID from merchant processor.
2061 2061
 	 */
2062 2062
 	private function get_transaction_id() {
2063
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2063
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2064 2064
 	}
2065 2065
 
2066 2066
 	/**
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 	 * @return string Payment IP address
2073 2073
 	 */
2074 2074
 	private function get_ip() {
2075
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2075
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2076 2076
 	}
2077 2077
 
2078 2078
 	/**
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 * @return int Payment donor ID.
2085 2085
 	 */
2086 2086
 	private function get_donor_id() {
2087
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2087
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2088 2088
 	}
2089 2089
 
2090 2090
 	/**
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 	 * @return int Payment user ID.
2097 2097
 	 */
2098 2098
 	private function get_user_id() {
2099
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2099
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2100 2100
 	}
2101 2101
 
2102 2102
 	/**
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 	 * @return string Payment donor email.
2109 2109
 	 */
2110 2110
 	private function get_email() {
2111
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2111
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2112 2112
 	}
2113 2113
 
2114 2114
 	/**
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 	 * @return array Payment user info.
2121 2121
 	 */
2122 2122
 	private function get_user_info() {
2123
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2123
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2124 2124
 	}
2125 2125
 
2126 2126
 	/**
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 	 * @return array Payment billing address.
2133 2133
 	 */
2134 2134
 	private function get_address() {
2135
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2135
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2136 2136
 	}
2137 2137
 
2138 2138
 	/**
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 	 * @return string Payment key.
2145 2145
 	 */
2146 2146
 	private function get_key() {
2147
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2147
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2148 2148
 	}
2149 2149
 
2150 2150
 	/**
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 	 * @return string Payment form id
2157 2157
 	 */
2158 2158
 	private function get_form_id() {
2159
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2159
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2160 2160
 	}
2161 2161
 
2162 2162
 	/**
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 	 * @return int|string Payment number
2169 2169
 	 */
2170 2170
 	private function get_number() {
2171
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2171
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2172 2172
 	}
2173 2173
 
2174 2174
 }
Please login to merge, or discard this patch.