Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/shortcodes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -738,7 +738,7 @@
 block discarded – undo
738 738
  *     @type string $display_style       How the form is displayed, either in new page or modal popup.
739 739
  *                                       Default 'redirect'. Accepts 'redirect', 'modal'.
740 740
  * }
741
- * @return string|bool The markup of the form grid or false.
741
+ * @return string|null The markup of the form grid or false.
742 742
  */
743 743
 function give_form_grid_shortcode( $atts ) {
744 744
 	$form_ids = array();
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,42 +26,42 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string|bool
28 28
  */
29
-function give_donation_history( $atts, $content = false ) {
29
+function give_donation_history($atts, $content = false) {
30 30
 
31
-	$donation_history_args = shortcode_atts( array(
31
+	$donation_history_args = shortcode_atts(array(
32 32
 		'id'             => true,
33 33
 		'date'           => true,
34 34
 		'donor'          => false,
35 35
 		'amount'         => true,
36 36
 		'status'         => false,
37 37
 		'payment_method' => false,
38
-	), $atts, 'donation_history' );
38
+	), $atts, 'donation_history');
39 39
 
40 40
 	// Always show receipt link.
41 41
 	$donation_history_args['details'] = true;
42 42
 
43 43
 	// Set Donation History Shortcode Arguments in session variable.
44
-	Give()->session->set( 'give_donation_history_args', $donation_history_args );
44
+	Give()->session->set('give_donation_history_args', $donation_history_args);
45 45
 
46 46
 	// If payment_key query arg exists, return receipt instead of donation history.
47
-	if ( isset( $_GET['payment_key'] ) ) {
47
+	if (isset($_GET['payment_key'])) {
48 48
 		ob_start();
49 49
 
50
-		echo give_receipt_shortcode( array() );
50
+		echo give_receipt_shortcode(array());
51 51
 
52 52
 		// Display donation history link only if Receipt Access Session is available.
53
-		if ( give_get_receipt_session() ) {
53
+		if (give_get_receipt_session()) {
54 54
 			echo sprintf(
55 55
 				'<a href="%s">%s</a>',
56
-				esc_url( give_get_history_page_uri() ),
57
-				__( '&laquo; Return to All Donations', 'give' )
56
+				esc_url(give_get_history_page_uri()),
57
+				__('&laquo; Return to All Donations', 'give')
58 58
 			);
59 59
 		}
60 60
 
61 61
 		return ob_get_clean();
62 62
 	}
63 63
 
64
-	$email_access = give_get_option( 'email_access' );
64
+	$email_access = give_get_option('email_access');
65 65
 
66 66
 	ob_start();
67 67
 
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
 	if (
75 75
 		is_user_logged_in() ||
76 76
 		false !== Give()->session->get_session_expiration() ||
77
-		( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) ||
77
+		(give_is_setting_enabled($email_access) && Give()->email_access->token_exists) ||
78 78
 		true === give_get_history_session()
79 79
 	) {
80
-		give_get_template_part( 'history', 'donations' );
80
+		give_get_template_part('history', 'donations');
81 81
 
82
-		if ( ! empty( $content ) ) {
83
-			echo do_shortcode( $content );
82
+		if ( ! empty($content)) {
83
+			echo do_shortcode($content);
84 84
 		}
85 85
 
86
-	} elseif ( give_is_setting_enabled( $email_access ) ) {
86
+	} elseif (give_is_setting_enabled($email_access)) {
87 87
 		// Is Email-based access enabled?
88
-		give_get_template_part( 'email', 'login-form' );
88
+		give_get_template_part('email', 'login-form');
89 89
 
90 90
 	} else {
91 91
 
92
-		echo apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ), false ) );
93
-		echo do_shortcode( '[give_login]' );
92
+		echo apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'), false));
93
+		echo do_shortcode('[give_login]');
94 94
 	}
95 95
 
96 96
 	/**
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return string HTML content
106 106
 	 */
107
-	return apply_filters( 'give_donation_history_shortcode_html', ob_get_clean(), $atts, $content );
107
+	return apply_filters('give_donation_history_shortcode_html', ob_get_clean(), $atts, $content);
108 108
 }
109 109
 
110
-add_shortcode( 'donation_history', 'give_donation_history' );
110
+add_shortcode('donation_history', 'give_donation_history');
111 111
 
112 112
 /**
113 113
  * Donation Form Shortcode
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_form_shortcode( $atts ) {
124
-	$atts = shortcode_atts( array(
123
+function give_form_shortcode($atts) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'                    => '',
126 126
 		'show_title'            => true,
127 127
 		'show_goal'             => true,
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		'float_labels'          => '',
130 130
 		'display_style'         => '',
131 131
 		'continue_button_title' => '',
132
-	), $atts, 'give_form' );
132
+	), $atts, 'give_form');
133 133
 
134 134
 	// Convert string to bool.
135
-	$atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN );
136
-	$atts['show_goal']  = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN );
135
+	$atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN);
136
+	$atts['show_goal']  = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN);
137 137
 
138 138
 	// get the Give Form
139 139
 	ob_start();
140
-	give_get_donation_form( $atts );
140
+	give_get_donation_form($atts);
141 141
 	$final_output = ob_get_clean();
142 142
 
143
-	return apply_filters( 'give_donate_form', $final_output, $atts );
143
+	return apply_filters('give_donate_form', $final_output, $atts);
144 144
 }
145 145
 
146
-add_shortcode( 'give_form', 'give_form_shortcode' );
146
+add_shortcode('give_form', 'give_form_shortcode');
147 147
 
148 148
 /**
149 149
  * Donation Form Goal Shortcode.
@@ -156,36 +156,36 @@  discard block
 block discarded – undo
156 156
  *
157 157
  * @return string
158 158
  */
159
-function give_goal_shortcode( $atts ) {
160
-	$atts = shortcode_atts( array(
159
+function give_goal_shortcode($atts) {
160
+	$atts = shortcode_atts(array(
161 161
 		'id'        => '',
162 162
 		'show_text' => true,
163 163
 		'show_bar'  => true,
164
-	), $atts, 'give_goal' );
164
+	), $atts, 'give_goal');
165 165
 
166 166
 	// get the Give Form.
167 167
 	ob_start();
168 168
 
169 169
 	// Sanity check 1: ensure there is an ID Provided.
170
-	if ( empty( $atts['id'] ) ) {
171
-		Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
170
+	if (empty($atts['id'])) {
171
+		Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true);
172 172
 	}
173 173
 
174 174
 	// Sanity check 2: Check the form even has Goals enabled.
175
-	if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {
175
+	if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) {
176 176
 
177
-		Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true );
177
+		Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true);
178 178
 	} else {
179 179
 		// Passed all sanity checks: output Goal.
180
-		give_show_goal_progress( $atts['id'], $atts );
180
+		give_show_goal_progress($atts['id'], $atts);
181 181
 	}
182 182
 
183 183
 	$final_output = ob_get_clean();
184 184
 
185
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
185
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
186 186
 }
187 187
 
188
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
188
+add_shortcode('give_goal', 'give_goal_shortcode');
189 189
 
190 190
 
191 191
 /**
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string
204 204
  */
205
-function give_login_form_shortcode( $atts ) {
205
+function give_login_form_shortcode($atts) {
206 206
 
207
-	$atts = shortcode_atts( array(
207
+	$atts = shortcode_atts(array(
208 208
 		// Add backward compatibility for redirect attribute.
209 209
 		'redirect' => '',
210 210
 		'login-redirect'  => '',
211 211
 		'logout-redirect' => '',
212
-	), $atts, 'give_login' );
212
+	), $atts, 'give_login');
213 213
 
214 214
 	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
215
-	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' );
215
+	$atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
216 216
 
217
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
217
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
218 218
 }
219 219
 
220
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
220
+add_shortcode('give_login', 'give_login_form_shortcode');
221 221
 
222 222
 /**
223 223
  * Register Shortcode.
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
  *
233 233
  * @return string
234 234
  */
235
-function give_register_form_shortcode( $atts ) {
236
-	$atts = shortcode_atts( array(
235
+function give_register_form_shortcode($atts) {
236
+	$atts = shortcode_atts(array(
237 237
 		'redirect' => '',
238
-	), $atts, 'give_register' );
238
+	), $atts, 'give_register');
239 239
 
240
-	return give_register_form( $atts['redirect'] );
240
+	return give_register_form($atts['redirect']);
241 241
 }
242 242
 
243
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
243
+add_shortcode('give_register', 'give_register_form_shortcode');
244 244
 
245 245
 /**
246 246
  * Receipt Shortcode.
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string
255 255
  */
256
-function give_receipt_shortcode( $atts ) {
256
+function give_receipt_shortcode($atts) {
257 257
 
258 258
 	global $give_receipt_args;
259 259
 
260
-	$give_receipt_args = shortcode_atts( array(
261
-		'error'          => __( 'You are missing the payment key to view this donation receipt.', 'give' ),
260
+	$give_receipt_args = shortcode_atts(array(
261
+		'error'          => __('You are missing the payment key to view this donation receipt.', 'give'),
262 262
 		'price'          => true,
263 263
 		'donor'          => true,
264 264
 		'date'           => true,
@@ -268,49 +268,49 @@  discard block
 block discarded – undo
268 268
 		'payment_status' => false,
269 269
 		'company_name'   => false,
270 270
 		'status_notice'  => true,
271
-	), $atts, 'give_receipt' );
271
+	), $atts, 'give_receipt');
272 272
 
273 273
 	// set $session var
274 274
 	$session = give_get_purchase_session();
275 275
 
276 276
 	// set payment key var
277
-	if ( isset( $_GET['payment_key'] ) ) {
278
-		$payment_key = urldecode( $_GET['payment_key'] );
279
-	} elseif ( $session ) {
277
+	if (isset($_GET['payment_key'])) {
278
+		$payment_key = urldecode($_GET['payment_key']);
279
+	} elseif ($session) {
280 280
 		$payment_key = $session['purchase_key'];
281
-	} elseif ( $give_receipt_args['payment_key'] ) {
281
+	} elseif ($give_receipt_args['payment_key']) {
282 282
 		$payment_key = $give_receipt_args['payment_key'];
283 283
 	}
284 284
 
285
-	$email_access = give_get_option( 'email_access' );
285
+	$email_access = give_get_option('email_access');
286 286
 
287 287
 	// No payment_key found & Email Access is Turned on.
288
-	if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
288
+	if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
289 289
 
290 290
 		ob_start();
291 291
 
292
-		give_get_template_part( 'email-login-form' );
292
+		give_get_template_part('email-login-form');
293 293
 
294 294
 		return ob_get_clean();
295 295
 
296
-	} elseif ( ! isset( $payment_key ) ) {
296
+	} elseif ( ! isset($payment_key)) {
297 297
 
298
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
298
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
299 299
 
300 300
 	}
301 301
 
302
-	$user_can_view = give_can_view_receipt( $payment_key );
302
+	$user_can_view = give_can_view_receipt($payment_key);
303 303
 
304 304
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt.
305
-	if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) {
305
+	if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) {
306 306
 
307 307
 		ob_start();
308 308
 
309
-		give_get_template_part( 'email-login-form' );
309
+		give_get_template_part('email-login-form');
310 310
 
311 311
 		return ob_get_clean();
312 312
 
313
-	} elseif ( ! $user_can_view ) {
313
+	} elseif ( ! $user_can_view) {
314 314
 
315 315
 		global $give_login_redirect;
316 316
 
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 		ob_start();
320 320
 
321
-		Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) );
321
+		Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give')));
322 322
 
323
-		give_get_template_part( 'shortcode', 'login' );
323
+		give_get_template_part('shortcode', 'login');
324 324
 
325 325
 		$login_form = ob_get_clean();
326 326
 
@@ -334,20 +334,20 @@  discard block
 block discarded – undo
334 334
 	 * or if user is logged out and donation was made as a guest, the donation session is checked for
335 335
 	 * or if user is logged in and the user can view sensitive shop data.
336 336
 	 */
337
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
338
-		return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' );
337
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
338
+		return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error');
339 339
 	}
340 340
 
341 341
 	ob_start();
342 342
 
343
-	give_get_template_part( 'shortcode', 'receipt' );
343
+	give_get_template_part('shortcode', 'receipt');
344 344
 
345 345
 	$display = ob_get_clean();
346 346
 
347 347
 	return $display;
348 348
 }
349 349
 
350
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
350
+add_shortcode('give_receipt', 'give_receipt_shortcode');
351 351
 
352 352
 /**
353 353
  * Profile Editor Shortcode.
@@ -366,25 +366,25 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return string Output generated from the profile editor
368 368
  */
369
-function give_profile_editor_shortcode( $atts ) {
369
+function give_profile_editor_shortcode($atts) {
370 370
 
371 371
 	ob_start();
372 372
 
373 373
 	// Restrict access to donor profile, if donor and user are disconnected.
374
-	$is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true );
375
-	if ( is_user_logged_in() && $is_donor_disconnected ) {
376
-		Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' );
374
+	$is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true);
375
+	if (is_user_logged_in() && $is_donor_disconnected) {
376
+		Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error');
377 377
 		return false;
378 378
 	}
379 379
 
380
-	give_get_template_part( 'shortcode', 'profile-editor' );
380
+	give_get_template_part('shortcode', 'profile-editor');
381 381
 
382 382
 	$display = ob_get_clean();
383 383
 
384 384
 	return $display;
385 385
 }
386 386
 
387
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
387
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
388 388
 
389 389
 /**
390 390
  * Process Profile Updater Form.
@@ -397,31 +397,31 @@  discard block
 block discarded – undo
397 397
  *
398 398
  * @return bool
399 399
  */
400
-function give_process_profile_editor_updates( $data ) {
400
+function give_process_profile_editor_updates($data) {
401 401
 	// Profile field change request.
402
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
402
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
403 403
 		return false;
404 404
 	}
405 405
 
406 406
 	// Nonce security.
407
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
407
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
408 408
 		return false;
409 409
 	}
410 410
 
411 411
 	$user_id       = get_current_user_id();
412
-	$old_user_data = get_userdata( $user_id );
412
+	$old_user_data = get_userdata($user_id);
413 413
 
414 414
 	/* @var Give_Donor $donor */
415
-	$donor            = new Give_Donor( $user_id, true );
415
+	$donor            = new Give_Donor($user_id, true);
416 416
 	$old_company_name = $donor->get_company_name();
417 417
 
418
-	$display_name     = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
419
-	$first_name       = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
420
-	$last_name        = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
421
-	$company_name     = ! empty( $data['give_company_name'] ) ? sanitize_text_field( $data['give_company_name'] ) : $old_company_name;
422
-	$email            = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
423
-	$password         = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : '';
424
-	$confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : '';
418
+	$display_name     = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
419
+	$first_name       = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
420
+	$last_name        = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
421
+	$company_name     = ! empty($data['give_company_name']) ? sanitize_text_field($data['give_company_name']) : $old_company_name;
422
+	$email            = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
423
+	$password         = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : '';
424
+	$confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : '';
425 425
 
426 426
 	$userdata = array(
427 427
 		'ID'           => $user_id,
@@ -441,60 +441,60 @@  discard block
 block discarded – undo
441 441
 	 * @param int $user_id The ID of the user.
442 442
 	 * @param array $userdata User info, including ID, first name, last name, display name and email.
443 443
 	 */
444
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
444
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
445 445
 
446 446
 	// Make sure to validate first name of existing donors.
447
-	if ( empty( $first_name ) ) {
447
+	if (empty($first_name)) {
448 448
 		// Empty First Name.
449
-		give_set_error( 'empty_first_name', __( 'Please enter your first name.', 'give' ) );
449
+		give_set_error('empty_first_name', __('Please enter your first name.', 'give'));
450 450
 	}
451 451
 
452 452
 	// Make sure to validate passwords for existing Donors.
453
-	give_validate_user_password( $password, $confirm_password );
453
+	give_validate_user_password($password, $confirm_password);
454 454
 
455
-	if ( empty( $email ) ) {
455
+	if (empty($email)) {
456 456
 		// Make sure email should not be empty.
457
-		give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) );
457
+		give_set_error('email_empty', __('The email you entered is empty.', 'give'));
458 458
 
459
-	} elseif ( ! is_email( $email ) ) {
459
+	} elseif ( ! is_email($email)) {
460 460
 		// Make sure email should be valid.
461
-		give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) );
461
+		give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give'));
462 462
 
463
-	} elseif ( $email != $old_user_data->user_email ) {
463
+	} elseif ($email != $old_user_data->user_email) {
464 464
 		// Make sure the new email doesn't belong to another user.
465
-		if ( email_exists( $email ) ) {
466
-			give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
467
-		} elseif ( Give()->donors->get_donor_by( 'email', $email ) ) {
465
+		if (email_exists($email)) {
466
+			give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
467
+		} elseif (Give()->donors->get_donor_by('email', $email)) {
468 468
 			// Make sure the new email doesn't belong to another user.
469
-			give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) );
469
+			give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give'));
470 470
 		}
471 471
 	}
472 472
 
473 473
 	// Check for errors.
474 474
 	$errors = give_get_errors();
475 475
 
476
-	if ( $errors ) {
476
+	if ($errors) {
477 477
 		// Send back to the profile editor if there are errors.
478
-		wp_redirect( $data['give_redirect'] );
478
+		wp_redirect($data['give_redirect']);
479 479
 		give_die();
480 480
 	}
481 481
 
482 482
 	// Update Donor First Name and Last Name.
483
-	Give()->donors->update( $donor->id, array(
484
-		'name' => trim( "{$first_name} {$last_name}" ),
485
-	) );
486
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name );
487
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name );
488
-	Give()->donor_meta->update_meta( $donor->id, '_give_donor_company', $company_name );
483
+	Give()->donors->update($donor->id, array(
484
+		'name' => trim("{$first_name} {$last_name}"),
485
+	));
486
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name);
487
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name);
488
+	Give()->donor_meta->update_meta($donor->id, '_give_donor_company', $company_name);
489 489
 
490 490
 	$current_user = wp_get_current_user();
491 491
 
492 492
 	// Compares new values with old values to detect change in values.
493
-	$email_update        = ( $email !== $current_user->user_email ) ? true : false;
494
-	$display_name_update = ( $display_name !== $current_user->display_name ) ? true : false;
495
-	$first_name_update   = ( $first_name !== $current_user->first_name ) ? true : false;
496
-	$last_name_update    = ( $last_name !== $current_user->last_name ) ? true : false;
497
-	$company_name_update = ( $company_name !== $old_company_name ) ? true : false;
493
+	$email_update        = ($email !== $current_user->user_email) ? true : false;
494
+	$display_name_update = ($display_name !== $current_user->display_name) ? true : false;
495
+	$first_name_update   = ($first_name !== $current_user->first_name) ? true : false;
496
+	$last_name_update    = ($last_name !== $current_user->last_name) ? true : false;
497
+	$company_name_update = ($company_name !== $old_company_name) ? true : false;
498 498
 	$update_code         = 0;
499 499
 
500 500
 	/**
@@ -502,35 +502,35 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @var boolean
504 504
 	 */
505
-	$profile_update = ( $email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update );
505
+	$profile_update = ($email_update || $display_name_update || $first_name_update || $last_name_update || $company_name_update);
506 506
 
507 507
 	/**
508 508
 	 * True if password fields are filled.
509 509
 	 *
510 510
 	 * @var boolean
511 511
 	 */
512
-	$password_update = ( ! empty( $password ) && ! empty( $confirm_password ) );
512
+	$password_update = ( ! empty($password) && ! empty($confirm_password));
513 513
 
514
-	if ( $profile_update ) {
514
+	if ($profile_update) {
515 515
 
516 516
 		// If only profile fields are updated.
517 517
 		$update_code = '1';
518 518
 
519
-		if ( $password_update ) {
519
+		if ($password_update) {
520 520
 
521 521
 			// If profile fields AND password both are updated.
522 522
 			$update_code = '2';
523 523
 		}
524
-	} elseif ( $password_update ) {
524
+	} elseif ($password_update) {
525 525
 
526 526
 		// If only password is updated.
527 527
 		$update_code = '3';
528 528
 	}
529 529
 
530 530
 	// Update the user.
531
-	$updated = wp_update_user( $userdata );
531
+	$updated = wp_update_user($userdata);
532 532
 
533
-	if ( $updated ) {
533
+	if ($updated) {
534 534
 
535 535
 		/**
536 536
 		 * Fires after updating user profile.
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		 * @param int $user_id The ID of the user.
541 541
 		 * @param array $userdata User info, including ID, first name, last name, display name and email.
542 542
 		 */
543
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
543
+		do_action('give_user_profile_updated', $user_id, $userdata);
544 544
 
545 545
 		$profile_edit_redirect_args = array(
546 546
 			'updated'     => 'true',
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 		 * Update codes '2' and '3' indicate a password change.
552 552
 		 * If the password is changed, then logout and redirect to the same page.
553 553
 		 */
554
-		if ( '2' === $update_code || '3' === $update_code ) {
555
-			wp_logout( wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) ) );
554
+		if ('2' === $update_code || '3' === $update_code) {
555
+			wp_logout(wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect'])));
556 556
 		} else {
557
-			wp_redirect( add_query_arg( $profile_edit_redirect_args, $data['give_redirect'] ) );
557
+			wp_redirect(add_query_arg($profile_edit_redirect_args, $data['give_redirect']));
558 558
 		}
559 559
 
560 560
 		give_die();
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	return false;
564 564
 }
565 565
 
566
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
566
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
567 567
 
568 568
 /**
569 569
  * Give totals Shortcode.
@@ -576,24 +576,24 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return string
578 578
  */
579
-function give_totals_shortcode( $atts ) {
580
-	$total = get_option( 'give_earnings_total', false );
579
+function give_totals_shortcode($atts) {
580
+	$total = get_option('give_earnings_total', false);
581 581
 
582
-	$message = apply_filters( 'give_totals_message', __( 'Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give' ) );
582
+	$message = apply_filters('give_totals_message', __('Hey! We\'ve raised {total} of the {total_goal} we are trying to raise for this campaign!', 'give'));
583 583
 
584
-	$atts = shortcode_atts( array(
584
+	$atts = shortcode_atts(array(
585 585
 		'total_goal'   => 0, // integer
586 586
 		'ids'          => 0, // integer|array
587 587
 		'cats'         => 0, // integer|array
588 588
 		'tags'         => 0, // integer|array
589 589
 		'message'      => $message,
590 590
 		'link'         => '', // URL
591
-		'link_text'    => __( 'Donate Now', 'give' ), // string,
591
+		'link_text'    => __('Donate Now', 'give'), // string,
592 592
 		'progress_bar' => true, // boolean
593
-	), $atts, 'give_totals' );
593
+	), $atts, 'give_totals');
594 594
 
595 595
 	// Total Goal.
596
-	$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );
596
+	$total_goal = give_maybe_sanitize_amount($atts['total_goal']);
597 597
 
598 598
 	/**
599 599
 	 * Give Action fire before the shortcode is rendering is started.
@@ -602,14 +602,14 @@  discard block
 block discarded – undo
602 602
 	 *
603 603
 	 * @param array $atts shortcode attribute.
604 604
 	 */
605
-	do_action( 'give_totals_goal_shortcode_before_render', $atts );
605
+	do_action('give_totals_goal_shortcode_before_render', $atts);
606 606
 
607 607
 	// Build query based on cat, tag and Form ids.
608
-	if ( ! empty( $atts['cats'] ) || ! empty( $atts['tags'] ) || ! empty( $atts['ids'] ) ) {
608
+	if ( ! empty($atts['cats']) || ! empty($atts['tags']) || ! empty($atts['ids'])) {
609 609
 
610 610
 		$form_ids = array();
611
-		if ( ! empty( $atts['ids'] ) ) {
612
-			$form_ids = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
611
+		if ( ! empty($atts['ids'])) {
612
+			$form_ids = array_filter(array_map('trim', explode(',', $atts['ids'])));
613 613
 		}
614 614
 
615 615
 		/**
@@ -623,23 +623,23 @@  discard block
 block discarded – undo
623 623
 			'post_type'        => 'give_forms',
624 624
 			'post_status'      => 'publish',
625 625
 			'post__in'         => $form_ids,
626
-			'posts_per_page'   => - 1,
626
+			'posts_per_page'   => -1,
627 627
 			'fields'           => 'ids',
628 628
 			'tax_query'        => array(
629 629
 				'relation' => 'AND',
630 630
 			),
631 631
 		);
632 632
 
633
-		if ( ! empty( $atts['cats'] ) ) {
634
-			$cats                     = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
633
+		if ( ! empty($atts['cats'])) {
634
+			$cats                     = array_filter(array_map('trim', explode(',', $atts['cats'])));
635 635
 			$form_args['tax_query'][] = array(
636 636
 				'taxonomy' => 'give_forms_category',
637 637
 				'terms'    => $cats,
638 638
 			);
639 639
 		}
640 640
 
641
-		if ( ! empty( $atts['tags'] ) ) {
642
-			$tags                     = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
641
+		if ( ! empty($atts['tags'])) {
642
+			$tags                     = array_filter(array_map('trim', explode(',', $atts['tags'])));
643 643
 			$form_args['tax_query'][] = array(
644 644
 				'taxonomy' => 'give_forms_tag',
645 645
 				'terms'    => $tags,
@@ -655,15 +655,15 @@  discard block
 block discarded – undo
655 655
 		 *
656 656
 		 * @return array $form_args WP query argument for Total Goal.
657 657
 		 */
658
-		$form_args = (array) apply_filters( 'give_totals_goal_shortcode_query_args', $form_args );
658
+		$form_args = (array) apply_filters('give_totals_goal_shortcode_query_args', $form_args);
659 659
 
660
-		$forms = new WP_Query( $form_args );
660
+		$forms = new WP_Query($form_args);
661 661
 
662
-		if ( isset( $forms->posts ) ) {
662
+		if (isset($forms->posts)) {
663 663
 			$total = 0;
664
-			foreach ( $forms->posts as $post ) {
665
-				$form_earning = give_get_meta( $post, '_give_form_earnings', true );
666
-				$form_earning = ! empty( $form_earning ) ? $form_earning : 0;
664
+			foreach ($forms->posts as $post) {
665
+				$form_earning = give_get_meta($post, '_give_form_earnings', true);
666
+				$form_earning = ! empty($form_earning) ? $form_earning : 0;
667 667
 
668 668
 				/**
669 669
 				 * Update Form earnings.
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				 * @param int $post Form ID.
674 674
 				 * @param string $form_earning Total earning of Form.
675 675
 				 */
676
-				$total += apply_filters( 'give_totals_form_earning', $form_earning, $post );
676
+				$total += apply_filters('give_totals_form_earning', $form_earning, $post);
677 677
 			}
678 678
 		}
679 679
 
@@ -681,23 +681,23 @@  discard block
 block discarded – undo
681 681
 
682 682
 	// Append link with text.
683 683
 	$donate_link = '';
684
-	if ( ! empty( $atts['link'] ) ) {
685
-		$donate_link = sprintf( ' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url( $atts['link'] ), esc_html( $atts['link_text'] ) );
684
+	if ( ! empty($atts['link'])) {
685
+		$donate_link = sprintf(' <a class="give-totals-text-link" href="%1$s">%2$s</a>', esc_url($atts['link']), esc_html($atts['link_text']));
686 686
 	}
687 687
 
688 688
 	// Replace {total} in message.
689
-	$message = str_replace( '{total}', give_currency_filter(
690
-		give_format_amount( $total,
691
-			array( 'sanitize' => false )
689
+	$message = str_replace('{total}', give_currency_filter(
690
+		give_format_amount($total,
691
+			array('sanitize' => false)
692 692
 		)
693
-	), esc_html( $atts['message'] ) );
693
+	), esc_html($atts['message']));
694 694
 
695 695
 	// Replace {total_goal} in message.
696
-	$message = str_replace( '{total_goal}', give_currency_filter(
697
-		give_format_amount( $total_goal,
698
-			array( 'sanitize' => true )
696
+	$message = str_replace('{total_goal}', give_currency_filter(
697
+		give_format_amount($total_goal,
698
+			array('sanitize' => true)
699 699
 		)
700
-	), $message );
700
+	), $message);
701 701
 
702 702
 	/**
703 703
 	 * Update Give totals shortcode output.
@@ -707,19 +707,19 @@  discard block
 block discarded – undo
707 707
 	 * @param string $message Shortcode Message.
708 708
 	 * @param array $atts ShortCode attributes.
709 709
 	 */
710
-	$message = apply_filters( 'give_totals_shortcode_message', $message, $atts );
710
+	$message = apply_filters('give_totals_shortcode_message', $message, $atts);
711 711
 
712 712
 	ob_start();
713 713
 	?>
714 714
 	<div class="give-totals-shortcode-wrap">
715 715
 		<?php
716 716
 		// Show Progress Bar if progress_bar set true.
717
-		$show_progress_bar = isset( $atts['progress_bar'] ) ? filter_var( $atts['progress_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
718
-		if ( $show_progress_bar ) {
719
-			give_show_goal_totals_progress( $total, $total_goal );
717
+		$show_progress_bar = isset($atts['progress_bar']) ? filter_var($atts['progress_bar'], FILTER_VALIDATE_BOOLEAN) : true;
718
+		if ($show_progress_bar) {
719
+			give_show_goal_totals_progress($total, $total_goal);
720 720
 		}
721 721
 
722
-		echo sprintf( $message ) . $donate_link;
722
+		echo sprintf($message).$donate_link;
723 723
 		?>
724 724
 	</div>
725 725
 	<?php
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	 * @param array  $atts               shortcode attribute.
735 735
 	 * @param string $give_totals_output shortcode output.
736 736
 	 */
737
-	do_action( 'give_totals_goal_shortcode_after_render', $atts, $give_totals_output );
737
+	do_action('give_totals_goal_shortcode_after_render', $atts, $give_totals_output);
738 738
 
739 739
 	/**
740 740
 	 * Give Totals Shortcode output.
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 	 *
744 744
 	 * @param string $give_totals_output
745 745
 	 */
746
-	return apply_filters( 'give_totals_shortcode_output', $give_totals_output );
746
+	return apply_filters('give_totals_shortcode_output', $give_totals_output);
747 747
 
748 748
 }
749 749
 
750
-add_shortcode( 'give_totals', 'give_totals_shortcode' );
750
+add_shortcode('give_totals', 'give_totals_shortcode');
751 751
 
752 752
 
753 753
 /**
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
  * }
778 778
  * @return string|bool The markup of the form grid or false.
779 779
  */
780
-function give_form_grid_shortcode( $atts ) {
780
+function give_form_grid_shortcode($atts) {
781 781
 	$form_ids = array();
782 782
 	$give_settings = give_get_settings();
783 783
 
784
-	$atts = shortcode_atts( array(
784
+	$atts = shortcode_atts(array(
785 785
 		'forms_per_page'      => 12,
786 786
 		'paged'               => true,
787 787
 		'ids'                 => '',
@@ -797,11 +797,11 @@  discard block
 block discarded – undo
797 797
 		'excerpt_length'      => 16,
798 798
 		'display_style'       => 'modal_reveal',
799 799
 		'status'              => '' // open or closed
800
-	), $atts );
800
+	), $atts);
801 801
 
802 802
 	// Validate integer attributes.
803
-	$atts['forms_per_page'] = intval( $atts['forms_per_page'] );
804
-	$atts['excerpt_length'] = intval( $atts['excerpt_length'] );
803
+	$atts['forms_per_page'] = intval($atts['forms_per_page']);
804
+	$atts['excerpt_length'] = intval($atts['excerpt_length']);
805 805
 
806 806
 	// Validate boolean attributes.
807 807
 	$boolean_attributes = array(
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
 		'show_featured_image',
813 813
 	);
814 814
 
815
-	foreach ( $boolean_attributes as $att ) {
816
-		$atts[ $att ] = filter_var( $atts[ $att ], FILTER_VALIDATE_BOOLEAN );
815
+	foreach ($boolean_attributes as $att) {
816
+		$atts[$att] = filter_var($atts[$att], FILTER_VALIDATE_BOOLEAN);
817 817
 	}
818 818
 
819 819
 	// Set default form query args.
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 	);
828 828
 
829 829
 	// Filter results of form grid based on form status.
830
-	$form_closed_status = trim( $atts['status'] );
831
-	if ( ! empty( $form_closed_status ) ) {
830
+	$form_closed_status = trim($atts['status']);
831
+	if ( ! empty($form_closed_status)) {
832 832
 		$form_args['meta_query'] = array(
833 833
 			array(
834 834
 				'key'   => '_give_form_status',
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 	}
839 839
 
840 840
 	// Maybe add pagination.
841
-	if ( true === $atts['paged'] ) {
842
-		$form_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
841
+	if (true === $atts['paged']) {
842
+		$form_args['paged'] = get_query_var('paged') ? get_query_var('paged') : 1;
843 843
 	}
844 844
 
845 845
 	// Maybe filter forms by IDs.
846
-	if ( ! empty( $atts['ids'] ) ) {
847
-		$form_args['post__in'] = array_filter( array_map( 'trim', explode( ',', $atts['ids'] ) ) );
846
+	if ( ! empty($atts['ids'])) {
847
+		$form_args['post__in'] = array_filter(array_map('trim', explode(',', $atts['ids'])));
848 848
 	}
849 849
 
850 850
 	// Maybe filter by form category.
851
-	if ( ! empty( $atts['cats'] ) ) {
852
-		$cats      = array_filter( array_map( 'trim', explode( ',', $atts['cats'] ) ) );
851
+	if ( ! empty($atts['cats'])) {
852
+		$cats      = array_filter(array_map('trim', explode(',', $atts['cats'])));
853 853
 		$tax_query = array(
854 854
 			'taxonomy' => 'give_forms_category',
855 855
 			'terms'    => $cats,
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 	}
859 859
 
860 860
 	// Maybe filter by form tag.
861
-	if ( ! empty( $atts['tags'] ) ) {
862
-		$tags      = array_filter( array_map( 'trim', explode( ',', $atts['tags'] ) ) );
861
+	if ( ! empty($atts['tags'])) {
862
+		$tags      = array_filter(array_map('trim', explode(',', $atts['tags'])));
863 863
 		$tax_query = array(
864 864
 			'taxonomy' => 'give_forms_tag',
865 865
 			'terms'    => $tags,
@@ -868,24 +868,24 @@  discard block
 block discarded – undo
868 868
 	}
869 869
 
870 870
 	// Query to output donation forms.
871
-	$form_query = new WP_Query( $form_args );
871
+	$form_query = new WP_Query($form_args);
872 872
 
873
-	if ( $form_query->have_posts() ) {
873
+	if ($form_query->have_posts()) {
874 874
 		ob_start();
875 875
 
876
-		add_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1 );
877
-		add_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1 );
878
-		add_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10, 3 );
879
-		add_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3 );
876
+		add_filter('add_give_goal_progress_class', 'add_give_goal_progress_class', 10, 1);
877
+		add_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class', 10, 1);
878
+		add_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10, 3);
879
+		add_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10, 3);
880 880
 
881 881
 		echo '<div class="give-wrap">';
882
-		echo '<div class="give-grid give-grid--' . esc_attr( $atts['columns'] ) . '">';
882
+		echo '<div class="give-grid give-grid--'.esc_attr($atts['columns']).'">';
883 883
 
884
-		while ( $form_query->have_posts() ) {
884
+		while ($form_query->have_posts()) {
885 885
 			$form_query->the_post();
886 886
 
887 887
 			// Give/templates/shortcode-form-grid.php.
888
-			give_get_template( 'shortcode-form-grid', array( $give_settings, $atts ) );
888
+			give_get_template('shortcode-form-grid', array($give_settings, $atts));
889 889
 
890 890
 		}
891 891
 
@@ -893,28 +893,28 @@  discard block
 block discarded – undo
893 893
 
894 894
 		echo '</div><!-- .give-grid -->';
895 895
 
896
-		remove_filter( 'add_give_goal_progress_class', 'add_give_goal_progress_class' );
897
-		remove_filter( 'add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class' );
898
-		remove_filter( 'give_form_wrap_classes', 'add_class_for_form_grid', 10 );
899
-		remove_action( 'give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10 );
896
+		remove_filter('add_give_goal_progress_class', 'add_give_goal_progress_class');
897
+		remove_filter('add_give_goal_progress_bar_class', 'add_give_goal_progress_bar_class');
898
+		remove_filter('give_form_wrap_classes', 'add_class_for_form_grid', 10);
899
+		remove_action('give_donation_form_top', 'give_is_form_grid_page_hidden_field', 10);
900 900
 
901
-		if ( false !== $atts['paged'] ) {
901
+		if (false !== $atts['paged']) {
902 902
 			$paginate_args = array(
903
-				'current'   => max( 1, get_query_var( 'paged' ) ),
903
+				'current'   => max(1, get_query_var('paged')),
904 904
 				'total'     => $form_query->max_num_pages,
905 905
 				'show_all'  => false,
906 906
 				'end_size'  => 1,
907 907
 				'mid_size'  => 2,
908 908
 				'prev_next' => true,
909
-				'prev_text' => __( '« Previous', 'give' ),
910
-				'next_text' => __( 'Next »', 'give' ),
909
+				'prev_text' => __('« Previous', 'give'),
910
+				'next_text' => __('Next »', 'give'),
911 911
 				'type'      => 'plain',
912 912
 				'add_args'  => false,
913 913
 			);
914 914
 
915 915
 			printf(
916 916
 				'<div class="give-page-numbers">%s</div>',
917
-				paginate_links( $paginate_args )
917
+				paginate_links($paginate_args)
918 918
 			);
919 919
 		}
920 920
 		echo '</div><!-- .give-wrap -->';
@@ -923,4 +923,4 @@  discard block
 block discarded – undo
923 923
 	}
924 924
 }
925 925
 
926
-add_shortcode( 'give_form_grid', 'give_form_grid_shortcode' );
926
+add_shortcode('give_form_grid', 'give_form_grid_shortcode');
Please login to merge, or discard this patch.
blocks/load.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if access directly.
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined('ABSPATH')) {
4 4
 	exit;
5 5
 }
6 6
 
7 7
 /**
8 8
 * Blocks
9 9
 */
10
-require_once GIVE_PLUGIN_DIR . 'blocks/donation-form/class-give-donation-form-block.php';
11
-require_once GIVE_PLUGIN_DIR . 'blocks/donation-form-grid/class-give-donation-form-grid-block.php';
10
+require_once GIVE_PLUGIN_DIR.'blocks/donation-form/class-give-donation-form-block.php';
11
+require_once GIVE_PLUGIN_DIR.'blocks/donation-form-grid/class-give-donation-form-grid-block.php';
Please login to merge, or discard this patch.
blocks/donation-form/class-give-donation-form-block.php 1 patch
Spacing   +11 added lines, -11 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
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return Give_Donation_Form_Block
50 50
 	 */
51 51
 	public static function get_instance() {
52
-		if ( null === static::$instance ) {
52
+		if (null === static::$instance) {
53 53
 			self::$instance = new static();
54 54
 
55 55
 			self::$instance->init();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access private
68 68
 	 */
69 69
 	private function init() {
70
-		add_action( 'init', array( $this, 'register_block' ), 999 );
70
+		add_action('init', array($this, 'register_block'), 999);
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function register_block() {
82 82
 		// Bailout.
83
-		if( ! function_exists('register_block_type' ) ) {
83
+		if ( ! function_exists('register_block_type')) {
84 84
 			return;
85 85
 		}
86 86
 
87 87
 		// Register block.
88
-		register_block_type( 'give/donation-form', array(
89
-			'render_callback' => array( $this, 'render_donation_form' ),
88
+		register_block_type('give/donation-form', array(
89
+			'render_callback' => array($this, 'render_donation_form'),
90 90
 			'attributes'      => array(
91 91
 				'id'                  => array(
92 92
 					'type' => 'number',
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					'default' => 'none',
111 111
 				),
112 112
 			),
113
-		) );
113
+		));
114 114
 	}
115 115
 
116 116
 	/**
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @access public
122 122
 	 * @return string;
123 123
 	 */
124
-	public function render_donation_form( $attributes ) {
124
+	public function render_donation_form($attributes) {
125 125
 		// Bailout.
126
-		if ( empty( $attributes['id'] ) ) {
126
+		if (empty($attributes['id'])) {
127 127
 			return '';
128 128
 		}
129 129
 
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 		$parameters['show_goal']             = $attributes['showGoal'];
135 135
 		$parameters['show_content']          = $attributes['showContent'];
136 136
 		$parameters['display_style']         = $attributes['displayStyle'];
137
-		$parameters['continue_button_title'] = trim( $attributes['continueButtonTitle'] );
137
+		$parameters['continue_button_title'] = trim($attributes['continueButtonTitle']);
138 138
 
139
-		return give_form_shortcode( $parameters );
139
+		return give_form_shortcode($parameters);
140 140
 	}
141 141
 }
142 142
 
Please login to merge, or discard this patch.
blocks/donation-form-grid/class-give-donation-form-grid-block.php 1 patch
Spacing   +10 added lines, -10 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
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @return Give_Donation_form_Grid_Block
50 50
 	 */
51 51
 	public static function get_instance() {
52
-		if ( null === static::$instance ) {
52
+		if (null === static::$instance) {
53 53
 			self::$instance = new static();
54 54
 
55 55
 			self::$instance->init();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access private
68 68
 	 */
69 69
 	private function init() {
70
-		add_action( 'init', array( $this, 'register_block' ), 999 );
70
+		add_action('init', array($this, 'register_block'), 999);
71 71
 	}
72 72
 
73 73
 	/**
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function register_block() {
80 80
 		// Bailout.
81
-		if( ! function_exists('register_block_type' ) ) {
81
+		if ( ! function_exists('register_block_type')) {
82 82
 			return;
83 83
 		}
84 84
 
85 85
 		// Register block.
86
-		register_block_type( 'give/donation-form-grid', array(
87
-			'render_callback' => array( $this, 'render_block' ),
86
+		register_block_type('give/donation-form-grid', array(
87
+			'render_callback' => array($this, 'render_block'),
88 88
 			'attributes'      => array(
89 89
 				'columns'           => array(
90 90
 					'type'    => 'string',
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 					'default' => 'redirect',
108 108
 				),
109 109
 			),
110
-		) );
110
+		));
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 	 * @access public
119 119
 	 * @return string;
120 120
 	 */
121
-	public function render_block( $attributes ) {
121
+	public function render_block($attributes) {
122 122
 		$parameters = array(
123
-			'columns'             => absint( $attributes['columns'] ),
123
+			'columns'             => absint($attributes['columns']),
124 124
 			'show_goal'           => $attributes['showGoal'],
125 125
 			'show_excerpt'        => $attributes['showExcerpt'],
126 126
 			'show_featured_image' => $attributes['showFeaturedImage'],
127 127
 			'display_type'        => $attributes['displayType'],
128 128
 		);
129 129
 
130
-		return give_form_grid_shortcode( $parameters );
130
+		return give_form_grid_shortcode($parameters);
131 131
 	}
132 132
 }
133 133
 
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag' );
27
-	$give_post_types = array( 'give_forms', 'give_payment' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag');
27
+	$give_post_types = array('give_forms', 'give_payment');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -73,27 +73,27 @@  discard block
 block discarded – undo
73 73
 	Give()->roles->remove_caps();
74 74
 
75 75
 	// Delete the Roles.
76
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' );
77
-	foreach ( $give_roles as $role ) {
78
-		remove_role( $role );
76
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor');
77
+	foreach ($give_roles as $role) {
78
+		remove_role($role);
79 79
 	}
80 80
 
81 81
 	// Remove all database tables.
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donormeta' );
84
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
85
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
86
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_paymentmeta' );
87
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_formmeta' );
88
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_logs' );
89
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_logmeta' );
90
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_sequential_ordering' );
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donormeta');
84
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
85
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
86
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_paymentmeta');
87
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_formmeta');
88
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_logs');
89
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_logmeta');
90
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_sequential_ordering');
91 91
 
92 92
 	// Cleanup Cron Events.
93
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
94
-	wp_clear_scheduled_hook( 'give_weekly_scheduled_events' );
95
-	wp_clear_scheduled_hook( 'give_daily_cron' );
96
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
93
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
94
+	wp_clear_scheduled_hook('give_weekly_scheduled_events');
95
+	wp_clear_scheduled_hook('give_daily_cron');
96
+	wp_clear_scheduled_hook('give_weekly_cron');
97 97
 
98 98
 	// Get all options.
99 99
 	$give_option_names = $wpdb->get_col(
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
 		)
104 104
 	);
105 105
 
106
-	if ( ! empty( $give_option_names ) ) {
106
+	if ( ! empty($give_option_names)) {
107 107
 		// Convert option name to transient or option name.
108 108
 		$new_give_option_names = array();
109 109
 
110 110
 		// Delete all the Plugin Options.
111
-		foreach ( $give_option_names as $option ) {
112
-			if ( false !== strpos( $option, 'give_cache' ) ) {
113
-				Give_Cache::delete( $option );
111
+		foreach ($give_option_names as $option) {
112
+			if (false !== strpos($option, 'give_cache')) {
113
+				Give_Cache::delete($option);
114 114
 			} else {
115
-				delete_option( $option );
115
+				delete_option($option);
116 116
 			}
117 117
 		}
118 118
 	}
Please login to merge, or discard this patch.
templates/history-donations.php 2 patches
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -190,7 +190,8 @@  discard block
 block discarded – undo
190 190
 								esc_html( $table_headings['details'] )
191 191
 							);
192 192
 
193
-						else :
193
+						else {
194
+							:
194 195
 							echo sprintf(
195 196
 								'<span class="title-for-mobile">%3$s</span><a href="%1$s">%2$s</a>',
196 197
 								esc_url(
@@ -203,6 +204,7 @@  discard block
 block discarded – undo
203 204
 								__( 'View Receipt &raquo;', 'give' ),
204 205
 								esc_html( $table_headings['details'] )
205 206
 							);
207
+						}
206 208
 
207 209
 						endif;
208 210
 						?>
@@ -247,6 +249,9 @@  discard block
 block discarded – undo
247 249
 		</div>
248 250
 	</div>
249 251
 	<?php wp_reset_postdata(); ?>
250
-<?php else : ?>
251
-	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
252
+<?php else {
253
+	: ?>
254
+	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' );
255
+}
256
+?>
252 257
 <?php endif;
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 $donations             = array();
7
-$donation_history_args = Give()->session->get( 'give_donation_history_args' );
7
+$donation_history_args = Give()->session->get('give_donation_history_args');
8 8
 
9 9
 // User's Donations.
10
-if ( is_user_logged_in() ) {
11
-	$donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' );
12
-} elseif ( Give()->email_access->token_exists ) {
10
+if (is_user_logged_in()) {
11
+	$donations = give_get_users_donations(get_current_user_id(), 20, true, 'any');
12
+} elseif (Give()->email_access->token_exists) {
13 13
 	// Email Access Token?
14
-	$donations = give_get_users_donations( 0, 20, true, 'any' );
14
+	$donations = give_get_users_donations(0, 20, true, 'any');
15 15
 } elseif (
16 16
 	false !== Give()->session->get_session_expiration() ||
17 17
 	true === give_get_history_session()
18 18
 ) {
19 19
 	// Session active?
20
-	$email           = Give()->session->get( 'give_email' );
21
-	$donor           = Give()->donors->get_donor_by( 'email', $email );
22
-	$donations_count = count( explode( ',', $donor->payment_ids ) );
20
+	$email           = Give()->session->get('give_email');
21
+	$donor           = Give()->donors->get_donor_by('email', $email);
22
+	$donations_count = count(explode(',', $donor->payment_ids));
23 23
 
24
-	if ( $donations_count > give_get_limit_display_donations() ) {
24
+	if ($donations_count > give_get_limit_display_donations()) {
25 25
 
26 26
 		// Restrict Security Email Access option, if donation count of a donor is less than or equal to limit.
27
-		if ( true !== Give_Cache::get( "give_cache_email_throttle_limit_exhausted_{$donor->id}" ) ) {
28
-			add_action( 'give_donation_history_table_end', 'give_donation_history_table_end' );
27
+		if (true !== Give_Cache::get("give_cache_email_throttle_limit_exhausted_{$donor->id}")) {
28
+			add_action('give_donation_history_table_end', 'give_donation_history_table_end');
29 29
 		} else {
30 30
 			$value = Give()->email_access->verify_throttle / 60;
31 31
 
@@ -42,35 +42,35 @@  discard block
 block discarded – undo
42 42
 			$message = (string) apply_filters(
43 43
 				'give_email_access_requests_exceed_notice',
44 44
 				sprintf(
45
-					__( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
46
-					sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
45
+					__('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'),
46
+					sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value)
47 47
 				),
48 48
 				$value
49 49
 			);
50 50
 
51
-			give_set_error( 'give-limited-throttle',
51
+			give_set_error('give-limited-throttle',
52 52
 				$message
53 53
 			);
54 54
 		}
55 55
 
56
-		$donations = give_get_users_donations( $email, give_get_limit_display_donations(), true, 'any' );
56
+		$donations = give_get_users_donations($email, give_get_limit_display_donations(), true, 'any');
57 57
 	} else {
58
-		$donations = give_get_users_donations( $email, 20, true, 'any' );
58
+		$donations = give_get_users_donations($email, 20, true, 'any');
59 59
 	}
60 60
 }
61 61
 
62
-Give()->notices->render_frontend_notices( 0 );
62
+Give()->notices->render_frontend_notices(0);
63 63
 
64
-if ( $donations ) : ?>
64
+if ($donations) : ?>
65 65
 	<?php
66 66
 	$table_headings = array(
67
-		'id'             => __( 'ID', 'give' ),
68
-		'date'           => __( 'Date', 'give' ),
69
-		'donor'          => __( 'Donor', 'give' ),
70
-		'amount'         => __( 'Amount', 'give' ),
71
-		'status'         => __( 'Status', 'give' ),
72
-		'payment_method' => __( 'Payment Method', 'give' ),
73
-		'details'        => __( 'Details', 'give' ),
67
+		'id'             => __('ID', 'give'),
68
+		'date'           => __('Date', 'give'),
69
+		'donor'          => __('Donor', 'give'),
70
+		'amount'         => __('Amount', 'give'),
71
+		'status'         => __('Status', 'give'),
72
+		'payment_method' => __('Payment Method', 'give'),
73
+		'details'        => __('Details', 'give'),
74 74
 	);
75 75
 	?>
76 76
 	<div class="give_user_history_main" >
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 				 *
87 87
 				 * @since 1.7
88 88
 				 */
89
-				do_action( 'give_donation_history_header_before' );
89
+				do_action('give_donation_history_header_before');
90 90
 
91
-				foreach ( $donation_history_args as $index => $value ) {
92
-					if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) :
91
+				foreach ($donation_history_args as $index => $value) {
92
+					if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) :
93 93
 						echo sprintf(
94 94
 							'<th scope="col" class="give-donation-%1$s>">%2$s</th>',
95 95
 							$index,
96
-							$table_headings[ $index ]
96
+							$table_headings[$index]
97 97
 						);
98 98
 					endif;
99 99
 				}
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 				 *
106 106
 				 * @since 1.7
107 107
 				 */
108
-				do_action( 'give_donation_history_header_after' );
108
+				do_action('give_donation_history_header_after');
109 109
 				?>
110 110
 			</tr>
111 111
 			</thead>
112
-			<?php foreach ( $donations as $post ) :
113
-				setup_postdata( $post );
114
-				$donation_data = give_get_payment_meta( $post->ID ); ?>
112
+			<?php foreach ($donations as $post) :
113
+				setup_postdata($post);
114
+				$donation_data = give_get_payment_meta($post->ID); ?>
115 115
 				<tr class="give-donation-row">
116 116
 					<?php
117 117
 					/**
@@ -124,37 +124,37 @@  discard block
 block discarded – undo
124 124
 					 * @param int   $post_id       The ID of the post.
125 125
 					 * @param mixed $donation_data Payment meta data.
126 126
 					 */
127
-					do_action( 'give_donation_history_row_start', $post->ID, $donation_data );
127
+					do_action('give_donation_history_row_start', $post->ID, $donation_data);
128 128
 
129
-					if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) :
129
+					if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) :
130 130
 						echo sprintf(
131 131
 							'<td class="give-donation-id"><span class="title-for-mobile">%2$s</span>%1$s</td>',
132
-							give_get_payment_number( $post->ID ), esc_html( $table_headings['id'] )
132
+							give_get_payment_number($post->ID), esc_html($table_headings['id'])
133 133
 						);
134 134
 					endif;
135 135
 
136
-					if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) :
136
+					if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) :
137 137
 						echo sprintf(
138 138
 							'<td class="give-donation-date"><span class="title-for-mobile">%2$s</span>%1$s</td>',
139
-							date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ), esc_html( $table_headings['date'] )
139
+							date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))), esc_html($table_headings['date'])
140 140
 						);
141 141
 					endif;
142 142
 
143
-					if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) :
143
+					if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) :
144 144
 						echo sprintf(
145 145
 							'<td class="give-donation-donor"><span class="title-for-mobile">%2$s</span>%1$s</td>',
146
-							give_get_donor_name_by( $post->ID ), $table_headings['donor']
146
+							give_get_donor_name_by($post->ID), $table_headings['donor']
147 147
 						);
148 148
 					endif;
149 149
 					?>
150 150
 
151
-					<?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
151
+					<?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?>
152 152
 						<td class="give-donation-amount">
153
-						<?php printf( '<span class="title-for-mobile">%1$s</span>', esc_html( $table_headings['amount'] ) ); ?>
153
+						<?php printf('<span class="title-for-mobile">%1$s</span>', esc_html($table_headings['amount'])); ?>
154 154
 						<span class="give-donation-amount">
155 155
 							<?php
156
-							$currency_code   = give_get_payment_currency_code( $post->ID );
157
-							$donation_amount = give_donation_amount( $post->ID, true );
156
+							$currency_code   = give_get_payment_currency_code($post->ID);
157
+							$donation_amount = give_donation_amount($post->ID, true);
158 158
 
159 159
 							/**
160 160
 							 * Filters the donation amount on Donation History Page.
@@ -166,45 +166,45 @@  discard block
 block discarded – undo
166 166
 							 *
167 167
 							 * @return int
168 168
 							 */
169
-							echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID );
169
+							echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID);
170 170
 							?>
171 171
 						</span>
172 172
 						</td>
173 173
 					<?php endif; ?>
174 174
 
175 175
 					<?php
176
-					if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) :
176
+					if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) :
177 177
 						echo sprintf(
178 178
 							'<td class="give-donation-status"><span class="title-for-mobile">%2$s</span>%1$s</td>',
179
-							give_get_payment_status( $post, true ),
180
-							esc_html( $table_headings['status'] )
179
+							give_get_payment_status($post, true),
180
+							esc_html($table_headings['status'])
181 181
 						);
182 182
 					endif;
183 183
 
184
-					if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) :
184
+					if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) :
185 185
 						echo sprintf(
186 186
 							'<td class="give-donation-payment-method"><span class="title-for-mobile">%2$s</span>%1$s</td>',
187
-							give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) ),
188
-							esc_html( $table_headings['payment_method'] )
187
+							give_get_gateway_checkout_label(give_get_payment_gateway($post->ID)),
188
+							esc_html($table_headings['payment_method'])
189 189
 						);
190 190
 					endif;
191 191
 					?>
192 192
 					<td class="give-donation-details">
193 193
 						<?php
194 194
 						// Display View Receipt or.
195
-						if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) :
195
+						if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) :
196 196
 							echo sprintf(
197 197
 								'<span class="title-for-mobile">%4$s</span><a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>',
198 198
 								esc_url(
199 199
 									add_query_arg(
200 200
 										'payment_key',
201
-										give_get_payment_key( $post->ID ),
201
+										give_get_payment_key($post->ID),
202 202
 										give_get_history_page_uri()
203 203
 									)
204 204
 								),
205 205
 								$post->post_status,
206
-								__( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' &raquo;',
207
-								esc_html( $table_headings['details'] )
206
+								__('View', 'give').' '.give_get_payment_status($post, true).' &raquo;',
207
+								esc_html($table_headings['details'])
208 208
 							);
209 209
 
210 210
 						else :
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 								esc_url(
214 214
 									add_query_arg(
215 215
 										'payment_key',
216
-										give_get_payment_key( $post->ID ),
216
+										give_get_payment_key($post->ID),
217 217
 										give_get_history_page_uri()
218 218
 									)
219 219
 								),
220
-								__( 'View Receipt &raquo;', 'give' ),
221
-								esc_html( $table_headings['details'] )
220
+								__('View Receipt &raquo;', 'give'),
221
+								esc_html($table_headings['details'])
222 222
 							);
223 223
 
224 224
 						endif;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					 * @param int   $post_id       The ID of the post.
236 236
 					 * @param mixed $donation_data Payment meta data.
237 237
 					 */
238
-					do_action( 'give_donation_history_row_end', $post->ID, $donation_data );
238
+					do_action('give_donation_history_row_end', $post->ID, $donation_data);
239 239
 					?>
240 240
 				</tr>
241 241
 			<?php endforeach; ?>
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 			 *
249 249
 			 * @since 1.8.17
250 250
 			 */
251
-			do_action( 'give_donation_history_table_end' );
251
+			do_action('give_donation_history_table_end');
252 252
 			?>
253 253
 		</table>
254 254
 		<div id="give-donation-history-pagination" class="give_pagination navigation">
255 255
 			<?php
256 256
 			$big = 999999;
257
-			echo paginate_links( array(
258
-				'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
257
+			echo paginate_links(array(
258
+				'base'    => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
259 259
 				'format'  => '?paged=%#%',
260
-				'current' => max( 1, get_query_var( 'paged' ) ),
261
-				'total'   => ceil( give_count_donations_of_donor() / 20 ), // 20 items per page
262
-			) );
260
+				'current' => max(1, get_query_var('paged')),
261
+				'total'   => ceil(give_count_donations_of_donor() / 20), // 20 items per page
262
+			));
263 263
 			?>
264 264
 		</div>
265 265
 	</div>
266 266
 	<?php wp_reset_postdata(); ?>
267 267
 <?php else : ?>
268
-	<?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?>
268
+	<?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?>
269 269
 <?php endif;
Please login to merge, or discard this patch.
templates/shortcode-totals-progress.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@  discard block
 block discarded – undo
4 4
  */
5 5
 
6 6
 // Bail out if total goal is empty.
7
-if ( empty( $total_goal ) ) {
7
+if (empty($total_goal)) {
8 8
 	return false;
9 9
 }
10 10
 
11 11
 // Set Give total progress bar color.
12
-$color = apply_filters( 'give_totals_progress_color', '#2bc253' );
12
+$color = apply_filters('give_totals_progress_color', '#2bc253');
13 13
 
14 14
 // Give total.
15
-$total = ! empty( $total ) ? $total : 0;
15
+$total = ! empty($total) ? $total : 0;
16 16
 
17 17
 /**
18 18
  * Filter the goal progress output
19 19
  *
20 20
  * @since 2.1
21 21
  */
22
-$progress = round( ( $total / $total_goal ) * 100, 2 );
22
+$progress = round(($total / $total_goal) * 100, 2);
23 23
 
24 24
 // Set progress to 100 percentage if total > total_goal
25 25
 $progress = $total >= $total_goal ? 100 : $progress;
26
-$progress = apply_filters( 'give_goal_totals_funded_percentage_output', $progress, $total, $total_goal );
26
+$progress = apply_filters('give_goal_totals_funded_percentage_output', $progress, $total, $total_goal);
27 27
 
28 28
 ?>
29 29
 <div class="give-goal-progress">
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 		<?php
32 32
 		echo sprintf(
33 33
 		/* translators: %s: percentage of the amount raised compared to the goal target */
34
-			__( '<span class="give-percentage">%s%%</span> funded', 'give' ),
35
-			round( $progress )
34
+			__('<span class="give-percentage">%s%%</span> funded', 'give'),
35
+			round($progress)
36 36
 		);
37 37
 		?>
38 38
 	</div>
39 39
 
40 40
 	<div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"
41
-	     aria-valuenow="<?php echo esc_attr( $progress ); ?>">
42
-			<span style="width: <?php echo esc_attr( $progress ); ?>%;<?php if ( ! empty( $color ) ) {
43
-				echo 'background-color:' . $color;
41
+	     aria-valuenow="<?php echo esc_attr($progress); ?>">
42
+			<span style="width: <?php echo esc_attr($progress); ?>%;<?php if ( ! empty($color)) {
43
+				echo 'background-color:'.$color;
44 44
 			} ?>"></span>
45 45
 	</div><!-- /.give-progress-bar -->
46 46
 
Please login to merge, or discard this patch.
templates/shortcode-profile-editor.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -217,12 +217,14 @@
 block discarded – undo
217 217
 	?>
218 218
 
219 219
 <?php
220
-else :
220
+else {
221
+	:
221 222
 	if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) {
222 223
 		if ( isset( $_GET['update_code'] ) ) {
223 224
 			switch ( $_GET['update_code'] ) {
224 225
 				case '2':
225 226
 					printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) );
227
+}
226 228
 					_e( 'Login with your new credentials.', 'give' );
227 229
 					echo give_login_form();
228 230
 					break;
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
 
11 11
 $current_user = wp_get_current_user();
12 12
 
13
-if ( is_user_logged_in() ) :
13
+if (is_user_logged_in()) :
14 14
 	$user_id = get_current_user_id();
15
-	$first_name   = get_user_meta( $user_id, 'first_name', true );
16
-	$last_name    = get_user_meta( $user_id, 'last_name', true );
17
-	$last_name    = get_user_meta( $user_id, 'last_name', true );
15
+	$first_name   = get_user_meta($user_id, 'first_name', true);
16
+	$last_name    = get_user_meta($user_id, 'last_name', true);
17
+	$last_name    = get_user_meta($user_id, 'last_name', true);
18 18
 	$display_name = $current_user->display_name;
19
-	$donor        = new Give_Donor( $user_id, true );
20
-	$address      = $donor->get_donor_address( array( 'address_type' => 'personal' ) );
21
-	$company_name = $donor->get_meta( '_give_donor_company', true );
22
-
23
-	if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) {
24
-		if ( isset( $_GET['update_code'] ) ) {
25
-			if ( 1 === absint( $_GET['update_code'] ) ) {
26
-				printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile has been updated.', 'give' ) );
19
+	$donor        = new Give_Donor($user_id, true);
20
+	$address      = $donor->get_donor_address(array('address_type' => 'personal'));
21
+	$company_name = $donor->get_meta('_give_donor_company', true);
22
+
23
+	if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) {
24
+		if (isset($_GET['update_code'])) {
25
+			if (1 === absint($_GET['update_code'])) {
26
+				printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile has been updated.', 'give'));
27 27
 			}
28 28
 		}
29 29
 	}
30 30
 
31
-	Give()->notices->render_frontend_notices( 0 );
31
+	Give()->notices->render_frontend_notices(0);
32 32
 
33 33
 	/**
34 34
 	 * Fires in the profile editor shortcode, before the form.
@@ -37,57 +37,57 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @since 1.0
39 39
 	 */
40
-	do_action( 'give_profile_editor_before' );
40
+	do_action('give_profile_editor_before');
41 41
 	?>
42 42
 
43 43
 	<form id="give_profile_editor_form" class="give-form" action="<?php echo give_get_current_page_url(); ?>" method="post">
44 44
 		<fieldset>
45
-			<legend id="give_profile_name_label"><?php _e( 'Profile', 'give' ); ?></legend>
45
+			<legend id="give_profile_name_label"><?php _e('Profile', 'give'); ?></legend>
46 46
 
47 47
 			<h3 id="give_personal_information_label"
48
-			    class="give-section-break"><?php _e( 'Change your Name', 'give' ); ?></h3>
48
+			    class="give-section-break"><?php _e('Change your Name', 'give'); ?></h3>
49 49
 
50 50
 			<p id="give_profile_first_name_wrap" class="form-row form-row-first form-row-responsive">
51 51
 				<label for="give_first_name">
52
-					<?php _e( 'First Name', 'give' ); ?>
52
+					<?php _e('First Name', 'give'); ?>
53 53
 					<span class="give-required-indicator  ">*</span>
54 54
 				</label>
55 55
 				<input name="give_first_name" id="give_first_name" class="text give-input" type="text"
56
-				       value="<?php echo esc_attr( $first_name ); ?>"/>
56
+				       value="<?php echo esc_attr($first_name); ?>"/>
57 57
 			</p>
58 58
 
59 59
 			<p id="give_profile_last_name_wrap" class="form-row form-row-last form-row-responsive">
60
-				<label for="give_last_name"><?php _e( 'Last Name', 'give' ); ?></label>
60
+				<label for="give_last_name"><?php _e('Last Name', 'give'); ?></label>
61 61
 				<input name="give_last_name" id="give_last_name" class="text give-input" type="text"
62
-				       value="<?php echo esc_attr( $last_name ); ?>"/>
62
+				       value="<?php echo esc_attr($last_name); ?>"/>
63 63
 			</p>
64 64
 
65
-			<?php if ( ! empty( $company_name ) ) : ?>
65
+			<?php if ( ! empty($company_name)) : ?>
66 66
 				<p id="give_profile_company_name_wrap" class="form-row form-row-wide">
67
-					<label for="give_company_name"><?php _e( 'Company Name', 'give' ); ?></label>
67
+					<label for="give_company_name"><?php _e('Company Name', 'give'); ?></label>
68 68
 					<input name="give_company_name" id="give_company_name" class="text give-input" type="text"
69
-					       value="<?php echo esc_attr( $company_name ); ?>"/>
69
+					       value="<?php echo esc_attr($company_name); ?>"/>
70 70
 				</p>
71 71
 			<?php endif; ?>
72 72
 
73 73
 			<p id="give_profile_display_name_wrap" class="form-row form-row-first form-row-responsive">
74
-				<label for="give_display_name"><?php _e( 'Display Name', 'give' ); ?></label>
74
+				<label for="give_display_name"><?php _e('Display Name', 'give'); ?></label>
75 75
 				<select name="give_display_name" id="give_display_name" class="select give-select">
76
-					<?php if ( ! empty( $current_user->first_name ) ): ?>
77
-						<option <?php selected( $display_name, $current_user->first_name ); ?>
78
-							value="<?php echo esc_attr( $current_user->first_name ); ?>"><?php echo esc_html( $current_user->first_name ); ?></option>
76
+					<?php if ( ! empty($current_user->first_name)): ?>
77
+						<option <?php selected($display_name, $current_user->first_name); ?>
78
+							value="<?php echo esc_attr($current_user->first_name); ?>"><?php echo esc_html($current_user->first_name); ?></option>
79 79
 					<?php endif; ?>
80
-					<option <?php selected( $display_name, $current_user->user_nicename ); ?>
81
-						value="<?php echo esc_attr( $current_user->user_nicename ); ?>"><?php echo esc_html( $current_user->user_nicename ); ?></option>
82
-					<?php if ( ! empty( $current_user->last_name ) ): ?>
83
-						<option <?php selected( $display_name, $current_user->last_name ); ?>
84
-							value="<?php echo esc_attr( $current_user->last_name ); ?>"><?php echo esc_html( $current_user->last_name ); ?></option>
80
+					<option <?php selected($display_name, $current_user->user_nicename); ?>
81
+						value="<?php echo esc_attr($current_user->user_nicename); ?>"><?php echo esc_html($current_user->user_nicename); ?></option>
82
+					<?php if ( ! empty($current_user->last_name)): ?>
83
+						<option <?php selected($display_name, $current_user->last_name); ?>
84
+							value="<?php echo esc_attr($current_user->last_name); ?>"><?php echo esc_html($current_user->last_name); ?></option>
85 85
 					<?php endif; ?>
86
-					<?php if ( ! empty( $current_user->first_name ) && ! empty( $current_user->last_name ) ): ?>
87
-						<option <?php selected( $display_name, $current_user->first_name . ' ' . $current_user->last_name ); ?>
88
-							value="<?php echo esc_attr( $current_user->first_name . ' ' . $current_user->last_name ); ?>"><?php echo esc_html( $current_user->first_name . ' ' . $current_user->last_name ); ?></option>
89
-						<option <?php selected( $display_name, $current_user->last_name . ' ' . $current_user->first_name ); ?>
90
-							value="<?php echo esc_attr( $current_user->last_name . ' ' . $current_user->first_name ); ?>"><?php echo esc_html( $current_user->last_name . ' ' . $current_user->first_name ); ?></option>
86
+					<?php if ( ! empty($current_user->first_name) && ! empty($current_user->last_name)): ?>
87
+						<option <?php selected($display_name, $current_user->first_name.' '.$current_user->last_name); ?>
88
+							value="<?php echo esc_attr($current_user->first_name.' '.$current_user->last_name); ?>"><?php echo esc_html($current_user->first_name.' '.$current_user->last_name); ?></option>
89
+						<option <?php selected($display_name, $current_user->last_name.' '.$current_user->first_name); ?>
90
+							value="<?php echo esc_attr($current_user->last_name.' '.$current_user->first_name); ?>"><?php echo esc_html($current_user->last_name.' '.$current_user->first_name); ?></option>
91 91
 					<?php endif; ?>
92 92
 				</select>
93 93
 				<?php
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 				 *
99 99
 				 * @since 1.0
100 100
 				 */
101
-				do_action( 'give_profile_editor_name' );
101
+				do_action('give_profile_editor_name');
102 102
 				?>
103 103
 			</p>
104 104
 
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 			 *
111 111
 			 * @since 1.0
112 112
 			 */
113
-			do_action( 'give_profile_editor_after_name' );
113
+			do_action('give_profile_editor_after_name');
114 114
 			?>
115 115
 
116 116
 			<p class="form-row form-row-last form-row-responsive">
117 117
 				<label for="give_email">
118
-					<?php _e( 'Email Address', 'give' ); ?>
118
+					<?php _e('Email Address', 'give'); ?>
119 119
 					<span class="give-required-indicator  ">*</span>
120 120
 				</label>
121 121
 				<input name="give_email" id="give_email" class="text give-input required" type="email"
122
-				       value="<?php echo esc_attr( $current_user->user_email ); ?>" required aria-required="true"/>
122
+				       value="<?php echo esc_attr($current_user->user_email); ?>" required aria-required="true"/>
123 123
 				<?php
124 124
 				/**
125 125
 				 * Fires in the profile editor shortcode, to the email section.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				 *
129 129
 				 * @since 1.0
130 130
 				 */
131
-				do_action( 'give_profile_editor_email' );
131
+				do_action('give_profile_editor_email');
132 132
 				?>
133 133
 			</p>
134 134
 
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 			 *
141 141
 			 * @since 1.0
142 142
 			 */
143
-			do_action( 'give_profile_editor_after_email' );
143
+			do_action('give_profile_editor_after_email');
144 144
 			?>
145 145
 
146 146
 			<h3 id="give_profile_password_label"
147
-			    class="give-section-break"><?php _e( 'Change your Password', 'give' ); ?></h3>
147
+			    class="give-section-break"><?php _e('Change your Password', 'give'); ?></h3>
148 148
 
149 149
 			<div id="give_profile_password_wrap" class="give-clearfix">
150 150
 				<p id="give_profile_password_wrap_1" class="form-row form-row-first form-row-responsive">
151
-					<label for="give_new_user_pass1"><?php _e( 'New Password', 'give' ); ?></label>
151
+					<label for="give_new_user_pass1"><?php _e('New Password', 'give'); ?></label>
152 152
 					<input name="give_new_user_pass1" id="give_new_user_pass1" class="password give-input"
153 153
 					       type="password"/>
154 154
 				</p>
155 155
 
156 156
 				<p id="give_profile_password_wrap_2" class="form-row form-row-last form-row-responsive">
157
-					<label for="give_new_user_pass2"><?php _e( 'Re-enter Password', 'give' ); ?></label>
157
+					<label for="give_new_user_pass2"><?php _e('Re-enter Password', 'give'); ?></label>
158 158
 					<input name="give_new_user_pass2" id="give_new_user_pass2" class="password give-input"
159 159
 					       type="password"/>
160 160
 					<?php
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 					 *
166 166
 					 * @since 1.0
167 167
 					 */
168
-					do_action( 'give_profile_editor_password' );
168
+					do_action('give_profile_editor_password');
169 169
 					?>
170 170
 				</p>
171 171
 			</div>
172 172
 
173
-			<p class="give_password_change_notice"><?php _e( 'Please note after changing your password, you must log back in.', 'give' ); ?></p>
173
+			<p class="give_password_change_notice"><?php _e('Please note after changing your password, you must log back in.', 'give'); ?></p>
174 174
 
175 175
 			<?php
176 176
 			/**
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			 *
181 181
 			 * @since 1.0
182 182
 			 */
183
-			do_action( 'give_profile_editor_after_password' );
183
+			do_action('give_profile_editor_after_password');
184 184
 			?>
185 185
 
186 186
 			<p id="give_profile_submit_wrap">
187 187
 				<input type="hidden" name="give_profile_editor_nonce"
188
-				       value="<?php echo wp_create_nonce( 'give-profile-editor-nonce' ); ?>"/>
188
+				       value="<?php echo wp_create_nonce('give-profile-editor-nonce'); ?>"/>
189 189
 				<input type="hidden" name="give_action" value="edit_user_profile"/>
190 190
 				<input type="hidden" name="give_redirect"
191
-				       value="<?php echo esc_url( give_get_current_page_url() ); ?>"/>
191
+				       value="<?php echo esc_url(give_get_current_page_url()); ?>"/>
192 192
 				<input name="give_profile_editor_submit" id="give_profile_editor_submit" type="submit"
193
-				       class="give_submit" value="<?php _e( 'Save Changes', 'give' ); ?>"/>
193
+				       class="give_submit" value="<?php _e('Save Changes', 'give'); ?>"/>
194 194
 			</p>
195 195
 
196 196
 		</fieldset>
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	do_action( 'give_profile_editor_after' );
208
+	do_action('give_profile_editor_after');
209 209
 	?>
210 210
 
211 211
 <?php
212 212
 else :
213
-	if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] && ! give_get_errors() ) {
214
-		if ( isset( $_GET['update_code'] ) ) {
215
-			switch ( $_GET['update_code'] ) {
213
+	if (isset($_GET['updated']) && 'true' === $_GET['updated'] && ! give_get_errors()) {
214
+		if (isset($_GET['update_code'])) {
215
+			switch ($_GET['update_code']) {
216 216
 				case '2':
217
-					printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your profile and password has been updated.', 'give' ) );
218
-					_e( 'Login with your new credentials.', 'give' );
217
+					printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your profile and password has been updated.', 'give'));
218
+					_e('Login with your new credentials.', 'give');
219 219
 					echo give_login_form();
220 220
 					break;
221 221
 
222 222
 				case '3':
223
-					printf( '<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__( 'Success:', 'give' ), esc_html__( 'Your password has been updated.', 'give' ) );
224
-					_e( 'Login with your new credentials.', 'give' );
223
+					printf('<p class="give_success"><strong>%1$s</strong> %2$s</p>', esc_html__('Success:', 'give'), esc_html__('Your password has been updated.', 'give'));
224
+					_e('Login with your new credentials.', 'give');
225 225
 					echo give_login_form();
226 226
 					break;
227 227
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			}
231 231
 		}
232 232
 	} else {
233
-		_e( 'You need to login to edit your profile.', 'give' );
233
+		_e('You need to login to edit your profile.', 'give');
234 234
 		echo give_login_form();
235 235
 	}
236 236
 endif;
Please login to merge, or discard this patch.
templates/shortcode-receipt.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
 global $give_receipt_args, $payment;
7 7
 
8 8
 // Validation: Ensure $payment var is set.
9
-if ( empty( $payment ) ) {
10
-	$payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0;
9
+if (empty($payment)) {
10
+	$payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0;
11 11
 }
12 12
 
13 13
 // Double-Validation: Check for $payment global.
14
-if ( empty( $payment ) ) {
15
-	Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) );
14
+if (empty($payment)) {
15
+	Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give'));
16 16
 
17 17
 	return;
18 18
 }
19 19
 
20 20
 $donation_id  = $payment->ID;
21
-$donation_number = Give()->seq_donation_number->get_serial_code( $payment->ID );
22
-$form_id      = give_get_payment_meta( $donation_id, '_give_payment_form_id', true );
23
-$donation     = give_get_donation_form_title( $donation_id );
24
-$user         = give_get_payment_meta_user_info( $donation_id );
25
-$email        = give_get_payment_user_email( $donation_id );
21
+$donation_number = Give()->seq_donation_number->get_serial_code($payment->ID);
22
+$form_id      = give_get_payment_meta($donation_id, '_give_payment_form_id', true);
23
+$donation     = give_get_donation_form_title($donation_id);
24
+$user         = give_get_payment_meta_user_info($donation_id);
25
+$email        = give_get_payment_user_email($donation_id);
26 26
 $status       = $payment->post_status;
27
-$status_label = give_get_payment_status( $payment, true );
28
-$company_name = give_get_payment_meta( $donation_id, '_give_donation_company', true );
27
+$status_label = give_get_payment_status($payment, true);
28
+$company_name = give_get_payment_meta($donation_id, '_give_donation_company', true);
29 29
 
30 30
 /**
31 31
  * Generate Donation Receipt Arguments.
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
  * @since 1.8.8
37 37
  */
38 38
 $give_receipt_args['donation_receipt']['donor'] = array(
39
-	'name'    => __( 'Donor', 'give' ),
40
-	'value'   => $user['first_name'] . ' ' . $user['last_name'],
39
+	'name'    => __('Donor', 'give'),
40
+	'value'   => $user['first_name'].' '.$user['last_name'],
41 41
 	'display' => $give_receipt_args['donor'],
42 42
 );
43 43
 
@@ -51,50 +51,50 @@  discard block
 block discarded – undo
51 51
  * @return bool show/hide company name in donation receipt page.
52 52
  */
53 53
 $give_receipt_args['donation_receipt']['company_name'] = array(
54
-	'name'    => __( 'Company Name', 'give' ),
55
-	'value'   => esc_attr( $company_name ),
54
+	'name'    => __('Company Name', 'give'),
55
+	'value'   => esc_attr($company_name),
56 56
 	'display' => $give_receipt_args['company_name'],
57 57
 );
58 58
 
59 59
 $give_receipt_args['donation_receipt']['date'] = array(
60
-	'name'    => __( 'Date', 'give' ),
61
-	'value'   => date_i18n( give_date_format(), strtotime( give_get_payment_completed_date( $donation_id ) ) ),
60
+	'name'    => __('Date', 'give'),
61
+	'value'   => date_i18n(give_date_format(), strtotime(give_get_payment_completed_date($donation_id))),
62 62
 	'display' => $give_receipt_args['date'],
63 63
 );
64 64
 
65 65
 $give_receipt_args['donation_receipt']['total_donation'] = array(
66
-	'name'    => __( 'Total Donation', 'give' ),
67
-	'value'   => give_donation_amount( $donation_id, array( 'currency' => true, 'amount' => true, 'type' => 'receipt' ) ),
66
+	'name'    => __('Total Donation', 'give'),
67
+	'value'   => give_donation_amount($donation_id, array('currency' => true, 'amount' => true, 'type' => 'receipt')),
68 68
 	'display' => $give_receipt_args['price'],
69 69
 );
70 70
 
71 71
 $give_receipt_args['donation_receipt']['donation'] = array(
72
-	'name'    => __( 'Donation', 'give' ),
72
+	'name'    => __('Donation', 'give'),
73 73
 	'value'   => $donation,
74 74
 	'display' => true,
75 75
 );
76 76
 
77 77
 $give_receipt_args['donation_receipt']['donation_status'] = array(
78
-	'name'    => __( 'Donation Status', 'give' ),
79
-	'value'   => esc_attr( $status_label ),
78
+	'name'    => __('Donation Status', 'give'),
79
+	'value'   => esc_attr($status_label),
80 80
 	'display' => $give_receipt_args['payment_status'],
81 81
 );
82 82
 
83 83
 $give_receipt_args['donation_receipt']['donation_id'] = array(
84
-	'name'    => __( 'Donation ID', 'give' ),
84
+	'name'    => __('Donation ID', 'give'),
85 85
 	'value'   => $donation_number,
86 86
 	'display' => $give_receipt_args['payment_id'],
87 87
 );
88 88
 
89 89
 $give_receipt_args['donation_receipt']['payment_key'] = array(
90
-	'name'    => __( 'Payment Key', 'give' ),
91
-	'value'   => get_post_meta( $donation_id, '_give_payment_purchase_key', true ),
90
+	'name'    => __('Payment Key', 'give'),
91
+	'value'   => get_post_meta($donation_id, '_give_payment_purchase_key', true),
92 92
 	'display' => $give_receipt_args['payment_key'],
93 93
 );
94 94
 
95 95
 $give_receipt_args['donation_receipt']['payment_method'] = array(
96
-	'name'    => __( 'Payment Method', 'give' ),
97
-	'value'   => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ),
96
+	'name'    => __('Payment Method', 'give'),
97
+	'value'   => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)),
98 98
 	'display' => $give_receipt_args['payment_method'],
99 99
 );
100 100
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @since 1.8.8
111 111
  */
112
-$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id );
112
+$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id);
113 113
 
114 114
 // When the donation were made through offline donation, We won't show receipt and payment status though.
115
-if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) {
115
+if ('offline' === give_get_payment_gateway($payment->ID) && 'pending' === $status) {
116 116
 
117 117
 	/**
118 118
 	 * Before the offline donation receipt content starts.
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param Give_Payment $payment           Donation payment object.
123 123
 	 * @param array        $give_receipt_args Receipt Arguments.
124 124
 	 */
125
-	do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args );
125
+	do_action('give_receipt_before_offline_payment', $payment, $give_receipt_args);
126 126
 	?>
127
-	<h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2>
128
-	<div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>">
127
+	<h2><?php echo apply_filters('give_receipt_offline_payment_heading', __('Your Donation is Almost Complete!', 'give')); ?></h2>
128
+	<div id="give_donation_receipt" class="<?php echo esc_attr(apply_filters('give_receipt_offline_payment_classes', 'give_receipt_offline_payment')); ?>">
129 129
 		<?php
130 130
 		// Instruction for offline donation.
131
-		$offline_instruction = give_get_offline_payment_instruction( $form_id, true );
131
+		$offline_instruction = give_get_offline_payment_instruction($form_id, true);
132 132
 
133 133
 		/**
134 134
 		 * Instruction for the offline donation.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		 * @param Give_Payment $payment             Payment object.
140 140
 		 * @param integer      $form_id             Donation form id.
141 141
 		 */
142
-		echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id );
142
+		echo apply_filters('give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id);
143 143
 		?>
144 144
 	</div>
145 145
 	<?php
@@ -151,52 +151,52 @@  discard block
 block discarded – undo
151 151
 	 * @param Give_Payment $payment           Donation payment object.
152 152
 	 * @param array        $give_receipt_args Receipt Arguments.
153 153
 	 */
154
-	do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args );
154
+	do_action('give_receipt_after_offline_payment', $payment, $give_receipt_args);
155 155
 
156 156
 	return;
157 157
 }
158 158
 
159 159
 // Show payment status notice based on shortcode attribute.
160
-if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) {
160
+if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) {
161 161
 	$notice_message = '';
162 162
 	$notice_type    = 'warning';
163 163
 
164
-	switch ( $status ) {
164
+	switch ($status) {
165 165
 		case 'publish':
166
-			$notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' );
166
+			$notice_message = __('Payment Complete: Thank you for your donation.', 'give');
167 167
 			$notice_type    = 'success';
168 168
 			break;
169 169
 		case 'pending':
170
-			$notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' );
170
+			$notice_message = __('Payment Pending: Your donation is currently processing.', 'give');
171 171
 			$notice_type    = 'warning';
172 172
 			break;
173 173
 		case 'refunded':
174
-			$notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' );
174
+			$notice_message = __('Payment Refunded: Your donation has been refunded.', 'give');
175 175
 			$notice_type    = 'warning';
176 176
 			break;
177 177
 		case 'preapproval':
178
-			$notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' );
178
+			$notice_message = __('Payment Preapproved: Thank you for your donation.', 'give');
179 179
 			$notice_type    = 'warning';
180 180
 			break;
181 181
 		case 'failed':
182
-			$notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' );
182
+			$notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give');
183 183
 			$notice_type    = 'error';
184 184
 			break;
185 185
 		case 'cancelled':
186
-			$notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' );
186
+			$notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give');
187 187
 			$notice_type    = 'error';
188 188
 			break;
189 189
 		case 'abandoned':
190
-			$notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' );
190
+			$notice_message = __('Payment Abandoned: This donation has not been completed.', 'give');
191 191
 			$notice_type    = 'error';
192 192
 			break;
193 193
 		case 'revoked':
194
-			$notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' );
194
+			$notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give');
195 195
 			$notice_type    = 'error';
196 196
 			break;
197 197
 	}
198 198
 
199
-	if ( ! empty( $notice_message ) ) {
199
+	if ( ! empty($notice_message)) {
200 200
 		/**
201 201
 		 * Filters payment status notice for receipts.
202 202
 		 *
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		 * @param string $status Payment status.
212 212
 		 * @param int $donation_id Donation ID.
213 213
 		 */
214
-		echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $donation_id );
214
+		echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $donation_id);
215 215
 	}
216 216
 }// End if().
217 217
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  * @param object $payment           The payment object.
226 226
  * @param array  $give_receipt_args Receipt_argument.
227 227
  */
228
-do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args );
228
+do_action('give_payment_receipt_before_table', $payment, $give_receipt_args);
229 229
 ?>
230 230
 
231 231
 <table id="give_donation_receipt" class="give-table">
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @param object $payment           The payment object.
242 242
 	 * @param array  $give_receipt_args Receipt_argument.
243 243
 	 */
244
-	do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args );
244
+	do_action('give_payment_receipt_header_before', $payment, $give_receipt_args);
245 245
 	?>
246 246
 	<tr>
247 247
 		<th scope="colgroup" colspan="2">
248
-			<span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span>
248
+			<span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span>
249 249
 		</th>
250 250
 	</tr>
251 251
 	<?php
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param object $payment           The payment object.
260 260
 	 * @param array  $give_receipt_args Receipt_argument.
261 261
 	 */
262
-	do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args );
262
+	do_action('give_payment_receipt_header_after', $payment, $give_receipt_args);
263 263
 	?>
264 264
 	</thead>
265 265
 
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	 * @param object $payment           The payment object.
276 276
 	 * @param array  $give_receipt_args Receipt_argument.
277 277
 	 */
278
-	do_action( 'give_payment_receipt_before', $payment, $give_receipt_args );
278
+	do_action('give_payment_receipt_before', $payment, $give_receipt_args);
279 279
 	?>
280 280
 
281
-	<?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?>
282
-		<?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?>
281
+	<?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?>
282
+		<?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?>
283 283
 			<tr>
284 284
 				<td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td>
285 285
 				<td><?php echo $receipt_item['value']; ?></td>
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @param object $payment           The payment object.
299 299
 	 * @param array  $give_receipt_args Receipt_argument.
300 300
 	 */
301
-	do_action( 'give_payment_receipt_after', $payment, $give_receipt_args );
301
+	do_action('give_payment_receipt_after', $payment, $give_receipt_args);
302 302
 	?>
303 303
 	</tbody>
304 304
 </table>
@@ -314,5 +314,5 @@  discard block
 block discarded – undo
314 314
  * @param object $payment           The payment object.
315 315
  * @param array  $give_receipt_args Receipt_argument.
316 316
  */
317
-do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args );
317
+do_action('give_payment_receipt_after_table', $payment, $give_receipt_args);
318 318
 ?>
Please login to merge, or discard this patch.