Completed
Pull Request — master (#1749)
by Devin
06:21
created
includes/process-donation.php 1 patch
Spacing   +239 added lines, -239 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_donation_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array $_POST Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_donation_form_user( $valid_data );
58
+	$user = give_get_donation_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
103
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
103
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
104 104
 
105 105
 	// Setup donation information
106 106
 	$donation_data = array(
107 107
 		'price'        => $price,
108 108
 		'purchase_key' => $purchase_key,
109 109
 		'user_email'   => $user['user_email'],
110
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
111
-		'user_info'    => stripslashes_deep( $user_info ),
110
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
111
+		'user_info'    => stripslashes_deep($user_info),
112 112
 		'post_data'    => $_POST,
113 113
 		'gateway'      => $valid_data['gateway'],
114 114
 		'card_info'    => $valid_data['cc_info'],
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param array $user_info Array containing basic user information.
129 129
 	 * @param bool|array $valid_data Validate fields.
130 130
 	 */
131
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
131
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
132 132
 
133 133
 	// Sanity check for price
134
-	if ( ! $donation_data['price'] ) {
134
+	if ( ! $donation_data['price']) {
135 135
 		// Revert to manual
136 136
 		$donation_data['gateway'] = 'manual';
137 137
 		$_POST['give-gateway']    = 'manual';
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @since 1.7
144 144
 	 */
145
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
145
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
146 146
 
147 147
 	// Setup the data we're storing in the donation session
148 148
 	$session_data = $donation_data;
149 149
 
150 150
 	// Make sure credit card numbers are never stored in sessions
151
-	unset( $session_data['card_info']['card_number'] );
152
-	unset( $session_data['post_data']['card_number'] );
151
+	unset($session_data['card_info']['card_number']);
152
+	unset($session_data['post_data']['card_number']);
153 153
 
154 154
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
155
-	give_set_purchase_session( $session_data );
155
+	give_set_purchase_session($session_data);
156 156
 
157 157
 	// Send info to the gateway for payment processing
158
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
158
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
159 159
 	give_die();
160 160
 
161 161
 }
162 162
 
163
-add_action( 'give_purchase', 'give_process_donation_form' );
164
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
165
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
163
+add_action('give_purchase', 'give_process_donation_form');
164
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
165
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
166 166
 
167 167
 
168 168
 /**
@@ -175,29 +175,29 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
178
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
179 179
 
180 180
 	// Verify that the email address belongs to this customer.
181
-	if ( is_user_logged_in() ) {
181
+	if (is_user_logged_in()) {
182 182
 
183
-		$submitted_email    = $valid_data['logged_in_user']['user_email'];
184
-		$customer = new Give_Customer( get_current_user_id(), true );
183
+		$submitted_email = $valid_data['logged_in_user']['user_email'];
184
+		$customer = new Give_Customer(get_current_user_id(), true);
185 185
 
186 186
 		// If this email address is not registered with this customer, see if it belongs to any other customer
187 187
 		if (
188 188
 			$submitted_email !== $customer->email
189
-			&& ( is_array( $customer->emails ) && ! in_array( $submitted_email, $customer->emails ) )
189
+			&& (is_array($customer->emails) && ! in_array($submitted_email, $customer->emails))
190 190
 		) {
191
-			$found_customer = new Give_Customer( $submitted_email );
191
+			$found_customer = new Give_Customer($submitted_email);
192 192
 
193
-			if ( $found_customer->id > 0 ) {
194
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.' ), $customer->email, $submitted_email ) );
193
+			if ($found_customer->id > 0) {
194
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.'), $customer->email, $submitted_email));
195 195
 			}
196 196
 		}
197 197
 	}
198 198
 }
199 199
 
200
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
200
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
201 201
 
202 202
 /**
203 203
  * Process the checkout login form
@@ -208,37 +208,37 @@  discard block
 block discarded – undo
208 208
  */
209 209
 function give_process_form_login() {
210 210
 
211
-	$is_ajax = isset( $_POST['give_ajax'] );
211
+	$is_ajax = isset($_POST['give_ajax']);
212 212
 
213 213
 	$user_data = give_donation_form_validate_user_login();
214 214
 
215
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
216
-		if ( $is_ajax ) {
215
+	if (give_get_errors() || $user_data['user_id'] < 1) {
216
+		if ($is_ajax) {
217 217
 			/**
218 218
 			 * Fires when AJAX sends back errors from the donation form.
219 219
 			 *
220 220
 			 * @since 1.0
221 221
 			 */
222
-			do_action( 'give_ajax_donation_errors' );
222
+			do_action('give_ajax_donation_errors');
223 223
 			give_die();
224 224
 		} else {
225
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
225
+			wp_redirect($_SERVER['HTTP_REFERER']);
226 226
 			exit;
227 227
 		}
228 228
 	}
229 229
 
230
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
230
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
231 231
 
232
-	if ( $is_ajax ) {
232
+	if ($is_ajax) {
233 233
 		echo 'success';
234 234
 		give_die();
235 235
 	} else {
236
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
236
+		wp_redirect($_SERVER['HTTP_REFERER']);
237 237
 	}
238 238
 }
239 239
 
240
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
241
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
240
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
241
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
242 242
 
243 243
 /**
244 244
  * Donation Form Validate Fields.
@@ -250,55 +250,55 @@  discard block
 block discarded – undo
250 250
 function give_donation_form_validate_fields() {
251 251
 
252 252
 	// Check if there is $_POST
253
-	if ( empty( $_POST ) ) {
253
+	if (empty($_POST)) {
254 254
 		return false;
255 255
 	}
256 256
 
257
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
257
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
258 258
 
259 259
 	// Start an array to collect valid data
260 260
 	$valid_data = array(
261 261
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here)
262
-		'need_new_user'    => false,     // New user flag
263
-		'need_user_login'  => false,     // Login user flag
264
-		'logged_user_data' => array(),   // Logged user collected data
265
-		'new_user_data'    => array(),   // New user collected data
266
-		'login_user_data'  => array(),   // Login user collected data
267
-		'guest_user_data'  => array(),   // Guest user collected data
268
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info
262
+		'need_new_user'    => false, // New user flag
263
+		'need_user_login'  => false, // Login user flag
264
+		'logged_user_data' => array(), // Logged user collected data
265
+		'new_user_data'    => array(), // New user collected data
266
+		'login_user_data'  => array(), // Login user collected data
267
+		'guest_user_data'  => array(), // Guest user collected data
268
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info
269 269
 	);
270 270
 
271 271
 	// Validate Honeypot First
272
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
273
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
272
+	if ( ! empty($_POST['give-honeypot'])) {
273
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
274 274
 	}
275 275
 
276 276
 	// Validate agree to terms
277
-	if ( give_is_terms_enabled( $form_id ) ) {
277
+	if (give_is_terms_enabled($form_id)) {
278 278
 		give_donation_form_validate_agree_to_terms();
279 279
 	}
280 280
 
281 281
 	// Stop processing donor registration, if donor registration is optional and donor can do guest checkout.
282 282
 	// If registration form username field is empty that means donor do not want to registration instead want guest checkout.
283 283
 	if (
284
-		! give_logged_in_only( $form_id )
285
-		&& isset( $_POST['give-purchase-var'] )
284
+		! give_logged_in_only($form_id)
285
+		&& isset($_POST['give-purchase-var'])
286 286
 		&& $_POST['give-purchase-var'] == 'needs-to-register'
287
-		&& empty( $_POST['give_user_login'] )
287
+		&& empty($_POST['give_user_login'])
288 288
 	) {
289
-		unset( $_POST['give-purchase-var'] );
289
+		unset($_POST['give-purchase-var']);
290 290
 	}
291 291
 
292
-	if ( is_user_logged_in() ) {
292
+	if (is_user_logged_in()) {
293 293
 		// Collect logged in user data.
294 294
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
295
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
295
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
296 296
 		// Set new user registration as required.
297 297
 		$valid_data['need_new_user'] = true;
298 298
 		// Validate new user data.
299 299
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
300 300
 		// Check if login validation is needed.
301
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
301
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
302 302
 		// Set user login as required.
303 303
 		$valid_data['need_user_login'] = true;
304 304
 		// Validate users login info.
@@ -323,41 +323,41 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function give_donation_form_validate_gateway() {
325 325
 
326
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
327
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
328
-	$gateway = give_get_default_gateway( $form_id );
326
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
327
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
328
+	$gateway = give_get_default_gateway($form_id);
329 329
 
330 330
 	// Check if a gateway value is present.
331
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
331
+	if ( ! empty($_REQUEST['give-gateway'])) {
332 332
 
333
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
333
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
334 334
 
335 335
 		// Is amount being donated in LIVE mode 0.00? If so, error:
336
-		if ( $amount == 0 && ! give_is_test_mode() ) {
336
+		if ($amount == 0 && ! give_is_test_mode()) {
337 337
 
338
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
338
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
339 339
 
340 340
 		} // End if().
341
-		elseif ( ! give_verify_minimum_price() ) {
341
+		elseif ( ! give_verify_minimum_price()) {
342 342
 			// translators: %s: minimum donation amount.
343 343
 			give_set_error(
344 344
 				'invalid_donation_minimum',
345 345
 				sprintf(
346 346
 					/* translators: %s: minimum donation amount */
347
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
348
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
347
+					__('This form has a minimum donation amount of %s.', 'give'),
348
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
349 349
 				)
350 350
 			);
351 351
 
352 352
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
353
-		elseif ( $amount == 0 && give_is_test_mode() ) {
353
+		elseif ($amount == 0 && give_is_test_mode()) {
354 354
 
355 355
 			$gateway = 'manual';
356 356
 
357 357
 		} //Check if this gateway is active.
358
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
358
+		elseif ( ! give_is_gateway_active($gateway)) {
359 359
 
360
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
360
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
361 361
 
362 362
 		}
363 363
 	}
@@ -375,21 +375,21 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function give_verify_minimum_price() {
377 377
 
378
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
379
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
380
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
381
-	$variable_prices = give_has_variable_prices( $form_id );
378
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
379
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
380
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
381
+	$variable_prices = give_has_variable_prices($form_id);
382 382
 
383
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
383
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
384 384
 
385
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
385
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
386 386
 
387
-		if ( $price_level_amount == $amount ) {
387
+		if ($price_level_amount == $amount) {
388 388
 			return true;
389 389
 		}
390 390
 	}
391 391
 
392
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
392
+	if (give_get_form_minimum_price($form_id) > $amount) {
393 393
 		return false;
394 394
 	}
395 395
 
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
  */
406 406
 function give_donation_form_validate_agree_to_terms() {
407 407
 	// Validate agree to terms.
408
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
408
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
409 409
 		// User did not agree.
410
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
410
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
411 411
 	}
412 412
 }
413 413
 
@@ -421,43 +421,43 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return      array
423 423
  */
424
-function give_get_required_fields( $form_id ) {
424
+function give_get_required_fields($form_id) {
425 425
 
426
-	$payment_mode = give_get_chosen_gateway( $form_id );
426
+	$payment_mode = give_get_chosen_gateway($form_id);
427 427
 
428 428
 	$required_fields = array(
429 429
 		'give_email' => array(
430 430
 			'error_id'      => 'invalid_email',
431
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
431
+			'error_message' => __('Please enter a valid email address.', 'give'),
432 432
 		),
433 433
 		'give_first' => array(
434 434
 			'error_id'      => 'invalid_first_name',
435
-			'error_message' => __( 'Please enter your first name.', 'give' ),
435
+			'error_message' => __('Please enter your first name.', 'give'),
436 436
 		),
437 437
 	);
438 438
 
439
-	$require_address = give_require_billing_address( $payment_mode );
439
+	$require_address = give_require_billing_address($payment_mode);
440 440
 
441
-	if ( $require_address ) {
442
-		$required_fields['card_address']    = array(
441
+	if ($require_address) {
442
+		$required_fields['card_address'] = array(
443 443
 			'error_id'      => 'invalid_card_address',
444
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
444
+			'error_message' => __('Please enter your primary billing address.', 'give'),
445 445
 		);
446
-		$required_fields['card_zip']        = array(
446
+		$required_fields['card_zip'] = array(
447 447
 			'error_id'      => 'invalid_zip_code',
448
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
448
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
449 449
 		);
450
-		$required_fields['card_city']       = array(
450
+		$required_fields['card_city'] = array(
451 451
 			'error_id'      => 'invalid_city',
452
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
452
+			'error_message' => __('Please enter your billing city.', 'give'),
453 453
 		);
454 454
 		$required_fields['billing_country'] = array(
455 455
 			'error_id'      => 'invalid_country',
456
-			'error_message' => __( 'Please select your billing country.', 'give' ),
456
+			'error_message' => __('Please select your billing country.', 'give'),
457 457
 		);
458
-		$required_fields['card_state']      = array(
458
+		$required_fields['card_state'] = array(
459 459
 			'error_id'      => 'invalid_state',
460
-			'error_message' => __( 'Please enter billing state / province.', 'give' ),
460
+			'error_message' => __('Please enter billing state / province.', 'give'),
461 461
 		);
462 462
 	}
463 463
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @since 1.7
468 468
 	 */
469
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
469
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
470 470
 
471 471
 	return $required_fields;
472 472
 
@@ -481,16 +481,16 @@  discard block
 block discarded – undo
481 481
  *
482 482
  * @return bool
483 483
  */
484
-function give_require_billing_address( $payment_mode ) {
484
+function give_require_billing_address($payment_mode) {
485 485
 
486 486
 	$return = false;
487 487
 
488
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
488
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
489 489
 		$return = true;
490 490
 	}
491 491
 
492 492
 	// Let payment gateways and other extensions determine if address fields should be required.
493
-	return apply_filters( 'give_require_billing_address', $return );
493
+	return apply_filters('give_require_billing_address', $return);
494 494
 
495 495
 }
496 496
 
@@ -504,42 +504,42 @@  discard block
 block discarded – undo
504 504
 function give_donation_form_validate_logged_in_user() {
505 505
 	global $user_ID;
506 506
 
507
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
507
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
508 508
 
509 509
 	// Start empty array to collect valid user data.
510 510
 	$valid_user_data = array(
511 511
 		// Assume there will be errors.
512
-		'user_id' => - 1,
512
+		'user_id' => -1,
513 513
 	);
514 514
 
515 515
 	// Verify there is a user_ID.
516
-	if ( $user_ID > 0 ) {
516
+	if ($user_ID > 0) {
517 517
 		// Get the logged in user data.
518
-		$user_data = get_userdata( $user_ID );
518
+		$user_data = get_userdata($user_ID);
519 519
 
520 520
 		// Loop through required fields and show error messages.
521
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
522
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
523
-				give_set_error( $value['error_id'], $value['error_message'] );
521
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
522
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
523
+				give_set_error($value['error_id'], $value['error_message']);
524 524
 			}
525 525
 		}
526 526
 
527 527
 		// Verify data.
528
-		if ( $user_data ) {
528
+		if ($user_data) {
529 529
 			// Collected logged in user data.
530 530
 			$valid_user_data = array(
531 531
 				'user_id'    => $user_ID,
532
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
533
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
534
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
532
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
533
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
534
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
535 535
 			);
536 536
 
537
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
538
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
537
+			if ( ! is_email($valid_user_data['user_email'])) {
538
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
539 539
 			}
540 540
 		} else {
541 541
 			// Set invalid user error.
542
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
542
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
543 543
 		}
544 544
 	}
545 545
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	// Default user data.
559 559
 	$default_user_data = array(
560 560
 		'give-form-id'           => '',
561
-		'user_id'                => - 1, // Assume there will be errors.
561
+		'user_id'                => -1, // Assume there will be errors.
562 562
 		'user_first'             => '',
563 563
 		'user_last'              => '',
564 564
 		'give_user_login'        => false,
@@ -568,14 +568,14 @@  discard block
 block discarded – undo
568 568
 	);
569 569
 
570 570
 	// Get user data.
571
-	$user_data            = wp_parse_args( array_map( 'trim', give_clean( $_POST ) ), $default_user_data );
571
+	$user_data            = wp_parse_args(array_map('trim', give_clean($_POST)), $default_user_data);
572 572
 	$registering_new_user = false;
573
-	$form_id              = absint( $user_data['give-form-id'] );
573
+	$form_id              = absint($user_data['give-form-id']);
574 574
 
575 575
 	// Start an empty array to collect valid user data.
576 576
 	$valid_user_data = array(
577 577
 		// Assume there will be errors.
578
-		'user_id'    => - 1,
578
+		'user_id'    => -1,
579 579
 
580 580
 		// Get first name.
581 581
 		'user_first' => $user_data['give_first'],
@@ -585,25 +585,25 @@  discard block
 block discarded – undo
585 585
 	);
586 586
 
587 587
 	// Loop through required fields and show error messages.
588
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
589
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
590
-			give_set_error( $value['error_id'], $value['error_message'] );
588
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
589
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
590
+			give_set_error($value['error_id'], $value['error_message']);
591 591
 		}
592 592
 	}
593 593
 
594 594
 	// Check if we have an username to register.
595
-	if ( give_validate_username( $user_data['give_user_login'] ) ) {
595
+	if (give_validate_username($user_data['give_user_login'])) {
596 596
 		$registering_new_user          = true;
597 597
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
598 598
 	}
599 599
 
600 600
 	// Check if we have an email to verify.
601
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
601
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
602 602
 		$valid_user_data['user_email'] = $user_data['give_email'];
603 603
 	}
604 604
 
605 605
 	// Check password.
606
-	if ( give_validate_user_password( $user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user ) ) {
606
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
607 607
 		// All is good to go.
608 608
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
609 609
 	}
@@ -623,36 +623,36 @@  discard block
 block discarded – undo
623 623
 	// Start an array to collect valid user data.
624 624
 	$valid_user_data = array(
625 625
 		// Assume there will be errors.
626
-		'user_id' => - 1,
626
+		'user_id' => -1,
627 627
 	);
628 628
 
629 629
 	// Username.
630
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
631
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
630
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
631
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
632 632
 
633 633
 		return $valid_user_data;
634 634
 	}
635 635
 
636 636
 	// Get the user by login.
637
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
637
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
638 638
 
639 639
 	// Check if user exists.
640
-	if ( $user_data ) {
640
+	if ($user_data) {
641 641
 		// Get password.
642
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
642
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
643 643
 
644 644
 		// Check user_pass.
645
-		if ( $user_pass ) {
645
+		if ($user_pass) {
646 646
 			// Check if password is valid.
647
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
647
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
648 648
 				// Incorrect password.
649 649
 				give_set_error(
650 650
 					'password_incorrect',
651 651
 					sprintf(
652 652
 						'%1$s <a href="%2$s">%3$s</a>',
653
-						__( 'The password you entered is incorrect.', 'give' ),
654
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
655
-						__( 'Reset Password', 'give' )
653
+						__('The password you entered is incorrect.', 'give'),
654
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
655
+						__('Reset Password', 'give')
656 656
 					)
657 657
 				);
658 658
 				// All is correct.
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 			}
670 670
 		} else {
671 671
 			// Empty password.
672
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
672
+			give_set_error('password_empty', __('Enter a password.', 'give'));
673 673
 		}
674 674
 	} else {
675 675
 		// No username.
676
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
676
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
677 677
 	}// End if().
678 678
 
679 679
 	return $valid_user_data;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
  */
689 689
 function give_donation_form_validate_guest_user() {
690 690
 
691
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
691
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
692 692
 
693 693
 	// Start an array to collect valid user data.
694 694
 	$valid_user_data = array(
@@ -697,38 +697,38 @@  discard block
 block discarded – undo
697 697
 	);
698 698
 
699 699
 	// Show error message if user must be logged in.
700
-	if ( give_logged_in_only( $form_id ) ) {
701
-		give_set_error( 'logged_in_only', __( 'You must be logged in to donate.', 'give' ) );
700
+	if (give_logged_in_only($form_id)) {
701
+		give_set_error('logged_in_only', __('You must be logged in to donate.', 'give'));
702 702
 	}
703 703
 
704 704
 	// Get the guest email.
705
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
705
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
706 706
 
707 707
 	// Check email.
708
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
708
+	if ($guest_email && strlen($guest_email) > 0) {
709 709
 		// Validate email.
710
-		if ( ! is_email( $guest_email ) ) {
710
+		if ( ! is_email($guest_email)) {
711 711
 			// Invalid email.
712
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
712
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
713 713
 		} else {
714 714
 			// All is good to go.
715 715
 			$valid_user_data['user_email'] = $guest_email;
716 716
 
717 717
 			// Get user_id from donor if exist.
718
-			$donor = new Give_Customer( $guest_email );
719
-			if ( $donor->id && $donor->user_id ) {
718
+			$donor = new Give_Customer($guest_email);
719
+			if ($donor->id && $donor->user_id) {
720 720
 				$valid_user_data['user_id'] = $donor->user_id;
721 721
 			}
722 722
 		}
723 723
 	} else {
724 724
 		// No email.
725
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
725
+		give_set_error('email_empty', __('Enter an email.', 'give'));
726 726
 	}
727 727
 
728 728
 	// Loop through required fields and show error messages.
729
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
730
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
731
-			give_set_error( $value['error_id'], $value['error_message'] );
729
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
730
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
731
+			give_set_error($value['error_id'], $value['error_message']);
732 732
 		}
733 733
 	}
734 734
 
@@ -744,36 +744,36 @@  discard block
 block discarded – undo
744 744
  * @since   1.0
745 745
  * @return  integer
746 746
  */
747
-function give_register_and_login_new_user( $user_data = array() ) {
747
+function give_register_and_login_new_user($user_data = array()) {
748 748
 	// Verify the array.
749
-	if ( empty( $user_data ) ) {
750
-		return - 1;
749
+	if (empty($user_data)) {
750
+		return -1;
751 751
 	}
752 752
 
753
-	if ( give_get_errors() ) {
754
-		return - 1;
753
+	if (give_get_errors()) {
754
+		return -1;
755 755
 	}
756 756
 
757
-	$user_args = apply_filters( 'give_insert_user_args', array(
758
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
759
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
760
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
761
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
762
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
763
-		'user_registered' => date( 'Y-m-d H:i:s' ),
764
-		'role'            => get_option( 'default_role' ),
765
-	), $user_data );
757
+	$user_args = apply_filters('give_insert_user_args', array(
758
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
759
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
760
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
761
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
762
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
763
+		'user_registered' => date('Y-m-d H:i:s'),
764
+		'role'            => get_option('default_role'),
765
+	), $user_data);
766 766
 
767 767
 	// Insert new user.
768
-	$user_id = wp_insert_user( $user_args );
768
+	$user_id = wp_insert_user($user_args);
769 769
 
770 770
 	// Validate inserted user.
771
-	if ( is_wp_error( $user_id ) ) {
772
-		return - 1;
771
+	if (is_wp_error($user_id)) {
772
+		return -1;
773 773
 	}
774 774
 
775 775
 	// Allow themes and plugins to filter the user data.
776
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
776
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
777 777
 
778 778
 	/**
779 779
 	 * Fires after inserting user.
@@ -783,10 +783,10 @@  discard block
 block discarded – undo
783 783
 	 * @param int $user_id User id.
784 784
 	 * @param array $user_data Array containing user data.
785 785
 	 */
786
-	do_action( 'give_insert_user', $user_id, $user_data );
786
+	do_action('give_insert_user', $user_id, $user_data);
787 787
 
788 788
 	// Login new user.
789
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
789
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
790 790
 
791 791
 	// Return user id.
792 792
 	return $user_id;
@@ -801,27 +801,27 @@  discard block
 block discarded – undo
801 801
  * @since   1.0
802 802
  * @return  array|bool
803 803
  */
804
-function give_get_donation_form_user( $valid_data = array() ) {
804
+function give_get_donation_form_user($valid_data = array()) {
805 805
 
806 806
 	// Initialize user.
807 807
 	$user    = false;
808
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
808
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
809 809
 
810
-	if ( $is_ajax ) {
810
+	if ($is_ajax) {
811 811
 		// Do not create or login the user during the ajax submission (check for errors only).
812 812
 		return true;
813
-	} elseif ( is_user_logged_in() ) {
813
+	} elseif (is_user_logged_in()) {
814 814
 		// Set the valid user as the logged in collected data.
815 815
 		$user = $valid_data['logged_in_user'];
816
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
816
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
817 817
 		// New user registration.
818
-		if ( $valid_data['need_new_user'] === true ) {
818
+		if ($valid_data['need_new_user'] === true) {
819 819
 			// Set user.
820 820
 			$user = $valid_data['new_user_data'];
821 821
 			// Register and login new user.
822
-			$user['user_id'] = give_register_and_login_new_user( $user );
822
+			$user['user_id'] = give_register_and_login_new_user($user);
823 823
 			// User login
824
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
824
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
825 825
 
826 826
 			/**
827 827
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -833,48 +833,48 @@  discard block
 block discarded – undo
833 833
 			// Set user.
834 834
 			$user = $valid_data['login_user_data'];
835 835
 			// Login user.
836
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
836
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
837 837
 		}
838 838
 	}
839 839
 
840 840
 	// Check guest checkout.
841
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
841
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
842 842
 		// Set user
843 843
 		$user = $valid_data['guest_user_data'];
844 844
 	}
845 845
 
846 846
 	// Verify we have an user.
847
-	if ( false === $user || empty( $user ) ) {
847
+	if (false === $user || empty($user)) {
848 848
 		// Return false.
849 849
 		return false;
850 850
 	}
851 851
 
852 852
 	// Get user first name.
853
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
854
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
853
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
854
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
855 855
 	}
856 856
 
857 857
 	// Get user last name.
858
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
859
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
858
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
859
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
860 860
 	}
861 861
 
862 862
 	// Get the user's billing address details.
863 863
 	$user['address']            = array();
864
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
865
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
866
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
867
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
868
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
869
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
870
-
871
-	if ( empty( $user['address']['country'] ) ) {
864
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
865
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
866
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
867
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
868
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
869
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
870
+
871
+	if (empty($user['address']['country'])) {
872 872
 		$user['address'] = false;
873 873
 	} // End if().
874 874
 
875
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
875
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
876 876
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return donation.
877
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
877
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
878 878
 	}
879 879
 
880 880
 	// Return valid user.
@@ -893,16 +893,16 @@  discard block
 block discarded – undo
893 893
 	$card_data = give_get_donation_cc_info();
894 894
 
895 895
 	// Validate the card zip.
896
-	if ( ! empty( $card_data['card_zip'] ) ) {
897
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
898
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
896
+	if ( ! empty($card_data['card_zip'])) {
897
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
898
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
899 899
 		}
900 900
 	}
901 901
 
902 902
 	// Ensure no spaces.
903
-	if ( ! empty( $card_data['card_number'] ) ) {
904
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
905
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
903
+	if ( ! empty($card_data['card_number'])) {
904
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
905
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
906 906
 	}
907 907
 
908 908
 	// This should validate card numbers at some point too.
@@ -919,17 +919,17 @@  discard block
 block discarded – undo
919 919
 function give_get_donation_cc_info() {
920 920
 
921 921
 	$cc_info                   = array();
922
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
923
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
924
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
925
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
926
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
927
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
928
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
929
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
930
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
931
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
932
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
922
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
923
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
924
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
925
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
926
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
927
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
928
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
929
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
930
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
931
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
932
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
933 933
 
934 934
 	// Return cc info.
935 935
 	return $cc_info;
@@ -945,14 +945,14 @@  discard block
 block discarded – undo
945 945
  *
946 946
  * @return bool|mixed
947 947
  */
948
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
948
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
949 949
 	$ret = false;
950 950
 
951
-	if ( empty( $zip ) || empty( $country_code ) ) {
951
+	if (empty($zip) || empty($country_code)) {
952 952
 		return $ret;
953 953
 	}
954 954
 
955
-	$country_code = strtoupper( $country_code );
955
+	$country_code = strtoupper($country_code);
956 956
 
957 957
 	$zip_regex = array(
958 958
 		'AD' => 'AD\d{3}',
@@ -1112,11 +1112,11 @@  discard block
 block discarded – undo
1112 1112
 		'ZM' => '\d{5}',
1113 1113
 	);
1114 1114
 
1115
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1115
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1116 1116
 		$ret = true;
1117 1117
 	}
1118 1118
 
1119
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1119
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1120 1120
 }
1121 1121
 
1122 1122
 
@@ -1130,36 +1130,36 @@  discard block
 block discarded – undo
1130 1130
  *
1131 1131
  * @return bool
1132 1132
  */
1133
-function give_validate_multi_donation_form_level( $valid_data, $data ) {
1133
+function give_validate_multi_donation_form_level($valid_data, $data) {
1134 1134
 	/* @var Give_Donate_Form $form */
1135
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1135
+	$form = new Give_Donate_Form($data['give-form-id']);
1136 1136
 
1137 1137
 	$donation_level_matched = false;
1138 1138
 
1139
-	if ( $form->is_multi_type_donation_form() ) {
1139
+	if ($form->is_multi_type_donation_form()) {
1140 1140
 
1141 1141
 		// Bailout.
1142
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1142
+		if ( ! ($variable_prices = $form->get_prices())) {
1143 1143
 			return false;
1144 1144
 		}
1145 1145
 
1146 1146
 		// Sanitize donation amount.
1147
-		$data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1147
+		$data['give-amount'] = give_sanitize_amount($data['give-amount']);
1148 1148
 
1149 1149
 		// Get number of decimals.
1150 1150
 		$default_decimals = give_get_price_decimals();
1151 1151
 
1152
-		if ( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ) {
1152
+		if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) {
1153 1153
 			return true;
1154 1154
 		}
1155 1155
 
1156 1156
 		// Find correct donation level from all donation levels.
1157
-		foreach ( $variable_prices as $variable_price ) {
1157
+		foreach ($variable_prices as $variable_price) {
1158 1158
 			// Sanitize level amount.
1159
-			$variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1159
+			$variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals);
1160 1160
 
1161 1161
 			// Set first match donation level ID.
1162
-			if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1162
+			if ($data['give-amount'] === $variable_price['_give_amount']) {
1163 1163
 				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1164 1164
 				$donation_level_matched = true;
1165 1165
 				break;
@@ -1170,19 +1170,19 @@  discard block
 block discarded – undo
1170 1170
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1171 1171
 		if (
1172 1172
 			! $donation_level_matched
1173
-			&& ( give_is_setting_enabled( give_get_meta( $data['give-form-id'], '_give_custom_amount', true ) ) )
1173
+			&& (give_is_setting_enabled(give_get_meta($data['give-form-id'], '_give_custom_amount', true)))
1174 1174
 		) {
1175 1175
 			// Sanitize custom minimum amount.
1176
-			$custom_minimum_amount = give_sanitize_amount( give_get_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1176
+			$custom_minimum_amount = give_sanitize_amount(give_get_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals);
1177 1177
 
1178
-			if ( $data['give-amount'] >= $custom_minimum_amount ) {
1178
+			if ($data['give-amount'] >= $custom_minimum_amount) {
1179 1179
 				$_POST['give-price-id'] = 'custom';
1180 1180
 				$donation_level_matched = true;
1181 1181
 			}
1182 1182
 		}
1183 1183
 	}// End if().
1184 1184
 
1185
-	return ( $donation_level_matched ? true : false );
1185
+	return ($donation_level_matched ? true : false);
1186 1186
 }
1187 1187
 
1188
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1188
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
Please login to merge, or discard this patch.
includes/formatting.php 1 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
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-	return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+	return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0));
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-	return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-	return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -61,67 +61,67 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string $amount Newly sanitized amount
63 63
  */
64
-function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
64
+function give_sanitize_amount($number, $dp = false, $trim_zeros = false) {
65 65
 
66 66
 	// Bailout.
67
-	if ( empty( $number ) ) {
67
+	if (empty($number)) {
68 68
 		return $number;
69 69
 	}
70 70
 
71 71
 	// Remove slash from amount.
72 72
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
73 73
 	// To prevent notices and warning remove slash from amount/number.
74
-	$number = wp_unslash( $number );
74
+	$number = wp_unslash($number);
75 75
 
76 76
 	$thousand_separator = give_get_price_thousand_separator();
77 77
 
78 78
 	$locale   = localeconv();
79
-	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
79
+	$decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
80 80
 
81 81
 	// Remove locale from string
82
-	if ( ! is_float( $number ) ) {
83
-		$number = str_replace( $decimals, '.', $number );
82
+	if ( ! is_float($number)) {
83
+		$number = str_replace($decimals, '.', $number);
84 84
 	}
85 85
 
86 86
 	// Remove thousand amount formatting if amount has.
87 87
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
88 88
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
89
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
90
-		$number = str_replace( $thousand_separator, '', $number );
91
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
92
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
89
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
90
+		$number = str_replace($thousand_separator, '', $number);
91
+	} elseif (in_array($thousand_separator, $decimals)) {
92
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
93 93
 	}
94 94
 
95 95
 	// Remove non numeric entity before decimal separator.
96
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
96
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
97 97
 	$default_dp = give_get_price_decimals();
98 98
 
99 99
 	// Reset negative amount to zero.
100
-	if ( 0 > $number ) {
101
-		$number = number_format( 0, $default_dp, '.' );
100
+	if (0 > $number) {
101
+		$number = number_format(0, $default_dp, '.');
102 102
 	}
103 103
 
104 104
 	// If number does not have decimal then add number of decimals to it.
105 105
 	if (
106
-		false === strpos( $number, '.' )
107
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
106
+		false === strpos($number, '.')
107
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
108 108
 	) {
109
-		$number = number_format( $number, $default_dp, '.', '' );
109
+		$number = number_format($number, $default_dp, '.', '');
110 110
 	}
111 111
 
112 112
 	// Format number by custom number of decimals.
113
-	if ( false !== $dp ) {
114
-		$dp     = intval( is_bool( $dp ) ? $default_dp : $dp );
115
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
116
-		$number = number_format( floatval( $number ), $dp, '.', '' );
113
+	if (false !== $dp) {
114
+		$dp     = intval(is_bool($dp) ? $default_dp : $dp);
115
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
116
+		$number = number_format(floatval($number), $dp, '.', '');
117 117
 	}
118 118
 
119 119
 	// Trim zeros.
120
-	if ( $trim_zeros && strstr( $number, '.' ) ) {
121
-		$number = rtrim( rtrim( $number, '0' ), '.' );
120
+	if ($trim_zeros && strstr($number, '.')) {
121
+		$number = rtrim(rtrim($number, '0'), '.');
122 122
 	}
123 123
 
124
-	return apply_filters( 'give_sanitize_amount', $number );
124
+	return apply_filters('give_sanitize_amount', $number);
125 125
 }
126 126
 
127 127
 /**
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
  *
135 135
  * @return string $amount   Newly formatted amount or Price Not Available
136 136
  */
137
-function give_format_amount( $amount, $decimals = true ) {
138
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
139
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
137
+function give_format_amount($amount, $decimals = true) {
138
+	$thousands_sep = give_get_option('thousands_separator', ',');
139
+	$decimal_sep   = give_get_option('decimal_separator', '.');
140 140
 
141
-	if ( empty( $amount ) ) {
141
+	if (empty($amount)) {
142 142
 		$amount = 0;
143 143
 	} else {
144 144
 		// Sanitize amount before formatting.
145
-		$amount = give_sanitize_amount( $amount );
145
+		$amount = give_sanitize_amount($amount);
146 146
 	}
147 147
 
148 148
 	$decimals = $decimals ? give_get_price_decimals() : 0;
149 149
 
150
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
150
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
151 151
 
152
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
152
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
153 153
 }
154 154
 
155 155
 
@@ -166,33 +166,33 @@  discard block
 block discarded – undo
166 166
  *
167 167
  * @return float|string  formatted amount number with large number names.
168 168
  */
169
-function give_human_format_large_amount( $amount ) {
169
+function give_human_format_large_amount($amount) {
170 170
 
171 171
 	// Get thousand separator.
172 172
 	$thousands_sep = give_get_price_thousand_separator();
173 173
 
174 174
 	// Sanitize amount.
175
-	$sanitize_amount = give_sanitize_amount( $amount );
175
+	$sanitize_amount = give_sanitize_amount($amount);
176 176
 
177 177
 	// Explode amount to calculate name of large numbers.
178
-	$amount_array = explode( $thousands_sep, $amount );
178
+	$amount_array = explode($thousands_sep, $amount);
179 179
 
180 180
 	// Calculate amount parts count.
181
-	$amount_count_parts = count( $amount_array );
181
+	$amount_count_parts = count($amount_array);
182 182
 
183 183
 	// Human format amount (default).
184 184
 	$human_format_amount = $amount;
185 185
 
186 186
 	// Calculate large number formatted amount.
187
-	if ( 4 < $amount_count_parts ) {
188
-		$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
-	} elseif ( 3 < $amount_count_parts ) {
190
-		$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
191
-	} elseif ( 2 < $amount_count_parts ) {
192
-		$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
187
+	if (4 < $amount_count_parts) {
188
+		$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
189
+	} elseif (3 < $amount_count_parts) {
190
+		$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
191
+	} elseif (2 < $amount_count_parts) {
192
+		$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
193 193
 	}
194 194
 
195
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
195
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
196 196
 }
197 197
 
198 198
 /**
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $amount Newly formatted amount or Price Not Available
207 207
  */
208
-function give_format_decimal( $amount, $dp = false ) {
208
+function give_format_decimal($amount, $dp = false) {
209 209
 	$decimal_separator = give_get_price_decimal_separator();
210
-	$formatted_amount  = give_sanitize_amount( $amount, $dp );
210
+	$formatted_amount  = give_sanitize_amount($amount, $dp);
211 211
 
212
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
213
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
212
+	if (false !== strpos($formatted_amount, '.')) {
213
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
214 214
 	}
215 215
 
216
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
216
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
217 217
 }
218 218
 
219 219
 /**
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return mixed|string
229 229
  */
230
-function give_currency_filter( $price = '', $currency = '', $decode_currency = false ) {
230
+function give_currency_filter($price = '', $currency = '', $decode_currency = false) {
231 231
 
232
-	if ( empty( $currency ) ) {
232
+	if (empty($currency)) {
233 233
 		$currency = give_get_currency();
234 234
 	}
235 235
 
236
-	$position = give_get_option( 'currency_position', 'before' );
236
+	$position = give_get_option('currency_position', 'before');
237 237
 
238 238
 	$negative = $price < 0;
239 239
 
240
-	if ( $negative ) {
240
+	if ($negative) {
241 241
 		// Remove proceeding "-".
242
-		$price = substr( $price, 1 );
242
+		$price = substr($price, 1);
243 243
 	}
244 244
 
245
-	$symbol = give_currency_symbol( $currency, $decode_currency );
245
+	$symbol = give_currency_symbol($currency, $decode_currency);
246 246
 
247
-	switch ( $currency ) :
247
+	switch ($currency) :
248 248
 		case 'GBP' :
249 249
 		case 'BRL' :
250 250
 		case 'EUR' :
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 		case 'MAD' :
274 274
 		case 'KRW' :
275 275
 		case 'ZAR' :
276
-			$formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
276
+			$formatted = ('before' === $position ? $symbol.$price : $price.$symbol);
277 277
 			break;
278 278
 		case 'NOK' :
279
-			$formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
279
+			$formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol);
280 280
 			break;
281 281
 		default :
282
-			$formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
282
+			$formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency);
283 283
 			break;
284 284
 	endswitch;
285 285
 
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 *           and if currency is USD and currency position is after then
295 295
 	 *           filter name will be give_usd_currency_filter_after
296 296
 	 */
297
-	$formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
297
+	$formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price);
298 298
 
299
-	if ( $negative ) {
299
+	if ($negative) {
300 300
 		// Prepend the minus sign before the currency sign.
301
-		$formatted = '-' . $formatted;
301
+		$formatted = '-'.$formatted;
302 302
 	}
303 303
 
304 304
 	return $formatted;
@@ -314,21 +314,21 @@  discard block
 block discarded – undo
314 314
  */
315 315
 function give_currency_decimal_filter() {
316 316
 
317
-	remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
317
+	remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
318 318
 
319 319
 	// Set default number of decimals.
320 320
 	$decimals = give_get_price_decimals();
321 321
 
322
-	add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
322
+	add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
323 323
 
324 324
 	// Get number of decimals with backward compatibility ( version < 1.6 )
325
-	if ( 1 <= func_num_args() ) {
326
-		$decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
325
+	if (1 <= func_num_args()) {
326
+		$decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0)));
327 327
 	}
328 328
 
329 329
 	$currency = give_get_currency();
330 330
 
331
-	switch ( $currency ) {
331
+	switch ($currency) {
332 332
 		case 'RIAL' :
333 333
 		case 'JPY' :
334 334
 		case 'TWD' :
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			break;
339 339
 	}
340 340
 
341
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
341
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
342 342
 }
343 343
 
344
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
345
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
344
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
345
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
346 346
 
347 347
 
348 348
 /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  *
355 355
  * @return string                  Date format string
356 356
  */
357
-function give_date_format( $date_context = '' ) {
357
+function give_date_format($date_context = '') {
358 358
 	/**
359 359
 	 * Filter the date context
360 360
 	 *
@@ -375,19 +375,19 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 *    }
377 377
 	 */
378
-	$date_format_contexts = apply_filters( 'give_date_format_contexts', array() );
378
+	$date_format_contexts = apply_filters('give_date_format_contexts', array());
379 379
 
380 380
 	// Set date format to default date format.
381
-	$date_format = get_option( 'date_format' );
381
+	$date_format = get_option('date_format');
382 382
 
383 383
 	// Update date format if we have non empty date format context array and non empty date format string for that context.
384
-	if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) {
385
-		$date_format = ! empty( $date_format_contexts[ $date_context ] )
386
-			? $date_format_contexts[ $date_context ]
384
+	if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) {
385
+		$date_format = ! empty($date_format_contexts[$date_context])
386
+			? $date_format_contexts[$date_context]
387 387
 			: $date_format;
388 388
 	}
389 389
 
390
-	return apply_filters( 'give_date_format', $date_format );
390
+	return apply_filters('give_date_format', $date_format);
391 391
 }
392 392
 
393 393
 /**
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
  *
402 402
  * @return string
403 403
  */
404
-function give_get_cache_key( $action, $query_args ) {
405
-	return Give_Cache::get_key( $action, $query_args );
404
+function give_get_cache_key($action, $query_args) {
405
+	return Give_Cache::get_key($action, $query_args);
406 406
 }
407 407
 
408 408
 /**
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
  *
416 416
  * @return string|array
417 417
  */
418
-function give_clean( $var ) {
419
-	if ( is_array( $var ) ) {
420
-		return array_map( 'give_clean', $var );
418
+function give_clean($var) {
419
+	if (is_array($var)) {
420
+		return array_map('give_clean', $var);
421 421
 	} else {
422
-		return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
422
+		return is_scalar($var) ? sanitize_text_field($var) : $var;
423 423
 	}
424 424
 }
425 425
 
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
  *
433 433
  * @return int
434 434
  */
435
-function give_let_to_num( $size ) {
436
-	$l   = substr( $size, - 1 );
437
-	$ret = substr( $size, 0, - 1 );
438
-	switch ( strtoupper( $l ) ) {
435
+function give_let_to_num($size) {
436
+	$l   = substr($size, - 1);
437
+	$ret = substr($size, 0, - 1);
438
+	switch (strtoupper($l)) {
439 439
 		case 'P':
440 440
 			$ret *= 1024;
441 441
 		case 'T':
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
  * @param int   $action
461 461
  * @param array $wp_die_args
462 462
  */
463
-function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) {
463
+function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) {
464 464
 
465 465
 	$default_wp_die_args = array(
466
-		'message' => esc_html__( 'Nonce verification has failed.', 'give' ),
467
-		'title'   => esc_html__( 'Error', 'give' ),
466
+		'message' => esc_html__('Nonce verification has failed.', 'give'),
467
+		'title'   => esc_html__('Error', 'give'),
468 468
 		'args'    => array(
469 469
 			'response' => 403,
470 470
 		),
471 471
 	);
472 472
 
473
-	$wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args );
473
+	$wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args);
474 474
 
475
-	if ( ! wp_verify_nonce( $nonce, $action ) ) {
475
+	if ( ! wp_verify_nonce($nonce, $action)) {
476 476
 		wp_die(
477 477
 			$wp_die_args['message'],
478 478
 			$wp_die_args['title'],
@@ -494,23 +494,23 @@  discard block
 block discarded – undo
494 494
  *
495 495
  * @return mixed
496 496
  */
497
-function give_check_variable( $variable, $conditional = '', $default = false ) {
497
+function give_check_variable($variable, $conditional = '', $default = false) {
498 498
 
499
-	switch ( $conditional ) {
499
+	switch ($conditional) {
500 500
 		case 'isset_empty':
501
-			$variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default;
501
+			$variable = (isset($variable) && ! empty($variable)) ? $variable : $default;
502 502
 			break;
503 503
 
504 504
 		case 'empty':
505
-			$variable = ! empty( $variable ) ? $variable : $default;
505
+			$variable = ! empty($variable) ? $variable : $default;
506 506
 			break;
507 507
 
508 508
 		case 'null':
509
-			$variable = ! is_null( $variable ) ? $variable : $default;
509
+			$variable = ! is_null($variable) ? $variable : $default;
510 510
 			break;
511 511
 
512 512
 		default:
513
-			$variable = isset( $variable ) ? $variable : $default;
513
+			$variable = isset($variable) ? $variable : $default;
514 514
 
515 515
 	}
516 516
 
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +150 added lines, -150 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return string       Donations dropdown.
37 37
 	 */
38
-	public function donations_dropdown( $args = array() ) {
38
+	public function donations_dropdown($args = array()) {
39 39
 
40 40
 		$defaults = array(
41 41
 			'name'        => 'donations',
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
 			'selected'    => 0,
46 46
 			'chosen'      => false,
47 47
 			'number'      => 30,
48
-			'placeholder' => __( 'Select a donation', 'give' )
48
+			'placeholder' => __('Select a donation', 'give')
49 49
 		);
50 50
 
51
-		$args = wp_parse_args( $args, $defaults );
51
+		$args = wp_parse_args($args, $defaults);
52 52
 
53
-		$payments = new Give_Payments_Query( array(
53
+		$payments = new Give_Payments_Query(array(
54 54
 			'number' => $args['number']
55
-		) );
55
+		));
56 56
 
57 57
 		$payments = $payments->get_payments();
58 58
 
59 59
 		$options = array();
60 60
 
61 61
 		//Provide nice human readable options.
62
-		if ( $payments ) {
62
+		if ($payments) {
63 63
 			$options[0] = $args['placeholder'];
64
-			foreach ( $payments as $payment ) {
64
+			foreach ($payments as $payment) {
65 65
 
66
-				$options[ absint( $payment->ID ) ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
66
+				$options[absint($payment->ID)] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
67 67
 
68 68
 			}
69 69
 		} else {
70
-			$options[0] = __( 'No donations found.', 'give' );
70
+			$options[0] = __('No donations found.', 'give');
71 71
 		}
72 72
 
73 73
 
74
-		$output = $this->select( array(
74
+		$output = $this->select(array(
75 75
 			'name'             => $args['name'],
76 76
 			'selected'         => $args['selected'],
77 77
 			'id'               => $args['id'],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			'select_atts'      => $args['select_atts'],
84 84
 			'show_option_all'  => false,
85 85
 			'show_option_none' => false
86
-		) );
86
+		));
87 87
 
88 88
 		return $output;
89 89
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @return string      Give forms dropdown.
102 102
 	 */
103
-	public function forms_dropdown( $args = array() ) {
103
+	public function forms_dropdown($args = array()) {
104 104
 
105 105
 		$defaults = array(
106 106
 			'name'        => 'forms',
@@ -110,38 +110,38 @@  discard block
 block discarded – undo
110 110
 			'selected'    => 0,
111 111
 			'chosen'      => false,
112 112
 			'number'      => 30,
113
-			'placeholder' => esc_attr__( 'Select a Donation Form', 'give' ),
114
-			'data'        => array( 'search-type' => 'form' ),
113
+			'placeholder' => esc_attr__('Select a Donation Form', 'give'),
114
+			'data'        => array('search-type' => 'form'),
115 115
 		);
116 116
 
117
-		$args = wp_parse_args( $args, $defaults );
117
+		$args = wp_parse_args($args, $defaults);
118 118
 
119
-		$forms = get_posts( array(
119
+		$forms = get_posts(array(
120 120
 			'post_type'      => 'give_forms',
121 121
 			'orderby'        => 'title',
122 122
 			'order'          => 'ASC',
123 123
 			'posts_per_page' => $args['number']
124
-		) );
124
+		));
125 125
 
126 126
 		$options = array();
127 127
 
128 128
 		// Ensure the selected.
129
-		if ( false !== $args['selected'] && $args['selected'] !== 0 ) {
130
-			$options[ $args['selected'] ] = get_the_title( $args['selected'] );
129
+		if (false !== $args['selected'] && $args['selected'] !== 0) {
130
+			$options[$args['selected']] = get_the_title($args['selected']);
131 131
 		}
132 132
 
133 133
 
134
-		if ( $forms ) {
134
+		if ($forms) {
135 135
 			$options[0] = $args['placeholder'];
136
-			foreach ( $forms as $form ) {
137
-				$form_title                     = empty( $form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID ) : $form->post_title;
138
-				$options[ absint( $form->ID ) ] = esc_html( $form_title );
136
+			foreach ($forms as $form) {
137
+				$form_title                     = empty($form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $form->ID) : $form->post_title;
138
+				$options[absint($form->ID)] = esc_html($form_title);
139 139
 			}
140 140
 		} else {
141
-			$options[0] = esc_html__( 'No forms found.', 'give' );
141
+			$options[0] = esc_html__('No forms found.', 'give');
142 142
 		}
143 143
 
144
-		$output = $this->select( array(
144
+		$output = $this->select(array(
145 145
 			'name'             => $args['name'],
146 146
 			'selected'         => $args['selected'],
147 147
 			'id'               => $args['id'],
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			'show_option_all'  => false,
154 154
 			'show_option_none' => false,
155 155
 			'data'             => $args['data'],
156
-		) );
156
+		));
157 157
 
158 158
 		return $output;
159 159
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string      Donors dropdown.
172 172
 	 */
173
-	public function donor_dropdown( $args = array() ) {
173
+	public function donor_dropdown($args = array()) {
174 174
 
175 175
 		$defaults = array(
176 176
 			'name'        => 'donors',
@@ -179,39 +179,39 @@  discard block
 block discarded – undo
179 179
 			'multiple'    => false,
180 180
 			'selected'    => 0,
181 181
 			'chosen'      => true,
182
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
182
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
183 183
 			'number'      => 30,
184
-			'data'        => array( 'search-type' => 'donor' )
184
+			'data'        => array('search-type' => 'donor')
185 185
 		);
186 186
 
187
-		$args = wp_parse_args( $args, $defaults );
187
+		$args = wp_parse_args($args, $defaults);
188 188
 
189
-		$customers = Give()->customers->get_customers( array(
189
+		$customers = Give()->customers->get_customers(array(
190 190
 			'number' => $args['number']
191
-		) );
191
+		));
192 192
 
193 193
 		$options = array();
194 194
 
195
-		if ( $customers ) {
196
-			$options[0] = esc_html__( 'No donor attached', 'give' );
197
-			foreach ( $customers as $customer ) {
198
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
195
+		if ($customers) {
196
+			$options[0] = esc_html__('No donor attached', 'give');
197
+			foreach ($customers as $customer) {
198
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
199 199
 			}
200 200
 		} else {
201
-			$options[0] = esc_html__( 'No donors found.', 'give' );
201
+			$options[0] = esc_html__('No donors found.', 'give');
202 202
 		}
203 203
 
204
-		if ( ! empty( $args['selected'] ) ) {
204
+		if ( ! empty($args['selected'])) {
205 205
 
206 206
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed.
207 207
 
208
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
208
+			if ( ! array_key_exists($args['selected'], $options)) {
209 209
 
210
-				$customer = new Give_Customer( $args['selected'] );
210
+				$customer = new Give_Customer($args['selected']);
211 211
 
212
-				if ( $customer ) {
212
+				if ($customer) {
213 213
 
214
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
214
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
215 215
 
216 216
 				}
217 217
 
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 
220 220
 		}
221 221
 
222
-		$output = $this->select( array(
222
+		$output = $this->select(array(
223 223
 			'name'             => $args['name'],
224 224
 			'selected'         => $args['selected'],
225 225
 			'id'               => $args['id'],
226
-			'class'            => $args['class'] . ' give-customer-select',
226
+			'class'            => $args['class'].' give-customer-select',
227 227
 			'options'          => $options,
228 228
 			'multiple'         => $args['multiple'],
229 229
 			'chosen'           => $args['chosen'],
230 230
 			'show_option_all'  => false,
231 231
 			'show_option_none' => false,
232 232
 			'data'             => $args['data'],
233
-		) );
233
+		));
234 234
 
235 235
 		return $output;
236 236
 	}
@@ -249,24 +249,24 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return string           Categories dropdown.
251 251
 	 */
252
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0, $args = array() ) {
253
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
252
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0, $args = array()) {
253
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
254 254
 		$options    = array();
255 255
 
256
-		foreach ( $categories as $category ) {
257
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
256
+		foreach ($categories as $category) {
257
+			$options[absint($category->term_id)] = esc_html($category->name);
258 258
 		}
259 259
 
260
-		$output = $this->select( wp_parse_args(
260
+		$output = $this->select(wp_parse_args(
261 261
 			$args,
262 262
 			array(
263 263
 				'name'             => $name,
264 264
 				'selected'         => $selected,
265 265
 				'options'          => $options,
266
-				'show_option_all'  => esc_html__( 'All Categories', 'give' ),
266
+				'show_option_all'  => esc_html__('All Categories', 'give'),
267 267
 				'show_option_none' => false
268 268
 			)
269
-		) );
269
+		));
270 270
 
271 271
 		return $output;
272 272
 	}
@@ -285,24 +285,24 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return string           Tags dropdown.
287 287
 	 */
288
-	public function tags_dropdown( $name = 'give_forms_tags', $selected = 0, $args = array() ) {
289
-		$tags    = get_terms( 'give_forms_tag', apply_filters( 'give_forms_tag_dropdown', array() ) );
288
+	public function tags_dropdown($name = 'give_forms_tags', $selected = 0, $args = array()) {
289
+		$tags    = get_terms('give_forms_tag', apply_filters('give_forms_tag_dropdown', array()));
290 290
 		$options = array();
291 291
 
292
-		foreach ( $tags as $tag ) {
293
-			$options[ absint( $tag->term_id ) ] = esc_html( $tag->name );
292
+		foreach ($tags as $tag) {
293
+			$options[absint($tag->term_id)] = esc_html($tag->name);
294 294
 		}
295 295
 
296
-		$output = $this->select( wp_parse_args(
296
+		$output = $this->select(wp_parse_args(
297 297
 			$args,
298 298
 			array(
299 299
 				'name'             => $name,
300 300
 				'selected'         => $selected,
301 301
 				'options'          => $options,
302
-				'show_option_all'  => esc_html__( 'All Tags', 'give' ),
302
+				'show_option_all'  => esc_html__('All Tags', 'give'),
303 303
 				'show_option_none' => false,
304 304
 			)
305
-		) );
305
+		));
306 306
 
307 307
 		return $output;
308 308
 	}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return string               Years dropdown.
324 324
 	 */
325
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
326
-		$current    = date( 'Y' );
327
-		$start_year = $current - absint( $years_before );
328
-		$end_year   = $current + absint( $years_after );
329
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
325
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
326
+		$current    = date('Y');
327
+		$start_year = $current - absint($years_before);
328
+		$end_year   = $current + absint($years_after);
329
+		$selected   = empty($selected) ? date('Y') : $selected;
330 330
 		$options    = array();
331 331
 
332
-		while ( $start_year <= $end_year ) {
333
-			$options[ absint( $start_year ) ] = $start_year;
334
-			$start_year ++;
332
+		while ($start_year <= $end_year) {
333
+			$options[absint($start_year)] = $start_year;
334
+			$start_year++;
335 335
 		}
336 336
 
337
-		$output = $this->select( array(
337
+		$output = $this->select(array(
338 338
 			'name'             => $name,
339 339
 			'selected'         => $selected,
340 340
 			'options'          => $options,
341 341
 			'show_option_all'  => false,
342 342
 			'show_option_none' => false
343
-		) );
343
+		));
344 344
 
345 345
 		return $output;
346 346
 	}
@@ -358,23 +358,23 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @return string           Months dropdown.
360 360
 	 */
361
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
361
+	public function month_dropdown($name = 'month', $selected = 0) {
362 362
 		$month    = 1;
363 363
 		$options  = array();
364
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
364
+		$selected = empty($selected) ? date('n') : $selected;
365 365
 
366
-		while ( $month <= 12 ) {
367
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
368
-			$month ++;
366
+		while ($month <= 12) {
367
+			$options[absint($month)] = give_month_num_to_name($month);
368
+			$month++;
369 369
 		}
370 370
 
371
-		$output = $this->select( array(
371
+		$output = $this->select(array(
372 372
 			'name'             => $name,
373 373
 			'selected'         => $selected,
374 374
 			'options'          => $options,
375 375
 			'show_option_all'  => false,
376 376
 			'show_option_none' => false
377
-		) );
377
+		));
378 378
 
379 379
 		return $output;
380 380
 	}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string      The dropdown.
393 393
 	 */
394
-	public function select( $args = array() ) {
394
+	public function select($args = array()) {
395 395
 		$defaults = array(
396 396
 			'options'          => array(),
397 397
 			'name'             => null,
@@ -402,68 +402,68 @@  discard block
 block discarded – undo
402 402
 			'placeholder'      => null,
403 403
 			'multiple'         => false,
404 404
 			'select_atts'      => false,
405
-			'show_option_all'  => __( 'All', 'give' ),
406
-			'show_option_none' => __( 'None', 'give' ),
405
+			'show_option_all'  => __('All', 'give'),
406
+			'show_option_none' => __('None', 'give'),
407 407
 			'data'             => array(),
408 408
 			'readonly'         => false,
409 409
 			'disabled'         => false,
410 410
 		);
411 411
 
412
-		$args = wp_parse_args( $args, $defaults );
412
+		$args = wp_parse_args($args, $defaults);
413 413
 
414 414
 		$data_elements = '';
415
-		foreach ( $args['data'] as $key => $value ) {
416
-			$data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
415
+		foreach ($args['data'] as $key => $value) {
416
+			$data_elements .= ' data-'.esc_attr($key).'="'.esc_attr($value).'"';
417 417
 		}
418 418
 
419
-		if ( $args['multiple'] ) {
419
+		if ($args['multiple']) {
420 420
 			$multiple = ' MULTIPLE';
421 421
 		} else {
422 422
 			$multiple = '';
423 423
 		}
424 424
 
425
-		if ( $args['chosen'] ) {
425
+		if ($args['chosen']) {
426 426
 			$args['class'] .= ' give-select-chosen';
427 427
 		}
428 428
 
429
-		if ( $args['placeholder'] ) {
429
+		if ($args['placeholder']) {
430 430
 			$placeholder = $args['placeholder'];
431 431
 		} else {
432 432
 			$placeholder = '';
433 433
 		}
434 434
 
435 435
 
436
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' ' . $args['select_atts'] . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
436
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' '.$args['select_atts'].' data-placeholder="'.$placeholder.'"'.$data_elements.'>';
437 437
 
438
-		if ( $args['show_option_all'] ) {
439
-			if ( $args['multiple'] ) {
440
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
438
+		if ($args['show_option_all']) {
439
+			if ($args['multiple']) {
440
+				$selected = selected(true, in_array(0, $args['selected']), false);
441 441
 			} else {
442
-				$selected = selected( $args['selected'], 0, false );
442
+				$selected = selected($args['selected'], 0, false);
443 443
 			}
444
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
444
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
445 445
 		}
446 446
 
447
-		if ( ! empty( $args['options'] ) ) {
447
+		if ( ! empty($args['options'])) {
448 448
 
449
-			if ( $args['show_option_none'] ) {
450
-				if ( $args['multiple'] ) {
451
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
449
+			if ($args['show_option_none']) {
450
+				if ($args['multiple']) {
451
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
452 452
 				} else {
453
-					$selected = selected( $args['selected'], - 1, false );
453
+					$selected = selected($args['selected'], - 1, false);
454 454
 				}
455
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
455
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
456 456
 			}
457 457
 
458
-			foreach ( $args['options'] as $key => $option ) {
458
+			foreach ($args['options'] as $key => $option) {
459 459
 
460
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
461
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
460
+				if ($args['multiple'] && is_array($args['selected'])) {
461
+					$selected = selected(true, in_array($key, $args['selected']), false);
462 462
 				} else {
463
-					$selected = selected( $args['selected'], $key, false );
463
+					$selected = selected($args['selected'], $key, false);
464 464
 				}
465 465
 
466
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
466
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
467 467
 			}
468 468
 		}
469 469
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return string      The checkbox.
486 486
 	 */
487
-	public function checkbox( $args = array() ) {
487
+	public function checkbox($args = array()) {
488 488
 		$defaults = array(
489 489
 			'name'    => null,
490 490
 			'current' => null,
@@ -495,16 +495,16 @@  discard block
 block discarded – undo
495 495
 			)
496 496
 		);
497 497
 
498
-		$args = wp_parse_args( $args, $defaults );
498
+		$args = wp_parse_args($args, $defaults);
499 499
 
500 500
 		$options = '';
501
-		if ( ! empty( $args['options']['disabled'] ) ) {
501
+		if ( ! empty($args['options']['disabled'])) {
502 502
 			$options .= ' disabled="disabled"';
503
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
503
+		} elseif ( ! empty($args['options']['readonly'])) {
504 504
 			$options .= ' readonly';
505 505
 		}
506 506
 
507
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
507
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
508 508
 
509 509
 		return $output;
510 510
 	}
@@ -521,22 +521,22 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string      The text field.
523 523
 	 */
524
-	public function text( $args = array() ) {
524
+	public function text($args = array()) {
525 525
 		// Backwards compatibility.
526
-		if ( func_num_args() > 1 ) {
526
+		if (func_num_args() > 1) {
527 527
 			$args = func_get_args();
528 528
 
529 529
 			$name  = $args[0];
530
-			$value = isset( $args[1] ) ? $args[1] : '';
531
-			$label = isset( $args[2] ) ? $args[2] : '';
532
-			$desc  = isset( $args[3] ) ? $args[3] : '';
530
+			$value = isset($args[1]) ? $args[1] : '';
531
+			$label = isset($args[2]) ? $args[2] : '';
532
+			$desc  = isset($args[3]) ? $args[3] : '';
533 533
 		}
534 534
 
535 535
 		$defaults = array(
536
-			'name'         => isset( $name ) ? $name : 'text',
537
-			'value'        => isset( $value ) ? $value : null,
538
-			'label'        => isset( $label ) ? $label : null,
539
-			'desc'         => isset( $desc ) ? $desc : null,
536
+			'name'         => isset($name) ? $name : 'text',
537
+			'value'        => isset($value) ? $value : null,
538
+			'label'        => isset($label) ? $label : null,
539
+			'desc'         => isset($desc) ? $desc : null,
540 540
 			'placeholder'  => '',
541 541
 			'class'        => 'regular-text',
542 542
 			'disabled'     => false,
@@ -544,29 +544,29 @@  discard block
 block discarded – undo
544 544
 			'data'         => false
545 545
 		);
546 546
 
547
-		$args = wp_parse_args( $args, $defaults );
547
+		$args = wp_parse_args($args, $defaults);
548 548
 
549 549
 		$disabled = '';
550
-		if ( $args['disabled'] ) {
550
+		if ($args['disabled']) {
551 551
 			$disabled = ' disabled="disabled"';
552 552
 		}
553 553
 
554 554
 		$data = '';
555
-		if ( ! empty( $args['data'] ) ) {
556
-			foreach ( $args['data'] as $key => $value ) {
557
-				$data .= 'data-' . $key . '="' . $value . '" ';
555
+		if ( ! empty($args['data'])) {
556
+			foreach ($args['data'] as $key => $value) {
557
+				$data .= 'data-'.$key.'="'.$value.'" ';
558 558
 			}
559 559
 		}
560 560
 
561
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
561
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
562 562
 
563
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
563
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
564 564
 
565
-		if ( ! empty( $args['desc'] ) ) {
566
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
565
+		if ( ! empty($args['desc'])) {
566
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
567 567
 		}
568 568
 
569
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
569
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
570 570
 
571 571
 		$output .= '</span>';
572 572
 
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 *
586 586
 	 * @return string      The date picker.
587 587
 	 */
588
-	public function date_field( $args = array() ) {
588
+	public function date_field($args = array()) {
589 589
 
590
-		if ( empty( $args['class'] ) ) {
590
+		if (empty($args['class'])) {
591 591
 			$args['class'] = 'give_datepicker';
592
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
592
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
593 593
 			$args['class'] .= ' give_datepicker';
594 594
 		}
595 595
 
596
-		return $this->text( $args );
596
+		return $this->text($args);
597 597
 	}
598 598
 
599 599
 	/**
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 *
609 609
 	 * @return string      The textarea.
610 610
 	 */
611
-	public function textarea( $args = array() ) {
611
+	public function textarea($args = array()) {
612 612
 		$defaults = array(
613 613
 			'name'     => 'textarea',
614 614
 			'value'    => null,
@@ -618,21 +618,21 @@  discard block
 block discarded – undo
618 618
 			'disabled' => false
619 619
 		);
620 620
 
621
-		$args = wp_parse_args( $args, $defaults );
621
+		$args = wp_parse_args($args, $defaults);
622 622
 
623 623
 		$disabled = '';
624
-		if ( $args['disabled'] ) {
624
+		if ($args['disabled']) {
625 625
 			$disabled = ' disabled="disabled"';
626 626
 		}
627 627
 
628
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
628
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
629 629
 
630
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
630
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
631 631
 
632
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
632
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
633 633
 
634
-		if ( ! empty( $args['desc'] ) ) {
635
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
634
+		if ( ! empty($args['desc'])) {
635
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
636 636
 		}
637 637
 
638 638
 		$output .= '</span>';
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 *
653 653
 	 * @return string      The text field with ajax search.
654 654
 	 */
655
-	public function ajax_user_search( $args = array() ) {
655
+	public function ajax_user_search($args = array()) {
656 656
 
657 657
 		$defaults = array(
658 658
 			'name'        => 'users',
@@ -663,30 +663,30 @@  discard block
 block discarded – undo
663 663
 			'chosen'      => true,
664 664
 			'number'      => 30,
665 665
 			'select_atts' => '',
666
-			'placeholder' => __( 'Select a user', 'give' ),
667
-			'data'        => array( 'search-type' => 'user' ),
666
+			'placeholder' => __('Select a user', 'give'),
667
+			'data'        => array('search-type' => 'user'),
668 668
 		);
669 669
 
670 670
 
671
-		$args = wp_parse_args( $args, $defaults );
671
+		$args = wp_parse_args($args, $defaults);
672 672
 
673 673
 		$get_users_args = array(
674 674
 			'number' => $args['number'],
675 675
 		);
676 676
 
677
-		$users = apply_filters( 'give_ajax_user_search_initial_results', get_users( $get_users_args ), $args );
677
+		$users = apply_filters('give_ajax_user_search_initial_results', get_users($get_users_args), $args);
678 678
 		$options = array();
679 679
 
680
-		if ( $users ) {
680
+		if ($users) {
681 681
 			$options[0] = $args['placeholder'];
682
-			foreach ( $users as $user ) {
683
-				$options[ absint( $user->id ) ] = esc_html( $user->user_login . ' (' . $user->user_email . ')' );
682
+			foreach ($users as $user) {
683
+				$options[absint($user->id)] = esc_html($user->user_login.' ('.$user->user_email.')');
684 684
 			}
685 685
 		} else {
686
-			$options[0] = esc_html__( 'No users found.', 'give' );
686
+			$options[0] = esc_html__('No users found.', 'give');
687 687
 		}
688 688
 
689
-		$output = $this->select( array(
689
+		$output = $this->select(array(
690 690
 			'name'             => $args['name'],
691 691
 			'selected'         => $args['selected'],
692 692
 			'id'               => $args['id'],
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 			'show_option_all'  => false,
700 700
 			'show_option_none' => false,
701 701
 			'data'             => $args['data'],
702
-		) );
702
+		));
703 703
 
704 704
 		return $output;
705 705
 
Please login to merge, or discard this patch.
includes/ajax-functions.php 1 patch
Spacing   +104 added lines, -104 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 ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
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
@@ -193,23 +193,23 @@  discard block
 block discarded – undo
193 193
  */
194 194
 function give_ajax_get_states_field() {
195 195
 
196
-	if ( empty( $_POST['country'] ) ) {
196
+	if (empty($_POST['country'])) {
197 197
 		$_POST['country'] = give_get_country();
198 198
 	}
199
-	$states = give_get_states( $_POST['country'] );
199
+	$states = give_get_states($_POST['country']);
200 200
 
201
-	if ( ! empty( $states ) ) {
201
+	if ( ! empty($states)) {
202 202
 
203 203
 		$args = array(
204 204
 			'name'             => $_POST['field_name'],
205 205
 			'id'               => $_POST['field_name'],
206
-			'class'            => $_POST['field_name'] . '  give-select',
207
-			'options'          => give_get_states( $_POST['country'] ),
206
+			'class'            => $_POST['field_name'].'  give-select',
207
+			'options'          => give_get_states($_POST['country']),
208 208
 			'show_option_all'  => false,
209 209
 			'show_option_none' => false,
210 210
 		);
211 211
 
212
-		$response = Give()->html->select( $args );
212
+		$response = Give()->html->select($args);
213 213
 
214 214
 	} else {
215 215
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	give_die();
222 222
 }
223 223
 
224
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
225
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
224
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
225
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
226 226
 
227 227
 /**
228 228
  * Retrieve donation forms via AJAX for chosen dropdown search field.
@@ -234,19 +234,19 @@  discard block
 block discarded – undo
234 234
 function give_ajax_form_search() {
235 235
 	global $wpdb;
236 236
 
237
-	$search   = esc_sql( sanitize_text_field( $_GET['s'] ) );
238
-	$excludes = ( isset( $_GET['current_id'] ) ? (array) $_GET['current_id'] : array() );
237
+	$search   = esc_sql(sanitize_text_field($_GET['s']));
238
+	$excludes = (isset($_GET['current_id']) ? (array) $_GET['current_id'] : array());
239 239
 
240 240
 	$results = array();
241
-	if ( current_user_can( 'edit_give_forms' ) ) {
242
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
241
+	if (current_user_can('edit_give_forms')) {
242
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
243 243
 	} else {
244
-		$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" );
244
+		$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");
245 245
 	}
246 246
 
247
-	if ( $items ) {
247
+	if ($items) {
248 248
 
249
-		foreach ( $items as $item ) {
249
+		foreach ($items as $item) {
250 250
 
251 251
 			$results[] = array(
252 252
 				'id'   => $item->ID,
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$items[] = array(
259 259
 			'id'   => 0,
260
-			'name' => __( 'No forms found.', 'give' ),
260
+			'name' => __('No forms found.', 'give'),
261 261
 		);
262 262
 
263 263
 	}
264 264
 
265
-	echo json_encode( $results );
265
+	echo json_encode($results);
266 266
 
267 267
 	give_die();
268 268
 }
269 269
 
270
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
271
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
270
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
271
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
272 272
 
273 273
 /**
274 274
  * Search the donors database via Ajax
@@ -280,38 +280,38 @@  discard block
 block discarded – undo
280 280
 function give_ajax_donor_search() {
281 281
 	global $wpdb;
282 282
 
283
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
283
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
284 284
 	$results = array();
285
-	if ( ! current_user_can( 'view_give_reports' ) ) {
285
+	if ( ! current_user_can('view_give_reports')) {
286 286
 		$donors = array();
287 287
 	} else {
288
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
288
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_customers WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
289 289
 	}
290 290
 
291
-	if ( $donors ) {
291
+	if ($donors) {
292 292
 
293
-		foreach ( $donors as $donor ) {
293
+		foreach ($donors as $donor) {
294 294
 
295 295
 			$results[] = array(
296 296
 				'id'   => $donor->id,
297
-				'name' => $donor->name . ' (' . $donor->email . ')',
297
+				'name' => $donor->name.' ('.$donor->email.')',
298 298
 			);
299 299
 		}
300 300
 	} else {
301 301
 
302 302
 		$donors[] = array(
303 303
 			'id'   => 0,
304
-			'name' => __( 'No donors found.', 'give' ),
304
+			'name' => __('No donors found.', 'give'),
305 305
 		);
306 306
 
307 307
 	}
308 308
 
309
-	echo json_encode( $results );
309
+	echo json_encode($results);
310 310
 
311 311
 	give_die();
312 312
 }
313 313
 
314
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
314
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
315 315
 
316 316
 
317 317
 /**
@@ -323,39 +323,39 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function give_ajax_search_users() {
325 325
 
326
-	if ( current_user_can( 'manage_give_settings' ) ) {
326
+	if (current_user_can('manage_give_settings')) {
327 327
 
328
-		$search   = esc_sql( sanitize_text_field( $_GET['s'] ) );
328
+		$search = esc_sql(sanitize_text_field($_GET['s']));
329 329
 
330 330
 		$get_users_args = array(
331 331
 			'number' => 9999,
332
-			'search' => $search . '*',
332
+			'search' => $search.'*',
333 333
 		);
334 334
 
335
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
335
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
336 336
 
337
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search );
337
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search);
338 338
 		$results     = array();
339 339
 
340
-		if ( $found_users ) {
340
+		if ($found_users) {
341 341
 
342
-			foreach ( $found_users as $user ) {
342
+			foreach ($found_users as $user) {
343 343
 
344 344
 				$results[] = array(
345 345
 					'id'   => $user->ID,
346
-					'name' =>  esc_html( $user->user_login . ' (' . $user->user_email . ')' ),
346
+					'name' =>  esc_html($user->user_login.' ('.$user->user_email.')'),
347 347
 				);
348 348
 			}
349 349
 		} else {
350 350
 
351 351
 			$results[] = array(
352 352
 				'id'   => 0,
353
-				'name' => __( 'No users found.', 'give' ),
353
+				'name' => __('No users found.', 'give'),
354 354
 			);
355 355
 
356 356
 		}
357 357
 
358
-		echo json_encode( $results );
358
+		echo json_encode($results);
359 359
 
360 360
 	}// End if().
361 361
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 }
365 365
 
366
-add_action( 'wp_ajax_give_user_search', 'give_ajax_search_users' );
366
+add_action('wp_ajax_give_user_search', 'give_ajax_search_users');
367 367
 
368 368
 
369 369
 /**
@@ -375,32 +375,32 @@  discard block
 block discarded – undo
375 375
  */
376 376
 function give_check_for_form_price_variations() {
377 377
 
378
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
379
-		die( '-1' );
378
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
379
+		die('-1');
380 380
 	}
381 381
 
382
-	$form_id = intval( $_POST['form_id'] );
383
-	$form    = get_post( $form_id );
382
+	$form_id = intval($_POST['form_id']);
383
+	$form    = get_post($form_id);
384 384
 
385
-	if ( 'give_forms' != $form->post_type ) {
386
-		die( '-2' );
385
+	if ('give_forms' != $form->post_type) {
386
+		die('-2');
387 387
 	}
388 388
 
389
-	if ( give_has_variable_prices( $form_id ) ) {
390
-		$variable_prices = give_get_variable_prices( $form_id );
389
+	if (give_has_variable_prices($form_id)) {
390
+		$variable_prices = give_get_variable_prices($form_id);
391 391
 
392
-		if ( $variable_prices ) {
392
+		if ($variable_prices) {
393 393
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
394 394
 
395
-			if ( isset( $_POST['all_prices'] ) ) {
396
-				$ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>';
395
+			if (isset($_POST['all_prices'])) {
396
+				$ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>';
397 397
 			}
398 398
 
399
-			foreach ( $variable_prices as $key => $price ) {
399
+			foreach ($variable_prices as $key => $price) {
400 400
 
401
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
401
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
402 402
 
403
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
403
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
404 404
 			}
405 405
 			$ajax_response .= '</select>';
406 406
 			echo $ajax_response;
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	give_die();
411 411
 }
412 412
 
413
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
413
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
414 414
 
415 415
 
416 416
 /**
@@ -421,25 +421,25 @@  discard block
 block discarded – undo
421 421
  * @return void
422 422
  */
423 423
 function give_check_for_form_price_variations_html() {
424
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
424
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
425 425
 		wp_die();
426 426
 	}
427 427
 
428
-	$form_id    = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0;
429
-	$payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : 0;
430
-	$form       = get_post( $form_id );
428
+	$form_id    = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : 0;
429
+	$payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : 0;
430
+	$form       = get_post($form_id);
431 431
 
432
-	if ( 'give_forms' != $form->post_type ) {
432
+	if ('give_forms' != $form->post_type) {
433 433
 		wp_die();
434 434
 	}
435 435
 
436
-	if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) {
437
-		esc_html_e( 'n/a', 'give' );
436
+	if ( ! give_has_variable_prices($form_id) || ! $form_id) {
437
+		esc_html_e('n/a', 'give');
438 438
 	} else {
439 439
 		$prices_atts = '';
440
-		if ( $variable_prices = give_get_variable_prices( $form_id ) ) {
441
-			foreach ( $variable_prices as $variable_price ) {
442
-				$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'] );
440
+		if ($variable_prices = give_get_variable_prices($form_id)) {
441
+			foreach ($variable_prices as $variable_price) {
442
+				$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
443 443
 			}
444 444
 		}
445 445
 
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
 			'chosen'           => true,
451 451
 			'show_option_all'  => '',
452 452
 			'show_option_none' => '',
453
-			'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
453
+			'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
454 454
 		);
455 455
 
456
-		if ( $payment_id ) {
456
+		if ($payment_id) {
457 457
 			// Payment object.
458
-			$payment = new Give_Payment( $payment_id );
458
+			$payment = new Give_Payment($payment_id);
459 459
 
460 460
 			// Payment meta.
461 461
 			$payment_meta                               = $payment->get_meta();
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		// Render variable prices select tag html.
466
-		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
466
+		give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
467 467
 	}
468 468
 
469 469
 	give_die();
470 470
 }
471 471
 
472
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
472
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/scripts.php 1 patch
Spacing   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_vars = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_vars = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
39
-		'currency_sign'       => give_currency_filter( '' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39
+		'currency_sign'       => give_currency_filter(''),
40 40
 		'currency_pos'        => give_get_currency_position(),
41 41
 		'thousands_separator' => give_get_price_thousand_separator(),
42 42
 		'decimal_separator'   => give_get_price_decimal_separator(),
43
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
44
-		'bad_minimum'         => __( 'The minimum custom donation amount for this form is', 'give' ),
45
-		'general_loading'     => __( 'Loading...', 'give' ),
46
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
43
+		'no_gateway'          => __('Please select a payment method.', 'give'),
44
+		'bad_minimum'         => __('The minimum custom donation amount for this form is', 'give'),
45
+		'general_loading'     => __('Loading...', 'give'),
46
+		'purchase_loading'    => __('Please Wait...', 'give'),
47 47
 		'number_decimals'     => give_get_price_decimals(),
48 48
 		'give_version'        => GIVE_VERSION,
49 49
 		'magnific_options'    => apply_filters(
@@ -57,81 +57,81 @@  discard block
 block discarded – undo
57 57
 			'give_form_translation_js',
58 58
 			array(
59 59
 				// Field name               Validation message.
60
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
61
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
62
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
63
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
64
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
65
-				'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
66
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
60
+				'payment-mode'           => __('Please select payment mode.', 'give'),
61
+				'give_first'             => __('Please enter your first name.', 'give'),
62
+				'give_email'             => __('Please enter a valid email address.', 'give'),
63
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
64
+				'give_user_pass'         => __('Enter a password.', 'give'),
65
+				'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
66
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
67 67
 			)
68 68
 		),
69
-	) );
69
+	));
70 70
 
71
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
71
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
72 72
 		'ajaxurl'         => give_get_ajax_url(),
73
-		'loading'         => __( 'Loading', 'give' ),
73
+		'loading'         => __('Loading', 'give'),
74 74
 		// General loading message.
75
-		'select_option'   => __( 'Please select an option', 'give' ),
75
+		'select_option'   => __('Please select an option', 'give'),
76 76
 		// Variable pricing error with multi-donation option enabled.
77
-		'default_gateway' => give_get_default_gateway( null ),
78
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
77
+		'default_gateway' => give_get_default_gateway(null),
78
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
79 79
 		'number_decimals' => give_get_price_decimals(),
80
-	) );
80
+	));
81 81
 
82 82
 	// DEBUG is On.
83
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
83
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
84 84
 
85
-		if ( give_is_cc_verify_enabled() ) {
86
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
87
-			wp_enqueue_script( 'give-cc-validator' );
85
+		if (give_is_cc_verify_enabled()) {
86
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
87
+			wp_enqueue_script('give-cc-validator');
88 88
 		}
89 89
 
90
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
91
-		wp_enqueue_script( 'give-float-labels' );
90
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
91
+		wp_enqueue_script('give-float-labels');
92 92
 
93
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
94
-		wp_enqueue_script( 'give-blockui' );
93
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
94
+		wp_enqueue_script('give-blockui');
95 95
 
96
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
97
-		wp_enqueue_script( 'give-qtip' );
96
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
97
+		wp_enqueue_script('give-qtip');
98 98
 
99
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
100
-		wp_enqueue_script( 'give-accounting' );
99
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
100
+		wp_enqueue_script('give-accounting');
101 101
 
102
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
103
-		wp_enqueue_script( 'give-magnific' );
102
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
103
+		wp_enqueue_script('give-magnific');
104 104
 
105
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give-checkout-global' );
105
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-checkout-global');
107 107
 
108 108
 		// General scripts.
109
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
110
-		wp_enqueue_script( 'give-scripts' );
109
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
110
+		wp_enqueue_script('give-scripts');
111 111
 
112 112
 		// Load AJAX scripts, if enabled.
113
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
114
-		wp_enqueue_script( 'give-ajax' );
113
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
114
+		wp_enqueue_script('give-ajax');
115 115
 
116 116
 		// Localize / Pass AJAX vars from PHP,
117
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
118
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
117
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
118
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
119 119
 
120 120
 	} else {
121 121
 
122 122
 		// DEBUG is OFF (one JS file to rule them all!).
123
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
124
-		wp_enqueue_script( 'give' );
123
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
124
+		wp_enqueue_script('give');
125 125
 
126 126
 		// Localize / Pass AJAX vars from PHP.
127
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
128
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
127
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
128
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
129 129
 
130 130
 	}
131 131
 
132 132
 }
133 133
 
134
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
134
+add_action('wp_enqueue_scripts', 'give_load_scripts');
135 135
 
136 136
 /**
137 137
  * Register styles.
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function give_register_styles() {
146 146
 
147
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
147
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
148 148
 		return;
149 149
 	}
150 150
 
151
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
152
-	wp_enqueue_style( 'give-styles' );
151
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
152
+	wp_enqueue_style('give-styles');
153 153
 
154 154
 }
155 155
 
156
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
156
+add_action('wp_enqueue_scripts', 'give_register_styles');
157 157
 
158 158
 
159 159
 /**
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 function give_get_stylesheet_uri() {
167 167
 
168 168
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
169
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
169
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
170 170
 
171 171
 	// LTR or RTL files.
172
-	$direction = ( is_rtl() ) ? '-rtl' : '';
172
+	$direction = (is_rtl()) ? '-rtl' : '';
173 173
 
174
-	$file          = 'give' . $direction . $suffix . '.css';
174
+	$file          = 'give'.$direction.$suffix.'.css';
175 175
 	$templates_dir = give_get_theme_template_dir_name();
176 176
 
177
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
178
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
179
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
180
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
181
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
177
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
178
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
179
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
180
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
181
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
182 182
 
183 183
 	$uri = false;
184 184
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
189 189
 	 * This allows users to copy just give.css to their theme.
190 190
 	 */
191
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
192
-		if ( ! empty( $nonmin ) ) {
193
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
191
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
192
+		if ( ! empty($nonmin)) {
193
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
194 194
 		} else {
195
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
195
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
196 196
 		}
197
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
198
-		if ( ! empty( $nonmin ) ) {
199
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
197
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
198
+		if ( ! empty($nonmin)) {
199
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
200 200
 		} else {
201
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
201
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
202 202
 		}
203
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
204
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
203
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
204
+		$uri = trailingslashit(give_get_templates_url()).$file;
205 205
 	}
206 206
 
207
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
207
+	return apply_filters('give_get_stylesheet_uri', $uri);
208 208
 
209 209
 }
210 210
 
@@ -221,76 +221,76 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return void
223 223
  */
224
-function give_load_admin_scripts( $hook ) {
224
+function give_load_admin_scripts($hook) {
225 225
 
226 226
 	global $post, $post_type;
227 227
 
228 228
 	$give_options = give_get_settings();
229 229
 
230 230
 	// Directories of assets.
231
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
232
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
233
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
231
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
232
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
233
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
234 234
 
235 235
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
236
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
236
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
237 237
 
238 238
 	// LTR or RTL files.
239
-	$direction = ( is_rtl() ) ? '-rtl' : '';
239
+	$direction = (is_rtl()) ? '-rtl' : '';
240 240
 
241 241
 	// Global Admin.
242
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
243
-	wp_enqueue_style( 'give-admin-bar-notification' );
242
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
243
+	wp_enqueue_style('give-admin-bar-notification');
244 244
 
245 245
 	// Give Admin Only.
246
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
246
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
247 247
 		return;
248 248
 	}
249 249
 
250 250
 	// CSS.
251
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
252
-	wp_enqueue_style( 'jquery-ui-css' );
253
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION );
254
-	wp_enqueue_style( 'give-admin' );
255
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
256
-	wp_enqueue_style( 'jquery-chosen' );
257
-	wp_enqueue_style( 'thickbox' );
258
-	wp_enqueue_style( 'wp-color-picker' );
251
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
252
+	wp_enqueue_style('jquery-ui-css');
253
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION);
254
+	wp_enqueue_style('give-admin');
255
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
256
+	wp_enqueue_style('jquery-chosen');
257
+	wp_enqueue_style('thickbox');
258
+	wp_enqueue_style('wp-color-picker');
259 259
 
260 260
 
261 261
 	// JS.
262
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
263
-	wp_enqueue_script( 'jquery-chosen' );
262
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
263
+	wp_enqueue_script('jquery-chosen');
264 264
 
265
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
266
-	wp_enqueue_script( 'give-accounting' );
265
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
266
+	wp_enqueue_script('give-accounting');
267 267
 
268
-	wp_enqueue_script( 'wp-color-picker' );
269
-	wp_enqueue_script( 'jquery-ui-datepicker' );
270
-	wp_enqueue_script( 'thickbox' );
268
+	wp_enqueue_script('wp-color-picker');
269
+	wp_enqueue_script('jquery-ui-datepicker');
270
+	wp_enqueue_script('thickbox');
271 271
 
272
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false );
273
-	wp_enqueue_script( 'give-admin-scripts' );
272
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker'), GIVE_VERSION, false);
273
+	wp_enqueue_script('give-admin-scripts');
274 274
 
275
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
276
-	wp_enqueue_script( 'jquery-flot' );
275
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
276
+	wp_enqueue_script('jquery-flot');
277 277
 
278
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
279
-	wp_enqueue_script( 'give-qtip' );
278
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
279
+	wp_enqueue_script('give-qtip');
280 280
 
281
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
282
-	wp_enqueue_script( 'give-repeatable-fields' );
281
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
282
+	wp_enqueue_script('give-repeatable-fields');
283 283
 
284 284
 	// Forms CPT Script.
285
-	if ( $post_type === 'give_forms' ) {
286
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
287
-		wp_enqueue_script( 'give-admin-forms-scripts' );
285
+	if ($post_type === 'give_forms') {
286
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
287
+		wp_enqueue_script('give-admin-forms-scripts');
288 288
 	}
289 289
 
290 290
 	// Settings Scripts.
291
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
292
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
293
-		wp_enqueue_script( 'give-admin-settings-scripts' );
291
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
292
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
293
+		wp_enqueue_script('give-admin-settings-scripts');
294 294
 	}
295 295
 
296 296
 	// Price Separators.
@@ -298,68 +298,68 @@  discard block
 block discarded – undo
298 298
 	$decimal_separator  = give_get_price_decimal_separator();
299 299
 
300 300
 	// Localize strings & variables for JS.
301
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
302
-		'post_id'                        => isset( $post->ID ) ? $post->ID : null,
301
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
302
+		'post_id'                        => isset($post->ID) ? $post->ID : null,
303 303
 		'give_version'                   => GIVE_VERSION,
304 304
 		'thousands_separator'            => $thousand_separator,
305 305
 		'decimal_separator'              => $decimal_separator,
306
-		'quick_edit_warning'             => __( 'Not available for variable priced forms.', 'give' ),
307
-		'delete_payment'                 => __( 'Are you sure you wish to delete this payment?', 'give' ),
308
-		'delete_payment_note'            => __( 'Are you sure you wish to delete this note?', 'give' ),
309
-		'revoke_api_key'                 => __( 'Are you sure you wish to revoke this API key?', 'give' ),
310
-		'regenerate_api_key'             => __( 'Are you sure you wish to regenerate this API key?', 'give' ),
311
-		'resend_receipt'                 => __( 'Are you sure you wish to resend the donation receipt?', 'give' ),
312
-		'disconnect_user'                => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
313
-		'logo'                           => __( 'Logo', 'give' ),
314
-		'use_this_image'                 => __( 'Use this image', 'give' ),
315
-		'one_option'                     => __( 'Choose a form', 'give' ),
316
-		'one_or_more_option'             => __( 'Choose one or more forms', 'give' ),
317
-		'currency_sign'                  => give_currency_filter( '' ),
318
-		'currency_pos'                   => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
319
-		'currency_decimals'              => give_currency_decimal_filter( give_get_price_decimals() ),
320
-		'batch_export_no_class'          => __( 'You must choose a method.', 'give' ),
321
-		'batch_export_no_reqs'           => __( 'Required fields not completed.', 'give' ),
322
-		'reset_stats_warn'               => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
323
-		'price_format_guide'             => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
306
+		'quick_edit_warning'             => __('Not available for variable priced forms.', 'give'),
307
+		'delete_payment'                 => __('Are you sure you wish to delete this payment?', 'give'),
308
+		'delete_payment_note'            => __('Are you sure you wish to delete this note?', 'give'),
309
+		'revoke_api_key'                 => __('Are you sure you wish to revoke this API key?', 'give'),
310
+		'regenerate_api_key'             => __('Are you sure you wish to regenerate this API key?', 'give'),
311
+		'resend_receipt'                 => __('Are you sure you wish to resend the donation receipt?', 'give'),
312
+		'disconnect_user'                => __('Are you sure you want to disconnect the user from this donor?', 'give'),
313
+		'logo'                           => __('Logo', 'give'),
314
+		'use_this_image'                 => __('Use this image', 'give'),
315
+		'one_option'                     => __('Choose a form', 'give'),
316
+		'one_or_more_option'             => __('Choose one or more forms', 'give'),
317
+		'currency_sign'                  => give_currency_filter(''),
318
+		'currency_pos'                   => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
319
+		'currency_decimals'              => give_currency_decimal_filter(give_get_price_decimals()),
320
+		'batch_export_no_class'          => __('You must choose a method.', 'give'),
321
+		'batch_export_no_reqs'           => __('Required fields not completed.', 'give'),
322
+		'reset_stats_warn'               => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
323
+		'price_format_guide'             => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
324 324
 		/* translators : %s: Donation form options metabox */
325
-		'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ),
326
-		'matched_success_failure_page'   => __( 'You cannot set the success and failed pages to the same page', 'give' ),
327
-		'dismiss_notice_text'            => __( 'Dismiss this notice.', 'give' ),
328
-		'search_placeholder'             => __( 'Type to search all forms', 'give' ),
329
-		'search_placeholder_donor'       => __( 'Type to search all donors', 'give' ),
330
-		'search_placeholder_country'     => __( 'Type to search all countries', 'give' ),
331
-		'search_placeholder_state'       => __( 'Type to search all states/provinces', 'give' ),
325
+		'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'),
326
+		'matched_success_failure_page'   => __('You cannot set the success and failed pages to the same page', 'give'),
327
+		'dismiss_notice_text'            => __('Dismiss this notice.', 'give'),
328
+		'search_placeholder'             => __('Type to search all forms', 'give'),
329
+		'search_placeholder_donor'       => __('Type to search all donors', 'give'),
330
+		'search_placeholder_country'     => __('Type to search all countries', 'give'),
331
+		'search_placeholder_state'       => __('Type to search all states/provinces', 'give'),
332 332
 		'bulk_action' => array(
333 333
 			'delete'         => array(
334
-				'zero_payment_selected' => __( 'You must choose at least one or more payments to delete.', 'give' ),
335
-				'delete_payment'        => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
336
-				'delete_payments'       => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
334
+				'zero_payment_selected' => __('You must choose at least one or more payments to delete.', 'give'),
335
+				'delete_payment'        => __('Are you sure you want to permanently delete this donation?', 'give'),
336
+				'delete_payments'       => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
337 337
 			),
338 338
 			'resend_receipt' => array(
339
-				'zero_recipient_selected' => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
340
-				'resend_receipt'          => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
341
-				'resend_receipts'         => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
339
+				'zero_recipient_selected' => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
340
+				'resend_receipt'          => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
341
+				'resend_receipts'         => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
342 342
 			),
343 343
 		),
344 344
 		'metabox_fields' => array(
345 345
 			'media' => array(
346
-				'button_title' => __( 'Choose Attachment', 'give' ),
346
+				'button_title' => __('Choose Attachment', 'give'),
347 347
 			)
348 348
 		),
349 349
 		'chosen' => array(
350
-			'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
351
-			'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
350
+			'no_results_msg'  => __('No results match {search_term}', 'give'),
351
+			'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
352 352
 		),
353
-	) );
353
+	));
354 354
 
355
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
355
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
356 356
 		// call for new media manager.
357 357
 		wp_enqueue_media();
358 358
 	}
359 359
 
360 360
 }
361 361
 
362
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
362
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
363 363
 
364 364
 /**
365 365
  * Admin Give Icon
@@ -374,13 +374,13 @@  discard block
 block discarded – undo
374 374
 	?>
375 375
     <style type="text/css" media="screen">
376 376
 
377
-        <?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
377
+        <?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
378 378
         @font-face {
379 379
             font-family: 'give-icomoon';
380
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>');
381
-            src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
382
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
383
-            url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
380
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>');
381
+            src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
382
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
383
+            url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
384 384
             font-weight: normal;
385 385
             font-style: normal;
386 386
         }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	<?php
400 400
 }
401 401
 
402
-add_action( 'admin_head', 'give_admin_icon' );
402
+add_action('admin_head', 'give_admin_icon');
403 403
 
404 404
 /**
405 405
  * Admin js code
@@ -431,4 +431,4 @@  discard block
 block discarded – undo
431 431
 	<?php
432 432
 }
433 433
 
434
-add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' );
434
+add_action('admin_head', 'give_admin_hide_notice_shortly_js');
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 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,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount );
131
+	return apply_filters('give_default_form_amount', $default_amount);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 		/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 		/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 		/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 	}
109 109
 
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 	 * @return void
116 116
 	 */
117 117
 	public function tabs() {
118
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
118
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
119 119
 		?>
120 120
         <h2 class="nav-tab-wrapper">
121 121
             <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>"
122
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
123
-				<?php esc_html_e( 'About Give', 'give' ); ?>
122
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
123
+				<?php esc_html_e('About Give', 'give'); ?>
124 124
             </a>
125 125
             <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>"
126
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
127
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
126
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
127
+				<?php esc_html_e('Getting Started', 'give'); ?>
128 128
             </a>
129 129
             <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>"
130
-               href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
131
-				<?php esc_html_e( 'Credits', 'give' ); ?>
130
+               href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
131
+				<?php esc_html_e('Credits', 'give'); ?>
132 132
             </a>
133 133
             <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>"
134
-               href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
135
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
134
+               href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
135
+				<?php esc_html_e('Add-ons', 'give'); ?>
136 136
             </a>
137 137
         </h2>
138 138
 		<?php
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return void
147 147
 	 */
148 148
 	public function about_screen() {
149
-		list( $display_version ) = explode( '-', GIVE_VERSION );
149
+		list($display_version) = explode('-', GIVE_VERSION);
150 150
 		?>
151 151
         <div class="wrap about-wrap">
152 152
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
             <p class="about-text"><?php
156 156
 				printf(
157 157
 				/* translators: %s: https://givewp.com/documenation/ */
158
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
159
-					esc_url( 'https://givewp.com/documenation/' )
158
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
159
+					esc_url('https://givewp.com/documenation/')
160 160
 				);
161 161
 				?></p>
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             <div class="give-badge"><?php
166 166
 				printf(
167 167
 				/* translators: %s: Give version */
168
-					esc_html__( 'Version %s', 'give' ),
168
+					esc_html__('Version %s', 'give'),
169 169
 					$display_version
170 170
 				);
171 171
 				?></div>
@@ -175,17 +175,17 @@  discard block
 block discarded – undo
175 175
             <div class="feature-section clearfix introduction">
176 176
 
177 177
                 <div class="video feature-section-item">
178
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>"
179
-                         alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
178
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>"
179
+                         alt="<?php esc_attr_e('Give', 'give'); ?>">
180 180
                 </div>
181 181
 
182 182
                 <div class="content feature-section-item last-feature">
183 183
 
184
-                    <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
184
+                    <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
185 185
 
186
-                    <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
186
+                    <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
187 187
                     <a href="https://givewp.com" target="_blank" class="button-secondary">
188
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
188
+						<?php esc_html_e('Learn More', 'give'); ?>
189 189
                         <span class="dashicons dashicons-external"></span>
190 190
                     </a>
191 191
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 
199 199
                 <div class="content feature-section-item">
200 200
 
201
-                    <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
201
+                    <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
202 202
 
203
-                    <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
203
+                    <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
204 204
 
205 205
                     <h4>Find Out More:</h4>
206 206
                     <ul class="ul-disc">
207
-                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li>
208
-                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li>
209
-                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li>
207
+                        <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li>
208
+                        <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li>
209
+                        <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li>
210 210
                     </ul>
211 211
 
212 212
                 </div>
213 213
 
214 214
                 <div class="content  feature-section-item last-feature">
215
-                    <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>"
216
-                         alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
215
+                    <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>"
216
+                         alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
217 217
                 </div>
218 218
 
219 219
             </div>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return void
233 233
 	 */
234 234
 	public function changelog_screen() {
235
-		list( $display_version ) = explode( '-', GIVE_VERSION );
235
+		list($display_version) = explode('-', GIVE_VERSION);
236 236
 		?>
237 237
         <div class="wrap about-wrap">
238 238
             <h1><?php echo get_admin_page_title(); ?></h1>
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
             <p class="about-text"><?php
241 241
 				printf(
242 242
 				/* translators: %s: Give version */
243
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
243
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
244 244
 					$display_version
245 245
 				);
246 246
 				?></p>
247 247
             <div class="give-badge"><?php
248 248
 				printf(
249 249
 				/* translators: %s: Give version */
250
-					esc_html__( 'Version %s', 'give' ),
250
+					esc_html__('Version %s', 'give'),
251 251
 					$display_version
252 252
 				);
253 253
 				?></div>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			<?php $this->tabs(); ?>
256 256
 
257 257
             <div class="changelog">
258
-                <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
258
+                <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
259 259
 
260 260
                 <div class="feature-section">
261 261
 					<?php echo $this->parse_readme(); ?>
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
             </div>
264 264
 
265 265
             <div class="return-to-dashboard">
266
-                <a href="<?php echo esc_url( admin_url( add_query_arg( array(
266
+                <a href="<?php echo esc_url(admin_url(add_query_arg(array(
267 267
 					'post_type' => 'give_forms',
268 268
 					'page'      => 'give-settings'
269
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
269
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
270 270
             </div>
271 271
         </div>
272 272
 		<?php
@@ -280,36 +280,36 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function getting_started_screen() {
283
-		list( $display_version ) = explode( '-', GIVE_VERSION );
283
+		list($display_version) = explode('-', GIVE_VERSION);
284 284
 		?>
285 285
         <div class="wrap about-wrap get-started">
286 286
 
287 287
 			<?php $this->get_welcome_header() ?>
288 288
 
289
-            <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
289
+            <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
290 290
 
291 291
 			<?php give_get_newsletter(); ?>
292 292
 
293 293
             <div class="give-badge"><?php
294 294
 				printf(
295 295
 				/* translators: %s: Give version */
296
-					esc_html__( 'Version %s', 'give' ),
296
+					esc_html__('Version %s', 'give'),
297 297
 					$display_version
298 298
 				);
299 299
 				?></div>
300 300
 
301 301
 			<?php $this->tabs(); ?>
302 302
 
303
-            <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
303
+            <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
304 304
 
305 305
             <div class="feature-section clearfix">
306 306
 
307 307
                 <div class="content feature-section-item">
308
-                    <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
308
+                    <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
309 309
 
310
-                    <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p>
310
+                    <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p>
311 311
 
312
-                    <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p>
312
+                    <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p>
313 313
                 </div>
314 314
 
315 315
                 <div class="content feature-section-item last-feature">
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
                 </div>
327 327
 
328 328
                 <div class="content feature-section-item last-feature">
329
-                    <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3>
329
+                    <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3>
330 330
 
331
-                    <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p>
331
+                    <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p>
332 332
                 </div>
333 333
 
334 334
             </div>
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
             <div class="feature-section clearfix">
338 338
 
339 339
                 <div class="content feature-section-item add-content">
340
-                    <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3>
340
+                    <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3>
341 341
 
342
-                    <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p>
342
+                    <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p>
343 343
 
344
-                    <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
344
+                    <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
345 345
                 </div>
346 346
 
347 347
                 <div class="content feature-section-item last-feature">
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
                 </div>
359 359
 
360 360
                 <div class="content feature-section-item last-feature">
361
-                    <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
361
+                    <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
362 362
 
363
-                    <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p>
363
+                    <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p>
364 364
                 </div>
365 365
 
366 366
 
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function credits_screen() {
383
-		list( $display_version ) = explode( '-', GIVE_VERSION );
383
+		list($display_version) = explode('-', GIVE_VERSION);
384 384
 		?>
385 385
         <div class="wrap about-wrap">
386 386
 
387 387
 			<?php $this->get_welcome_header() ?>
388 388
 
389
-            <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
389
+            <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
390 390
 
391 391
 			<?php give_get_newsletter(); ?>
392 392
 
393 393
             <div class="give-badge"><?php
394 394
 				printf(
395 395
 				/* translators: %s: Give version */
396
-					esc_html__( 'Version %s', 'give' ),
396
+					esc_html__('Version %s', 'give'),
397 397
 					$display_version
398 398
 				);
399 399
 				?></div>
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
             <p class="about-description"><?php
404 404
 				printf(
405 405
 				/* translators: %s: https://github.com/WordImpress/give */
406
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
407
-					esc_url( 'https://github.com/WordImpress/give' )
406
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
407
+					esc_url('https://github.com/WordImpress/give')
408 408
 				);
409 409
 				?></p>
410 410
 
@@ -421,21 +421,21 @@  discard block
 block discarded – undo
421 421
 	 * @return string $readme HTML formatted readme file
422 422
 	 */
423 423
 	public function parse_readme() {
424
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
424
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
425 425
 
426
-		if ( ! $file ) {
427
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
426
+		if ( ! $file) {
427
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
428 428
 		} else {
429
-			$readme = file_get_contents( $file );
430
-			$readme = nl2br( esc_html( $readme ) );
431
-			$readme = explode( '== Changelog ==', $readme );
432
-			$readme = end( $readme );
433
-
434
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
435
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
436
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
437
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
438
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
429
+			$readme = file_get_contents($file);
430
+			$readme = nl2br(esc_html($readme));
431
+			$readme = explode('== Changelog ==', $readme);
432
+			$readme = end($readme);
433
+
434
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
435
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
436
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
437
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
438
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
439 439
 		}
440 440
 
441 441
 		return $readme;
@@ -452,24 +452,24 @@  discard block
 block discarded – undo
452 452
 	public function contributors() {
453 453
 		$contributors = $this->get_contributors();
454 454
 
455
-		if ( empty( $contributors ) ) {
455
+		if (empty($contributors)) {
456 456
 			return '';
457 457
 		}
458 458
 
459 459
 		$contributor_list = '<ul class="wp-people-group">';
460 460
 
461
-		foreach ( $contributors as $contributor ) {
461
+		foreach ($contributors as $contributor) {
462 462
 			$contributor_list .= '<li class="wp-person">';
463 463
 			$contributor_list .= sprintf(
464 464
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
465
-				esc_url( 'https://github.com/' . $contributor->login ),
466
-				esc_url( $contributor->avatar_url ),
467
-				esc_attr( $contributor->login )
465
+				esc_url('https://github.com/'.$contributor->login),
466
+				esc_url($contributor->avatar_url),
467
+				esc_attr($contributor->login)
468 468
 			);
469 469
 			$contributor_list .= sprintf(
470 470
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
471
-				esc_url( 'https://github.com/' . $contributor->login ),
472
-				esc_html( $contributor->login )
471
+				esc_url('https://github.com/'.$contributor->login),
472
+				esc_html($contributor->login)
473 473
 			);
474 474
 			$contributor_list .= '</li>';
475 475
 		}
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 	 * @return array $contributors List of contributors
488 488
 	 */
489 489
 	public function get_contributors() {
490
-		$contributors = Give_Cache::get( 'give_contributors', true );
490
+		$contributors = Give_Cache::get('give_contributors', true);
491 491
 
492
-		if ( false !== $contributors ) {
492
+		if (false !== $contributors) {
493 493
 			return $contributors;
494 494
 		}
495 495
 
496
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
496
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
497 497
 
498
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
498
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
499 499
 			return array();
500 500
 		}
501 501
 
502
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
502
+		$contributors = json_decode(wp_remote_retrieve_body($response));
503 503
 
504
-		if ( ! is_array( $contributors ) ) {
504
+		if ( ! is_array($contributors)) {
505 505
 			return array();
506 506
 		}
507 507
 
508
-		Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
508
+		Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true);
509 509
 
510 510
 		return $contributors;
511 511
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function get_welcome_header() {
519 519
 		// Badge for welcome page
520
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
520
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
521 521
 		?>
522 522
         <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
523 523
 		<?php $this->social_media_elements(); ?>
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
             <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php
611 611
 				printf(
612 612
 				/* translators: %s: Give twitter user @givewp */
613
-					esc_html_e( 'Follow %s', 'give' ),
613
+					esc_html_e('Follow %s', 'give'),
614 614
 					'@givewp'
615 615
 				);
616 616
 				?></a>
@@ -644,27 +644,27 @@  discard block
 block discarded – undo
644 644
 	public function welcome() {
645 645
 
646 646
 		// Bail if no activation redirect
647
-		if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) {
647
+		if ( ! Give_Cache::get('_give_activation_redirect', true)) {
648 648
 			return;
649 649
 		}
650 650
 
651 651
 		// Delete the redirect transient
652
-		Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) );
652
+		Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect'));
653 653
 
654 654
 		// Bail if activating from network, or bulk
655
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
655
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
656 656
 			return;
657 657
 		}
658 658
 
659
-		$upgrade = get_option( 'give_version_upgraded_from' );
659
+		$upgrade = get_option('give_version_upgraded_from');
660 660
 
661
-		if ( ! $upgrade ) { // First time install
662
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
661
+		if ( ! $upgrade) { // First time install
662
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
663 663
 			exit;
664
-		} elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings
664
+		} elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings
665 665
 
666 666
 		} else { // Welcome is NOT disabled in settings
667
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
667
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
668 668
 			exit;
669 669
 		}
670 670
 	}
Please login to merge, or discard this patch.
includes/admin/class-api-keys-table.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -254,8 +254,8 @@
 block discarded – undo
254 254
 		$args = array(
255 255
 		  'id' => 'give-api-user-search',
256 256
 		  'name' => 'user_id',
257
-        );
258
-        echo Give()->html->ajax_user_search($args); ?>
257
+		);
258
+		echo Give()->html->ajax_user_search($args); ?>
259 259
 		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 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
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		global $status, $page;
54 54
 
55 55
 		// Set parent defaults
56
-		parent::__construct( array(
57
-			'singular' => esc_html__( 'API Key', 'give' ),     // Singular name of the listed records
58
-			'plural'   => esc_html__( 'API Keys', 'give' ),    // Plural name of the listed records
59
-			'ajax'     => false,// Does this table support ajax?
60
-		) );
56
+		parent::__construct(array(
57
+			'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records
58
+			'plural'   => esc_html__('API Keys', 'give'), // Plural name of the listed records
59
+			'ajax'     => false, // Does this table support ajax?
60
+		));
61 61
 
62 62
 		$this->query();
63 63
 	}
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string Column Name
75 75
 	 */
76
-	public function column_default( $item, $column_name ) {
77
-		return $item[ $column_name ];
76
+	public function column_default($item, $column_name) {
77
+		return $item[$column_name];
78 78
 	}
79 79
 
80 80
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return string Column Name
89 89
 	 */
90
-	public function column_key( $item ) {
91
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>';
90
+	public function column_key($item) {
91
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>';
92 92
 	}
93 93
 
94 94
 	/**
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string Column Name
103 103
 	 */
104
-	public function column_token( $item ) {
105
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>';
104
+	public function column_token($item) {
105
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>';
106 106
 	}
107 107
 
108 108
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return string Column Name
117 117
 	 */
118
-	public function column_secret( $item ) {
119
-		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>';
118
+	public function column_secret($item) {
119
+		return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>';
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,46 +126,46 @@  discard block
 block discarded – undo
126 126
 	 * @since  1.1
127 127
 	 * @return string
128 128
 	 */
129
-	public function column_user( $item ) {
129
+	public function column_user($item) {
130 130
 
131 131
 		$actions = array();
132 132
 
133
-		if ( apply_filters( 'give_api_log_requests', true ) ) {
133
+		if (apply_filters('give_api_log_requests', true)) {
134 134
 			$actions['view'] = sprintf(
135 135
 				'<a href="%s">%s</a>',
136
-				esc_url( add_query_arg( array(
136
+				esc_url(add_query_arg(array(
137 137
 					'section'   => 'api_requests',
138 138
 					'post_type' => 'give_forms',
139 139
 					'page'      => 'give-tools',
140 140
 					'tab'       => 'logs',
141 141
 					's'         => $item['email'],
142
-				), 'edit.php' ) ),
143
-				esc_html__( 'View API Log', 'give' )
142
+				), 'edit.php')),
143
+				esc_html__('View API Log', 'give')
144 144
 			);
145 145
 		}
146 146
 
147 147
 		$actions['reissue'] = sprintf(
148 148
 			'<a href="%s" class="give-regenerate-api-key">%s</a>',
149
-			esc_url( wp_nonce_url( add_query_arg( array(
149
+			esc_url(wp_nonce_url(add_query_arg(array(
150 150
 				'user_id'          => $item['id'],
151 151
 				'give_action'      => 'process_api_key',
152 152
 				'give_api_process' => 'regenerate',
153
-			) ), 'give-api-nonce' ) ),
154
-			esc_html__( 'Reissue', 'give' )
153
+			)), 'give-api-nonce')),
154
+			esc_html__('Reissue', 'give')
155 155
 		);
156
-		$actions['revoke']  = sprintf(
156
+		$actions['revoke'] = sprintf(
157 157
 			'<a href="%s" class="give-revoke-api-key give-delete">%s</a>',
158
-			esc_url( wp_nonce_url( add_query_arg( array(
158
+			esc_url(wp_nonce_url(add_query_arg(array(
159 159
 				'user_id'          => $item['id'],
160 160
 				'give_action'      => 'process_api_key',
161 161
 				'give_api_process' => 'revoke',
162
-			) ), 'give-api-nonce' ) ),
163
-			esc_html__( 'Revoke', 'give' )
162
+			)), 'give-api-nonce')),
163
+			esc_html__('Revoke', 'give')
164 164
 		);
165 165
 
166
-		$actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) );
166
+		$actions = apply_filters('give_api_row_actions', array_filter($actions));
167 167
 
168
-		return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) );
168
+		return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions));
169 169
 	}
170 170
 
171 171
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192
-			'user'   => esc_html__( 'Username', 'give' ),
193
-			'key'    => esc_html__( 'Public Key', 'give' ),
194
-			'token'  => esc_html__( 'Token', 'give' ),
195
-			'secret' => esc_html__( 'Secret Key', 'give' ),
192
+			'user'   => esc_html__('Username', 'give'),
193
+			'key'    => esc_html__('Public Key', 'give'),
194
+			'token'  => esc_html__('Token', 'give'),
195
+			'secret' => esc_html__('Secret Key', 'give'),
196 196
 		);
197 197
 
198 198
 		return $columns;
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param string $which
208 208
 	 */
209
-	protected function display_tablenav( $which ) {
210
-		if ( 'top' === $which ) {
211
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
209
+	protected function display_tablenav($which) {
210
+		if ('top' === $which) {
211
+			wp_nonce_field('bulk-'.$this->_args['plural']);
212 212
 		}
213 213
 		?>
214
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
214
+		<div class="tablenav <?php echo esc_attr($which); ?>">
215 215
 
216 216
 			<div class="alignleft actions bulkactions">
217
-				<?php $this->bulk_actions( $which ); ?>
217
+				<?php $this->bulk_actions($which); ?>
218 218
 			</div>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	function bulk_actions( $which = '' ) {
240
+	function bulk_actions($which = '') {
241 241
 		// These aren't really bulk actions but this outputs the markup in the right place.
242 242
 		static $give_api_is_bottom;
243 243
 
244
-		if ( $give_api_is_bottom ) {
244
+		if ($give_api_is_bottom) {
245 245
 			return;
246 246
 		}
247 247
 		?>
248 248
 		<input type="hidden" name="give_action" value="process_api_key"/>
249 249
 		<input type="hidden" name="give_api_process" value="generate"/>
250
-		<?php wp_nonce_field( 'give-api-nonce' );
250
+		<?php wp_nonce_field('give-api-nonce');
251 251
 		/**
252 252
 		 * API Key user search.
253 253
 		 */
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		  'name' => 'user_id',
257 257
         );
258 258
         echo Give()->html->ajax_user_search($args); ?>
259
-		<?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?>
259
+		<?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?>
260 260
 		<?php
261 261
 		$give_api_is_bottom = true;
262 262
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @return int Current page number
270 270
 	 */
271 271
 	public function get_paged() {
272
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
272
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
273 273
 	}
274 274
 
275 275
 	/**
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 * @return array
281 281
 	 */
282 282
 	public function query() {
283
-		$users = get_users( array(
283
+		$users = get_users(array(
284 284
 			'meta_value' => 'give_user_secret_key',
285 285
 			'number'     => $this->per_page,
286
-			'offset'     => $this->per_page * ( $this->get_paged() - 1 ),
287
-		) );
288
-		$keys  = array();
289
-
290
-		foreach ( $users as $user ) {
291
-			$keys[ $user->ID ]['id']    = $user->ID;
292
-			$keys[ $user->ID ]['email'] = $user->user_email;
293
-			$keys[ $user->ID ]['user']  = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>';
294
-
295
-			$keys[ $user->ID ]['key']    = Give()->api->get_user_public_key( $user->ID );
296
-			$keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID );
297
-			$keys[ $user->ID ]['token']  = Give()->api->get_token( $user->ID );
286
+			'offset'     => $this->per_page * ($this->get_paged() - 1),
287
+		));
288
+		$keys = array();
289
+
290
+		foreach ($users as $user) {
291
+			$keys[$user->ID]['id']    = $user->ID;
292
+			$keys[$user->ID]['email'] = $user->user_email;
293
+			$keys[$user->ID]['user']  = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>';
294
+
295
+			$keys[$user->ID]['key']    = Give()->api->get_user_public_key($user->ID);
296
+			$keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID);
297
+			$keys[$user->ID]['token']  = Give()->api->get_token($user->ID);
298 298
 		}
299 299
 
300 300
 		return $keys;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	public function total_items() {
312 312
 		global $wpdb;
313 313
 
314
-		if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) {
314
+		if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) {
315 315
 			$total_items = $wpdb->get_var(
316 316
 				$wpdb->prepare(
317 317
 					"SELECT count(user_id)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				)
321 321
 			);
322 322
 
323
-			Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true );
323
+			Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true);
324 324
 		}
325 325
 
326 326
 		return $total_items;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 		$hidden   = array(); // No hidden columns
340 340
 		$sortable = array(); // Not sortable... for now
341 341
 
342
-		$this->_column_headers = array( $columns, $hidden, $sortable );
342
+		$this->_column_headers = array($columns, $hidden, $sortable);
343 343
 
344 344
 		$data = $this->query();
345 345
 
@@ -347,10 +347,10 @@  discard block
 block discarded – undo
347 347
 
348 348
 		$this->items = $data;
349 349
 
350
-		$this->set_pagination_args( array(
350
+		$this->set_pagination_args(array(
351 351
 				'total_items' => $total_items,
352 352
 				'per_page'    => $this->per_page,
353
-				'total_pages' => ceil( $total_items / $this->per_page ),
353
+				'total_pages' => ceil($total_items / $this->per_page),
354 354
 			)
355 355
 		);
356 356
 	}
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +142 added lines, -142 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
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $currency_code  = $payment->currency;
46 46
 $gateway        = $payment->gateway;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	<h1 id="transaction-details-heading"><?php
53 53
 		printf(
54 54
 			/* translators: %s: donation number */
55
-			esc_html__( 'Donation %s', 'give' ),
55
+			esc_html__('Donation %s', 'give'),
56 56
 			$number
57 57
 		);
58
-		if ( $payment_mode == 'test' ) {
59
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
58
+		if ($payment_mode == 'test') {
59
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
60 60
 		}
61 61
 		?></h1>
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param int $payment_id Payment id.
70 70
 	 */
71
-	do_action( 'give_view_order_details_before', $payment_id );
71
+	do_action('give_view_order_details_before', $payment_id);
72 72
 	?>
73 73
 	<form id="give-edit-order-form" method="post">
74 74
 		<?php
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @param int $payment_id Payment id.
81 81
 		 */
82
-		do_action( 'give_view_order_details_form_top', $payment_id );
82
+		do_action('give_view_order_details_form_top', $payment_id);
83 83
 		?>
84 84
 		<div id="poststuff">
85 85
 			<div id="give-dashboard-widgets-wrap">
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 							 *
96 96
 							 * @param int $payment_id Payment id.
97 97
 							 */
98
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
98
+							do_action('give_view_order_details_sidebar_before', $payment_id);
99 99
 							?>
100 100
 
101 101
 							<div id="give-order-update" class="postbox give-order-data">
102 102
 
103
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
103
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
104 104
 
105 105
 								<div class="inside">
106 106
 									<div class="give-admin-box">
@@ -113,33 +113,33 @@  discard block
 block discarded – undo
113 113
 										 *
114 114
 										 * @param int $payment_id Payment id.
115 115
 										 */
116
-										do_action( 'give_view_order_details_totals_before', $payment_id );
116
+										do_action('give_view_order_details_totals_before', $payment_id);
117 117
 										?>
118 118
 
119 119
 										<div class="give-admin-box-inside">
120 120
 											<p>
121
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
121
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
122 122
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
123
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
124
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
123
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
124
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
125 125
 													<?php endforeach; ?>
126 126
 												</select>
127
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
127
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
128 128
 											</p>
129 129
 										</div>
130 130
 
131 131
 										<div class="give-admin-box-inside">
132 132
 											<p>
133
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
134
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
133
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
134
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
135 135
 											</p>
136 136
 										</div>
137 137
 
138 138
 										<div class="give-admin-box-inside">
139 139
 											<p>
140
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
141
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
140
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
141
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
142
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
143 143
 											</p>
144 144
 										</div>
145 145
 
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 										 *
154 154
 										 * @param int $payment_id Payment id.
155 155
 										 */
156
-										do_action( 'give_view_order_details_update_inner', $payment_id );
156
+										do_action('give_view_order_details_update_inner', $payment_id);
157 157
 
158 158
 										// @TODO: Fees
159
-										$fees = give_get_payment_fees( $payment_id );
160
-										if ( ! empty( $fees ) ) : ?>
159
+										$fees = give_get_payment_fees($payment_id);
160
+										if ( ! empty($fees)) : ?>
161 161
 											<div class="give-order-fees give-admin-box-inside">
162
-												<p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p>
162
+												<p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p>
163 163
 												<ul class="give-payment-fees">
164
-													<?php foreach ( $fees as $fee ) : ?>
164
+													<?php foreach ($fees as $fee) : ?>
165 165
 														<li>
166 166
 															<span class="fee-label"><?php echo $fee['label']; ?>:</span>
167
-															<span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span>
167
+															<span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span>
168 168
 														</li>
169 169
 													<?php endforeach; ?>
170 170
 												</ul>
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 
174 174
 										<div class="give-order-payment give-admin-box-inside">
175 175
 											<p>
176
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
177
-												<?php echo give_currency_symbol( $payment->currency ); ?>
178
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
176
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
177
+												<?php echo give_currency_symbol($payment->currency); ?>
178
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
179 179
 											</p>
180 180
 										</div>
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 										 *
188 188
 										 * @param int $payment_id Payment id.
189 189
 										 */
190
-										do_action( 'give_view_order_details_totals_after', $payment_id );
190
+										do_action('give_view_order_details_totals_after', $payment_id);
191 191
 										?>
192 192
 
193 193
 									</div>
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 									 *
206 206
 									 * @param int $payment_id Payment id.
207 207
 									 */
208
-									do_action( 'give_view_order_details_update_before', $payment_id );
208
+									do_action('give_view_order_details_update_before', $payment_id);
209 209
 									?>
210 210
 
211 211
 									<div id="major-publishing-actions">
212 212
 										<div id="publishing-action">
213
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
214
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
215
-												<a href="<?php echo esc_url( add_query_arg( array(
213
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
214
+											<?php if (give_is_payment_complete($payment_id)) : ?>
215
+												<a href="<?php echo esc_url(add_query_arg(array(
216 216
 													'give-action' => 'email_links',
217 217
 													'purchase_id' => $payment_id,
218
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
218
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
219 219
 											<?php endif; ?>
220 220
 										</div>
221 221
 										<div class="clear"></div>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 									 *
230 230
 									 * @param int $payment_id Payment id.
231 231
 									 */
232
-									do_action( 'give_view_order_details_update_after', $payment_id );
232
+									do_action('give_view_order_details_update_after', $payment_id);
233 233
 									?>
234 234
 
235 235
 								</div>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 							<div id="give-order-details" class="postbox give-order-data">
242 242
 
243
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
243
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
244 244
 
245 245
 								<div class="inside">
246 246
 									<div class="give-admin-box">
@@ -253,44 +253,44 @@  discard block
 block discarded – undo
253 253
 										 *
254 254
 										 * @param int $payment_id Payment id.
255 255
 										 */
256
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
256
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
257 257
 
258
-										$gateway = give_get_payment_gateway( $payment_id );
259
-										if ( $gateway ) : ?>
258
+										$gateway = give_get_payment_gateway($payment_id);
259
+										if ($gateway) : ?>
260 260
 											<div class="give-order-gateway give-admin-box-inside">
261 261
 												<p>
262
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
263
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
262
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
263
+													<?php echo give_get_gateway_admin_label($gateway); ?>
264 264
 												</p>
265 265
 											</div>
266 266
 										<?php endif; ?>
267 267
 
268 268
 										<div class="give-order-payment-key give-admin-box-inside">
269 269
 											<p>
270
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
271
-												<?php echo give_get_payment_key( $payment_id ); ?>
270
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
271
+												<?php echo give_get_payment_key($payment_id); ?>
272 272
 											</p>
273 273
 										</div>
274 274
 
275 275
 										<div class="give-order-ip give-admin-box-inside">
276 276
 											<p>
277
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
278
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
277
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
278
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
279 279
 											</p>
280 280
 										</div>
281 281
 
282
-										<?php if ( $transaction_id ) : ?>
282
+										<?php if ($transaction_id) : ?>
283 283
 											<div class="give-order-tx-id give-admin-box-inside">
284 284
 												<p>
285
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
286
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
285
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
286
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
287 287
 												</p>
288 288
 											</div>
289 289
 										<?php endif; ?>
290 290
 
291 291
 										<div class="give-admin-box-inside">
292
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
293
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
292
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
293
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
294 294
 											</p>
295 295
 										</div>
296 296
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 										 *
303 303
 										 * @param int $payment_id Payment id.
304 304
 										 */
305
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
305
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
306 306
 										?>
307 307
 
308 308
 									</div>
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 							 *
323 323
 							 * @param int $payment_id Payment id.
324 324
 							 */
325
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
325
+							do_action('give_view_order_details_sidebar_after', $payment_id);
326 326
 							?>
327 327
 
328 328
 						</div>
@@ -342,56 +342,56 @@  discard block
 block discarded – undo
342 342
 							 *
343 343
 							 * @param int $payment_id Payment id.
344 344
 							 */
345
-							do_action( 'give_view_order_details_main_before', $payment_id );
345
+							do_action('give_view_order_details_main_before', $payment_id);
346 346
 							?>
347 347
 
348 348
 							<?php $column_count = 'columns-3'; ?>
349 349
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
350
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
350
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
351 351
 
352 352
 								<div class="inside">
353 353
 
354 354
 									<div class="column-container">
355 355
 										<div class="column">
356 356
 											<p>
357
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
357
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
358 358
 												<?php
359
-												if ( $payment_meta['form_id'] ) :
359
+												if ($payment_meta['form_id']) :
360 360
 													printf(
361 361
 														'<a href="%1$s" target="_blank">#%2$s</a>',
362
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
362
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
363 363
 														$payment_meta['form_id']
364 364
 													);
365 365
 												endif;
366 366
 												?>
367 367
 											</p>
368 368
 											<p>
369
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
370
-												<?php echo Give()->html->forms_dropdown( array(
369
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
370
+												<?php echo Give()->html->forms_dropdown(array(
371 371
 													'selected' => $payment_meta['form_id'],
372 372
 													'name'   => 'give-payment-form-select',
373 373
 													'id'     => 'give-payment-form-select',
374 374
 													'chosen' => true,
375
-												) ); ?>
375
+												)); ?>
376 376
 											</p>
377 377
 										</div>
378 378
 										<div class="column">
379 379
 											<p>
380
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
381
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
380
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
381
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
382 382
 											</p>
383 383
 											<p>
384
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
384
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
385 385
 												<span class="give-donation-level">
386 386
 													<?php
387
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
388
-													if ( empty( $var_prices ) ) {
389
-														esc_html_e( 'n/a', 'give' );
387
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
388
+													if (empty($var_prices)) {
389
+														esc_html_e('n/a', 'give');
390 390
 													} else {
391 391
 														$prices_atts = '';
392
-														if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
393
-															foreach ( $variable_prices as $variable_price ) {
394
-																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] );
392
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
393
+															foreach ($variable_prices as $variable_price) {
394
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
395 395
 															}
396 396
 														}
397 397
 														// Variable price dropdown options.
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 															'chosen'           => true,
402 402
 															'show_option_all'  => '',
403 403
 															'show_option_none' => '',
404
-															'select_atts'      => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ),
404
+															'select_atts'      => 'data-prices='.esc_attr(json_encode($prices_atts)),
405 405
 															'selected'         => $payment_meta['price_id'],
406 406
 														);
407 407
 														// Render variable prices select tag html.
408
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
408
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
409 409
 													}
410 410
 													?>
411 411
 												</span>
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 										</div>
414 414
 										<div class="column">
415 415
 											<p>
416
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
417
-												<?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?>
416
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
417
+												<?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?>
418 418
 											</p>
419 419
 											<p>
420 420
 												<?php
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 												 *
428 428
 												 * @param int $payment_id Payment id.
429 429
 												 */
430
-												do_action( 'give_donation_details_thead_before', $payment_id );
430
+												do_action('give_donation_details_thead_before', $payment_id);
431 431
 
432 432
 
433 433
 												/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 												 *
440 440
 												 * @param int $payment_id Payment id.
441 441
 												 */
442
-												do_action( 'give_donation_details_thead_after', $payment_id );
442
+												do_action('give_donation_details_thead_after', $payment_id);
443 443
 
444 444
 												/**
445 445
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 												 *
451 451
 												 * @param int $payment_id Payment id.
452 452
 												 */
453
-												do_action( 'give_donation_details_tbody_before', $payment_id );
453
+												do_action('give_donation_details_tbody_before', $payment_id);
454 454
 
455 455
 												/**
456 456
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 												 *
462 462
 												 * @param int $payment_id Payment id.
463 463
 												 */
464
-												do_action( 'give_donation_details_tbody_after', $payment_id );
464
+												do_action('give_donation_details_tbody_after', $payment_id);
465 465
 												?>
466 466
 											</p>
467 467
 										</div>
@@ -481,57 +481,57 @@  discard block
 block discarded – undo
481 481
 							 *
482 482
 							 * @param int $payment_id Payment id.
483 483
 							 */
484
-							do_action( 'give_view_order_details_files_after', $payment_id );
484
+							do_action('give_view_order_details_files_after', $payment_id);
485 485
 							?>
486 486
 
487 487
 							<div id="give-donor-details" class="postbox">
488
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
488
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
489 489
 
490 490
 								<div class="inside">
491 491
 
492
-									<?php $customer = new Give_Customer( $customer_id ); ?>
492
+									<?php $customer = new Give_Customer($customer_id); ?>
493 493
 
494 494
 									<div class="column-container customer-info">
495 495
 										<div class="column">
496 496
 											<p>
497
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
497
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
498 498
 												<?php
499
-												if ( ! empty( $customer->id ) ) {
499
+												if ( ! empty($customer->id)) {
500 500
 													printf(
501 501
 														'<a href="%1$s" target="_blank">#%2$s</a>',
502
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ),
502
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id),
503 503
 														$customer->id
504 504
 													);
505 505
 												}
506 506
 												?>
507 507
 											</p>
508 508
 											<p>
509
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
510
-												<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
509
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
510
+												<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
511 511
 											</p>
512 512
 										</div>
513 513
 										<div class="column">
514 514
 											<p>
515
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
515
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
516 516
 												<?php echo $customer->name; ?>
517 517
 											</p>
518 518
 											<p>
519
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
519
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
520 520
 												<?php echo $customer->email; ?>
521 521
 											</p>
522 522
 										</div>
523 523
 										<div class="column">
524 524
 											<p>
525
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
525
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
526 526
 												<?php
527
-												echo Give()->html->donor_dropdown( array(
527
+												echo Give()->html->donor_dropdown(array(
528 528
 													'selected' => $customer->id,
529 529
 													'name'     => 'customer-id',
530
-												) );
530
+												));
531 531
 												?>
532 532
 											</p>
533 533
 											<p>
534
-												<a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
534
+												<a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a>
535 535
 											</p>
536 536
 										</div>
537 537
 									</div>
@@ -539,13 +539,13 @@  discard block
 block discarded – undo
539 539
 									<div class="column-container new-customer" style="display: none">
540 540
 										<div class="column">
541 541
 											<p>
542
-												<label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
542
+												<label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
543 543
 												<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
544 544
 											</p>
545 545
 										</div>
546 546
 										<div class="column">
547 547
 											<p>
548
-												<label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
548
+												<label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
549 549
 												<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
550 550
 											</p>
551 551
 										</div>
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 											<p>
554 554
 												<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
555 555
 												<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
556
-												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
556
+												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
557 557
 												<br>
558
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
558
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
559 559
 											</p>
560 560
 										</div>
561 561
 									</div>
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 									 * @param array $payment_meta Payment meta.
572 572
 									 * @param array $user_info    User information.
573 573
 									 */
574
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
574
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
575 575
 
576 576
 									/**
577 577
 									 * Fires in order details page, in the donor-details metabox.
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 									 *
581 581
 									 * @param int $payment_id Payment id.
582 582
 									 */
583
-									do_action( 'give_payment_view_details', $payment_id );
583
+									do_action('give_payment_view_details', $payment_id);
584 584
 									?>
585 585
 
586 586
 								</div>
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
 							 *
597 597
 							 * @param int $payment_id Payment id.
598 598
 							 */
599
-							do_action( 'give_view_order_details_billing_before', $payment_id );
599
+							do_action('give_view_order_details_billing_before', $payment_id);
600 600
 							?>
601 601
 
602 602
 							<div id="give-billing-details" class="postbox">
603
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
603
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
604 604
 
605 605
 								<div class="inside">
606 606
 
@@ -610,59 +610,59 @@  discard block
 block discarded – undo
610 610
 											<div class="data column-container">
611 611
 												<div class="column">
612 612
 													<div class="give-wrap-address-line1">
613
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
614
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
613
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
614
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
615 615
 													</div>
616 616
 													<div class="give-wrap-address-line2">
617
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
618
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
617
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
618
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
619 619
 													</div>
620 620
 												</div>
621 621
 												<div class="column">
622 622
 													<div class="give-wrap-address-city">
623
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
624
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
623
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
624
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
625 625
 													</div>
626 626
 													<div class="give-wrap-address-zip">
627
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
628
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
627
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
628
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
629 629
 
630 630
 													</div>
631 631
 												</div>
632 632
 												<div class="column">
633 633
 													<div id="give-order-address-country-wrap">
634
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
634
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
635 635
 														<?php
636
-														echo Give()->html->select( array(
636
+														echo Give()->html->select(array(
637 637
 															'options'          => give_get_country_list(),
638 638
 															'name'             => 'give-payment-address[0][country]',
639 639
 															'selected'         => $address['country'],
640 640
 															'show_option_all'  => false,
641 641
 															'show_option_none' => false,
642 642
 															'chosen'           => true,
643
-															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
644
-															'data'             => array( 'search-type' => 'no_ajax' ),
645
-														) );
643
+															'placeholder'      => esc_attr__('Select a country', 'give'),
644
+															'data'             => array('search-type' => 'no_ajax'),
645
+														));
646 646
 														?>
647 647
 													</div>
648 648
 													<div id="give-order-address-state-wrap">
649
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
649
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
650 650
 														<?php
651
-														$states = give_get_states( $address['country'] );
652
-														if ( ! empty( $states ) ) {
653
-															echo Give()->html->select( array(
651
+														$states = give_get_states($address['country']);
652
+														if ( ! empty($states)) {
653
+															echo Give()->html->select(array(
654 654
 																'options'          => $states,
655 655
 																'name'             => 'give-payment-address[0][state]',
656 656
 																'selected'         => $address['state'],
657 657
 																'show_option_all'  => false,
658 658
 																'show_option_none' => false,
659 659
 																'chosen'           => true,
660
-																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
661
-																'data'             => array( 'search-type' => 'no_ajax' ),
662
-															) );
660
+																'placeholder'      => esc_attr__('Select a state', 'give'),
661
+																'data'             => array('search-type' => 'no_ajax'),
662
+															));
663 663
 														} else {
664 664
 															?>
665
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
665
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
666 666
 															<?php
667 667
 														} ?>
668 668
 													</div>
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 									 *
683 683
 									 * @param int $payment_id Payment id.
684 684
 									 */
685
-									do_action( 'give_payment_billing_details', $payment_id );
685
+									do_action('give_payment_billing_details', $payment_id);
686 686
 									?>
687 687
 
688 688
 								</div>
@@ -698,32 +698,32 @@  discard block
 block discarded – undo
698 698
 							 *
699 699
 							 * @param int $payment_id Payment id.
700 700
 							 */
701
-							do_action( 'give_view_order_details_billing_after', $payment_id );
701
+							do_action('give_view_order_details_billing_after', $payment_id);
702 702
 							?>
703 703
 
704 704
 							<div id="give-payment-notes" class="postbox">
705
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
705
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
706 706
 
707 707
 								<div class="inside">
708 708
 									<div id="give-payment-notes-inner">
709 709
 										<?php
710
-										$notes = give_get_payment_notes( $payment_id );
711
-										if ( ! empty( $notes ) ) {
710
+										$notes = give_get_payment_notes($payment_id);
711
+										if ( ! empty($notes)) {
712 712
 											$no_notes_display = ' style="display:none;"';
713
-											foreach ( $notes as $note ) :
713
+											foreach ($notes as $note) :
714 714
 
715
-												echo give_get_payment_note_html( $note, $payment_id );
715
+												echo give_get_payment_note_html($note, $payment_id);
716 716
 
717 717
 											endforeach;
718 718
 										} else {
719 719
 											$no_notes_display = '';
720 720
 										}
721
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
721
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
722 722
 									</div>
723 723
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
724 724
 
725 725
 									<div class="give-clearfix">
726
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
726
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
727 727
 									</div>
728 728
 
729 729
 								</div>
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 							 *
740 740
 							 * @param int $payment_id Payment id.
741 741
 							 */
742
-							do_action( 'give_view_order_details_main_after', $payment_id );
742
+							do_action('give_view_order_details_main_after', $payment_id);
743 743
 							?>
744 744
 
745 745
 						</div>
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 		 *
762 762
 		 * @param int $payment_id Payment id.
763 763
 		 */
764
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
764
+		do_action('give_view_order_details_form_bottom', $payment_id);
765 765
 
766
-		wp_nonce_field( 'give_update_payment_details_nonce' );
766
+		wp_nonce_field('give_update_payment_details_nonce');
767 767
 		?>
768
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
768
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
769 769
 		<input type="hidden" name="give_action" value="update_payment_details"/>
770 770
 	</form>
771 771
 	<?php
@@ -776,6 +776,6 @@  discard block
 block discarded – undo
776 776
 	 *
777 777
 	 * @param int $payment_id Payment id.
778 778
 	 */
779
-	do_action( 'give_view_order_details_after', $payment_id );
779
+	do_action('give_view_order_details_after', $payment_id);
780 780
 	?>
781 781
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.