Completed
Pull Request — master (#732)
by
unknown
11:55
created
includes/gateways/offline-donations.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,55 +40,55 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
60
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' );
61
-		echo wpautop( stripslashes( $offline_instructions ) );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>');
61
+		echo wpautop(stripslashes($offline_instructions));
62 62
 		?>
63 63
 	</fieldset>
64
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
64
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
65 65
 	<?php
66 66
 	echo ob_get_clean();
67 67
 }
68 68
 
69
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
69
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
70 70
 
71 71
 /**
72 72
  * Give Offline Billing Field
73 73
  *
74 74
  * @param $form_id
75 75
  */
76
-function give_offline_billing_fields( $form_id ) {
76
+function give_offline_billing_fields($form_id) {
77 77
 	//Enable Default CC fields (billing info)
78
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
79
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
78
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
79
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
80 80
 
81
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
81
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
82 82
 
83 83
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
84
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
85
-		give_default_cc_address_fields( $form_id );
86
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
-		give_default_cc_address_fields( $form_id );
84
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
85
+		give_default_cc_address_fields($form_id);
86
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
+		give_default_cc_address_fields($form_id);
88 88
 	}
89 89
 }
90 90
 
91
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
91
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
92 92
 
93 93
 /**
94 94
  * Process the payment
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_offline_process_payment( $purchase_data ) {
102
+function give_offline_process_payment($purchase_data) {
103 103
 
104
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
104
+	$purchase_summary = give_get_purchase_summary($purchase_data);
105 105
 
106 106
 	// setup the payment details
107 107
 	$payment_data = array(
108 108
 		'price'           => $purchase_data['price'],
109 109
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
110
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
111
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
110
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
111
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
112 112
 		'date'            => $purchase_data['date'],
113 113
 		'user_email'      => $purchase_data['user_email'],
114 114
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// record the pending payment
123
-	$payment = give_insert_payment( $payment_data );
123
+	$payment = give_insert_payment($payment_data);
124 124
 
125
-	if ( $payment ) {
126
-		give_offline_send_admin_notice( $payment );
127
-		give_offline_send_donor_instructions( $payment );
125
+	if ($payment) {
126
+		give_offline_send_admin_notice($payment);
127
+		give_offline_send_donor_instructions($payment);
128 128
 		give_send_to_success_page();
129 129
 	} else {
130 130
 		// if errors are present, send the user back to the donation form so they can be corrected
131
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
131
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
132 132
 	}
133 133
 
134 134
 }
135 135
 
136
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
136
+add_action('give_gateway_offline', 'give_offline_process_payment');
137 137
 
138 138
 
139 139
 /**
@@ -146,47 +146,47 @@  discard block
 block discarded – undo
146 146
  * @since       1.0
147 147
  * @return void
148 148
  */
149
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
149
+function give_offline_send_donor_instructions($payment_id = 0) {
150 150
 
151
-	$payment_data                      = give_get_payment_meta( $payment_id );
152
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
151
+	$payment_data                      = give_get_payment_meta($payment_id);
152
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
153 153
 
154 154
 	//Customize email content depending on whether the single form has been customized
155
-	$email_content = give_get_option( 'global_offline_donation_email' );
155
+	$email_content = give_get_option('global_offline_donation_email');
156 156
 
157
-	if ( $post_offline_customization_option === 'yes' ) {
158
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
157
+	if ($post_offline_customization_option === 'yes') {
158
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
159 159
 	}
160 160
 
161
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
162
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
161
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
162
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
163 163
 
164
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
165
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
164
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
165
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
166 166
 
167
-	$to_email = give_get_payment_user_email( $payment_id );
167
+	$to_email = give_get_payment_user_email($payment_id);
168 168
 
169
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
170
-	if ( $post_offline_customization_option === 'yes' ) {
171
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
169
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
170
+	if ($post_offline_customization_option === 'yes') {
171
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
172 172
 	}
173 173
 
174
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
175
-	$subject = give_do_email_tags( $subject, $payment_id );
174
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
175
+	$subject = give_do_email_tags($subject, $payment_id);
176 176
 
177
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
178
-	$message     = give_do_email_tags( $email_content, $payment_id );
177
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
178
+	$message     = give_do_email_tags($email_content, $payment_id);
179 179
 
180 180
 	$emails = Give()->emails;
181 181
 
182
-	$emails->__set( 'from_name', $from_name );
183
-	$emails->__set( 'from_email', $from_email );
184
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
182
+	$emails->__set('from_name', $from_name);
183
+	$emails->__set('from_email', $from_email);
184
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
185 185
 
186
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
187
-	$emails->__set( 'headers', $headers );
186
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
187
+	$emails->__set('headers', $headers);
188 188
 
189
-	$emails->send( $to_email, $subject, $message, $attachments );
189
+	$emails->send($to_email, $subject, $message, $attachments);
190 190
 
191 191
 }
192 192
 
@@ -203,50 +203,50 @@  discard block
 block discarded – undo
203 203
  * @return void
204 204
  *
205 205
  */
206
-function give_offline_send_admin_notice( $payment_id = 0 ) {
206
+function give_offline_send_admin_notice($payment_id = 0) {
207 207
 
208 208
 	/* Send an email notification to the admin */
209 209
 	$admin_email = give_get_admin_notice_emails();
210
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
210
+	$user_info   = give_get_payment_meta_user_info($payment_id);
211 211
 
212
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
213
-		$user_data = get_userdata( $user_info['id'] );
212
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
213
+		$user_data = get_userdata($user_info['id']);
214 214
 		$name      = $user_data->display_name;
215
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
216
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
215
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
216
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
217 217
 	} else {
218 218
 		$name = $user_info['email'];
219 219
 	}
220 220
 
221
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
221
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
222 222
 
223
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id );
223
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
224 224
 
225
-	$admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n";
226
-	$admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
227
-	$admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
225
+	$admin_message = esc_attr__('Dear Admin,', 'give')."\n\n";
226
+	$admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
227
+	$admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
228 228
 
229 229
 
230
-	$admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
231
-	$admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
230
+	$admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
231
+	$admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
232 232
 
233 233
 	$admin_message .= sprintf(
234 234
 		'<a href="%1$s">%2$s</a>',
235
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
236
-		__( 'Click Here to View and/or Update Donation Details', 'give' )
237
-	) . "\n\n";
235
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
236
+		__('Click Here to View and/or Update Donation Details', 'give')
237
+	)."\n\n";
238 238
 
239
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
240
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
241
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
239
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
240
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
241
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
242 242
 
243 243
 	//Send Email
244 244
 	$emails = Give()->emails;
245
-	if ( ! empty( $admin_headers ) ) {
246
-		$emails->__set( 'headers', $admin_headers );
245
+	if ( ! empty($admin_headers)) {
246
+		$emails->__set('headers', $admin_headers);
247 247
 	}
248 248
 
249
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
249
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
250 250
 
251 251
 }
252 252
 
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
  * @since  1.0
258 258
  * @return array
259 259
  */
260
-function give_offline_add_settings( $settings ) {
260
+function give_offline_add_settings($settings) {
261 261
 
262 262
 	//Vars
263 263
 	$prefix = '_give_';
264 264
 
265
-	$is_gateway_active = give_is_gateway_active( 'offline' );
265
+	$is_gateway_active = give_is_gateway_active('offline');
266 266
 
267 267
 	//this gateway isn't active
268
-	if ( ! $is_gateway_active ) {
268
+	if ( ! $is_gateway_active) {
269 269
 		//return settings and bounce
270 270
 		return $settings;
271 271
 	}
@@ -274,27 +274,27 @@  discard block
 block discarded – undo
274 274
 	$check_settings = array(
275 275
 
276 276
 		array(
277
-			'name'    => esc_attr__( 'Customize Offline Donations', 'give' ),
278
-			'desc'    => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
279
-			'id'      => $prefix . 'customize_offline_donations',
277
+			'name'    => esc_attr__('Customize Offline Donations', 'give'),
278
+			'desc'    => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
279
+			'id'      => $prefix.'customize_offline_donations',
280 280
 			'type'    => 'radio_inline',
281 281
 			'default' => 'no',
282 282
 			'options' => array(
283
-				'yes' => esc_attr__( 'Yes', 'give' ),
284
-				'no'  => esc_attr__( 'No', 'give' ),
283
+				'yes' => esc_attr__('Yes', 'give'),
284
+				'no'  => esc_attr__('No', 'give'),
285 285
 			),
286 286
 		),
287 287
 		array(
288
-			'name'        => esc_attr__( 'Request Billing Information', 'give' ),
289
-			'desc'        => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
290
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
288
+			'name'        => esc_attr__('Request Billing Information', 'give'),
289
+			'desc'        => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
290
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
291 291
 			'row_classes' => 'give-subfield',
292 292
 			'type'        => 'checkbox'
293 293
 		),
294 294
 		array(
295
-			'id'          => $prefix . 'offline_checkout_notes',
296
-			'name'        => esc_attr__( 'Offline Donation Instructions', 'give' ),
297
-			'desc'        => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
295
+			'id'          => $prefix.'offline_checkout_notes',
296
+			'name'        => esc_attr__('Offline Donation Instructions', 'give'),
297
+			'desc'        => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
298 298
 			'default'     => give_get_default_offline_donation_content(),
299 299
 			'type'        => 'wysiwyg',
300 300
 			'row_classes' => 'give-subfield',
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 			)
304 304
 		),
305 305
 		array(
306
-			'id'          => $prefix . 'offline_donation_subject',
307
-			'name'        => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ),
308
-			'desc'        => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ),
309
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
306
+			'id'          => $prefix.'offline_donation_subject',
307
+			'name'        => esc_attr__('Offline Donation Email Instructions Subject', 'give'),
308
+			'desc'        => esc_attr__('Enter the subject line for the donation receipt email.', 'give'),
309
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
310 310
 			'row_classes' => 'give-subfield',
311 311
 			'type'        => 'text'
312 312
 		),
313 313
 		array(
314
-			'id'          => $prefix . 'offline_donation_email',
315
-			'name'        => esc_attr__( 'Offline Donation Email Instructions', 'give' ),
316
-			'desc'        => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
314
+			'id'          => $prefix.'offline_donation_email',
315
+			'name'        => esc_attr__('Offline Donation Email Instructions', 'give'),
316
+			'desc'        => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
317 317
 			'default'     => give_get_default_offline_donation_email_content(),
318 318
 			'type'        => 'wysiwyg',
319 319
 			'row_classes' => 'give-subfield',
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 		)
324 324
 	);
325 325
 
326
-	return array_merge( $settings, $check_settings );
326
+	return array_merge($settings, $check_settings);
327 327
 }
328 328
 
329
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
329
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
330 330
 
331 331
 
332 332
 /**
@@ -338,20 +338,20 @@  discard block
 block discarded – undo
338 338
  */
339 339
 function give_get_default_offline_donation_content() {
340 340
 
341
-	$sitename = get_bloginfo( 'sitename' );
341
+	$sitename = get_bloginfo('sitename');
342 342
 
343
-	$default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
343
+	$default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
344 344
 	$default_text .= '<ol>';
345
-	$default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>';
346
-	$default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>';
347
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
345
+	$default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>';
346
+	$default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>';
347
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
348 348
 	$default_text .= '</ol>';
349
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
349
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
350 350
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
351 351
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
352
-	$default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
352
+	$default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
353 353
 
354
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
354
+	return apply_filters('give_default_offline_donation_content', $default_text);
355 355
 
356 356
 }
357 357
 
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
  */
365 365
 function give_get_default_offline_donation_email_content() {
366 366
 
367
-	$sitename     = get_bloginfo( 'sitename' );
368
-	$default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>';
369
-	$default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
367
+	$sitename     = get_bloginfo('sitename');
368
+	$default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>';
369
+	$default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
370 370
 	$default_text .= '<ol>';
371
-	$default_text .= '<li>' . sprintf( __( 'Make a check payable to "%s"', 'give' ), $sitename ) . '</li>';
372
-	$default_text .= '<li>' . sprintf( __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), $sitename ) . '</li>';
373
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
371
+	$default_text .= '<li>'.sprintf(__('Make a check payable to "%s"', 'give'), $sitename).'</li>';
372
+	$default_text .= '<li>'.sprintf(__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), $sitename).'</li>';
373
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
374 374
 	$default_text .= '</ol>';
375
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
375
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
376 376
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
377 377
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
378
-	$default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
379
-	$default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>';
380
-	$default_text .= '<p>' . $sitename . '</p>';
378
+	$default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
379
+	$default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>';
380
+	$default_text .= '<p>'.$sitename.'</p>';
381 381
 
382
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
382
+	return apply_filters('give_default_offline_donation_content', $default_text);
383 383
 
384 384
 }
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give'));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if purchase ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give'));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -49,72 +49,72 @@  discard block
 block discarded – undo
49 49
 $payment_mode   = $payment->mode;
50 50
 ?>
51 51
 <div class="wrap give-wrap">
52
-	<h1 id="transaction-details-heading"><?php printf( __( 'Payment %s', 'give' ), $number ); ?><?php if ( $payment_mode == 'test' ) {
53
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>';
52
+	<h1 id="transaction-details-heading"><?php printf(__('Payment %s', 'give'), $number); ?><?php if ($payment_mode == 'test') {
53
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>';
54 54
 		} ?></h1>
55 55
 
56
-	<?php do_action( 'give_view_order_details_before', $payment_id ); ?>
56
+	<?php do_action('give_view_order_details_before', $payment_id); ?>
57 57
 	<form id="give-edit-order-form" method="post">
58
-		<?php do_action( 'give_view_order_details_form_top', $payment_id ); ?>
58
+		<?php do_action('give_view_order_details_form_top', $payment_id); ?>
59 59
 		<div id="poststuff">
60 60
 			<div id="give-dashboard-widgets-wrap">
61 61
 				<div id="post-body" class="metabox-holder columns-2">
62 62
 					<div id="postbox-container-1" class="postbox-container">
63 63
 						<div id="side-sortables" class="meta-box-sortables ui-sortable">
64 64
 
65
-							<?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?>
65
+							<?php do_action('give_view_order_details_sidebar_before', $payment_id); ?>
66 66
 
67 67
 
68 68
 							<div id="give-order-update" class="postbox give-order-data">
69 69
 
70 70
 								<h3 class="hndle">
71
-									<span><?php _e( 'Update Payment', 'give' ); ?></span>
71
+									<span><?php _e('Update Payment', 'give'); ?></span>
72 72
 								</h3>
73 73
 
74 74
 								<div class="inside">
75 75
 									<div class="give-admin-box">
76 76
 
77
-										<?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?>
77
+										<?php do_action('give_view_order_details_totals_before', $payment_id); ?>
78 78
 
79 79
 										<div class="give-admin-box-inside">
80 80
 											<p>
81
-												<span class="label"><?php _e( 'Status:', 'give' ); ?></span>&nbsp;
81
+												<span class="label"><?php _e('Status:', 'give'); ?></span>&nbsp;
82 82
 												<select name="give-payment-status" class="medium-text">
83
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
84
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
83
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
84
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
85 85
 													<?php endforeach; ?>
86 86
 												</select>
87
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
87
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
88 88
 											</p>
89 89
 										</div>
90 90
 
91 91
 										<div class="give-admin-box-inside">
92 92
 											<p>
93
-												<span class="label"><?php _e( 'Date:', 'give' ); ?></span>&nbsp;
94
-												<input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
93
+												<span class="label"><?php _e('Date:', 'give'); ?></span>&nbsp;
94
+												<input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
95 95
 											</p>
96 96
 										</div>
97 97
 
98 98
 										<div class="give-admin-box-inside">
99 99
 											<p>
100
-												<span class="label"><?php _e( 'Time:', 'give' ); ?></span>&nbsp;
101
-												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
102
-												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
100
+												<span class="label"><?php _e('Time:', 'give'); ?></span>&nbsp;
101
+												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
102
+												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
103 103
 											</p>
104 104
 										</div>
105 105
 
106
-										<?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
106
+										<?php do_action('give_view_order_details_update_inner', $payment_id); ?>
107 107
 
108 108
 										<?php
109 109
 										//@TODO: Fees
110
-										$fees = give_get_payment_fees( $payment_id );
111
-										if ( ! empty( $fees ) ) : ?>
110
+										$fees = give_get_payment_fees($payment_id);
111
+										if ( ! empty($fees)) : ?>
112 112
 											<div class="give-order-fees give-admin-box-inside">
113
-												<p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p>
113
+												<p class="strong"><?php _e('Fees', 'give'); ?>:</p>
114 114
 												<ul class="give-payment-fees">
115
-													<?php foreach ( $fees as $fee ) : ?>
115
+													<?php foreach ($fees as $fee) : ?>
116 116
 														<li>
117
-															<span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span>
117
+															<span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span>
118 118
 														</li>
119 119
 													<?php endforeach; ?>
120 120
 												</ul>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 
125 125
 										<div class="give-order-payment give-admin-box-inside">
126 126
 											<p>
127
-												<span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span>&nbsp;
128
-												<?php echo give_currency_symbol( $payment->currency ); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_amount( give_get_payment_amount( $payment_id ) ) ); ?>"/>
127
+												<span class="label"><?php _e('Total Donation', 'give'); ?>:</span>&nbsp;
128
+												<?php echo give_currency_symbol($payment->currency); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_amount(give_get_payment_amount($payment_id))); ?>"/>
129 129
 											</p>
130 130
 										</div>
131 131
 
132
-										<?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?>
132
+										<?php do_action('give_view_order_details_totals_after', $payment_id); ?>
133 133
 
134 134
 									</div>
135 135
 									<!-- /.give-admin-box -->
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 								<!-- /.inside -->
139 139
 
140 140
 								<div class="give-order-update-box give-admin-box">
141
-									<?php do_action( 'give_view_order_details_update_before', $payment_id ); ?>
141
+									<?php do_action('give_view_order_details_update_before', $payment_id); ?>
142 142
 									<div id="major-publishing-actions">
143 143
 										<div id="publishing-action">
144
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/>
145
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
146
-												<a href="<?php echo esc_url( add_query_arg( array(
144
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/>
145
+											<?php if (give_is_payment_complete($payment_id)) : ?>
146
+												<a href="<?php echo esc_url(add_query_arg(array(
147 147
 													'give-action' => 'email_links',
148 148
 													'purchase_id' => $payment_id
149
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a>
149
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a>
150 150
 											<?php endif; ?>
151 151
 										</div>
152 152
 										<div class="clear"></div>
153 153
 									</div>
154
-									<?php do_action( 'give_view_order_details_update_after', $payment_id ); ?>
154
+									<?php do_action('give_view_order_details_update_after', $payment_id); ?>
155 155
 								</div>
156 156
 								<!-- /.give-order-update-box -->
157 157
 
@@ -161,55 +161,55 @@  discard block
 block discarded – undo
161 161
 							<div id="give-order-details" class="postbox give-order-data">
162 162
 
163 163
 								<h3 class="hndle">
164
-									<span><?php _e( 'Payment Meta', 'give' ); ?></span>
164
+									<span><?php _e('Payment Meta', 'give'); ?></span>
165 165
 								</h3>
166 166
 
167 167
 								<div class="inside">
168 168
 									<div class="give-admin-box">
169 169
 
170
-										<?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?>
170
+										<?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?>
171 171
 
172 172
 										<?php
173
-										$gateway = give_get_payment_gateway( $payment_id );
174
-										if ( $gateway ) : ?>
173
+										$gateway = give_get_payment_gateway($payment_id);
174
+										if ($gateway) : ?>
175 175
 											<div class="give-order-gateway give-admin-box-inside">
176 176
 												<p>
177
-													<span class="label"><?php _e( 'Gateway:', 'give' ); ?></span>&nbsp;
178
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
177
+													<span class="label"><?php _e('Gateway:', 'give'); ?></span>&nbsp;
178
+													<?php echo give_get_gateway_admin_label($gateway); ?>
179 179
 												</p>
180 180
 											</div>
181 181
 										<?php endif; ?>
182 182
 
183 183
 										<div class="give-order-payment-key give-admin-box-inside">
184 184
 											<p>
185
-												<span class="label"><?php _e( 'Key:', 'give' ); ?></span>&nbsp;
186
-												<span><?php echo give_get_payment_key( $payment_id ); ?></span>
185
+												<span class="label"><?php _e('Key:', 'give'); ?></span>&nbsp;
186
+												<span><?php echo give_get_payment_key($payment_id); ?></span>
187 187
 											</p>
188 188
 										</div>
189 189
 
190 190
 										<div class="give-order-ip give-admin-box-inside">
191 191
 											<p>
192
-												<span class="label"><?php _e( 'IP:', 'give' ); ?></span>&nbsp;
193
-												<span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span>
192
+												<span class="label"><?php _e('IP:', 'give'); ?></span>&nbsp;
193
+												<span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span>
194 194
 											</p>
195 195
 										</div>
196 196
 
197
-										<?php if ( $transaction_id ) : ?>
197
+										<?php if ($transaction_id) : ?>
198 198
 											<div class="give-order-tx-id give-admin-box-inside">
199 199
 												<p>
200
-													<span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span>&nbsp;
201
-													<span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span>
200
+													<span class="label"><?php _e('Transaction ID:', 'give'); ?></span>&nbsp;
201
+													<span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span>
202 202
 												</p>
203 203
 											</div>
204 204
 										<?php endif; ?>
205 205
 
206 206
 										<div class="give-admin-box-inside">
207
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?>
208
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> &raquo;</a>
207
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?>
208
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> &raquo;</a>
209 209
 											</p>
210 210
 										</div>
211 211
 
212
-										<?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?>
212
+										<?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?>
213 213
 
214 214
 									</div>
215 215
 									<!-- /.column-container -->
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 							</div>
221 221
 							<!-- /#give-order-data -->
222 222
 
223
-							<?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?>
223
+							<?php do_action('give_view_order_details_sidebar_after', $payment_id); ?>
224 224
 
225 225
 						</div>
226 226
 						<!-- /#side-sortables -->
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 
232 232
 						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
233 233
 
234
-							<?php do_action( 'give_view_order_details_main_before', $payment_id ); ?>
234
+							<?php do_action('give_view_order_details_main_before', $payment_id); ?>
235 235
 
236 236
 							<?php $column_count = 'columns-3'; ?>
237 237
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
238 238
 								<h3 class="hndle">
239
-									<span><?php _e( 'Donation Information', 'give' ); ?></span>
239
+									<span><?php _e('Donation Information', 'give'); ?></span>
240 240
 								</h3>
241 241
 
242 242
 								<div class="inside">
@@ -244,29 +244,29 @@  discard block
 block discarded – undo
244 244
 									<table style="width:100%;text-align:left;">
245 245
 										<thead>
246 246
 										<tr>
247
-											<?php do_action( 'give_donation_details_thead_before', $payment_id ); ?>
248
-											<th><?php _e( 'Donation Form ID', 'give' ) ?></th>
249
-											<th><?php _e( 'Donation Form Title', 'give' ) ?></th>
250
-											<th><?php _e( 'Donation Level', 'give' ) ?></th>
251
-											<th><?php _e( 'Donation Date', 'give' ) ?></th>
252
-											<th><?php _e( 'Total Donation', 'give' ) ?></th>
253
-											<?php do_action( 'give_donation_details_thead_after', $payment_id ); ?>
247
+											<?php do_action('give_donation_details_thead_before', $payment_id); ?>
248
+											<th><?php _e('Donation Form ID', 'give') ?></th>
249
+											<th><?php _e('Donation Form Title', 'give') ?></th>
250
+											<th><?php _e('Donation Level', 'give') ?></th>
251
+											<th><?php _e('Donation Date', 'give') ?></th>
252
+											<th><?php _e('Total Donation', 'give') ?></th>
253
+											<?php do_action('give_donation_details_thead_after', $payment_id); ?>
254 254
 										</tr>
255 255
 										</thead>
256 256
 										<tr>
257
-											<?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?>
257
+											<?php do_action('give_donation_details_tbody_before', $payment_id); ?>
258 258
 											<td>
259 259
 												<?php echo $payment_meta['form_id']; ?>
260 260
 											</td>
261 261
 											<td>
262
-												<a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a>
262
+												<a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a>
263 263
 											</td>
264 264
 											<td>
265 265
 												<?php
266 266
 												//Level ID
267
-												$level_title = give_get_payment_form_title( $payment_meta, true );
268
-												if ( empty( $level_title ) ) {
269
-													echo __( 'n/a', 'give' );
267
+												$level_title = give_get_payment_form_title($payment_meta, true);
268
+												if (empty($level_title)) {
269
+													echo __('n/a', 'give');
270 270
 												} else {
271 271
 													echo $level_title;
272 272
 												} ?>
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 											<td>
275 275
 												<?php
276 276
 												//Transaction Date
277
-												$date_format = get_option( 'date_format' );
278
-												echo date_i18n( $date_format, strtotime( $payment_date ) );
277
+												$date_format = get_option('date_format');
278
+												echo date_i18n($date_format, strtotime($payment_date));
279 279
 												?>
280 280
 											</td>
281 281
 											<td>
282
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td>
283
-											<?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?>
282
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td>
283
+											<?php do_action('give_donation_details_tbody_after', $payment_id); ?>
284 284
 
285 285
 										</tr>
286 286
 									</table>
@@ -292,64 +292,64 @@  discard block
 block discarded – undo
292 292
 							</div>
293 293
 							<!-- /#give-donation-overview -->
294 294
 
295
-							<?php do_action( 'give_view_order_details_files_after', $payment_id ); ?>
295
+							<?php do_action('give_view_order_details_files_after', $payment_id); ?>
296 296
 
297
-							<?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?>
297
+							<?php do_action('give_view_order_details_billing_before', $payment_id); ?>
298 298
 
299 299
 
300 300
 							<div id="give-customer-details" class="postbox">
301 301
 								<h3 class="hndle">
302
-									<span><?php _e( 'Donor Details', 'give' ); ?></span>
302
+									<span><?php _e('Donor Details', 'give'); ?></span>
303 303
 								</h3>
304 304
 
305 305
 								<div class="inside give-clearfix">
306 306
 
307
-									<?php $customer = new Give_Customer( $customer_id ); ?>
307
+									<?php $customer = new Give_Customer($customer_id); ?>
308 308
 
309 309
 									<div class="column-container customer-info">
310 310
 										<div class="column">
311
-											<?php echo Give()->html->donor_dropdown( array(
311
+											<?php echo Give()->html->donor_dropdown(array(
312 312
 												'selected' => $customer->id,
313 313
 												'name'     => 'customer-id'
314
-											) ); ?>
314
+											)); ?>
315 315
 										</div>
316 316
 										<div class="column">
317 317
 											<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
318 318
 										</div>
319 319
 										<div class="column">
320
-											<?php if ( ! empty( $customer->id ) ) : ?>
321
-												<?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>
322
-												<a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a>
320
+											<?php if ( ! empty($customer->id)) : ?>
321
+												<?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>
322
+												<a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a>
323 323
 												&nbsp;|&nbsp;
324 324
 											<?php endif; ?>
325
-											<a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a>
325
+											<a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a>
326 326
 										</div>
327 327
 									</div>
328 328
 
329 329
 									<div class="column-container new-customer" style="display: none">
330 330
 										<div class="column">
331
-											<strong><?php _e( 'Name:', 'give' ); ?></strong>&nbsp;
331
+											<strong><?php _e('Name:', 'give'); ?></strong>&nbsp;
332 332
 											<input type="text" name="give-new-customer-name" value="" class="medium-text"/>
333 333
 										</div>
334 334
 										<div class="column">
335
-											<strong><?php _e( 'Email:', 'give' ); ?></strong>&nbsp;
335
+											<strong><?php _e('Email:', 'give'); ?></strong>&nbsp;
336 336
 											<input type="email" name="give-new-customer-email" value="" class="medium-text"/>
337 337
 										</div>
338 338
 										<div class="column">
339 339
 											<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
340
-											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
340
+											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
341 341
 										</div>
342 342
 										<div class="column">
343 343
 											<small>
344
-												<em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em>
344
+												<em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em>
345 345
 											</small>
346 346
 										</div>
347 347
 									</div>
348 348
 
349 349
 									<?php
350 350
 									// The give_payment_personal_details_list hook is left here for backwards compatibility
351
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
352
-									do_action( 'give_payment_view_details', $payment_id );
351
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
352
+									do_action('give_payment_view_details', $payment_id);
353 353
 									?>
354 354
 
355 355
 								</div>
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
 							<div id="give-billing-details" class="postbox">
362 362
 								<h3 class="hndle">
363
-									<span><?php _e( 'Billing Address', 'give' ); ?></span>
363
+									<span><?php _e('Billing Address', 'give'); ?></span>
364 364
 								</h3>
365 365
 
366 366
 								<div class="inside give-clearfix">
@@ -371,62 +371,62 @@  discard block
 block discarded – undo
371 371
 											<div class="data column-container">
372 372
 												<div class="column">
373 373
 													<p>
374
-														<strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br/>
375
-														<input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
374
+														<strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br/>
375
+														<input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
376 376
 													</p>
377 377
 
378 378
 													<p>
379
-														<strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br/>
380
-														<input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
379
+														<strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br/>
380
+														<input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
381 381
 													</p>
382 382
 
383 383
 												</div>
384 384
 												<div class="column">
385 385
 													<p>
386
-														<strong class="order-data-address-line"><?php _e( 'City:', 'give' ); ?></strong><br/>
387
-														<input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
386
+														<strong class="order-data-address-line"><?php _e('City:', 'give'); ?></strong><br/>
387
+														<input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
388 388
 
389 389
 													</p>
390 390
 
391 391
 													<p>
392
-														<strong class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></strong><br/>
393
-														<input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
392
+														<strong class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></strong><br/>
393
+														<input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
394 394
 
395 395
 													</p>
396 396
 												</div>
397 397
 												<div class="column">
398 398
 													<p id="give-order-address-country-wrap">
399
-														<strong class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></strong><br/>
399
+														<strong class="order-data-address-line"><?php _e('Country:', 'give'); ?></strong><br/>
400 400
 														<?php
401
-														echo Give()->html->select( array(
401
+														echo Give()->html->select(array(
402 402
 															'options'          => give_get_country_list(),
403 403
 															'name'             => 'give-payment-address[0][country]',
404 404
 															'selected'         => $address['country'],
405 405
 															'show_option_all'  => false,
406 406
 															'show_option_none' => false,
407 407
 															'chosen'           => true,
408
-															'placeholder'      => __( 'Select a country', 'give' )
409
-														) );
408
+															'placeholder'      => __('Select a country', 'give')
409
+														));
410 410
 														?>
411 411
 													</p>
412 412
 
413 413
 													<p id="give-order-address-state-wrap">
414
-														<strong class="order-data-address-line"><?php _e( 'State / Province:', 'give' ); ?></strong><br/>
414
+														<strong class="order-data-address-line"><?php _e('State / Province:', 'give'); ?></strong><br/>
415 415
 														<?php
416
-														$states = give_get_states( $address['country'] );
417
-														if ( ! empty( $states ) ) {
418
-															echo Give()->html->select( array(
416
+														$states = give_get_states($address['country']);
417
+														if ( ! empty($states)) {
418
+															echo Give()->html->select(array(
419 419
 																'options'          => $states,
420 420
 																'name'             => 'give-payment-address[0][state]',
421 421
 																'selected'         => $address['state'],
422 422
 																'show_option_all'  => false,
423 423
 																'show_option_none' => false,
424 424
 																'chosen'           => true,
425
-																'placeholder'      => __( 'Select a state', 'give' )
426
-															) );
425
+																'placeholder'      => __('Select a state', 'give')
426
+															));
427 427
 														} else {
428 428
 															?>
429
-															<input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
429
+															<input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
430 430
 															<?php
431 431
 														} ?>
432 432
 													</p>
@@ -436,39 +436,39 @@  discard block
 block discarded – undo
436 436
 									</div>
437 437
 									<!-- /#give-order-address -->
438 438
 
439
-									<?php do_action( 'give_payment_billing_details', $payment_id ); ?>
439
+									<?php do_action('give_payment_billing_details', $payment_id); ?>
440 440
 
441 441
 								</div>
442 442
 								<!-- /.inside -->
443 443
 							</div>
444 444
 							<!-- /#give-billing-details -->
445 445
 
446
-							<?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?>
446
+							<?php do_action('give_view_order_details_billing_after', $payment_id); ?>
447 447
 
448 448
 							<div id="give-payment-notes" class="postbox">
449
-								<h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3>
449
+								<h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3>
450 450
 
451 451
 								<div class="inside">
452 452
 									<div id="give-payment-notes-inner">
453 453
 										<?php
454
-										$notes = give_get_payment_notes( $payment_id );
455
-										if ( ! empty( $notes ) ) :
454
+										$notes = give_get_payment_notes($payment_id);
455
+										if ( ! empty($notes)) :
456 456
 											$no_notes_display = ' style="display:none;"';
457
-											foreach ( $notes as $note ) :
457
+											foreach ($notes as $note) :
458 458
 
459
-												echo give_get_payment_note_html( $note, $payment_id );
459
+												echo give_get_payment_note_html($note, $payment_id);
460 460
 
461 461
 											endforeach;
462 462
 										else :
463 463
 											$no_notes_display = '';
464 464
 										endif;
465
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>';
465
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>';
466 466
 										?>
467 467
 									</div>
468 468
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
469 469
 
470 470
 									<p class="give-clearfix">
471
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
471
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
472 472
 									</p>
473 473
 
474 474
 									<div class="clear"></div>
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 							</div>
478 478
 							<!-- /#give-payment-notes -->
479 479
 
480
-							<?php do_action( 'give_view_order_details_main_after', $payment_id ); ?>
480
+							<?php do_action('give_view_order_details_main_after', $payment_id); ?>
481 481
 						</div>
482 482
 						<!-- /#normal-sortables -->
483 483
 					</div>
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
 			<!-- #give-dashboard-widgets-wrap -->
489 489
 		</div>
490 490
 		<!-- /#post-stuff -->
491
-		<?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?>
492
-		<?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?>
493
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
491
+		<?php do_action('give_view_order_details_form_bottom', $payment_id); ?>
492
+		<?php wp_nonce_field('give_update_payment_details_nonce'); ?>
493
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
494 494
 		<input type="hidden" name="give_action" value="update_payment_details"/>
495 495
 	</form>
496
-	<?php do_action( 'give_view_order_details_after', $payment_id ); ?>
496
+	<?php do_action('give_view_order_details_after', $payment_id); ?>
497 497
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,36 +29,36 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 		<h1 class="nav-tab-wrapper">
37
-			<a href="<?php echo esc_url( add_query_arg( array(
37
+			<a href="<?php echo esc_url(add_query_arg(array(
38 38
 				'tab'              => 'reports',
39 39
 				'settings-updated' => false
40
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a>
41
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
40
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a>
41
+			<?php if (current_user_can('export_give_reports')) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => 'export',
44 44
 					'settings-updated' => false
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a>
46 46
 			<?php } ?>
47
-			<a href="<?php echo esc_url( add_query_arg( array(
47
+			<a href="<?php echo esc_url(add_query_arg(array(
48 48
 				'tab'              => 'logs',
49 49
 				'settings-updated' => false
50
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a>
51
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a>
51
+			<a href="<?php echo esc_url(add_query_arg(array(
52 52
 				'tab'              => 'tools',
53 53
 				'settings-updated' => false
54
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a>
55
-			<?php do_action( 'give_reports_tabs' ); ?>
54
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a>
55
+			<?php do_action('give_reports_tabs'); ?>
56 56
 		</h1>
57 57
 
58 58
 		<?php
59
-		do_action( 'give_reports_page_top' );
60
-		do_action( 'give_reports_tab_' . $active_tab );
61
-		do_action( 'give_reports_page_bottom' );
59
+		do_action('give_reports_page_top');
60
+		do_action('give_reports_tab_'.$active_tab);
61
+		do_action('give_reports_page_bottom');
62 62
 		?>
63 63
 	</div><!-- .wrap -->
64 64
 	<?php
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function give_reports_default_views() {
74 74
 	$views = array(
75
-		'earnings' => __( 'Income', 'give' ),
75
+		'earnings' => __('Income', 'give'),
76 76
 		'forms'    => give_get_forms_label_plural(),
77
-		'donors'   => __( 'Donors', 'give' ),
78
-		'gateways' => __( 'Payment Methods', 'give' )
77
+		'donors'   => __('Donors', 'give'),
78
+		'gateways' => __('Payment Methods', 'give')
79 79
 	);
80 80
 
81
-	$views = apply_filters( 'give_report_views', $views );
81
+	$views = apply_filters('give_report_views', $views);
82 82
 
83 83
 	return $views;
84 84
 }
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $view Report View
95 95
  *
96 96
  */
97
-function give_get_reporting_view( $default = 'earnings' ) {
97
+function give_get_reporting_view($default = 'earnings') {
98 98
 
99
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
99
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
100 100
 		$view = $default;
101 101
 	} else {
102 102
 		$view = $_GET['view'];
103 103
 	}
104 104
 
105
-	return apply_filters( 'give_get_reporting_view', $view );
105
+	return apply_filters('give_get_reporting_view', $view);
106 106
 }
107 107
 
108 108
 /**
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	$current_view = 'earnings';
116 116
 	$views        = give_reports_default_views();
117 117
 
118
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
118
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
119 119
 		$current_view = $_GET['view'];
120 120
 	}
121 121
 
122
-	do_action( 'give_reports_view_' . $current_view );
122
+	do_action('give_reports_view_'.$current_view);
123 123
 }
124 124
 
125
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
125
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
126 126
 
127 127
 /**
128 128
  * Renders the Reports Page Views Drop Downs
@@ -132,25 +132,25 @@  discard block
 block discarded – undo
132 132
  */
133 133
 function give_report_views() {
134 134
 	$views        = give_reports_default_views();
135
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
136
-	do_action( 'give_report_view_actions_before' );
135
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
136
+	do_action('give_report_view_actions_before');
137 137
 	?>
138 138
 	<form id="give-reports-filter" method="get">
139 139
 		<select id="give-reports-view" name="view">
140
-			<option value="-1"><?php _e( 'Report Type', 'give' ); ?></option>
141
-			<?php foreach ( $views as $view_id => $label ) : ?>
142
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
140
+			<option value="-1"><?php _e('Report Type', 'give'); ?></option>
141
+			<?php foreach ($views as $view_id => $label) : ?>
142
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
143 143
 			<?php endforeach; ?>
144 144
 		</select>
145 145
 
146
-		<?php do_action( 'give_report_view_actions' ); ?>
146
+		<?php do_action('give_report_view_actions'); ?>
147 147
 
148 148
 		<input type="hidden" name="post_type" value="give_forms"/>
149 149
 		<input type="hidden" name="page" value="give-reports"/>
150
-		<?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
150
+		<?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?>
151 151
 	</form>
152 152
 	<?php
153
-	do_action( 'give_report_view_actions_after' );
153
+	do_action('give_report_view_actions_after');
154 154
 }
155 155
 
156 156
 /**
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function give_reports_forms_table() {
165 165
 
166
-	if ( isset( $_GET['form-id'] ) ) {
166
+	if (isset($_GET['form-id'])) {
167 167
 		return;
168 168
 	}
169 169
 
170
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
170
+	include(dirname(__FILE__).'/class-form-reports-table.php');
171 171
 
172 172
 	$give_table = new Give_Form_Reports_Table();
173 173
 	$give_table->prepare_items();
174 174
 	$give_table->display();
175 175
 }
176 176
 
177
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
177
+add_action('give_reports_view_forms', 'give_reports_forms_table');
178 178
 
179 179
 /**
180 180
  * Renders the detailed report for a specific give form
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
  * @return void
184 184
  */
185 185
 function give_reports_form_details() {
186
-	if ( ! isset( $_GET['form-id'] ) ) {
186
+	if ( ! isset($_GET['form-id'])) {
187 187
 		return;
188 188
 	}
189 189
 	?>
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 		<div class="actions bulkactions">
192 192
 			<?php give_report_views(); ?>
193 193
 			&nbsp;
194
-			<button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button>
194
+			<button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button>
195 195
 		</div>
196 196
 	</div>
197 197
 	<?php
198
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
198
+	give_reports_graph_of_form(absint($_GET['form-id']));
199 199
 }
200 200
 
201
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
201
+add_action('give_reports_view_forms', 'give_reports_form_details');
202 202
 
203 203
 /**
204 204
  * Renders the Reports Donors Table
@@ -209,28 +209,28 @@  discard block
 block discarded – undo
209 209
  * @return void
210 210
  */
211 211
 function give_reports_donors_table() {
212
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
212
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
213 213
 
214 214
 	$give_table = new Give_Donor_Reports_Table();
215 215
 	$give_table->prepare_items();
216 216
 	?>
217 217
 	<div class="wrap give-reports-donors-wrap">
218
-		<?php do_action( 'give_logs_donors_table_top' ); ?>
219
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
218
+		<?php do_action('give_logs_donors_table_top'); ?>
219
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
220 220
 			<?php
221
-			$give_table->search_box( __( 'Search', 'give' ), 'give-donors' );
221
+			$give_table->search_box(__('Search', 'give'), 'give-donors');
222 222
 			$give_table->display();
223 223
 			?>
224 224
 			<input type="hidden" name="post_type" value="give_forms"/>
225 225
 			<input type="hidden" name="page" value="give-reports"/>
226 226
 			<input type="hidden" name="view" value="donors"/>
227 227
 		</form>
228
-		<?php do_action( 'give_logs_donors_table_bottom' ); ?>
228
+		<?php do_action('give_logs_donors_table_bottom'); ?>
229 229
 	</div>
230 230
 	<?php
231 231
 }
232 232
 
233
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
233
+add_action('give_reports_view_donors', 'give_reports_donors_table');
234 234
 
235 235
 
236 236
 /**
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
  * @return void
243 243
  */
244 244
 function give_reports_gateways_table() {
245
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
245
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
246 246
 
247 247
 	$give_table = new Give_Gateawy_Reports_Table();
248 248
 	$give_table->prepare_items();
249 249
 	$give_table->display();
250 250
 }
251 251
 
252
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
252
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
253 253
 
254 254
 
255 255
 /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 function give_reports_earnings() {
262 262
 	?>
263 263
 	<div class="tablenav top reports-table-nav">
264
-		<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3>
264
+		<h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3>
265 265
 
266 266
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
267 267
 	</div>
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	give_reports_graph();
270 270
 }
271 271
 
272
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
272
+add_action('give_reports_view_earnings', 'give_reports_earnings');
273 273
 
274 274
 
275 275
 /**
@@ -284,52 +284,52 @@  discard block
 block discarded – undo
284 284
 		<div id="post-body">
285 285
 			<div id="post-body-content">
286 286
 
287
-				<?php do_action( 'give_reports_tab_export_content_top' ); ?>
287
+				<?php do_action('give_reports_tab_export_content_top'); ?>
288 288
 
289 289
 				<table class="widefat export-options-table give-table">
290 290
 					<thead>
291 291
 					<tr>
292
-						<th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th>
293
-						<th><?php _e( 'Export Options', 'give' ); ?></th>
292
+						<th class="row-title"><?php _e('Export Type', 'give'); ?></th>
293
+						<th><?php _e('Export Options', 'give'); ?></th>
294 294
 					</tr>
295 295
 					</thead>
296 296
 					<tbody>
297
-					<?php do_action( 'give_reports_tab_export_table_top' ); ?>
297
+					<?php do_action('give_reports_tab_export_table_top'); ?>
298 298
 					<tr class="give-export-pdf-sales-earnings">
299 299
 						<td class="row-title">
300
-							<h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
300
+							<h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3>
301 301
 
302
-							<p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
302
+							<p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
303 303
 						</td>
304 304
 						<td>
305
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a>
305
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a>
306 306
 						</td>
307 307
 					</tr>
308 308
 					<tr class="alternate give-export-sales-earnings">
309 309
 						<td class="row-title">
310
-							<h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
310
+							<h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3>
311 311
 
312
-							<p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
312
+							<p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p>
313 313
 						</td>
314 314
 						<td>
315 315
 							<form method="post">
316 316
 								<?php
317 317
 									printf(
318
-										__( '%1$s to %2$s', 'give' ),
319
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
320
-										Give()->html->year_dropdown( 'end_year' )   . ' ' . Give()->html->month_dropdown( 'end_month' )
318
+										__('%1$s to %2$s', 'give'),
319
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
320
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
321 321
 									);
322 322
 								?>
323 323
 								<input type="hidden" name="give-action" value="earnings_export"/>
324
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
324
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
325 325
 							</form>
326 326
 						</td>
327 327
 					</tr>
328 328
 					<tr class="give-export-payment-history">
329 329
 						<td class="row-title">
330
-							<h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3>
330
+							<h3><span><?php _e('Export Donation History', 'give'); ?></span></h3>
331 331
 
332
-							<p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
332
+							<p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p>
333 333
 						</td>
334 334
 						<td>
335 335
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -337,29 +337,29 @@  discard block
 block discarded – undo
337 337
 								$args = array(
338 338
 									'id'          => 'give-payment-export-start',
339 339
 									'name'        => 'start',
340
-									'placeholder' => __( 'Start date', 'give' )
340
+									'placeholder' => __('Start date', 'give')
341 341
 								);
342
-								echo Give()->html->date_field( $args ); ?>
342
+								echo Give()->html->date_field($args); ?>
343 343
 								<?php
344 344
 								$args = array(
345 345
 									'id'          => 'give-payment-export-end',
346 346
 									'name'        => 'end',
347
-									'placeholder' => __( 'End date', 'give' )
347
+									'placeholder' => __('End date', 'give')
348 348
 								);
349
-								echo Give()->html->date_field( $args ); ?>
349
+								echo Give()->html->date_field($args); ?>
350 350
 								<select name="status">
351
-									<option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
351
+									<option value="any"><?php _e('All Statuses', 'give'); ?></option>
352 352
 									<?php
353 353
 									$statuses = give_get_payment_statuses();
354
-									foreach ( $statuses as $status => $label ) {
355
-										echo '<option value="' . $status . '">' . $label . '</option>';
354
+									foreach ($statuses as $status => $label) {
355
+										echo '<option value="'.$status.'">'.$label.'</option>';
356 356
 									}
357 357
 									?>
358 358
 								</select>
359
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
359
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
360 360
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
361 361
 								<span>
362
-									<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
362
+									<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
363 363
 									<span class="spinner"></span>
364 364
 								</span>
365 365
 							</form>
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
 					</tr>
369 369
 					<tr class="alternate give-export-donors">
370 370
 						<td class="row-title">
371
-							<h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3>
371
+							<h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3>
372 372
 
373
-							<p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
373
+							<p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
374 374
 						</td>
375 375
 						<td>
376 376
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -381,54 +381,54 @@  discard block
 block discarded – undo
381 381
 										'id'     => 'give_customer_export_form',
382 382
 										'chosen' => true
383 383
 									);
384
-									echo Give()->html->forms_dropdown( $args ); ?>
384
+									echo Give()->html->forms_dropdown($args); ?>
385 385
 								
386
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
386
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
387 387
 
388 388
 								<div id="export-donor-options-wrap" class="give-clearfix">
389
-									<p><?php _e( 'Export Columns', 'give' ); ?>:</p>
389
+									<p><?php _e('Export Columns', 'give'); ?>:</p>
390 390
 									<ul id="give-export-option-ul">
391 391
 										<li>
392
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?>
392
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?>
393 393
 											</label>
394 394
 										</li>
395 395
 										<li>
396
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?>
396
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?>
397 397
 											</label>
398 398
 										</li>
399 399
 										<li>
400
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?>
400
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?>
401 401
 											</label>
402 402
 										</li>
403 403
 										<li>
404
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
404
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?>
405 405
 											</label>
406 406
 										</li>
407 407
 										<li>
408
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?>
408
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?>
409 409
 											</label>
410 410
 										</li>
411 411
 										<li>
412
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?>
412
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?>
413 413
 											</label>
414 414
 										</li>
415 415
 										<li>
416
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?>
416
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?>
417 417
 											</label>
418 418
 										</li>
419 419
 									</ul>
420 420
 								</div>
421
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
421
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
422 422
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
423 423
 								<input type="hidden" name="give-action" value="email_export"/>
424 424
 							</form>
425 425
 						</td>
426 426
 					</tr>
427
-					<?php do_action( 'give_reports_tab_export_table_bottom' ); ?>
427
+					<?php do_action('give_reports_tab_export_table_bottom'); ?>
428 428
 					</tbody>
429 429
 				</table>
430 430
 
431
-				<?php do_action( 'give_reports_tab_export_content_bottom' ); ?>
431
+				<?php do_action('give_reports_tab_export_content_bottom'); ?>
432 432
 
433 433
 			</div>
434 434
 			<!-- .post-body-content -->
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	<?php
439 439
 }
440 440
 
441
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
441
+add_action('give_reports_tab_export', 'give_reports_tab_export');
442 442
 
443 443
 /**
444 444
  * Renders the Reports page
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function give_reports_tab_logs() {
450 450
 
451
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
451
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
452 452
 
453 453
 	$current_view = 'sales';
454 454
 	$log_views    = give_log_default_views();
455 455
 
456
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
456
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
457 457
 		$current_view = $_GET['view'];
458 458
 	}
459 459
 
460
-	do_action( 'give_logs_view_' . $current_view );
460
+	do_action('give_logs_view_'.$current_view);
461 461
 }
462 462
 
463
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
463
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
464 464
 
465 465
 /**
466 466
  * Retrieves estimated monthly earnings and sales
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
  */
471 471
 function give_estimated_monthly_stats() {
472 472
 
473
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
473
+	$estimated = get_transient('give_estimated_monthly_stats');
474 474
 
475
-	if ( false === $estimated ) {
475
+	if (false === $estimated) {
476 476
 
477 477
 		$estimated = array(
478 478
 			'earnings' => 0,
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
 
482 482
 		$stats = new Give_Payment_Stats;
483 483
 
484
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
485
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
484
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
485
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
486 486
 
487
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
488
-		$current_month = date( 'n', current_time( 'timestamp' ) );
489
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
490
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
487
+		$current_day   = date('d', current_time('timestamp'));
488
+		$current_month = date('n', current_time('timestamp'));
489
+		$current_year  = date('Y', current_time('timestamp'));
490
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
491 491
 
492
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
493
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
492
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
493
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
494 494
 
495 495
 		// Cache for one day
496
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
496
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
497 497
 	}
498 498
 
499
-	return maybe_unserialize( $estimated );
499
+	return maybe_unserialize($estimated);
500 500
 }
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 1 patch
Spacing   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -49,26 +49,26 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __construct() {
51 51
 
52
-		add_action( 'admin_init', array( $this, 'init' ) );
52
+		add_action('admin_init', array($this, 'init'));
53 53
 
54 54
 		//Customize CMB2 URL
55
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
55
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
56 56
 
57 57
 		//Custom CMB2 Settings Fields
58
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
59
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
60
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
61
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
62
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
63
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
64
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
65
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
66
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
58
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
59
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
60
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
61
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
62
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
63
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
64
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
65
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
66
+		add_action('admin_notices', array($this, 'settings_notices'));
67 67
 
68 68
 		// Include CMB CSS in the head to avoid FOUC
69
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
69
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
70 70
 
71
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
71
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
72 72
 
73 73
 	}
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since  1.0
79 79
 	 */
80 80
 	public function init() {
81
-		register_setting( $this->key, $this->key );
81
+		register_setting($this->key, $this->key);
82 82
 
83 83
 	}
84 84
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return mixed
94 94
 	 */
95
-	public function give_update_cmb_meta_box_url( $url ) {
95
+	public function give_update_cmb_meta_box_url($url) {
96 96
 		//Path to Give's CMB
97
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
97
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
98 98
 	}
99 99
 
100 100
 
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function give_get_settings_tabs() {
108 108
 
109
-		$settings = $this->give_settings( null );
109
+		$settings = $this->give_settings(null);
110 110
 
111 111
 		$tabs             = array();
112
-		$tabs['general']  = __( 'General', 'give' );
113
-		$tabs['gateways'] = __( 'Payment Gateways', 'give' );
114
-		$tabs['display']  = __( 'Display Options', 'give' );
115
-		$tabs['emails']   = __( 'Emails', 'give' );
112
+		$tabs['general']  = __('General', 'give');
113
+		$tabs['gateways'] = __('Payment Gateways', 'give');
114
+		$tabs['display']  = __('Display Options', 'give');
115
+		$tabs['emails']   = __('Emails', 'give');
116 116
 
117
-		if ( ! empty( $settings['addons']['fields'] ) ) {
118
-			$tabs['addons'] = __( 'Add-ons', 'give' );
117
+		if ( ! empty($settings['addons']['fields'])) {
118
+			$tabs['addons'] = __('Add-ons', 'give');
119 119
 		}
120 120
 
121
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
122
-			$tabs['licenses'] = __( 'Licenses', 'give' );
121
+		if ( ! empty($settings['licenses']['fields'])) {
122
+			$tabs['licenses'] = __('Licenses', 'give');
123 123
 		}
124 124
 
125
-		$tabs['advanced']    = __( 'Advanced', 'give' );
126
-		$tabs['api']         = __( 'API', 'give' );
127
-		$tabs['system_info'] = __( 'System Info', 'give' );
125
+		$tabs['advanced']    = __('Advanced', 'give');
126
+		$tabs['api']         = __('API', 'give');
127
+		$tabs['system_info'] = __('System Info', 'give');
128 128
 
129
-		return apply_filters( 'give_settings_tabs', $tabs );
129
+		return apply_filters('give_settings_tabs', $tabs);
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function admin_page_display() {
138 138
 
139
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
139
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
140 140
 
141 141
 		?>
142 142
 
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 
145 145
 			<h1 class="nav-tab-wrapper">
146 146
 				<?php
147
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
147
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
148 148
 
149 149
 					//Support legacy tab creation conditions based off $_GET parameter
150 150
 					//We pass the $_GET['tab'] to conditions executed later
151 151
 					$_GET['tab'] = $tab_id;
152 152
 
153
-					$tab_url = esc_url( add_query_arg( array(
153
+					$tab_url = esc_url(add_query_arg(array(
154 154
 						'settings-updated' => false,
155 155
 						'tab'              => $tab_id
156
-					) ) );
156
+					)));
157 157
 
158
-					$active       = $active_tab == $tab_id ? ' nav-tab-active' : '';
158
+					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
159 159
 
160
-					echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
160
+					echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
161 161
 
162 162
 				}
163 163
 				?>
@@ -165,20 +165,20 @@  discard block
 block discarded – undo
165 165
 
166 166
 			<?php
167 167
 			//Loop through and output settings
168
-			foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
168
+			foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
169 169
 
170 170
 				//Support legacy tab creation conditions based off $_GET parameter
171 171
 				//We 'trick' the conditions into thinking this is the tab
172 172
 				$_GET['tab'] = $tab_id;
173 173
 
174
-				$tab_settings = $this->give_settings( $tab_id );
174
+				$tab_settings = $this->give_settings($tab_id);
175 175
 
176 176
 				//Pass active tab within $tab_settings so we can hide with CSS via PHP
177
-				if ( $active_tab == $tab_id ) {
177
+				if ($active_tab == $tab_id) {
178 178
 					$tab_settings['active_tab'] = true;
179 179
 				}
180 180
 
181
-				cmb2_metabox_form( $tab_settings, $this->key );
181
+				cmb2_metabox_form($tab_settings, $this->key);
182 182
 
183 183
 			} ?>
184 184
 
@@ -196,34 +196,34 @@  discard block
 block discarded – undo
196 196
 	 * @since 1.5 Modified to CSS hide non-active tabs
197 197
 	 * @since 1.0
198 198
 	 */
199
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
199
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
200 200
 
201 201
 
202
-		$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
202
+		$pagenow = isset($_GET['page']) ? $_GET['page'] : '';
203 203
 
204 204
 		//only modify the give settings form
205
-		if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) {
205
+		if ('give_settings' == $object_id && $pagenow == 'give-settings') {
206 206
 
207 207
 			$style = '';
208
-			if ( ! isset( $cmb->meta_box['active_tab'] ) ) {
208
+			if ( ! isset($cmb->meta_box['active_tab'])) {
209 209
 				$style = 'style="display:none;"';
210 210
 			}
211 211
 
212 212
 			//Set ID based off tab name - protects backwards compatibility
213
-			$tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id'];
213
+			$tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id'];
214 214
 
215
-			$save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div>' );
215
+			$save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div>');
216 216
 
217 217
 			//Filter so some tabs won't have save settings
218
-			$no_save_button = apply_filters( 'give_settings_no_save_output', array(
218
+			$no_save_button = apply_filters('give_settings_no_save_output', array(
219 219
 				'system_info'
220
-			) );
220
+			));
221 221
 
222
-			if ( in_array( $tab_id, $no_save_button ) ) {
222
+			if (in_array($tab_id, $no_save_button)) {
223 223
 				$save_button = '';
224 224
 			}
225 225
 
226
-			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>';
226
+			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>';
227 227
 
228 228
 		}
229 229
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return array
242 242
 	 */
243
-	public function give_settings( $active_tab ) {
243
+	public function give_settings($active_tab) {
244 244
 
245 245
 		$give_settings = array(
246 246
 			/**
@@ -248,60 +248,60 @@  discard block
 block discarded – undo
248 248
 			 */
249 249
 			'general'     => array(
250 250
 				'id'         => 'general_settings',
251
-				'give_title' => __( 'General Settings', 'give' ),
252
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
253
-				'fields'     => apply_filters( 'give_settings_general', array(
251
+				'give_title' => __('General Settings', 'give'),
252
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
253
+				'fields'     => apply_filters('give_settings_general', array(
254 254
 						array(
255
-							'name' => __( 'General Settings', 'give' ),
255
+							'name' => __('General Settings', 'give'),
256 256
 							'desc' => '',
257 257
 							'type' => 'give_title',
258 258
 							'id'   => 'give_title_general_settings_1'
259 259
 						),
260 260
 						array(
261
-							'name'    => __( 'Success Page', 'give' ),
262
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
261
+							'name'    => __('Success Page', 'give'),
262
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
263 263
 							'id'      => 'success_page',
264 264
 							'type'    => 'select',
265
-							'options' => give_cmb2_get_post_options( array(
265
+							'options' => give_cmb2_get_post_options(array(
266 266
 								'post_type'   => 'page',
267
-								'numberposts' => - 1
268
-							) ),
267
+								'numberposts' => -1
268
+							)),
269 269
 						),
270 270
 						array(
271
-							'name'    => __( 'Failed Transaction Page', 'give' ),
272
-							'desc'    => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
271
+							'name'    => __('Failed Transaction Page', 'give'),
272
+							'desc'    => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
273 273
 							'id'      => 'failure_page',
274 274
 							'type'    => 'select',
275
-							'options' => give_cmb2_get_post_options( array(
275
+							'options' => give_cmb2_get_post_options(array(
276 276
 								'post_type'   => 'page',
277
-								'numberposts' => - 1
278
-							) ),
277
+								'numberposts' => -1
278
+							)),
279 279
 						),
280 280
 						array(
281
-							'name'    => __( 'Donation History Page', 'give' ),
282
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
281
+							'name'    => __('Donation History Page', 'give'),
282
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
283 283
 							'id'      => 'history_page',
284 284
 							'type'    => 'select',
285
-							'options' => give_cmb2_get_post_options( array(
285
+							'options' => give_cmb2_get_post_options(array(
286 286
 								'post_type'   => 'page',
287
-								'numberposts' => - 1
288
-							) ),
287
+								'numberposts' => -1
288
+							)),
289 289
 						),
290 290
 						array(
291
-							'name'    => __( 'Base Country', 'give' ),
292
-							'desc'    => __( 'Where does your site operate from?', 'give' ),
291
+							'name'    => __('Base Country', 'give'),
292
+							'desc'    => __('Where does your site operate from?', 'give'),
293 293
 							'id'      => 'base_country',
294 294
 							'type'    => 'select',
295 295
 							'options' => give_get_country_list(),
296 296
 						),
297 297
 						array(
298
-							'name' => __( 'Currency Settings', 'give' ),
298
+							'name' => __('Currency Settings', 'give'),
299 299
 							'desc' => '',
300 300
 							'type' => 'give_title',
301 301
 							'id'   => 'give_title_general_settings_2'
302 302
 						),
303 303
 						array(
304
-							'name'    => __( 'Currency', 'give' ),
304
+							'name'    => __('Currency', 'give'),
305 305
 							'desc'    => 'Choose your currency. Note that some payment gateways have currency restrictions.',
306 306
 							'id'      => 'currency',
307 307
 							'type'    => 'select',
@@ -309,26 +309,26 @@  discard block
 block discarded – undo
309 309
 							'default' => 'USD',
310 310
 						),
311 311
 						array(
312
-							'name'    => __( 'Currency Position', 'give' ),
312
+							'name'    => __('Currency Position', 'give'),
313 313
 							'desc'    => 'Choose the position of the currency sign.',
314 314
 							'id'      => 'currency_position',
315 315
 							'type'    => 'select',
316 316
 							'options' => array(
317
-								'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
318
-								'after'  => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
317
+								'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
318
+								'after'  => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
319 319
 							),
320 320
 							'default' => 'before',
321 321
 						),
322 322
 						array(
323
-							'name'    => __( 'Thousands Separator', 'give' ),
324
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands', 'give' ),
323
+							'name'    => __('Thousands Separator', 'give'),
324
+							'desc'    => __('The symbol (typically , or .) to separate thousands', 'give'),
325 325
 							'id'      => 'thousands_separator',
326 326
 							'type'    => 'text_small',
327 327
 							'default' => ',',
328 328
 						),
329 329
 						array(
330
-							'name'    => __( 'Decimal Separator', 'give' ),
331
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points', 'give' ),
330
+							'name'    => __('Decimal Separator', 'give'),
331
+							'desc'    => __('The symbol (usually , or .) to separate decimal points', 'give'),
332 332
 							'id'      => 'decimal_separator',
333 333
 							'type'    => 'text_small',
334 334
 							'default' => '.',
@@ -341,83 +341,83 @@  discard block
 block discarded – undo
341 341
 			 */
342 342
 			'gateways'    => array(
343 343
 				'id'         => 'payment_gateways',
344
-				'give_title' => __( 'Payment Gateways', 'give' ),
345
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
346
-				'fields'     => apply_filters( 'give_settings_gateways', array(
344
+				'give_title' => __('Payment Gateways', 'give'),
345
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
346
+				'fields'     => apply_filters('give_settings_gateways', array(
347 347
 						array(
348
-							'name' => __( 'Gateways Settings', 'give' ),
348
+							'name' => __('Gateways Settings', 'give'),
349 349
 							'desc' => '',
350 350
 							'id'   => 'give_title_gateway_settings_1',
351 351
 							'type' => 'give_title'
352 352
 						),
353 353
 						array(
354
-							'name' => __( 'Test Mode', 'give' ),
355
-							'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
354
+							'name' => __('Test Mode', 'give'),
355
+							'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
356 356
 							'id'   => 'test_mode',
357 357
 							'type' => 'checkbox'
358 358
 						),
359 359
 						array(
360
-							'name' => __( 'Enabled Gateways', 'give' ),
361
-							'desc' => __( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
360
+							'name' => __('Enabled Gateways', 'give'),
361
+							'desc' => __('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
362 362
 							'id'   => 'gateways',
363 363
 							'type' => 'enabled_gateways'
364 364
 						),
365 365
 						array(
366
-							'name' => __( 'Default Gateway', 'give' ),
367
-							'desc' => __( 'This is the gateway that will be selected by default.', 'give' ),
366
+							'name' => __('Default Gateway', 'give'),
367
+							'desc' => __('This is the gateway that will be selected by default.', 'give'),
368 368
 							'id'   => 'default_gateway',
369 369
 							'type' => 'default_gateway'
370 370
 						),
371 371
 						array(
372
-							'name' => __( 'PayPal Standard', 'give' ),
372
+							'name' => __('PayPal Standard', 'give'),
373 373
 							'desc' => '',
374 374
 							'type' => 'give_title',
375 375
 							'id'   => 'give_title_gateway_settings_2',
376 376
 						),
377 377
 						array(
378
-							'name' => __( 'PayPal Email', 'give' ),
379
-							'desc' => __( 'Enter your PayPal account\'s email', 'give' ),
378
+							'name' => __('PayPal Email', 'give'),
379
+							'desc' => __('Enter your PayPal account\'s email', 'give'),
380 380
 							'id'   => 'paypal_email',
381 381
 							'type' => 'text_email',
382 382
 						),
383 383
 						array(
384
-							'name' => __( 'PayPal Page Style', 'give' ),
385
-							'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default', 'give' ),
384
+							'name' => __('PayPal Page Style', 'give'),
385
+							'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'),
386 386
 							'id'   => 'paypal_page_style',
387 387
 							'type' => 'text',
388 388
 						),
389 389
 						array(
390
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
391
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
390
+							'name'    => __('PayPal Transaction Type', 'give'),
391
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
392 392
 							'id'      => 'paypal_button_type',
393 393
 							'type'    => 'radio_inline',
394 394
 							'options' => array(
395
-								'donation' => __( 'Donation', 'give' ),
396
-								'standard' => __( 'Standard Transaction', 'give' )
395
+								'donation' => __('Donation', 'give'),
396
+								'standard' => __('Standard Transaction', 'give')
397 397
 							),
398 398
 							'default' => 'donation',
399 399
 						),
400 400
 						array(
401
-							'name' => __( 'Disable PayPal IPN Verification', 'give' ),
402
-							'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
401
+							'name' => __('Disable PayPal IPN Verification', 'give'),
402
+							'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
403 403
 							'id'   => 'disable_paypal_verification',
404 404
 							'type' => 'checkbox'
405 405
 						),
406 406
 						array(
407
-							'name' => __( 'Offline Donations', 'give' ),
407
+							'name' => __('Offline Donations', 'give'),
408 408
 							'desc' => '',
409 409
 							'type' => 'give_title',
410 410
 							'id'   => 'give_title_gateway_settings_3',
411 411
 						),
412 412
 						array(
413
-							'name' => __( 'Collect Billing Details', 'give' ),
414
-							'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
413
+							'name' => __('Collect Billing Details', 'give'),
414
+							'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
415 415
 							'id'   => 'give_offline_donation_enable_billing_fields',
416 416
 							'type' => 'checkbox'
417 417
 						),
418 418
 						array(
419
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
420
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
419
+							'name'    => __('Offline Donation Instructions', 'give'),
420
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
421 421
 							'id'      => 'global_offline_donation_content',
422 422
 							'default' => give_get_default_offline_donation_content(),
423 423
 							'type'    => 'wysiwyg',
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
 							)
427 427
 						),
428 428
 						array(
429
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
430
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
429
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
430
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
431 431
 							'id'      => 'offline_donation_subject',
432
-							'default' => __( '{donation} - Offline Donation Instructions', 'give' ),
432
+							'default' => __('{donation} - Offline Donation Instructions', 'give'),
433 433
 							'type'    => 'text'
434 434
 						),
435 435
 						array(
436
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
437
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
436
+							'name'    => __('Offline Donation Email Instructions', 'give'),
437
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
438 438
 							'id'      => 'global_offline_donation_email',
439 439
 							'default' => give_get_default_offline_donation_email_content(),
440 440
 							'type'    => 'wysiwyg',
@@ -448,93 +448,93 @@  discard block
 block discarded – undo
448 448
 			/** Display Settings */
449 449
 			'display'     => array(
450 450
 				'id'         => 'display_settings',
451
-				'give_title' => __( 'Display Settings', 'give' ),
452
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
453
-				'fields'     => apply_filters( 'give_settings_display', array(
451
+				'give_title' => __('Display Settings', 'give'),
452
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
453
+				'fields'     => apply_filters('give_settings_display', array(
454 454
 						array(
455
-							'name' => __( 'Display Settings', 'give' ),
455
+							'name' => __('Display Settings', 'give'),
456 456
 							'desc' => '',
457 457
 							'id'   => 'give_title_display_settings_1',
458 458
 							'type' => 'give_title'
459 459
 						),
460 460
 						array(
461
-							'name' => __( 'Disable CSS', 'give' ),
462
-							'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
461
+							'name' => __('Disable CSS', 'give'),
462
+							'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
463 463
 							'id'   => 'disable_css',
464 464
 							'type' => 'checkbox'
465 465
 						),
466 466
 						array(
467
-							'name' => __( 'Enable Floating Labels', 'give' ),
468
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), '<a href="' . esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) . '" target="_blank">', '</a>', '<br />' ),
467
+							'name' => __('Enable Floating Labels', 'give'),
468
+							'desc' => sprintf(esc_html__('Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), '<a href="'.esc_url("http://bradfrost.com/blog/post/float-label-pattern/").'" target="_blank">', '</a>', '<br />'),
469 469
 							'id'   => 'enable_floatlabels',
470 470
 							'type' => 'checkbox'
471 471
 						),
472 472
 						array(
473
-							'name' => __( 'Disable Welcome Screen', 'give' ),
474
-							'desc' => sprintf( esc_html__( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
473
+							'name' => __('Disable Welcome Screen', 'give'),
474
+							'desc' => sprintf(esc_html__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))),
475 475
 							'id'   => 'disable_welcome',
476 476
 							'type' => 'checkbox'
477 477
 						),
478 478
 						array(
479
-							'name' => __( 'Post Types', 'give' ),
479
+							'name' => __('Post Types', 'give'),
480 480
 							'desc' => '',
481 481
 							'id'   => 'give_title_display_settings_2',
482 482
 							'type' => 'give_title'
483 483
 						),
484 484
 						array(
485
-							'name' => __( 'Disable Form Single Views', 'give' ),
486
-							'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
485
+							'name' => __('Disable Form Single Views', 'give'),
486
+							'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
487 487
 							'id'   => 'disable_forms_singular',
488 488
 							'type' => 'checkbox'
489 489
 						),
490 490
 						array(
491
-							'name' => __( 'Disable Form Archives', 'give' ),
492
-							'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
491
+							'name' => __('Disable Form Archives', 'give'),
492
+							'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
493 493
 							'id'   => 'disable_forms_archives',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => __( 'Disable Form Excerpts', 'give' ),
498
-							'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
497
+							'name' => __('Disable Form Excerpts', 'give'),
498
+							'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
499 499
 							'id'   => 'disable_forms_excerpt',
500 500
 							'type' => 'checkbox'
501 501
 						),
502 502
 
503 503
 						array(
504
-							'name'    => __( 'Featured Image Size', 'give' ),
505
-							'desc'    => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
504
+							'name'    => __('Featured Image Size', 'give'),
505
+							'desc'    => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
506 506
 							'id'      => 'featured_image_size',
507 507
 							'type'    => 'select',
508 508
 							'default' => 'large',
509 509
 							'options' => give_get_featured_image_sizes()
510 510
 						),
511 511
 						array(
512
-							'name' => __( 'Disable Form Featured Image', 'give' ),
513
-							'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
512
+							'name' => __('Disable Form Featured Image', 'give'),
513
+							'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
514 514
 							'id'   => 'disable_form_featured_img',
515 515
 							'type' => 'checkbox'
516 516
 						),
517 517
 						array(
518
-							'name' => __( 'Disable Single Form Sidebar', 'give' ),
519
-							'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
518
+							'name' => __('Disable Single Form Sidebar', 'give'),
519
+							'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
520 520
 							'id'   => 'disable_form_sidebar',
521 521
 							'type' => 'checkbox'
522 522
 						),
523 523
 						array(
524
-							'name' => __( 'Taxonomies', 'give' ),
524
+							'name' => __('Taxonomies', 'give'),
525 525
 							'desc' => '',
526 526
 							'id'   => 'give_title_display_settings_3',
527 527
 							'type' => 'give_title'
528 528
 						),
529 529
 						array(
530
-							'name' => __( 'Enable Form Categories', 'give' ),
531
-							'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
530
+							'name' => __('Enable Form Categories', 'give'),
531
+							'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
532 532
 							'id'   => 'enable_categories',
533 533
 							'type' => 'checkbox'
534 534
 						),
535 535
 						array(
536
-							'name' => __( 'Enable Form Tags', 'give' ),
537
-							'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
536
+							'name' => __('Enable Form Tags', 'give'),
537
+							'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
538 538
 							'id'   => 'enable_tags',
539 539
 							'type' => 'checkbox'
540 540
 						),
@@ -547,93 +547,93 @@  discard block
 block discarded – undo
547 547
 			 */
548 548
 			'emails'      => array(
549 549
 				'id'         => 'email_settings',
550
-				'give_title' => __( 'Email Settings', 'give' ),
551
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
552
-				'fields'     => apply_filters( 'give_settings_emails', array(
550
+				'give_title' => __('Email Settings', 'give'),
551
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
552
+				'fields'     => apply_filters('give_settings_emails', array(
553 553
 						array(
554
-							'name' => __( 'Email Settings', 'give' ),
554
+							'name' => __('Email Settings', 'give'),
555 555
 							'desc' => '',
556 556
 							'id'   => 'give_title_email_settings_1',
557 557
 							'type' => 'give_title'
558 558
 						),
559 559
 						array(
560 560
 							'id'      => 'email_template',
561
-							'name'    => __( 'Email Template', 'give' ),
562
-							'desc'    => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
561
+							'name'    => __('Email Template', 'give'),
562
+							'desc'    => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
563 563
 							'type'    => 'select',
564 564
 							'options' => give_get_email_templates()
565 565
 						),
566 566
 						array(
567 567
 							'id'   => 'email_logo',
568
-							'name' => __( 'Logo', 'give' ),
569
-							'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
568
+							'name' => __('Logo', 'give'),
569
+							'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
570 570
 							'type' => 'file'
571 571
 						),
572 572
 						array(
573 573
 							'id'      => 'from_name',
574
-							'name'    => __( 'From Name', 'give' ),
575
-							'desc'    => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
576
-							'default' => get_bloginfo( 'name' ),
574
+							'name'    => __('From Name', 'give'),
575
+							'desc'    => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
576
+							'default' => get_bloginfo('name'),
577 577
 							'type'    => 'text'
578 578
 						),
579 579
 						array(
580 580
 							'id'      => 'from_email',
581
-							'name'    => __( 'From Email', 'give' ),
582
-							'desc'    => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
583
-							'default' => get_bloginfo( 'admin_email' ),
581
+							'name'    => __('From Email', 'give'),
582
+							'desc'    => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
583
+							'default' => get_bloginfo('admin_email'),
584 584
 							'type'    => 'text'
585 585
 						),
586 586
 						array(
587
-							'name' => __( 'Donation Receipt', 'give' ),
587
+							'name' => __('Donation Receipt', 'give'),
588 588
 							'desc' => '',
589 589
 							'id'   => 'give_title_email_settings_2',
590 590
 							'type' => 'give_title'
591 591
 						),
592 592
 						array(
593 593
 							'id'      => 'donation_subject',
594
-							'name'    => __( 'Donation Email Subject', 'give' ),
595
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
596
-							'default' => __( 'Donation Receipt', 'give' ),
594
+							'name'    => __('Donation Email Subject', 'give'),
595
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
596
+							'default' => __('Donation Receipt', 'give'),
597 597
 							'type'    => 'text'
598 598
 						),
599 599
 						array(
600 600
 							'id'      => 'donation_receipt',
601
-							'name'    => __( 'Donation Receipt', 'give' ),
602
-							'desc'    => __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(),
601
+							'name'    => __('Donation Receipt', 'give'),
602
+							'desc'    => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(),
603 603
 							'type'    => 'wysiwyg',
604 604
 							'default' => give_get_default_donation_receipt_email()
605 605
 						),
606 606
 						array(
607
-							'name' => __( 'New Donation Notification', 'give' ),
607
+							'name' => __('New Donation Notification', 'give'),
608 608
 							'desc' => '',
609 609
 							'id'   => 'give_title_email_settings_3',
610 610
 							'type' => 'give_title'
611 611
 						),
612 612
 						array(
613 613
 							'id'      => 'donation_notification_subject',
614
-							'name'    => __( 'Donation Notification Subject', 'give' ),
615
-							'desc'    => __( 'Enter the subject line for the donation notification email', 'give' ),
614
+							'name'    => __('Donation Notification Subject', 'give'),
615
+							'desc'    => __('Enter the subject line for the donation notification email', 'give'),
616 616
 							'type'    => 'text',
617
-							'default' => __( 'New Donation - #{payment_id}', 'give' )
617
+							'default' => __('New Donation - #{payment_id}', 'give')
618 618
 						),
619 619
 						array(
620 620
 							'id'      => 'donation_notification',
621
-							'name'    => __( 'Donation Notification', 'give' ),
622
-							'desc'    => __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(),
621
+							'name'    => __('Donation Notification', 'give'),
622
+							'desc'    => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(),
623 623
 							'type'    => 'wysiwyg',
624 624
 							'default' => give_get_default_donation_notification_email()
625 625
 						),
626 626
 						array(
627 627
 							'id'      => 'admin_notice_emails',
628
-							'name'    => __( 'Donation Notification Emails', 'give' ),
629
-							'desc'    => sprintf( __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give' ), '<span class="give-underline">', '</span>' ),
628
+							'name'    => __('Donation Notification Emails', 'give'),
629
+							'desc'    => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'),
630 630
 							'type'    => 'textarea',
631
-							'default' => get_bloginfo( 'admin_email' )
631
+							'default' => get_bloginfo('admin_email')
632 632
 						),
633 633
 						array(
634 634
 							'id'   => 'disable_admin_notices',
635
-							'name' => __( 'Disable Admin Notifications', 'give' ),
636
-							'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
635
+							'name' => __('Disable Admin Notifications', 'give'),
636
+							'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'),
637 637
 							'type' => 'checkbox'
638 638
 						)
639 639
 					)
@@ -642,96 +642,96 @@  discard block
 block discarded – undo
642 642
 			/** Extension Settings */
643 643
 			'addons'      => array(
644 644
 				'id'         => 'addons',
645
-				'give_title' => __( 'Give Add-ons Settings', 'give' ),
646
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
647
-				'fields'     => apply_filters( 'give_settings_addons', array()
645
+				'give_title' => __('Give Add-ons Settings', 'give'),
646
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
647
+				'fields'     => apply_filters('give_settings_addons', array()
648 648
 				)
649 649
 			),
650 650
 			/** Licenses Settings */
651 651
 			'licenses'    => array(
652 652
 				'id'         => 'licenses',
653
-				'give_title' => __( 'Give Licenses', 'give' ),
654
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
655
-				'fields'     => apply_filters( 'give_settings_licenses', array()
653
+				'give_title' => __('Give Licenses', 'give'),
654
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
655
+				'fields'     => apply_filters('give_settings_licenses', array()
656 656
 				)
657 657
 			),
658 658
 			/** Advanced Options */
659 659
 			'advanced'    => array(
660 660
 				'id'         => 'advanced_options',
661
-				'give_title' => __( 'Advanced Options', 'give' ),
662
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
663
-				'fields'     => apply_filters( 'give_settings_advanced', array(
661
+				'give_title' => __('Advanced Options', 'give'),
662
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
663
+				'fields'     => apply_filters('give_settings_advanced', array(
664 664
 						array(
665
-							'name' => __( 'Access Control', 'give' ),
665
+							'name' => __('Access Control', 'give'),
666 666
 							'desc' => '',
667 667
 							'id'   => 'give_title_session_control_1',
668 668
 							'type' => 'give_title'
669 669
 						),
670 670
 						array(
671 671
 							'id'      => 'session_lifetime',
672
-							'name'    => __( 'Session Lifetime', 'give' ),
673
-							'desc'    => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
672
+							'name'    => __('Session Lifetime', 'give'),
673
+							'desc'    => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
674 674
 							'type'    => 'select',
675 675
 							'options' => array(
676
-								'86400'  => __( '24 Hours', 'give' ),
677
-								'172800' => __( '48 Hours', 'give' ),
678
-								'259200' => __( '72 Hours', 'give' ),
679
-								'604800' => __( '1 Week', 'give' ),
676
+								'86400'  => __('24 Hours', 'give'),
677
+								'172800' => __('48 Hours', 'give'),
678
+								'259200' => __('72 Hours', 'give'),
679
+								'604800' => __('1 Week', 'give'),
680 680
 							)
681 681
 						),
682 682
 						array(
683
-							'name' => __( 'Email Access', 'give' ),
684
-							'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
683
+							'name' => __('Email Access', 'give'),
684
+							'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
685 685
 							'id'   => 'email_access',
686 686
 							'type' => 'checkbox',
687 687
 						),
688 688
 						array(
689 689
 							'id'      => 'recaptcha_key',
690
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
691
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>' ),
690
+							'name'    => __('reCAPTCHA Site Key', 'give'),
691
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>'),
692 692
 							'default' => '',
693 693
 							'type'    => 'text'
694 694
 						),
695 695
 						array(
696 696
 							'id'      => 'recaptcha_secret',
697
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
698
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
697
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
698
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
699 699
 							'default' => '',
700 700
 							'type'    => 'text'
701 701
 						),
702 702
 						array(
703
-							'name' => __( 'Data Control', 'give' ),
703
+							'name' => __('Data Control', 'give'),
704 704
 							'desc' => '',
705 705
 							'id'   => 'give_title_data_control_2',
706 706
 							'type' => 'give_title'
707 707
 						),
708 708
 						array(
709
-							'name' => __( 'Remove All Data on Uninstall?', 'give' ),
710
-							'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
709
+							'name' => __('Remove All Data on Uninstall?', 'give'),
710
+							'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
711 711
 							'id'   => 'uninstall_on_delete',
712 712
 							'type' => 'checkbox'
713 713
 						),
714 714
 						array(
715
-							'name' => __( 'Filter Control', 'give' ),
715
+							'name' => __('Filter Control', 'give'),
716 716
 							'desc' => '',
717 717
 							'id'   => 'give_title_filter_control',
718 718
 							'type' => 'give_title'
719 719
 						),
720 720
 						array(
721
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
722
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
721
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
722
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
723 723
 							'id'   => 'disable_the_content_filter',
724 724
 							'type' => 'checkbox'
725 725
 						),
726 726
 						array(
727
-							'name' => __( 'Script Loading', 'give' ),
727
+							'name' => __('Script Loading', 'give'),
728 728
 							'desc' => '',
729 729
 							'id'   => 'give_title_script_control',
730 730
 							'type' => 'give_title'
731 731
 						),
732 732
 						array(
733
-							'name' => __( 'Load Scripts in Footer?', 'give' ),
734
-							'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
733
+							'name' => __('Load Scripts in Footer?', 'give'),
734
+							'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
735 735
 							'id'   => 'scripts_footer',
736 736
 							'type' => 'checkbox'
737 737
 						)
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 			/** API Settings */
742 742
 			'api'         => array(
743 743
 				'id'         => 'api',
744
-				'give_title' => __( 'API', 'give' ),
745
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
744
+				'give_title' => __('API', 'give'),
745
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
746 746
 				'show_names' => false, // Hide field names on the left
747
-				'fields'     => apply_filters( 'give_settings_system', array(
747
+				'fields'     => apply_filters('give_settings_system', array(
748 748
 						array(
749 749
 							'id'   => 'api',
750
-							'name' => __( 'API', 'give' ),
750
+							'name' => __('API', 'give'),
751 751
 							'type' => 'api'
752 752
 						)
753 753
 					)
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
 			/** Licenses Settings */
757 757
 			'system_info' => array(
758 758
 				'id'         => 'system_info',
759
-				'give_title' => __( 'System Info', 'give' ),
760
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
761
-				'fields'     => apply_filters( 'give_settings_system', array(
759
+				'give_title' => __('System Info', 'give'),
760
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
761
+				'fields'     => apply_filters('give_settings_system', array(
762 762
 						array(
763 763
 							'id'   => 'system_info',
764
-							'name' => __( 'System Info', 'give' ),
765
-							'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
764
+							'name' => __('System Info', 'give'),
765
+							'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'),
766 766
 							'type' => 'system_info'
767 767
 						)
768 768
 					)
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 		);
772 772
 
773 773
 		//Return all settings array if no active tab
774
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
774
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
775 775
 
776
-			return apply_filters( 'give_registered_settings', $give_settings );
776
+			return apply_filters('give_registered_settings', $give_settings);
777 777
 			
778 778
 		}
779 779
 
780 780
 
781 781
 		// Add other tabs and settings fields as needed
782
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
782
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
783 783
 
784 784
 	}
785 785
 
@@ -788,11 +788,11 @@  discard block
 block discarded – undo
788 788
 	 */
789 789
 	public function settings_notices() {
790 790
 
791
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
791
+		if ( ! isset($_POST['give_settings_saved'])) {
792 792
 			return;
793 793
 		}
794 794
 
795
-		add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' );
795
+		add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated');
796 796
 
797 797
 	}
798 798
 
@@ -806,17 +806,17 @@  discard block
 block discarded – undo
806 806
 	 *
807 807
 	 * @return mixed          Field value or exception is thrown
808 808
 	 */
809
-	public function __get( $field ) {
809
+	public function __get($field) {
810 810
 
811 811
 		// Allowed fields to retrieve
812
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
812
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
813 813
 			return $this->{$field};
814 814
 		}
815
-		if ( 'option_metabox' === $field ) {
815
+		if ('option_metabox' === $field) {
816 816
 			return $this->option_metabox();
817 817
 		}
818 818
 
819
-		throw new Exception( 'Invalid property: ' . $field );
819
+		throw new Exception('Invalid property: '.$field);
820 820
 	}
821 821
 
822 822
 
@@ -833,12 +833,12 @@  discard block
 block discarded – undo
833 833
  *
834 834
  * @return mixed        Option value
835 835
  */
836
-function give_get_option( $key = '', $default = false ) {
836
+function give_get_option($key = '', $default = false) {
837 837
 	global $give_options;
838
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
839
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
838
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
839
+	$value = apply_filters('give_get_option', $value, $key, $default);
840 840
 
841
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
841
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
842 842
 }
843 843
 
844 844
 
@@ -856,33 +856,33 @@  discard block
 block discarded – undo
856 856
  *
857 857
  * @return boolean True if updated, false if not.
858 858
  */
859
-function give_update_option( $key = '', $value = false ) {
859
+function give_update_option($key = '', $value = false) {
860 860
 
861 861
 	// If no key, exit
862
-	if ( empty( $key ) ) {
862
+	if (empty($key)) {
863 863
 		return false;
864 864
 	}
865 865
 
866
-	if ( empty( $value ) ) {
867
-		$remove_option = give_delete_option( $key );
866
+	if (empty($value)) {
867
+		$remove_option = give_delete_option($key);
868 868
 
869 869
 		return $remove_option;
870 870
 	}
871 871
 
872 872
 	// First let's grab the current settings
873
-	$options = get_option( 'give_settings' );
873
+	$options = get_option('give_settings');
874 874
 
875 875
 	// Let's let devs alter that value coming in
876
-	$value = apply_filters( 'give_update_option', $value, $key );
876
+	$value = apply_filters('give_update_option', $value, $key);
877 877
 
878 878
 	// Next let's try to update the value
879
-	$options[ $key ] = $value;
880
-	$did_update      = update_option( 'give_settings', $options );
879
+	$options[$key] = $value;
880
+	$did_update      = update_option('give_settings', $options);
881 881
 
882 882
 	// If it updated, let's update the global variable
883
-	if ( $did_update ) {
883
+	if ($did_update) {
884 884
 		global $give_options;
885
-		$give_options[ $key ] = $value;
885
+		$give_options[$key] = $value;
886 886
 	}
887 887
 
888 888
 	return $did_update;
@@ -899,27 +899,27 @@  discard block
 block discarded – undo
899 899
  *
900 900
  * @return boolean True if updated, false if not.
901 901
  */
902
-function give_delete_option( $key = '' ) {
902
+function give_delete_option($key = '') {
903 903
 
904 904
 	// If no key, exit
905
-	if ( empty( $key ) ) {
905
+	if (empty($key)) {
906 906
 		return false;
907 907
 	}
908 908
 
909 909
 	// First let's grab the current settings
910
-	$options = get_option( 'give_settings' );
910
+	$options = get_option('give_settings');
911 911
 
912 912
 	// Next let's try to update the value
913
-	if ( isset( $options[ $key ] ) ) {
913
+	if (isset($options[$key])) {
914 914
 
915
-		unset( $options[ $key ] );
915
+		unset($options[$key]);
916 916
 
917 917
 	}
918 918
 
919
-	$did_update = update_option( 'give_settings', $options );
919
+	$did_update = update_option('give_settings', $options);
920 920
 
921 921
 	// If it updated, let's update the global variable
922
-	if ( $did_update ) {
922
+	if ($did_update) {
923 923
 		global $give_options;
924 924
 		$give_options = $options;
925 925
 	}
@@ -938,9 +938,9 @@  discard block
 block discarded – undo
938 938
  */
939 939
 function give_get_settings() {
940 940
 
941
-	$settings = get_option( 'give_settings' );
941
+	$settings = get_option('give_settings');
942 942
 
943
-	return (array) apply_filters( 'give_get_settings', $settings );
943
+	return (array) apply_filters('give_get_settings', $settings);
944 944
 
945 945
 }
946 946
 
@@ -958,25 +958,25 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return array
960 960
  */
961
-function give_settings_array_insert( $array, $position, $insert ) {
962
-	if ( is_int( $position ) ) {
963
-		array_splice( $array, $position, 0, $insert );
961
+function give_settings_array_insert($array, $position, $insert) {
962
+	if (is_int($position)) {
963
+		array_splice($array, $position, 0, $insert);
964 964
 	} else {
965 965
 
966
-		foreach ( $array as $index => $subarray ) {
967
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
966
+		foreach ($array as $index => $subarray) {
967
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
968 968
 				$pos = $index;
969 969
 			}
970 970
 		}
971 971
 
972
-		if ( ! isset( $pos ) ) {
972
+		if ( ! isset($pos)) {
973 973
 			return $array;
974 974
 		}
975 975
 
976 976
 		$array = array_merge(
977
-			array_slice( $array, 0, $pos ),
977
+			array_slice($array, 0, $pos),
978 978
 			$insert,
979
-			array_slice( $array, $pos )
979
+			array_slice($array, $pos)
980 980
 		);
981 981
 	}
982 982
 
@@ -999,31 +999,31 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return void
1001 1001
  */
1002
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1002
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1003 1003
 
1004 1004
 	$id                = $field_type_object->field->args['id'];
1005 1005
 	$field_description = $field_type_object->field->args['desc'];
1006
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1006
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1007 1007
 
1008 1008
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1009 1009
 
1010
-	foreach ( $gateways as $key => $option ) :
1010
+	foreach ($gateways as $key => $option) :
1011 1011
 
1012
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1012
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1013 1013
 			$enabled = '1';
1014 1014
 		} else {
1015 1015
 			$enabled = null;
1016 1016
 		}
1017 1017
 
1018
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1019
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1018
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1019
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1020 1020
 
1021 1021
 	endforeach;
1022 1022
 
1023 1023
 	echo '</ul>';
1024 1024
 
1025
-	if ( $field_description ) {
1026
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1025
+	if ($field_description) {
1026
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1027 1027
 	}
1028 1028
 
1029 1029
 }
@@ -1039,31 +1039,31 @@  discard block
 block discarded – undo
1039 1039
  *
1040 1040
  * @return void
1041 1041
  */
1042
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1042
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1043 1043
 
1044 1044
 	$id                = $field_type_object->field->args['id'];
1045 1045
 	$field_description = $field_type_object->field->args['desc'];
1046 1046
 	$gateways          = give_get_enabled_payment_gateways();
1047 1047
 
1048
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1048
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1049 1049
 
1050 1050
 	//Add a field to the Give Form admin single post view of this field
1051
-	if ( $field_type_object->field->object_type === 'post' ) {
1052
-		echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>';
1051
+	if ($field_type_object->field->object_type === 'post') {
1052
+		echo '<option value="global">'.__('Global Default', 'give').'</option>';
1053 1053
 	}
1054 1054
 
1055
-	foreach ( $gateways as $key => $option ) :
1055
+	foreach ($gateways as $key => $option) :
1056 1056
 
1057
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1057
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1058 1058
 
1059 1059
 
1060
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1060
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1061 1061
 
1062 1062
 	endforeach;
1063 1063
 
1064 1064
 	echo '</select>';
1065 1065
 
1066
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1066
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1067 1067
 
1068 1068
 }
1069 1069
 
@@ -1078,13 +1078,13 @@  discard block
 block discarded – undo
1078 1078
  *
1079 1079
  * @return void
1080 1080
  */
1081
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1081
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1082 1082
 
1083 1083
 	$id                = $field_type_object->field->args['id'];
1084 1084
 	$title             = $field_type_object->field->args['name'];
1085 1085
 	$field_description = $field_type_object->field->args['desc'];
1086 1086
 
1087
-	echo '<hr>' . $field_description;
1087
+	echo '<hr>'.$field_description;
1088 1088
 
1089 1089
 }
1090 1090
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
  *
1100 1100
  * @return void
1101 1101
  */
1102
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1102
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1103 1103
 
1104 1104
 	$id                = $field_type_object->field->args['id'];
1105 1105
 	$title             = $field_type_object->field->args['name'];
@@ -1119,25 +1119,25 @@  discard block
 block discarded – undo
1119 1119
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1120 1120
  * @return array An array of options that matches the CMB2 options array
1121 1121
  */
1122
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1122
+function give_cmb2_get_post_options($query_args, $force = false) {
1123 1123
 
1124
-	$post_options = array( '' => '' ); // Blank option
1124
+	$post_options = array('' => ''); // Blank option
1125 1125
 
1126
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1126
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1127 1127
 		return $post_options;
1128 1128
 	}
1129 1129
 
1130
-	$args = wp_parse_args( $query_args, array(
1130
+	$args = wp_parse_args($query_args, array(
1131 1131
 		'post_type'   => 'page',
1132 1132
 		'numberposts' => 10,
1133
-	) );
1133
+	));
1134 1134
 
1135
-	$posts = get_posts( $args );
1135
+	$posts = get_posts($args);
1136 1136
 
1137
-	if ( $posts ) {
1138
-		foreach ( $posts as $post ) {
1137
+	if ($posts) {
1138
+		foreach ($posts as $post) {
1139 1139
 
1140
-			$post_options[ $post->ID ] = $post->post_title;
1140
+			$post_options[$post->ID] = $post->post_title;
1141 1141
 
1142 1142
 		}
1143 1143
 	}
@@ -1157,17 +1157,17 @@  discard block
 block discarded – undo
1157 1157
 	global $_wp_additional_image_sizes;
1158 1158
 	$sizes = array();
1159 1159
 
1160
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1160
+	foreach (get_intermediate_image_sizes() as $_size) {
1161 1161
 
1162
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1163
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1164
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1165
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1162
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1163
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1164
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1165
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1166 1166
 		}
1167 1167
 
1168 1168
 	}
1169 1169
 
1170
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1170
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1171 1171
 }
1172 1172
 
1173 1173
 
@@ -1181,34 +1181,34 @@  discard block
 block discarded – undo
1181 1181
  *
1182 1182
  * @return void
1183 1183
  */
1184
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1184
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1185 1185
 
1186 1186
 	$id                = $field_type_object->field->args['id'];
1187 1187
 	$field_description = $field_type_object->field->args['desc'];
1188
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1188
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1189 1189
 	$field_classes     = 'regular-text give-license-field';
1190
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1190
+	$type              = empty($escaped_value) ? 'text' : 'password';
1191 1191
 
1192
-	if ( $license_status === 'valid' ) {
1192
+	if ($license_status === 'valid') {
1193 1193
 		$field_classes .= ' give-license-active';
1194 1194
 	}
1195 1195
 
1196
-	$html = $field_type_object->input( array(
1196
+	$html = $field_type_object->input(array(
1197 1197
 		'class' => $field_classes,
1198 1198
 		'type'  => $type
1199
-	) );
1199
+	));
1200 1200
 
1201 1201
 	//License is active so show deactivate button
1202
-	if ( $license_status === 'valid' ) {
1203
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>';
1202
+	if ($license_status === 'valid') {
1203
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>';
1204 1204
 	} else {
1205 1205
 		//This license is not valid so delete it
1206
-		give_delete_option( $id );
1206
+		give_delete_option($id);
1207 1207
 	}
1208 1208
 
1209
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1209
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1210 1210
 
1211
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1211
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1212 1212
 
1213 1213
 	echo $html;
1214 1214
 }
@@ -1222,13 +1222,13 @@  discard block
 block discarded – undo
1222 1222
  */
1223 1223
 function give_api_callback() {
1224 1224
 
1225
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1225
+	if ( ! current_user_can('manage_give_settings')) {
1226 1226
 		return;
1227 1227
 	}
1228 1228
 
1229
-	do_action( 'give_tools_api_keys_before' );
1229
+	do_action('give_tools_api_keys_before');
1230 1230
 
1231
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1231
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1232 1232
 
1233 1233
 	$api_keys_table = new Give_API_Keys_Table();
1234 1234
 	$api_keys_table->prepare_items();
@@ -1236,17 +1236,17 @@  discard block
 block discarded – undo
1236 1236
 	?>
1237 1237
 	<span class="cmb2-metabox-description api-description">
1238 1238
 		<?php echo sprintf(
1239
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1240
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1241
-			esc_url( 'https://givewp.com/addons/zapier/' )
1239
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1240
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1241
+			esc_url('https://givewp.com/addons/zapier/')
1242 1242
 		); ?>
1243 1243
 	</span>
1244 1244
 	<?php
1245 1245
 
1246
-	do_action( 'give_tools_api_keys_after' );
1246
+	do_action('give_tools_api_keys_after');
1247 1247
 }
1248 1248
 
1249
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1249
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1250 1250
 
1251 1251
 /**
1252 1252
  * Hook Callback
@@ -1259,8 +1259,8 @@  discard block
 block discarded – undo
1259 1259
  *
1260 1260
  * @return void
1261 1261
  */
1262
-function give_hook_callback( $args ) {
1263
-	do_action( 'give_' . $args['id'] );
1262
+function give_hook_callback($args) {
1263
+	do_action('give_'.$args['id']);
1264 1264
 }
1265 1265
 
1266 1266
 /**
@@ -1270,10 +1270,10 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  */
1272 1272
 
1273
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1274
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1275
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1276
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1277
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1278
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1273
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1274
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1275
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1276
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1277
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1278
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1279 1279
 }
1280 1280
\ No newline at end of file
Please login to merge, or discard this patch.
includes/login-register.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string Login form
27 27
  */
28
-function give_login_form( $redirect = '' ) {
28
+function give_login_form($redirect = '') {
29 29
 	global $give_login_redirect;
30 30
 
31
-	if ( empty( $redirect ) ) {
31
+	if (empty($redirect)) {
32 32
 		$redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
33 33
 	}
34 34
 
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	ob_start();
38 38
 
39
-	give_get_template_part( 'shortcode', 'login' );
39
+	give_get_template_part('shortcode', 'login');
40 40
 
41
-	return apply_filters( 'give_login_form', ob_get_clean() );
41
+	return apply_filters('give_login_form', ob_get_clean());
42 42
 }
43 43
 
44 44
 /**
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return string Register form
54 54
  */
55
-function give_register_form( $redirect = '' ) {
55
+function give_register_form($redirect = '') {
56 56
 	global $give_options, $give_register_redirect;
57 57
 
58
-	if ( empty( $redirect ) ) {
58
+	if (empty($redirect)) {
59 59
 		$redirect = give_get_current_page_url();
60 60
 	}
61 61
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 
64 64
 	ob_start();
65 65
 
66
-	if ( ! is_user_logged_in() ) {
67
-		give_get_template_part( 'shortcode', 'register' );
66
+	if ( ! is_user_logged_in()) {
67
+		give_get_template_part('shortcode', 'register');
68 68
 	}
69 69
 
70
-	return apply_filters( 'give_register_form', ob_get_clean() );
70
+	return apply_filters('give_register_form', ob_get_clean());
71 71
 }
72 72
 
73 73
 /**
@@ -79,34 +79,34 @@  discard block
 block discarded – undo
79 79
  *
80 80
  * @return void
81 81
  */
82
-function give_process_login_form( $data ) {
83
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
84
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
85
-		if ( ! $user_data ) {
86
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
82
+function give_process_login_form($data) {
83
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
84
+		$user_data = get_user_by('login', $data['give_user_login']);
85
+		if ( ! $user_data) {
86
+			$user_data = get_user_by('email', $data['give_user_login']);
87 87
 		}
88
-		if ( $user_data ) {
88
+		if ($user_data) {
89 89
 			$user_ID    = $user_data->ID;
90 90
 			$user_email = $user_data->user_email;
91
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
92
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
91
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
92
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
93 93
 			} else {
94
-				give_set_error( 'password_incorrect', __( 'The password you entered is incorrect', 'give' ) );
94
+				give_set_error('password_incorrect', __('The password you entered is incorrect', 'give'));
95 95
 			}
96 96
 		} else {
97
-			give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) );
97
+			give_set_error('username_incorrect', __('The username you entered does not exist', 'give'));
98 98
 		}
99 99
 		// Check for errors and redirect if none present
100 100
 		$errors = give_get_errors();
101
-		if ( ! $errors ) {
102
-			$redirect = apply_filters( 'give_login_redirect', $data['give_redirect'], $user_ID );
103
-			wp_redirect( $redirect );
101
+		if ( ! $errors) {
102
+			$redirect = apply_filters('give_login_redirect', $data['give_redirect'], $user_ID);
103
+			wp_redirect($redirect);
104 104
 			give_die();
105 105
 		}
106 106
 	}
107 107
 }
108 108
 
109
-add_action( 'give_user_login', 'give_process_login_form' );
109
+add_action('give_user_login', 'give_process_login_form');
110 110
 
111 111
 /**
112 112
  * Log User In
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
  *
120 120
  * @return void
121 121
  */
122
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
123
-	if ( $user_id < 1 ) {
122
+function give_log_user_in($user_id, $user_login, $user_pass) {
123
+	if ($user_id < 1) {
124 124
 		return;
125 125
 	}
126 126
 
127
-	wp_set_auth_cookie( $user_id );
128
-	wp_set_current_user( $user_id, $user_login );
129
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
130
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
127
+	wp_set_auth_cookie($user_id);
128
+	wp_set_current_user($user_id, $user_login);
129
+	do_action('wp_login', $user_login, get_userdata($user_id));
130
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
131 131
 }
132 132
 
133 133
 
@@ -140,70 +140,70 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return void
142 142
  */
143
-function give_process_register_form( $data ) {
143
+function give_process_register_form($data) {
144 144
 
145
-	if ( is_user_logged_in() ) {
145
+	if (is_user_logged_in()) {
146 146
 		return;
147 147
 	}
148 148
 
149
-	if ( empty( $_POST['give_register_submit'] ) ) {
149
+	if (empty($_POST['give_register_submit'])) {
150 150
 		return;
151 151
 	}
152 152
 
153
-	do_action( 'give_pre_process_register_form' );
153
+	do_action('give_pre_process_register_form');
154 154
 
155
-	if ( empty( $data['give_user_login'] ) ) {
156
-		give_set_error( 'empty_username', __( 'Invalid username', 'give' ) );
155
+	if (empty($data['give_user_login'])) {
156
+		give_set_error('empty_username', __('Invalid username', 'give'));
157 157
 	}
158 158
 
159
-	if ( username_exists( $data['give_user_login'] ) ) {
160
-		give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) );
159
+	if (username_exists($data['give_user_login'])) {
160
+		give_set_error('username_unavailable', __('Username already taken', 'give'));
161 161
 	}
162 162
 
163
-	if ( ! validate_username( $data['give_user_login'] ) ) {
164
-		give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) );
163
+	if ( ! validate_username($data['give_user_login'])) {
164
+		give_set_error('username_invalid', __('Invalid username', 'give'));
165 165
 	}
166 166
 
167
-	if ( email_exists( $data['give_user_email'] ) ) {
168
-		give_set_error( 'email_unavailable', __( 'Email address already taken', 'give' ) );
167
+	if (email_exists($data['give_user_email'])) {
168
+		give_set_error('email_unavailable', __('Email address already taken', 'give'));
169 169
 	}
170 170
 
171
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
172
-		give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
171
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
172
+		give_set_error('email_invalid', __('Invalid email', 'give'));
173 173
 	}
174 174
 
175
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
176
-		give_set_error( 'payment_email_invalid', __( 'Invalid payment email', 'give' ) );
175
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
176
+		give_set_error('payment_email_invalid', __('Invalid payment email', 'give'));
177 177
 	}
178 178
 
179
-	if ( empty( $_POST['give_user_pass'] ) ) {
180
-		give_set_error( 'empty_password', __( 'Please enter a password', 'give' ) );
179
+	if (empty($_POST['give_user_pass'])) {
180
+		give_set_error('empty_password', __('Please enter a password', 'give'));
181 181
 	}
182 182
 
183
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
184
-		give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) );
183
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
184
+		give_set_error('password_mismatch', __('Passwords don\'t match', 'give'));
185 185
 	}
186 186
 
187
-	do_action( 'give_process_register_form' );
187
+	do_action('give_process_register_form');
188 188
 
189 189
 	// Check for errors and redirect if none present
190 190
 	$errors = give_get_errors();
191 191
 
192
-	if ( empty( $errors ) ) {
192
+	if (empty($errors)) {
193 193
 
194
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
194
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
195 195
 
196
-		give_register_and_login_new_user( array(
196
+		give_register_and_login_new_user(array(
197 197
 			'user_login'      => $data['give_user_login'],
198 198
 			'user_pass'       => $data['give_user_pass'],
199 199
 			'user_email'      => $data['give_user_email'],
200
-			'user_registered' => date( 'Y-m-d H:i:s' ),
201
-			'role'            => get_option( 'default_role' )
202
-		) );
200
+			'user_registered' => date('Y-m-d H:i:s'),
201
+			'role'            => get_option('default_role')
202
+		));
203 203
 
204
-		wp_redirect( $redirect );
204
+		wp_redirect($redirect);
205 205
 		give_die();
206 206
 	}
207 207
 }
208 208
 
209
-add_action( 'give_user_register', 'give_process_register_form' );
210 209
\ No newline at end of file
210
+add_action('give_user_register', 'give_process_register_form');
211 211
\ No newline at end of file
Please login to merge, or discard this patch.
includes/process-purchase.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_process_purchase_form() {
27 27
 
28
-	do_action( 'give_pre_process_purchase' );
28
+	do_action('give_pre_process_purchase');
29 29
 
30 30
 	// Validate the form $_POST data
31 31
 	$valid_data = give_purchase_form_validate_fields();
32 32
 
33 33
 	// Allow themes and plugins to hook to errors
34
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
34
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
35 35
 
36
-	$is_ajax = isset( $_POST['give_ajax'] );
36
+	$is_ajax = isset($_POST['give_ajax']);
37 37
 
38 38
 	// Process the login form
39
-	if ( isset( $_POST['give_login_submit'] ) ) {
39
+	if (isset($_POST['give_login_submit'])) {
40 40
 		give_process_form_login();
41 41
 	}
42 42
 
43 43
 	// Validate the user
44
-	$user = give_get_purchase_form_user( $valid_data );
44
+	$user = give_get_purchase_form_user($valid_data);
45 45
 
46
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
47
-		if ( $is_ajax ) {
48
-			do_action( 'give_ajax_checkout_errors' );
46
+	if (false === $valid_data || give_get_errors() || ! $user) {
47
+		if ($is_ajax) {
48
+			do_action('give_ajax_checkout_errors');
49 49
 			give_die();
50 50
 		} else {
51 51
 			return false;
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	//If AJAX send back success to proceed with form submission
56
-	if ( $is_ajax ) {
56
+	if ($is_ajax) {
57 57
 		echo 'success';
58 58
 		give_die();
59 59
 	}
60 60
 
61 61
 	//After AJAX: Setup session if not using php_sessions
62
-	if ( ! Give()->session->use_php_sessions() ) {
62
+	if ( ! Give()->session->use_php_sessions()) {
63 63
 		//Double-check that set_cookie is publicly accessible;
64 64
 		// we're using a slightly modified class-wp-sessions.php
65
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
66
-		if ( $session_reflection->isPublic() ) {
65
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
66
+		if ($session_reflection->isPublic()) {
67 67
 			// Manually set the cookie.
68 68
 			Give()->session->init()->set_cookie();
69 69
 		}
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 		'address'    => $user['address']
79 79
 	);
80 80
 
81
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
81
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
82 82
 
83
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
84
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
83
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
84
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
85 85
 
86 86
 	// Setup purchase information
87 87
 	$purchase_data = array(
88 88
 		'price'        => $price,
89 89
 		'purchase_key' => $purchase_key,
90 90
 		'user_email'   => $user['user_email'],
91
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
92
-		'user_info'    => stripslashes_deep( $user_info ),
91
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
92
+		'user_info'    => stripslashes_deep($user_info),
93 93
 		'post_data'    => $_POST,
94 94
 		'gateway'      => $valid_data['gateway'],
95 95
 		'card_info'    => $valid_data['cc_info']
@@ -99,37 +99,37 @@  discard block
 block discarded – undo
99 99
 	$valid_data['user'] = $user;
100 100
 
101 101
 	// Allow themes and plugins to hook before the gateway
102
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
102
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
103 103
 
104 104
 	//Sanity check for price
105
-	if ( ! $purchase_data['price'] ) {
105
+	if ( ! $purchase_data['price']) {
106 106
 		// Revert to manual
107 107
 		$purchase_data['gateway'] = 'manual';
108 108
 		$_POST['give-gateway']    = 'manual';
109 109
 	}
110 110
 
111 111
 	// Allow the purchase data to be modified before it is sent to the gateway
112
-	$purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data );
112
+	$purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data);
113 113
 
114 114
 	// Setup the data we're storing in the purchase session
115 115
 	$session_data = $purchase_data;
116 116
 
117 117
 	// Make sure credit card numbers are never stored in sessions
118
-	unset( $session_data['card_info']['card_number'] );
119
-	unset( $session_data['post_data']['card_number'] );
118
+	unset($session_data['card_info']['card_number']);
119
+	unset($session_data['post_data']['card_number']);
120 120
 
121 121
 	// Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data.
122
-	give_set_purchase_session( $session_data );
122
+	give_set_purchase_session($session_data);
123 123
 
124 124
 	// Send info to the gateway for payment processing
125
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
125
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
126 126
 	give_die();
127 127
 
128 128
 }
129 129
 
130
-add_action( 'give_purchase', 'give_process_purchase_form' );
131
-add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' );
132
-add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' );
130
+add_action('give_purchase', 'give_process_purchase_form');
131
+add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form');
132
+add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form');
133 133
 
134 134
 /**
135 135
  * Process the checkout login form
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_process_form_login() {
142 142
 
143
-	$is_ajax = isset( $_POST['give_ajax'] );
143
+	$is_ajax = isset($_POST['give_ajax']);
144 144
 
145 145
 	$user_data = give_purchase_form_validate_user_login();
146 146
 
147
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
148
-		if ( $is_ajax ) {
149
-			do_action( 'give_ajax_checkout_errors' );
147
+	if (give_get_errors() || $user_data['user_id'] < 1) {
148
+		if ($is_ajax) {
149
+			do_action('give_ajax_checkout_errors');
150 150
 			give_die();
151 151
 		} else {
152
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
152
+			wp_redirect($_SERVER['HTTP_REFERER']);
153 153
 			exit;
154 154
 		}
155 155
 	}
156 156
 
157
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
157
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
158 158
 
159
-	if ( $is_ajax ) {
159
+	if ($is_ajax) {
160 160
 		echo 'success';
161 161
 		give_die();
162 162
 	} else {
163
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
163
+		wp_redirect($_SERVER['HTTP_REFERER']);
164 164
 	}
165 165
 }
166 166
 
167
-add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' );
168
-add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' );
167
+add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login');
168
+add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login');
169 169
 
170 170
 /**
171 171
  * Purchase Form Validate Fields
@@ -177,45 +177,45 @@  discard block
 block discarded – undo
177 177
 function give_purchase_form_validate_fields() {
178 178
 
179 179
 	// Check if there is $_POST
180
-	if ( empty( $_POST ) ) {
180
+	if (empty($_POST)) {
181 181
 		return false;
182 182
 	}
183 183
 
184
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
184
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
185 185
 
186 186
 	// Start an array to collect valid data
187 187
 	$valid_data = array(
188 188
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
189
-		'need_new_user'    => false,     // New user flag
190
-		'need_user_login'  => false,     // Login user flag
191
-		'logged_user_data' => array(),   // Logged user collected data
192
-		'new_user_data'    => array(),   // New user collected data
193
-		'login_user_data'  => array(),   // Login user collected data
194
-		'guest_user_data'  => array(),   // Guest user collected data
189
+		'need_new_user'    => false, // New user flag
190
+		'need_user_login'  => false, // Login user flag
191
+		'logged_user_data' => array(), // Logged user collected data
192
+		'new_user_data'    => array(), // New user collected data
193
+		'login_user_data'  => array(), // Login user collected data
194
+		'guest_user_data'  => array(), // Guest user collected data
195 195
 		'cc_info'          => give_purchase_form_validate_cc()    // Credit card info
196 196
 	);
197 197
 
198 198
 	//Validate Honeypot First
199
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
200
-		give_set_error( 'invalid_honeypot', __( 'Honeypot field detected. Go away bad bot!', 'give' ) );
199
+	if ( ! empty($_POST['give-honeypot'])) {
200
+		give_set_error('invalid_honeypot', __('Honeypot field detected. Go away bad bot!', 'give'));
201 201
 	}
202 202
 
203 203
 	// Validate agree to terms
204
-	$terms_option = get_post_meta( $form_id, '_give_terms_option', true );
205
-	if ( isset( $terms_option ) && $terms_option === 'yes' ) {
204
+	$terms_option = get_post_meta($form_id, '_give_terms_option', true);
205
+	if (isset($terms_option) && $terms_option === 'yes') {
206 206
 		give_purchase_form_validate_agree_to_terms();
207 207
 	}
208 208
 
209
-	if ( is_user_logged_in() ) {
209
+	if (is_user_logged_in()) {
210 210
 		// Collect logged in user data
211 211
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
212
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
212
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
213 213
 		// Set new user registration as required
214 214
 		$valid_data['need_new_user'] = true;
215 215
 		// Validate new user data
216 216
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
217 217
 		// Check if login validation is needed
218
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
218
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
219 219
 		// Set user login as required
220 220
 		$valid_data['need_user_login'] = true;
221 221
 		// Validate users login info
@@ -240,37 +240,37 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function give_purchase_form_validate_gateway() {
242 242
 
243
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
244
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
245
-	$gateway = give_get_default_gateway( $form_id );
243
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
244
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
245
+	$gateway = give_get_default_gateway($form_id);
246 246
 
247 247
 	// Check if a gateway value is present
248
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
248
+	if ( ! empty($_REQUEST['give-gateway'])) {
249 249
 
250
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
250
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
251 251
 
252 252
 		//Is amount being donated in LIVE mode 0.00? If so, error:
253
-		if ( $amount == 0 && ! give_is_test_mode() ) {
253
+		if ($amount == 0 && ! give_is_test_mode()) {
254 254
 
255
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
255
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
256 256
 
257 257
 		} //Check for a minimum custom amount
258
-		elseif ( ! give_verify_minimum_price() ) {
258
+		elseif ( ! give_verify_minimum_price()) {
259 259
 
260
-			$minimum       = give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) );
261
-			$error_message = __( 'This form has a minimum donation amount of %s', 'give' );
260
+			$minimum       = give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)));
261
+			$error_message = __('This form has a minimum donation amount of %s', 'give');
262 262
 
263
-			give_set_error( 'invalid_donation_minimum', sprintf( $error_message, $minimum ) );
263
+			give_set_error('invalid_donation_minimum', sprintf($error_message, $minimum));
264 264
 
265 265
 		} //Is this test mode zero donation? Let it through but set to manual gateway
266
-		elseif ( $amount == 0 && give_is_test_mode() ) {
266
+		elseif ($amount == 0 && give_is_test_mode()) {
267 267
 
268 268
 			$gateway = 'manual';
269 269
 
270 270
 		} //Check if this gateway is active
271
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
271
+		elseif ( ! give_is_gateway_active($gateway)) {
272 272
 
273
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) );
273
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give'));
274 274
 
275 275
 		}
276 276
 
@@ -289,23 +289,23 @@  discard block
 block discarded – undo
289 289
  */
290 290
 function give_verify_minimum_price() {
291 291
 
292
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
293
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
294
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
295
-	$variable_prices = give_has_variable_prices( $form_id );
292
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
293
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
294
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
295
+	$variable_prices = give_has_variable_prices($form_id);
296 296
 
297
-	if ( $variable_prices && ! empty( $price_id ) ) {
297
+	if ($variable_prices && ! empty($price_id)) {
298 298
 
299
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
299
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
300 300
 
301
-		if ( $price_level_amount == $amount ) {
301
+		if ($price_level_amount == $amount) {
302 302
 			return true;
303 303
 		}
304 304
 	}
305 305
 
306
-	$minimum = give_get_form_minimum_price( $form_id );
306
+	$minimum = give_get_form_minimum_price($form_id);
307 307
 
308
-	if ( $minimum > $amount ) {
308
+	if ($minimum > $amount) {
309 309
 		return false;
310 310
 	}
311 311
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
  */
322 322
 function give_purchase_form_validate_agree_to_terms() {
323 323
 	// Validate agree to terms
324
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
324
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
325 325
 		// User did not agree
326
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) );
326
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give')));
327 327
 	}
328 328
 }
329 329
 
@@ -337,47 +337,47 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @return      array
339 339
  */
340
-function give_purchase_form_required_fields( $form_id ) {
340
+function give_purchase_form_required_fields($form_id) {
341 341
 
342
-	$payment_mode = give_get_chosen_gateway( $form_id );
342
+	$payment_mode = give_get_chosen_gateway($form_id);
343 343
 
344 344
 	$required_fields = array(
345 345
 		'give_email' => array(
346 346
 			'error_id'      => 'invalid_email',
347
-			'error_message' => __( 'Please enter a valid email address.', 'give' )
347
+			'error_message' => __('Please enter a valid email address.', 'give')
348 348
 		),
349 349
 		'give_first' => array(
350 350
 			'error_id'      => 'invalid_first_name',
351
-			'error_message' => __( 'Please enter your first name.', 'give' )
351
+			'error_message' => __('Please enter your first name.', 'give')
352 352
 		)
353 353
 	);
354 354
 
355
-	$require_address = give_require_billing_address( $payment_mode );
355
+	$require_address = give_require_billing_address($payment_mode);
356 356
 
357
-	if ( $require_address ) {
358
-		$required_fields['card_address']    = array(
357
+	if ($require_address) {
358
+		$required_fields['card_address'] = array(
359 359
 			'error_id'      => 'invalid_card_address',
360
-			'error_message' => __( 'Please enter your primary billing address.', 'give' )
360
+			'error_message' => __('Please enter your primary billing address.', 'give')
361 361
 		);
362
-		$required_fields['card_zip']        = array(
362
+		$required_fields['card_zip'] = array(
363 363
 			'error_id'      => 'invalid_zip_code',
364
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' )
364
+			'error_message' => __('Please enter your zip / postal code.', 'give')
365 365
 		);
366
-		$required_fields['card_city']       = array(
366
+		$required_fields['card_city'] = array(
367 367
 			'error_id'      => 'invalid_city',
368
-			'error_message' => __( 'Please enter your billing city.', 'give' )
368
+			'error_message' => __('Please enter your billing city.', 'give')
369 369
 		);
370 370
 		$required_fields['billing_country'] = array(
371 371
 			'error_id'      => 'invalid_country',
372
-			'error_message' => __( 'Please select your billing country.', 'give' )
372
+			'error_message' => __('Please select your billing country.', 'give')
373 373
 		);
374
-		$required_fields['card_state']      = array(
374
+		$required_fields['card_state'] = array(
375 375
 			'error_id'      => 'invalid_state',
376
-			'error_message' => __( 'Please enter billing state / province.', 'give' )
376
+			'error_message' => __('Please enter billing state / province.', 'give')
377 377
 		);
378 378
 	}
379 379
 
380
-	return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id );
380
+	return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id);
381 381
 
382 382
 }
383 383
 
@@ -390,16 +390,16 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return mixed|void
392 392
  */
393
-function give_require_billing_address( $payment_mode ) {
393
+function give_require_billing_address($payment_mode) {
394 394
 
395 395
 	$return = false;
396 396
 
397
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
397
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
398 398
 		$return = true;
399 399
 	}
400 400
 
401 401
 	// Let payment gateways and other extensions determine if address fields should be required
402
-	return apply_filters( 'give_require_billing_address', $return );
402
+	return apply_filters('give_require_billing_address', $return);
403 403
 
404 404
 }
405 405
 
@@ -413,43 +413,43 @@  discard block
 block discarded – undo
413 413
 function give_purchase_form_validate_logged_in_user() {
414 414
 	global $user_ID;
415 415
 
416
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
416
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
417 417
 
418 418
 	// Start empty array to collect valid user data
419 419
 	$valid_user_data = array(
420 420
 		// Assume there will be errors
421
-		'user_id' => - 1
421
+		'user_id' => -1
422 422
 	);
423 423
 
424 424
 	// Verify there is a user_ID
425
-	if ( $user_ID > 0 ) {
425
+	if ($user_ID > 0) {
426 426
 		// Get the logged in user data
427
-		$user_data = get_userdata( $user_ID );
427
+		$user_data = get_userdata($user_ID);
428 428
 
429 429
 		// Loop through required fields and show error messages
430
-		foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
431
-			if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
432
-				give_set_error( $value['error_id'], $value['error_message'] );
430
+		foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
431
+			if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
432
+				give_set_error($value['error_id'], $value['error_message']);
433 433
 			}
434 434
 		}
435 435
 
436 436
 		// Verify data
437
-		if ( $user_data ) {
437
+		if ($user_data) {
438 438
 			// Collected logged in user data
439 439
 			$valid_user_data = array(
440 440
 				'user_id'    => $user_ID,
441
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
442
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
443
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
441
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
442
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
443
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
444 444
 			);
445 445
 
446
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
447
-				give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
446
+			if ( ! is_email($valid_user_data['user_email'])) {
447
+				give_set_error('email_invalid', __('Invalid email', 'give'));
448 448
 			}
449 449
 
450 450
 		} else {
451 451
 			// Set invalid user error
452
-			give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) );
452
+			give_set_error('invalid_user', __('The user information is invalid', 'give'));
453 453
 		}
454 454
 	}
455 455
 
@@ -467,90 +467,90 @@  discard block
 block discarded – undo
467 467
 function give_purchase_form_validate_new_user() {
468 468
 
469 469
 	$registering_new_user = false;
470
-	$form_id              = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
470
+	$form_id              = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
471 471
 
472 472
 	// Start an empty array to collect valid user data
473 473
 	$valid_user_data = array(
474 474
 		// Assume there will be errors
475
-		'user_id'    => - 1,
475
+		'user_id'    => -1,
476 476
 		// Get first name
477
-		'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '',
477
+		'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '',
478 478
 		// Get last name
479
-		'user_last'  => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '',
479
+		'user_last'  => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '',
480 480
 	);
481 481
 
482 482
 	// Check the new user's credentials against existing ones
483
-	$user_login   = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false;
484
-	$user_email   = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false;
485
-	$user_pass    = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false;
486
-	$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;
483
+	$user_login   = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false;
484
+	$user_email   = isset($_POST['give_email']) ? trim($_POST['give_email']) : false;
485
+	$user_pass    = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false;
486
+	$pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false;
487 487
 
488 488
 	// Loop through required fields and show error messages
489
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
490
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
491
-			give_set_error( $value['error_id'], $value['error_message'] );
489
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
490
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
491
+			give_set_error($value['error_id'], $value['error_message']);
492 492
 		}
493 493
 	}
494 494
 
495 495
 	// Check if we have an username to register
496
-	if ( $user_login && strlen( $user_login ) > 0 ) {
496
+	if ($user_login && strlen($user_login) > 0) {
497 497
 		$registering_new_user = true;
498 498
 
499 499
 		// We have an user name, check if it already exists
500
-		if ( username_exists( $user_login ) ) {
500
+		if (username_exists($user_login)) {
501 501
 			// Username already registered
502
-			give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) );
502
+			give_set_error('username_unavailable', __('Username already taken', 'give'));
503 503
 			// Check if it's valid
504
-		} else if ( ! give_validate_username( $user_login ) ) {
504
+		} else if ( ! give_validate_username($user_login)) {
505 505
 			// Invalid username
506
-			if ( is_multisite() ) {
507
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) );
506
+			if (is_multisite()) {
507
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give'));
508 508
 			} else {
509
-				give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) );
509
+				give_set_error('username_invalid', __('Invalid username', 'give'));
510 510
 			}
511 511
 		} else {
512 512
 			// All the checks have run and it's good to go
513 513
 			$valid_user_data['user_login'] = $user_login;
514 514
 		}
515
-	} elseif ( give_logged_in_only( $form_id ) ) {
516
-		give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation', 'give' ) );
515
+	} elseif (give_logged_in_only($form_id)) {
516
+		give_set_error('registration_required', esc_html__('You must register or login to complete your donation', 'give'));
517 517
 	}
518 518
 
519 519
 	// Check if we have an email to verify
520
-	if ( $user_email && strlen( $user_email ) > 0 ) {
520
+	if ($user_email && strlen($user_email) > 0) {
521 521
 		// Validate email
522
-		if ( ! is_email( $user_email ) ) {
523
-			give_set_error( 'email_invalid', __( 'Sorry, that email is invalid', 'give' ) );
522
+		if ( ! is_email($user_email)) {
523
+			give_set_error('email_invalid', __('Sorry, that email is invalid', 'give'));
524 524
 			// Check if email exists
525
-		} else if ( email_exists( $user_email ) && $registering_new_user ) {
526
-			give_set_error( 'email_used', __( 'Sorry, that email already active for another user', 'give' ) );
525
+		} else if (email_exists($user_email) && $registering_new_user) {
526
+			give_set_error('email_used', __('Sorry, that email already active for another user', 'give'));
527 527
 		} else {
528 528
 			// All the checks have run and it's good to go
529 529
 			$valid_user_data['user_email'] = $user_email;
530 530
 		}
531 531
 	} else {
532 532
 		// No email
533
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
533
+		give_set_error('email_empty', __('Enter an email', 'give'));
534 534
 	}
535 535
 
536 536
 	// Check password
537
-	if ( $user_pass && $pass_confirm ) {
537
+	if ($user_pass && $pass_confirm) {
538 538
 		// Verify confirmation matches
539
-		if ( $user_pass != $pass_confirm ) {
539
+		if ($user_pass != $pass_confirm) {
540 540
 			// Passwords do not match
541
-			give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) );
541
+			give_set_error('password_mismatch', __('Passwords don\'t match', 'give'));
542 542
 		} else {
543 543
 			// All is good to go
544 544
 			$valid_user_data['user_pass'] = $user_pass;
545 545
 		}
546 546
 	} else {
547 547
 		// Password or confirmation missing
548
-		if ( ! $user_pass && $registering_new_user ) {
548
+		if ( ! $user_pass && $registering_new_user) {
549 549
 			// The password is invalid
550
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
551
-		} else if ( ! $pass_confirm && $registering_new_user ) {
550
+			give_set_error('password_empty', __('Enter a password', 'give'));
551
+		} else if ( ! $pass_confirm && $registering_new_user) {
552 552
 			// Confirmation password is invalid
553
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) );
553
+			give_set_error('confirmation_empty', __('Enter the password confirmation', 'give'));
554 554
 		}
555 555
 	}
556 556
 
@@ -569,36 +569,36 @@  discard block
 block discarded – undo
569 569
 	// Start an array to collect valid user data
570 570
 	$valid_user_data = array(
571 571
 		// Assume there will be errors
572
-		'user_id' => - 1
572
+		'user_id' => -1
573 573
 	);
574 574
 
575 575
 	// Username
576
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
577
-		give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) );
576
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
577
+		give_set_error('must_log_in', __('You must login or register to complete your donation', 'give'));
578 578
 
579 579
 		return $valid_user_data;
580 580
 	}
581 581
 
582 582
 	// Get the user by login
583
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
583
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
584 584
 
585 585
 	// Check if user exists
586
-	if ( $user_data ) {
586
+	if ($user_data) {
587 587
 		// Get password
588
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
588
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
589 589
 
590 590
 		// Check user_pass
591
-		if ( $user_pass ) {
591
+		if ($user_pass) {
592 592
 			// Check if password is valid
593
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
593
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
594 594
 				// Incorrect password
595 595
 				give_set_error(
596 596
 					'password_incorrect',
597 597
 					sprintf(
598 598
 						'%1$s <a href="%2$s">%3$s</a>',
599
-						__( 'The password you entered is incorrect.', 'give' ),
600
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
601
-						__( 'Reset Password', 'give' )
599
+						__('The password you entered is incorrect.', 'give'),
600
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
601
+						__('Reset Password', 'give')
602 602
 					)
603 603
 				);
604 604
 				// All is correct
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 			}
616 616
 		} else {
617 617
 			// Empty password
618
-			give_set_error( 'password_empty', __( 'Enter a password', 'give' ) );
618
+			give_set_error('password_empty', __('Enter a password', 'give'));
619 619
 		}
620 620
 	} else {
621 621
 		// no username
622
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) );
622
+		give_set_error('username_incorrect', __('The username you entered does not exist', 'give'));
623 623
 	}
624 624
 
625 625
 	return $valid_user_data;
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
  */
635 635
 function give_purchase_form_validate_guest_user() {
636 636
 
637
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
637
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
638 638
 
639 639
 	// Start an array to collect valid user data
640 640
 	$valid_user_data = array(
@@ -643,32 +643,32 @@  discard block
 block discarded – undo
643 643
 	);
644 644
 
645 645
 	// Show error message if user must be logged in
646
-	if ( give_logged_in_only( $form_id ) ) {
647
-		give_set_error( 'logged_in_only', __( 'You must be logged into to donate', 'give' ) );
646
+	if (give_logged_in_only($form_id)) {
647
+		give_set_error('logged_in_only', __('You must be logged into to donate', 'give'));
648 648
 	}
649 649
 
650 650
 	// Get the guest email
651
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
651
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
652 652
 
653 653
 	// Check email
654
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
654
+	if ($guest_email && strlen($guest_email) > 0) {
655 655
 		// Validate email
656
-		if ( ! is_email( $guest_email ) ) {
656
+		if ( ! is_email($guest_email)) {
657 657
 			// Invalid email
658
-			give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
658
+			give_set_error('email_invalid', __('Invalid email', 'give'));
659 659
 		} else {
660 660
 			// All is good to go
661 661
 			$valid_user_data['user_email'] = $guest_email;
662 662
 		}
663 663
 	} else {
664 664
 		// No email
665
-		give_set_error( 'email_empty', __( 'Enter an email', 'give' ) );
665
+		give_set_error('email_empty', __('Enter an email', 'give'));
666 666
 	}
667 667
 
668 668
 	// Loop through required fields and show error messages
669
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
670
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
671
-			give_set_error( $value['error_id'], $value['error_message'] );
669
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
670
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
671
+			give_set_error($value['error_id'], $value['error_message']);
672 672
 		}
673 673
 	}
674 674
 
@@ -684,42 +684,42 @@  discard block
 block discarded – undo
684 684
  * @since   1.0
685 685
  * @return  integer
686 686
  */
687
-function give_register_and_login_new_user( $user_data = array() ) {
687
+function give_register_and_login_new_user($user_data = array()) {
688 688
 	// Verify the array
689
-	if ( empty( $user_data ) ) {
690
-		return - 1;
689
+	if (empty($user_data)) {
690
+		return -1;
691 691
 	}
692 692
 
693
-	if ( give_get_errors() ) {
694
-		return - 1;
693
+	if (give_get_errors()) {
694
+		return -1;
695 695
 	}
696 696
 
697
-	$user_args = apply_filters( 'give_insert_user_args', array(
698
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
699
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
700
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
701
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
702
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
703
-		'user_registered' => date( 'Y-m-d H:i:s' ),
704
-		'role'            => get_option( 'default_role' )
705
-	), $user_data );
697
+	$user_args = apply_filters('give_insert_user_args', array(
698
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
699
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
700
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
701
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
702
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
703
+		'user_registered' => date('Y-m-d H:i:s'),
704
+		'role'            => get_option('default_role')
705
+	), $user_data);
706 706
 
707 707
 	// Insert new user
708
-	$user_id = wp_insert_user( $user_args );
708
+	$user_id = wp_insert_user($user_args);
709 709
 
710 710
 	// Validate inserted user
711
-	if ( is_wp_error( $user_id ) ) {
712
-		return - 1;
711
+	if (is_wp_error($user_id)) {
712
+		return -1;
713 713
 	}
714 714
 
715 715
 	// Allow themes and plugins to filter the user data
716
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
716
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
717 717
 
718 718
 	// Allow themes and plugins to hook
719
-	do_action( 'give_insert_user', $user_id, $user_data );
719
+	do_action('give_insert_user', $user_id, $user_data);
720 720
 
721 721
 	// Login new user
722
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
722
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
723 723
 
724 724
 	// Return user id
725 725
 	return $user_id;
@@ -734,27 +734,27 @@  discard block
 block discarded – undo
734 734
  * @since   1.0
735 735
  * @return  array
736 736
  */
737
-function give_get_purchase_form_user( $valid_data = array() ) {
737
+function give_get_purchase_form_user($valid_data = array()) {
738 738
 
739 739
 	// Initialize user
740 740
 	$user    = false;
741
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
741
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
742 742
 
743
-	if ( $is_ajax ) {
743
+	if ($is_ajax) {
744 744
 		// Do not create or login the user during the ajax submission (check for errors only)
745 745
 		return true;
746
-	} else if ( is_user_logged_in() ) {
746
+	} else if (is_user_logged_in()) {
747 747
 		// Set the valid user as the logged in collected data
748 748
 		$user = $valid_data['logged_in_user'];
749
-	} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
749
+	} else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
750 750
 		// New user registration
751
-		if ( $valid_data['need_new_user'] === true ) {
751
+		if ($valid_data['need_new_user'] === true) {
752 752
 			// Set user
753 753
 			$user = $valid_data['new_user_data'];
754 754
 			// Register and login new user
755
-			$user['user_id'] = give_register_and_login_new_user( $user );
755
+			$user['user_id'] = give_register_and_login_new_user($user);
756 756
 			// User login
757
-		} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
757
+		} else if ($valid_data['need_user_login'] === true && ! $is_ajax) {
758 758
 
759 759
 			/*
760 760
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -769,48 +769,48 @@  discard block
 block discarded – undo
769 769
 			// Set user
770 770
 			$user = $valid_data['login_user_data'];
771 771
 			// Login user
772
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
772
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
773 773
 		}
774 774
 	}
775 775
 
776 776
 	// Check guest checkout
777
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
777
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
778 778
 		// Set user
779 779
 		$user = $valid_data['guest_user_data'];
780 780
 	}
781 781
 
782 782
 	// Verify we have an user
783
-	if ( false === $user || empty( $user ) ) {
783
+	if (false === $user || empty($user)) {
784 784
 		// Return false
785 785
 		return false;
786 786
 	}
787 787
 
788 788
 	// Get user first name
789
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
790
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
789
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
790
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
791 791
 	}
792 792
 
793 793
 	// Get user last name
794
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
795
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
794
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
795
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
796 796
 	}
797 797
 
798 798
 	// Get the user's billing address details
799 799
 	$user['address']            = array();
800
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
801
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
802
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
803
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
804
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
805
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
806
-
807
-	if ( empty( $user['address']['country'] ) ) {
800
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
801
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
802
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
803
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
804
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
805
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
806
+
807
+	if (empty($user['address']['country'])) {
808 808
 		$user['address'] = false;
809 809
 	} // Country will always be set if address fields are present
810 810
 
811
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
811
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
812 812
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases
813
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
813
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
814 814
 	}
815 815
 
816 816
 	// Return valid user
@@ -829,16 +829,16 @@  discard block
 block discarded – undo
829 829
 	$card_data = give_get_purchase_cc_info();
830 830
 
831 831
 	// Validate the card zip
832
-	if ( ! empty( $card_data['card_zip'] ) ) {
833
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
834
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) );
832
+	if ( ! empty($card_data['card_zip'])) {
833
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
834
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give'));
835 835
 		}
836 836
 	}
837 837
 
838 838
 	//Ensure no spaces
839
-	if ( ! empty( $card_data['card_number'] ) ) {
840
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs
841
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
839
+	if ( ! empty($card_data['card_number'])) {
840
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs
841
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
842 842
 	}
843 843
 
844 844
 	// This should validate card numbers at some point too
@@ -854,17 +854,17 @@  discard block
 block discarded – undo
854 854
  */
855 855
 function give_get_purchase_cc_info() {
856 856
 	$cc_info                   = array();
857
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
858
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
859
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
860
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
861
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
862
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
863
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
864
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
865
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
866
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
867
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
857
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
858
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
859
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
860
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
861
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
862
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
863
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
864
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
865
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
866
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
867
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
868 868
 
869 869
 	// Return cc info
870 870
 	return $cc_info;
@@ -880,14 +880,14 @@  discard block
 block discarded – undo
880 880
  *
881 881
  * @return bool|mixed|void
882 882
  */
883
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
883
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
884 884
 	$ret = false;
885 885
 
886
-	if ( empty( $zip ) || empty( $country_code ) ) {
886
+	if (empty($zip) || empty($country_code)) {
887 887
 		return $ret;
888 888
 	}
889 889
 
890
-	$country_code = strtoupper( $country_code );
890
+	$country_code = strtoupper($country_code);
891 891
 
892 892
 	$zip_regex = array(
893 893
 		"AD" => "AD\d{3}",
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
 		"ZM" => "\d{5}"
1048 1048
 	);
1049 1049
 
1050
-	if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) {
1050
+	if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) {
1051 1051
 		$ret = true;
1052 1052
 	}
1053 1053
 
1054
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1054
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1055 1055
 }
1056 1056
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +398 added lines, -398 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,64 +23,64 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55
-	) );
55
+	));
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? ' float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
80
+		'give-form-'.$form->ID,
81 81
 		$float_labels_option
82
-	), $form->ID, $args );
83
-	$form_classes       = implode( ' ', $form_classes_array );
82
+	), $form->ID, $args);
83
+	$form_classes = implode(' ', $form_classes_array);
84 84
 
85 85
 
86 86
 	ob_start();
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 * @param int $form ->ID The current form ID
94 94
 	 * @param array $args An array of form args
95 95
 	 */
96
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
96
+	do_action('give_pre_form_output', $form->ID, $args); ?>
97 97
 
98 98
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
99 99
 
100
-		<?php if ( $form->is_close_donation_form() ) {
100
+		<?php if ($form->is_close_donation_form()) {
101 101
 
102 102
 			//Get Goal thank you message.
103
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
104
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
103
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
104
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our fundraising goal.', 'give');
105 105
 
106 106
 			//Print thank you message.
107
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
107
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
108 108
 
109 109
 		} else {
110 110
 
111
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
111
+			if (isset($args['show_title']) && $args['show_title'] == true) {
112 112
 
113
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
113
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
114 114
 
115 115
 			}
116 116
 
117
-			do_action( 'give_pre_form', $form->ID, $args ); ?>
117
+			do_action('give_pre_form', $form->ID, $args); ?>
118 118
 
119 119
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
120 120
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
121
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
122
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
123
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
124
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
121
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
122
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
123
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
124
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
125 125
 
126 126
 				<!-- The following field is for robots only, invisible to humans: -->
127 127
 				<span class="give-hidden" style="display: none !important;">
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 				<?php
133 133
 
134 134
 				//Price ID hidden field for variable (mult-level) donation forms
135
-				if ( give_has_variable_prices( $form_id ) ) {
135
+				if (give_has_variable_prices($form_id)) {
136 136
 					//get default selected price ID
137
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
137
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
138 138
 					$price_id = 0;
139 139
 					//loop through prices
140
-					foreach ( $prices as $price ) {
141
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
140
+					foreach ($prices as $price) {
141
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
142 142
 							$price_id = $price['_give_id']['level_id'];
143 143
 						};
144 144
 					}
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
147 147
 				<?php }
148 148
 
149
-				do_action( 'give_checkout_form_top', $form->ID, $args );
149
+				do_action('give_checkout_form_top', $form->ID, $args);
150 150
 
151
-				do_action( 'give_payment_mode_select', $form->ID, $args );
151
+				do_action('give_payment_mode_select', $form->ID, $args);
152 152
 
153
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
153
+				do_action('give_checkout_form_bottom', $form->ID, $args);
154 154
 
155 155
 				?>
156 156
 			</form>
157 157
 
158
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
158
+			<?php do_action('give_post_form', $form->ID, $args); ?>
159 159
 
160 160
 		<?php } ?>
161 161
 
162
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
162
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
163 163
 	<?php
164 164
 
165 165
 	/**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 * @param int $form ->ID The current form ID
171 171
 	 * @param array $args An array of form args
172 172
 	 */
173
-	do_action( 'give_post_form_output', $form->ID, $args );
173
+	do_action('give_post_form_output', $form->ID, $args);
174 174
 
175 175
 	$final_output = ob_get_clean();
176 176
 
177
-	echo apply_filters( 'give_donate_form', $final_output, $args );
177
+	echo apply_filters('give_donate_form', $final_output, $args);
178 178
 }
179 179
 
180 180
 
@@ -194,43 +194,43 @@  discard block
 block discarded – undo
194 194
  * @global    $give_options Array of all the Give options
195 195
  * @return string
196 196
  */
197
-function give_show_purchase_form( $form_id ) {
197
+function give_show_purchase_form($form_id) {
198 198
 
199
-	$payment_mode = give_get_chosen_gateway( $form_id );
199
+	$payment_mode = give_get_chosen_gateway($form_id);
200 200
 
201
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
201
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
202 202
 		$form_id = $_POST['give_form_id'];
203 203
 	}
204 204
 
205
-	do_action( 'give_purchase_form_top', $form_id );
205
+	do_action('give_purchase_form_top', $form_id);
206 206
 
207
-	if ( give_can_checkout() && isset( $form_id ) ) {
207
+	if (give_can_checkout() && isset($form_id)) {
208 208
 
209
-		do_action( 'give_purchase_form_before_register_login', $form_id );
209
+		do_action('give_purchase_form_before_register_login', $form_id);
210 210
 
211
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
211
+		do_action('give_purchase_form_register_login_fields', $form_id);
212 212
 
213
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
213
+		do_action('give_purchase_form_before_cc_form', $form_id);
214 214
 
215 215
 		// Load the credit card form and allow gateways to load their own if they wish
216
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
217
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
216
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
217
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
218 218
 		} else {
219
-			do_action( 'give_cc_form', $form_id );
219
+			do_action('give_cc_form', $form_id);
220 220
 		}
221 221
 
222
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
222
+		do_action('give_purchase_form_after_cc_form', $form_id);
223 223
 
224 224
 	} else {
225 225
 		// Can't checkout
226
-		do_action( 'give_purchase_form_no_access', $form_id );
226
+		do_action('give_purchase_form_no_access', $form_id);
227 227
 
228 228
 	}
229 229
 
230
-	do_action( 'give_purchase_form_bottom', $form_id );
230
+	do_action('give_purchase_form_bottom', $form_id);
231 231
 }
232 232
 
233
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
233
+add_action('give_purchase_form', 'give_show_purchase_form');
234 234
 
235 235
 /**
236 236
  *
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return void
244 244
  */
245
-function give_show_register_login_fields( $form_id ) {
245
+function give_show_register_login_fields($form_id) {
246 246
 
247
-	$show_register_form = give_show_login_register_option( $form_id );
247
+	$show_register_form = give_show_login_register_option($form_id);
248 248
 
249
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
249
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
250 250
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
251
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
251
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
252 252
 		</div>
253
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
253
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
254 254
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
255
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
255
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
256 256
 		</div>
257 257
 	<?php endif; ?>
258 258
 
259
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
260
-		do_action( 'give_purchase_form_after_user_info', $form_id );
259
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
260
+		do_action('give_purchase_form_after_user_info', $form_id);
261 261
 	}
262 262
 }
263 263
 
264
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
264
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
265 265
 
266 266
 /**
267 267
  * Donation Amount Field
@@ -275,33 +275,33 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @return void
277 277
  */
278
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
278
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
279 279
 
280 280
 	global $give_options;
281 281
 
282
-	$variable_pricing    = give_has_variable_prices( $form_id );
283
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
284
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
285
-	$symbol              = give_currency_symbol( give_get_currency() );
286
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
287
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
288
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
282
+	$variable_pricing    = give_has_variable_prices($form_id);
283
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
284
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
285
+	$symbol              = give_currency_symbol(give_get_currency());
286
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
287
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
288
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
289 289
 
290
-	do_action( 'give_before_donation_levels', $form_id, $args );
290
+	do_action('give_before_donation_levels', $form_id, $args);
291 291
 
292 292
 	//Set Price, No Custom Amount Allowed means hidden price field
293
-	if ( $allow_custom_amount == 'no' ) {
293
+	if ($allow_custom_amount == 'no') {
294 294
 		?>
295 295
 
296
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
296
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
297 297
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
298 298
 		       value="<?php echo $default_amount; ?>" required>
299 299
 		<div class="set-price give-donation-amount form-row-wide">
300
-			<?php if ( $currency_position == 'before' ) {
300
+			<?php if ($currency_position == 'before') {
301 301
 				echo $currency_output;
302 302
 			} ?>
303 303
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
304
-			<?php if ( $currency_position == 'after' ) {
304
+			<?php if ($currency_position == 'after') {
305 305
 				echo $currency_output;
306 306
 			} ?>
307 307
 		</div>
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		?>
312 312
 		<div class="give-total-wrap">
313 313
 			<div class="give-donation-amount form-row-wide">
314
-				<?php if ( $currency_position == 'before' ) {
314
+				<?php if ($currency_position == 'before') {
315 315
 					echo $currency_output;
316 316
 				} ?>
317
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
317
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
318 318
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
319
-				<?php if ( $currency_position == 'after' ) {
319
+				<?php if ($currency_position == 'after') {
320 320
 					echo $currency_output;
321 321
 				} ?>
322 322
 			</div>
323 323
 		</div>
324 324
 	<?php }
325 325
 
326
-	do_action( 'give_after_donation_amount', $form_id, $args );
326
+	do_action('give_after_donation_amount', $form_id, $args);
327 327
 
328 328
 	//Custom Amount Text
329
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
329
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
330 330
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
331 331
 	<?php }
332 332
 
333 333
 	//Output Variable Pricing Levels
334
-	if ( $variable_pricing ) {
335
-		give_output_levels( $form_id );
334
+	if ($variable_pricing) {
335
+		give_output_levels($form_id);
336 336
 	}
337 337
 
338
-	do_action( 'give_after_donation_levels', $form_id, $args );
338
+	do_action('give_after_donation_levels', $form_id, $args);
339 339
 }
340 340
 
341
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
341
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
342 342
 
343 343
 
344 344
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  *
351 351
  * @return string
352 352
  */
353
-function give_output_levels( $form_id ) {
353
+function give_output_levels($form_id) {
354 354
 
355 355
 	//Get variable pricing
356
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
357
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
358
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
359
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
360
-	if ( empty( $custom_amount_text ) ) {
361
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
356
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
357
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
358
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
359
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
360
+	if (empty($custom_amount_text)) {
361
+		$custom_amount_text = __('Give a Custom Amount', 'give');
362 362
 	}
363 363
 
364 364
 	$output  = '';
365 365
 	$counter = 0;
366 366
 
367
-	switch ( $display_style ) {
367
+	switch ($display_style) {
368 368
 		case 'buttons':
369 369
 
370 370
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
371 371
 
372
-			foreach ( $prices as $price ) {
373
-				$counter ++;
374
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
375
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
372
+			foreach ($prices as $price) {
373
+				$counter++;
374
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
375
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
376 376
 
377 377
 				$output .= '<li>';
378
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
378
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
379 379
 				$output .= $level_text;
380 380
 				$output .= '</button>';
381 381
 				$output .= '</li>';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 
385 385
 			//Custom Amount
386
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
386
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
387 387
 				$output .= '<li>';
388 388
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
389 389
 				$output .= $custom_amount_text;
@@ -399,23 +399,23 @@  discard block
 block discarded – undo
399 399
 
400 400
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
401 401
 
402
-			foreach ( $prices as $price ) {
403
-				$counter ++;
404
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
405
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
402
+			foreach ($prices as $price) {
403
+				$counter++;
404
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
405
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
406 406
 
407 407
 				$output .= '<li>';
408
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
409
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
408
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
409
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
410 410
 				$output .= '</li>';
411 411
 
412 412
 			}
413 413
 
414 414
 			//Custom Amount
415
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
415
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
416 416
 				$output .= '<li>';
417 417
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
418
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
418
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
419 419
 				$output .= '</li>';
420 420
 			}
421 421
 
@@ -425,23 +425,23 @@  discard block
 block discarded – undo
425 425
 
426 426
 		case 'dropdown':
427 427
 
428
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
429
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
428
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
429
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
430 430
 
431 431
 			//first loop through prices
432
-			foreach ( $prices as $price ) {
433
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
434
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
432
+			foreach ($prices as $price) {
433
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
434
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
435 435
 
436
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
436
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
437 437
 				$output .= $level_text;
438 438
 				$output .= '</option>';
439 439
 
440 440
 			}
441 441
 
442 442
 			//Custom Amount
443
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
444
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
443
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
444
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
445 445
 			}
446 446
 
447 447
 			$output .= '</select>';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 			break;
450 450
 	}
451 451
 
452
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
452
+	echo apply_filters('give_form_level_output', $output, $form_id);
453 453
 }
454 454
 
455 455
 /**
@@ -461,26 +461,26 @@  discard block
 block discarded – undo
461 461
  * @param array $args
462 462
  *
463 463
  */
464
-function give_display_checkout_button( $form_id, $args ) {
464
+function give_display_checkout_button($form_id, $args) {
465 465
 
466
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
466
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
467 467
 		? $args['display_style']
468
-		: get_post_meta( $form_id, '_give_payment_display', true );
468
+		: get_post_meta($form_id, '_give_payment_display', true);
469 469
 
470 470
 	//no btn for onpage
471
-	if ( $display_option === 'onpage' ) {
471
+	if ($display_option === 'onpage') {
472 472
 		return;
473 473
 	}
474 474
 
475
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
476
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
475
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
476
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
477 477
 
478
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
478
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
479 479
 
480
-	echo apply_filters( 'give_display_checkout_button', $output );
480
+	echo apply_filters('give_display_checkout_button', $output);
481 481
 }
482 482
 
483
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
483
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
484 484
 
485 485
 /**
486 486
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -491,71 +491,71 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return void
493 493
  */
494
-function give_user_info_fields( $form_id ) {
494
+function give_user_info_fields($form_id) {
495 495
 
496
-	if ( is_user_logged_in() ) :
497
-		$user_data = get_userdata( get_current_user_id() );
496
+	if (is_user_logged_in()) :
497
+		$user_data = get_userdata(get_current_user_id());
498 498
 	endif;
499 499
 
500
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
500
+	do_action('give_purchase_form_before_personal_info', $form_id);
501 501
 	?>
502 502
 	<fieldset id="give_checkout_user_info">
503
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
503
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
504 504
 		<p id="give-first-name-wrap" class="form-row form-row-first">
505 505
 			<label class="give-label" for="give-first">
506
-				<?php _e( 'First Name', 'give' ); ?>
507
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
506
+				<?php _e('First Name', 'give'); ?>
507
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
508 508
 					<span class="give-required-indicator">*</span>
509 509
 				<?php } ?>
510
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
510
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
511 511
 			</label>
512
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
512
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
513 513
 				echo ' required ';
514 514
 			} ?>/>
515 515
 		</p>
516 516
 
517 517
 		<p id="give-last-name-wrap" class="form-row form-row-last">
518 518
 			<label class="give-label" for="give-last">
519
-				<?php _e( 'Last Name', 'give' ); ?>
520
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
519
+				<?php _e('Last Name', 'give'); ?>
520
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
521 521
 					<span class="give-required-indicator">*</span>
522 522
 				<?php } ?>
523
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
523
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
524 524
 			</label>
525 525
 
526
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
526
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
527 527
 				echo ' required';
528
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
528
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
529 529
 				echo ' required ';
530 530
 			} ?> />
531 531
 		</p>
532 532
 
533
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
533
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
534 534
 		<p id="give-email-wrap" class="form-row form-row-wide">
535 535
 			<label class="give-label" for="give-email">
536
-				<?php _e( 'Email Address', 'give' ); ?>
537
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
536
+				<?php _e('Email Address', 'give'); ?>
537
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
538 538
 					<span class="give-required-indicator">*</span>
539 539
 				<?php } ?>
540
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
540
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
541 541
 			</label>
542 542
 
543
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
543
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
544 544
 				echo ' required ';
545 545
 			} ?>/>
546 546
 
547 547
 		</p>
548
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
548
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
549 549
 
550
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
550
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
551 551
 	</fieldset>
552 552
 	<?php
553
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
553
+	do_action('give_purchase_form_after_personal_info', $form_id);
554 554
 
555 555
 }
556 556
 
557
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
558
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
557
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
558
+add_action('give_register_fields_before', 'give_user_info_fields');
559 559
 
560 560
 /**
561 561
  * Renders the credit card info form.
@@ -566,73 +566,73 @@  discard block
 block discarded – undo
566 566
  *
567 567
  * @return void
568 568
  */
569
-function give_get_cc_form( $form_id ) {
569
+function give_get_cc_form($form_id) {
570 570
 
571 571
 	ob_start();
572 572
 
573
-	do_action( 'give_before_cc_fields', $form_id ); ?>
573
+	do_action('give_before_cc_fields', $form_id); ?>
574 574
 
575 575
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
576
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
577
-		<?php if ( is_ssl() ) : ?>
576
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
577
+		<?php if (is_ssl()) : ?>
578 578
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
579 579
 				<span class="give-icon padlock"></span>
580
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
580
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
581 581
 			</div>
582 582
 		<?php endif; ?>
583 583
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
584 584
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
585
-				<?php _e( 'Card Number', 'give' ); ?>
585
+				<?php _e('Card Number', 'give'); ?>
586 586
 				<span class="give-required-indicator">*</span>
587
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
587
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
588 588
 				<span class="card-type"></span>
589 589
 			</label>
590 590
 
591
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
591
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
592 592
 		</p>
593 593
 
594 594
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
595 595
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
596
-				<?php _e( 'CVC', 'give' ); ?>
596
+				<?php _e('CVC', 'give'); ?>
597 597
 				<span class="give-required-indicator">*</span>
598
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
598
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
599 599
 			</label>
600 600
 
601
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/>
601
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/>
602 602
 		</p>
603 603
 
604 604
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
605 605
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
606
-				<?php _e( 'Name on the Card', 'give' ); ?>
606
+				<?php _e('Name on the Card', 'give'); ?>
607 607
 				<span class="give-required-indicator">*</span>
608
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
608
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
609 609
 			</label>
610 610
 
611
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/>
611
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/>
612 612
 		</p>
613
-		<?php do_action( 'give_before_cc_expiration' ); ?>
613
+		<?php do_action('give_before_cc_expiration'); ?>
614 614
 		<p class="card-expiration form-row form-row-one-third">
615 615
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
616
-				<?php _e( 'Expiration', 'give' ); ?>
616
+				<?php _e('Expiration', 'give'); ?>
617 617
 				<span class="give-required-indicator">*</span>
618
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
618
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
619 619
 			</label>
620 620
 
621 621
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
622 622
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
623 623
 
624
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/>
624
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/>
625 625
 		</p>
626
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
626
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
627 627
 
628 628
 	</fieldset>
629 629
 	<?php
630
-	do_action( 'give_after_cc_fields', $form_id );
630
+	do_action('give_after_cc_fields', $form_id);
631 631
 
632 632
 	echo ob_get_clean();
633 633
 }
634 634
 
635
-add_action( 'give_cc_form', 'give_get_cc_form' );
635
+add_action('give_cc_form', 'give_get_cc_form');
636 636
 
637 637
 /**
638 638
  * Outputs the default credit card address fields
@@ -643,110 +643,110 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return void
645 645
  */
646
-function give_default_cc_address_fields( $form_id ) {
646
+function give_default_cc_address_fields($form_id) {
647 647
 
648 648
 	$logged_in = is_user_logged_in();
649 649
 
650
-	if ( $logged_in ) {
651
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
650
+	if ($logged_in) {
651
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
652 652
 	}
653
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
654
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
655
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
656
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
653
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
654
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
655
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
656
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
657 657
 	ob_start(); ?>
658 658
 	<fieldset id="give_cc_address" class="cc-address">
659
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
660
-		<?php do_action( 'give_cc_billing_top' ); ?>
659
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
660
+		<?php do_action('give_cc_billing_top'); ?>
661 661
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
662 662
 			<label for="card_address" class="give-label">
663
-				<?php _e( 'Address', 'give' ); ?>
663
+				<?php _e('Address', 'give'); ?>
664 664
 				<?php
665
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
665
+				if (give_field_is_required('card_address', $form_id)) { ?>
666 666
 					<span class="give-required-indicator">*</span>
667 667
 				<?php } ?>
668
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
668
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
671
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
672 672
 				echo ' required';
673
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
673
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
674 674
 				echo '  required ';
675 675
 			} ?>/>
676 676
 		</p>
677 677
 
678 678
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
679 679
 			<label for="card_address_2" class="give-label">
680
-				<?php _e( 'Address Line 2', 'give' ); ?>
681
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
680
+				<?php _e('Address Line 2', 'give'); ?>
681
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
682 682
 					<span class="give-required-indicator">*</span>
683 683
 				<?php } ?>
684
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
684
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
685 685
 			</label>
686 686
 
687
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
687
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
688 688
 				echo ' required';
689
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
689
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
690 690
 				echo ' required ';
691 691
 			} ?>/>
692 692
 		</p>
693 693
 
694 694
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
695 695
 			<label for="card_city" class="give-label">
696
-				<?php _e( 'City', 'give' ); ?>
697
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
696
+				<?php _e('City', 'give'); ?>
697
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
698 698
 					<span class="give-required-indicator">*</span>
699 699
 				<?php } ?>
700
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
700
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
701 701
 			</label>
702
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
702
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
703 703
 				echo ' required';
704
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
704
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
705 705
 				echo ' required ';
706 706
 			} ?>/>
707 707
 		</p>
708 708
 
709 709
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
710 710
 			<label for="card_zip" class="give-label">
711
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
712
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
711
+				<?php _e('Zip / Postal Code', 'give'); ?>
712
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
713 713
 					<span class="give-required-indicator">*</span>
714 714
 				<?php } ?>
715
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
715
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
716 716
 			</label>
717 717
 
718
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
718
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
719 719
 				echo ' required';
720
-			} ?>" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
720
+			} ?>" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
721 721
 				echo ' required ';
722 722
 			} ?>/>
723 723
 		</p>
724 724
 
725 725
 		<p id="give-card-country-wrap" class="form-row form-row-first">
726 726
 			<label for="billing_country" class="give-label">
727
-				<?php _e( 'Country', 'give' ); ?>
728
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
727
+				<?php _e('Country', 'give'); ?>
728
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
729 729
 					<span class="give-required-indicator">*</span>
730 730
 				<?php } ?>
731
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
731
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
732 732
 			</label>
733 733
 
734
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
734
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
735 735
 				echo ' required';
736
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
736
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
737 737
 				echo ' required ';
738 738
 			} ?>>
739 739
 				<?php
740 740
 
741 741
 				$selected_country = give_get_country();
742 742
 
743
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
743
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
744 744
 					$selected_country = $user_address['country'];
745 745
 				}
746 746
 
747 747
 				$countries = give_get_country_list();
748
-				foreach ( $countries as $country_code => $country ) {
749
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
748
+				foreach ($countries as $country_code => $country) {
749
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
750 750
 				}
751 751
 				?>
752 752
 			</select>
@@ -754,44 +754,44 @@  discard block
 block discarded – undo
754 754
 
755 755
 		<p id="give-card-state-wrap" class="form-row form-row-last">
756 756
 			<label for="card_state" class="give-label">
757
-				<?php _e( 'State / Province', 'give' ); ?>
758
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
757
+				<?php _e('State / Province', 'give'); ?>
758
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
759 759
 					<span class="give-required-indicator">*</span>
760 760
 				<?php } ?>
761
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
761
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
762 762
 			</label>
763 763
 
764 764
 			<?php
765 765
 			$selected_state = give_get_state();
766
-			$states         = give_get_states( $selected_country );
766
+			$states         = give_get_states($selected_country);
767 767
 
768
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
768
+			if ($logged_in && ! empty($user_address['state'])) {
769 769
 				$selected_state = $user_address['state'];
770 770
 			}
771 771
 
772
-			if ( ! empty( $states ) ) : ?>
773
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
772
+			if ( ! empty($states)) : ?>
773
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
774 774
 					echo ' required';
775
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
775
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
776 776
 					echo ' required ';
777 777
 				} ?>>
778 778
 					<?php
779
-					foreach ( $states as $state_code => $state ) {
780
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
779
+					foreach ($states as $state_code => $state) {
780
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
781 781
 					}
782 782
 					?>
783 783
 				</select>
784 784
 			<?php else : ?>
785
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
785
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
786 786
 			<?php endif; ?>
787 787
 		</p>
788
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
788
+		<?php do_action('give_cc_billing_bottom'); ?>
789 789
 	</fieldset>
790 790
 	<?php
791 791
 	echo ob_get_clean();
792 792
 }
793 793
 
794
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
794
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
795 795
 
796 796
 
797 797
 /**
@@ -803,93 +803,93 @@  discard block
 block discarded – undo
803 803
  *
804 804
  * @return string
805 805
  */
806
-function give_get_register_fields( $form_id ) {
806
+function give_get_register_fields($form_id) {
807 807
 
808 808
 	global $user_ID;
809 809
 
810
-	if ( is_user_logged_in() ) {
811
-		$user_data = get_userdata( $user_ID );
810
+	if (is_user_logged_in()) {
811
+		$user_data = get_userdata($user_ID);
812 812
 	}
813 813
 
814
-	$show_register_form = give_show_login_register_option( $form_id );
814
+	$show_register_form = give_show_login_register_option($form_id);
815 815
 
816 816
 	ob_start(); ?>
817 817
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
818 818
 
819
-		<?php if ( $show_register_form == 'both' ) { ?>
819
+		<?php if ($show_register_form == 'both') { ?>
820 820
 			<div class="give-login-account-wrap">
821
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
822
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
821
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
822
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
823 823
 				</p>
824 824
 				<p class="give-loading-text">
825
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
825
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
826 826
 			</div>
827 827
 		<?php } ?>
828 828
 
829
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
829
+		<?php do_action('give_register_fields_before', $form_id); ?>
830 830
 
831 831
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
832
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
833
-				if ( ! give_logged_in_only( $form_id ) ) {
834
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
832
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
833
+				if ( ! give_logged_in_only($form_id)) {
834
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
835 835
 				} ?></legend>
836
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
836
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
837 837
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
838 838
 				<label for="give-user-login-<?php echo $form_id; ?>">
839
-					<?php _e( 'Username', 'give' ); ?>
840
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
839
+					<?php _e('Username', 'give'); ?>
840
+					<?php if (give_logged_in_only($form_id)) { ?>
841 841
 						<span class="give-required-indicator">*</span>
842 842
 					<?php } ?>
843
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
843
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
844 844
 				</label>
845 845
 
846
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
846
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
847 847
 					echo 'required ';
848
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
848
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
849 849
 			</div>
850 850
 
851 851
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
852 852
 				<label for="give-user-pass-<?php echo $form_id; ?>">
853
-					<?php _e( 'Password', 'give' ); ?>
854
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
853
+					<?php _e('Password', 'give'); ?>
854
+					<?php if (give_logged_in_only($form_id)) { ?>
855 855
 						<span class="give-required-indicator">*</span>
856 856
 					<?php } ?>
857
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
857
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
858 858
 				</label>
859 859
 
860
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
860
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
861 861
 					echo 'required ';
862
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
862
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
863 863
 			</div>
864 864
 
865 865
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
866 866
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
867
-					<?php _e( 'Confirm PW', 'give' ); ?>
868
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
867
+					<?php _e('Confirm PW', 'give'); ?>
868
+					<?php if (give_logged_in_only($form_id)) { ?>
869 869
 						<span class="give-required-indicator">*</span>
870 870
 					<?php } ?>
871
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
871
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
872 872
 				</label>
873 873
 
874
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
874
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
875 875
 					echo 'required ';
876
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
876
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
877 877
 			</div>
878
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
878
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
879 879
 		</fieldset>
880 880
 
881
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
881
+		<?php do_action('give_register_fields_after', $form_id); ?>
882 882
 
883 883
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
884 884
 
885
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
885
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
886 886
 
887 887
 	</fieldset>
888 888
 	<?php
889 889
 	echo ob_get_clean();
890 890
 }
891 891
 
892
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
892
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
893 893
 
894 894
 /**
895 895
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -902,79 +902,79 @@  discard block
 block discarded – undo
902 902
  *
903 903
  * @return string
904 904
  */
905
-function give_get_login_fields( $form_id ) {
905
+function give_get_login_fields($form_id) {
906 906
 
907
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
908
-	$show_register_form = give_show_login_register_option( $form_id );
907
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
908
+	$show_register_form = give_show_login_register_option($form_id);
909 909
 
910 910
 	ob_start();
911 911
 	?>
912 912
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
913
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
914
-			if ( ! give_logged_in_only( $form_id ) ) {
915
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
913
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
914
+			if ( ! give_logged_in_only($form_id)) {
915
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
916 916
 			} ?>
917 917
 		</legend>
918
-		<?php if ( $show_register_form == 'both' ) { ?>
918
+		<?php if ($show_register_form == 'both') { ?>
919 919
 			<p class="give-new-account-link">
920
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
921
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
-					<?php _e( 'Register', 'give' );
923
-					if ( ! give_logged_in_only( $form_id ) ) {
924
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
920
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
921
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
+					<?php _e('Register', 'give');
923
+					if ( ! give_logged_in_only($form_id)) {
924
+						echo ' '.__('or checkout as a guest.', 'give');
925 925
 					} ?>
926 926
 				</a>
927 927
 			</p>
928 928
 			<p class="give-loading-text">
929
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
929
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
930 930
 		<?php } ?>
931
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
931
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
932 932
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
933 933
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
934
-				<?php _e( 'Username', 'give' ); ?>
935
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
934
+				<?php _e('Username', 'give'); ?>
935
+				<?php if (give_logged_in_only($form_id)) { ?>
936 936
 					<span class="give-required-indicator">*</span>
937 937
 				<?php } ?>
938 938
 			</label>
939 939
 
940
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
940
+			<input class="<?php if (give_logged_in_only($form_id)) {
941 941
 				echo 'required ';
942
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
942
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
943 943
 		</div>
944 944
 
945 945
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
946 946
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
947
-				<?php _e( 'Password', 'give' ); ?>
948
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
947
+				<?php _e('Password', 'give'); ?>
948
+				<?php if (give_logged_in_only($form_id)) { ?>
949 949
 					<span class="give-required-indicator">*</span>
950 950
 				<?php } ?>
951 951
 			</label>
952
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
952
+			<input class="<?php if (give_logged_in_only($form_id)) {
953 953
 				echo 'required ';
954
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
954
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
955 955
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
956 956
 		</div>
957 957
 
958 958
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
959 959
 			 <span class="give-forgot-password ">
960
-				 <a href="<?php echo wp_lostpassword_url( $redirect )?>"> <?php _e( 'Forgot password?' ) ?> </a>
960
+				 <a href="<?php echo wp_lostpassword_url($redirect)?>"> <?php _e('Forgot password?') ?> </a>
961 961
 			 </span>
962 962
 		</div>
963 963
 		
964 964
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
965
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
966
-			<?php if ( $show_register_form !== 'login' ) { ?>
967
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/>
965
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
966
+			<?php if ($show_register_form !== 'login') { ?>
967
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/>
968 968
 			<?php } ?>
969 969
 			<span class="give-loading-animation"></span>
970 970
 		</div>
971
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
971
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
972 972
 	</fieldset><!--end #give-login-fields-->
973 973
 	<?php
974 974
 	echo ob_get_clean();
975 975
 }
976 976
 
977
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
977
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
978 978
 
979 979
 /**
980 980
  * Payment Mode Select
@@ -990,49 +990,49 @@  discard block
 block discarded – undo
990 990
  *
991 991
  * @return void
992 992
  */
993
-function give_payment_mode_select( $form_id ) {
993
+function give_payment_mode_select($form_id) {
994 994
 
995 995
 	$gateways = give_get_enabled_payment_gateways();
996 996
 
997
-	do_action( 'give_payment_mode_top', $form_id ); ?>
997
+	do_action('give_payment_mode_top', $form_id); ?>
998 998
 
999 999
 	<fieldset id="give-payment-mode-select">
1000
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
1000
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
1001 1001
 		<div id="give-payment-mode-wrap">
1002
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
1003
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
1002
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
1003
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
1004 1004
 			</legend>
1005 1005
 			<?php
1006 1006
 
1007
-			do_action( 'give_payment_mode_before_gateways' ) ?>
1007
+			do_action('give_payment_mode_before_gateways') ?>
1008 1008
 
1009 1009
 			<ul id="give-gateway-radio-list">
1010
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1011
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1010
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1011
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1012 1012
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1013
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
1014
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
1013
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
1014
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
1015 1015
 					echo '</label></li>';
1016 1016
 				endforeach; ?>
1017 1017
 			</ul>
1018
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
1018
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1019 1019
 		</div>
1020
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1020
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1021 1021
 	</fieldset>
1022 1022
 
1023
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1023
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1024 1024
 
1025 1025
 	<div id="give_purchase_form_wrap">
1026 1026
 
1027
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1027
+		<?php do_action('give_purchase_form', $form_id); ?>
1028 1028
 
1029 1029
 	</div><!-- the checkout fields are loaded into this-->
1030 1030
 
1031
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1031
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1032 1032
 
1033 1033
 }
1034 1034
 
1035
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1035
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1036 1036
 
1037 1037
 
1038 1038
 /**
@@ -1047,36 +1047,36 @@  discard block
 block discarded – undo
1047 1047
  *
1048 1048
  * @return void
1049 1049
  */
1050
-function give_terms_agreement( $form_id ) {
1050
+function give_terms_agreement($form_id) {
1051 1051
 
1052
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1053
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1054
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1052
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1053
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1054
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1055 1055
 
1056
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1056
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1057 1057
 		<fieldset id="give_terms_agreement">
1058 1058
 			<div id="give_terms" style="display:none;">
1059 1059
 				<?php
1060
-				do_action( 'give_before_terms' );
1061
-				echo wpautop( stripslashes( $terms ) );
1062
-				do_action( 'give_after_terms' );
1060
+				do_action('give_before_terms');
1061
+				echo wpautop(stripslashes($terms));
1062
+				do_action('give_after_terms');
1063 1063
 				?>
1064 1064
 			</div>
1065 1065
 			<div id="give_show_terms">
1066
-				<a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a>
1067
-				<a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1066
+				<a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a>
1067
+				<a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1068 1068
 			</div>
1069 1069
 
1070 1070
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1071 1071
 			<label
1072
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1072
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1073 1073
 
1074 1074
 		</fieldset>
1075 1075
 		<?php
1076 1076
 	}
1077 1077
 }
1078 1078
 
1079
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1079
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1080 1080
 
1081 1081
 /**
1082 1082
  * Checkout Final Total
@@ -1088,27 +1088,27 @@  discard block
 block discarded – undo
1088 1088
  * @since      1.0
1089 1089
  * @return void
1090 1090
  */
1091
-function give_checkout_final_total( $form_id ) {
1091
+function give_checkout_final_total($form_id) {
1092 1092
 
1093
-	if ( isset( $_POST['give_total'] ) ) {
1094
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1093
+	if (isset($_POST['give_total'])) {
1094
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1095 1095
 	} else {
1096 1096
 		//default total
1097
-		$total = give_get_default_form_amount( $form_id );
1097
+		$total = give_get_default_form_amount($form_id);
1098 1098
 	}
1099 1099
 	//Only proceed if give_total available
1100
-	if ( empty( $total ) ) {
1100
+	if (empty($total)) {
1101 1101
 		return;
1102 1102
 	}
1103 1103
 	?>
1104 1104
 	<p id="give-final-total-wrap" class="form-wrap ">
1105
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1106
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1105
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1106
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1107 1107
 	</p>
1108 1108
 	<?php
1109 1109
 }
1110 1110
 
1111
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1111
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1112 1112
 
1113 1113
 
1114 1114
 /**
@@ -1120,22 +1120,22 @@  discard block
 block discarded – undo
1120 1120
  *
1121 1121
  * @return void
1122 1122
  */
1123
-function give_checkout_submit( $form_id ) {
1123
+function give_checkout_submit($form_id) {
1124 1124
 	?>
1125 1125
 	<fieldset id="give_purchase_submit">
1126
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1126
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1127 1127
 
1128
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1128
+		<?php give_checkout_hidden_fields($form_id); ?>
1129 1129
 
1130
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1130
+		<?php echo give_checkout_button_purchase($form_id); ?>
1131 1131
 
1132
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1132
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1133 1133
 
1134 1134
 	</fieldset>
1135 1135
 	<?php
1136 1136
 }
1137 1137
 
1138
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1138
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1139 1139
 
1140 1140
 
1141 1141
 /**
@@ -1148,17 +1148,17 @@  discard block
 block discarded – undo
1148 1148
  *
1149 1149
  * @return string
1150 1150
  */
1151
-function give_checkout_button_purchase( $form_id ) {
1151
+function give_checkout_button_purchase($form_id) {
1152 1152
 
1153
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1154
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1153
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1154
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1155 1155
 	ob_start(); ?>
1156 1156
 	<div class="give-submit-button-wrap give-clearfix">
1157 1157
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1158 1158
 		<span class="give-loading-animation"></span>
1159 1159
 	</div>
1160 1160
 	<?php
1161
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1161
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1162 1162
 }
1163 1163
 
1164 1164
 /**
@@ -1171,11 +1171,11 @@  discard block
 block discarded – undo
1171 1171
  *
1172 1172
  * @return void
1173 1173
  */
1174
-function give_agree_to_terms_js( $form_id ) {
1174
+function give_agree_to_terms_js($form_id) {
1175 1175
 
1176
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1176
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1177 1177
 
1178
-	if ( $form_option === 'yes' ) {
1178
+	if ($form_option === 'yes') {
1179 1179
 		?>
1180 1180
 		<script type="text/javascript">
1181 1181
 			jQuery(document).ready(function ($) {
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 	}
1192 1192
 }
1193 1193
 
1194
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1194
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1195 1195
 
1196 1196
 /**
1197 1197
  * Show Give Goals
@@ -1204,25 +1204,25 @@  discard block
 block discarded – undo
1204 1204
  * @return mixed
1205 1205
  */
1206 1206
 
1207
-function give_show_goal_progress( $form_id, $args ) {
1207
+function give_show_goal_progress($form_id, $args) {
1208 1208
 
1209
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1210
-	$form        = new Give_Donate_Form( $form_id );
1209
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1210
+	$form        = new Give_Donate_Form($form_id);
1211 1211
 	$goal        = $form->goal;
1212
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1212
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1213 1213
 	$income      = $form->get_earnings();
1214
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1215
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1216
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1214
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1215
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1216
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1217 1217
 
1218 1218
 	//Sanity check - respect shortcode args
1219
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1219
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1220 1220
 		return false;
1221 1221
 	}
1222 1222
 
1223 1223
 	//Sanity check - ensure form has goal set to output
1224
-	if ( empty( $form->ID )
1225
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1224
+	if (empty($form->ID)
1225
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1226 1226
 	     || $goal_option !== 'yes'
1227 1227
 	     || $goal == 0
1228 1228
 	) {
@@ -1230,26 +1230,26 @@  discard block
 block discarded – undo
1230 1230
 		return false;
1231 1231
 	}
1232 1232
 
1233
-	$progress = round( ( $income / $goal ) * 100, 2 );
1233
+	$progress = round(($income / $goal) * 100, 2);
1234 1234
 
1235
-	if ( $income >= $goal ) {
1235
+	if ($income >= $goal) {
1236 1236
 		$progress = 100;
1237 1237
 	}
1238 1238
 
1239 1239
 	$output = '<div class="give-goal-progress">';
1240 1240
 
1241 1241
 	//Goal Progress Text
1242
-	if ( ! empty( $show_text ) ) {
1242
+	if ( ! empty($show_text)) {
1243 1243
 
1244 1244
 		$output .= '<div class="raised">';
1245 1245
 
1246
-		if ( $goal_format !== 'percentage' ) {
1246
+		if ($goal_format !== 'percentage') {
1247 1247
 
1248
-			$output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>';
1248
+			$output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>';
1249 1249
 
1250
-		} elseif ( $goal_format == 'percentage' ) {
1250
+		} elseif ($goal_format == 'percentage') {
1251 1251
 
1252
-			$output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>';
1252
+			$output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>';
1253 1253
 
1254 1254
 		}
1255 1255
 
@@ -1258,11 +1258,11 @@  discard block
 block discarded – undo
1258 1258
 	}
1259 1259
 
1260 1260
 	//Goal Progress Bar
1261
-	if ( ! empty( $show_bar ) ) {
1261
+	if ( ! empty($show_bar)) {
1262 1262
 		$output .= '<div class="give-progress-bar">';
1263
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1264
-		if ( ! empty( $color ) ) {
1265
-			$output .= 'background-color:' . $color;
1263
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1264
+		if ( ! empty($color)) {
1265
+			$output .= 'background-color:'.$color;
1266 1266
 		}
1267 1267
 		$output .= '"></span>';
1268 1268
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1270,13 +1270,13 @@  discard block
 block discarded – undo
1270 1270
 
1271 1271
 	$output .= '</div><!-- /.goal-progress -->';
1272 1272
 
1273
-	echo apply_filters( 'give_goal_output', $output );
1273
+	echo apply_filters('give_goal_output', $output);
1274 1274
 
1275 1275
 	return false;
1276 1276
 
1277 1277
 }
1278 1278
 
1279
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1279
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1280 1280
 
1281 1281
 /**
1282 1282
  * Adds Actions to Render Form Content
@@ -1288,19 +1288,19 @@  discard block
 block discarded – undo
1288 1288
  *
1289 1289
  * @return void
1290 1290
  */
1291
-function give_form_content( $form_id, $args ) {
1291
+function give_form_content($form_id, $args) {
1292 1292
 
1293
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1293
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1294 1294
 		? $args['show_content']
1295
-		: get_post_meta( $form_id, '_give_content_option', true );
1295
+		: get_post_meta($form_id, '_give_content_option', true);
1296 1296
 
1297
-	if ( $show_content !== 'none' ) {
1297
+	if ($show_content !== 'none') {
1298 1298
 		//add action according to value
1299
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1299
+		add_action($show_content, 'give_form_display_content', 10, 2);
1300 1300
 	}
1301 1301
 }
1302 1302
 
1303
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1303
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1304 1304
 
1305 1305
 /**
1306 1306
  * Renders Post Form Content
@@ -1312,24 +1312,24 @@  discard block
 block discarded – undo
1312 1312
  * @return void
1313 1313
  * @since      1.0
1314 1314
  */
1315
-function give_form_display_content( $form_id, $args ) {
1315
+function give_form_display_content($form_id, $args) {
1316 1316
 
1317
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1318
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1317
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1318
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1319 1319
 		? $args['show_content']
1320
-		: get_post_meta( $form_id, '_give_content_option', true );
1320
+		: get_post_meta($form_id, '_give_content_option', true);
1321 1321
 
1322
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1323
-		$content = apply_filters( 'the_content', $content );
1322
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1323
+		$content = apply_filters('the_content', $content);
1324 1324
 	}
1325 1325
 
1326
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1326
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1327 1327
 
1328
-	echo apply_filters( 'give_form_content_output', $output );
1328
+	echo apply_filters('give_form_content_output', $output);
1329 1329
 
1330 1330
 	//remove action to prevent content output on addition forms on page
1331 1331
 	//@see: https://github.com/WordImpress/Give/issues/634
1332
-	remove_action( $show_content, 'give_form_display_content' );
1332
+	remove_action($show_content, 'give_form_display_content');
1333 1333
 }
1334 1334
 
1335 1335
 
@@ -1342,16 +1342,16 @@  discard block
 block discarded – undo
1342 1342
  *
1343 1343
  * @return void
1344 1344
  */
1345
-function give_checkout_hidden_fields( $form_id ) {
1345
+function give_checkout_hidden_fields($form_id) {
1346 1346
 
1347
-	do_action( 'give_hidden_fields_before', $form_id );
1348
-	if ( is_user_logged_in() ) { ?>
1347
+	do_action('give_hidden_fields_before', $form_id);
1348
+	if (is_user_logged_in()) { ?>
1349 1349
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1350 1350
 	<?php } ?>
1351 1351
 	<input type="hidden" name="give_action" value="purchase"/>
1352
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1352
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1353 1353
 	<?php
1354
-	do_action( 'give_hidden_fields_after', $form_id );
1354
+	do_action('give_hidden_fields_after', $form_id);
1355 1355
 
1356 1356
 }
1357 1357
 
@@ -1366,20 +1366,20 @@  discard block
 block discarded – undo
1366 1366
  *
1367 1367
  * @return string $content Filtered content
1368 1368
  */
1369
-function give_filter_success_page_content( $content ) {
1369
+function give_filter_success_page_content($content) {
1370 1370
 
1371 1371
 	global $give_options;
1372 1372
 
1373
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1374
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1375
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1373
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1374
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1375
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1376 1376
 		}
1377 1377
 	}
1378 1378
 
1379 1379
 	return $content;
1380 1380
 }
1381 1381
 
1382
-add_filter( 'the_content', 'give_filter_success_page_content' );
1382
+add_filter('the_content', 'give_filter_success_page_content');
1383 1383
 
1384 1384
 
1385 1385
 /**
@@ -1391,14 +1391,14 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
 function give_test_mode_frontend_warning() {
1393 1393
 
1394
-	$test_mode = give_get_option( 'test_mode' );
1394
+	$test_mode = give_get_option('test_mode');
1395 1395
 
1396
-	if ( $test_mode == 'on' ) {
1397
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1396
+	if ($test_mode == 'on') {
1397
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1398 1398
 	}
1399 1399
 }
1400 1400
 
1401
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1401
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1402 1402
 
1403 1403
 
1404 1404
 /**
@@ -1408,21 +1408,21 @@  discard block
 block discarded – undo
1408 1408
  * @since       1.4.1
1409 1409
  */
1410 1410
 
1411
-function give_members_only_form( $final_output, $args ) {
1411
+function give_members_only_form($final_output, $args) {
1412 1412
 
1413
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1413
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1414 1414
 
1415 1415
 	//Sanity Check: Must have form_id & not be logged in
1416
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1416
+	if (empty($form_id) || is_user_logged_in()) {
1417 1417
 		return $final_output;
1418 1418
 	}
1419 1419
 
1420 1420
 	//Logged in only and Register / Login set to none
1421
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1421
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1422 1422
 
1423
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1423
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1424 1424
 
1425
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1425
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1426 1426
 
1427 1427
 	}
1428 1428
 
@@ -1430,4 +1430,4 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
 }
1432 1432
 
1433
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1433
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 2 patches
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_customers_page() {
26 26
 	$default_views  = give_customer_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_customer_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_customer_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_customers_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_customer_views', $views );
45
+	return apply_filters('give_customer_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_customer_tabs', $tabs );
59
+	return apply_filters('give_customer_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_customers_list() {
70
-	include( dirname( __FILE__ ) . '/class-customer-table.php' );
70
+	include(dirname(__FILE__).'/class-customer-table.php');
71 71
 
72 72
 	$customers_table = new Give_Customer_Reports_Table();
73 73
 	$customers_table->prepare_items();
74 74
 	?>
75 75
 	<div class="wrap">
76
-		<h2><?php _e( 'Donors', 'give' ); ?></h2>
77
-		<?php do_action( 'give_donors_table_top' ); ?>
78
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
76
+		<h2><?php _e('Donors', 'give'); ?></h2>
77
+		<?php do_action('give_donors_table_top'); ?>
78
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
79 79
 			<?php
80
-			$customers_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' );
80
+			$customers_table->search_box(__('Search Donors', 'give'), 'give-donors');
81 81
 			$customers_table->display();
82 82
 			?>
83 83
 			<input type="hidden" name="post_type" value="give_forms" />
84 84
 			<input type="hidden" name="page" value="give-donors" />
85 85
 			<input type="hidden" name="view" value="customers" />
86 86
 		</form>
87
-		<?php do_action( 'give_donors_table_bottom' ); ?>
87
+		<?php do_action('give_donors_table_bottom'); ?>
88 88
 	</div>
89 89
 	<?php
90 90
 }
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_render_customer_view( $view, $callbacks ) {
102
+function give_render_customer_view($view, $callbacks) {
103 103
 
104 104
 	$render = true;
105 105
 
106
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
106
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
107 107
 
108
-	if ( ! current_user_can( $customer_view_role ) ) {
109
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
108
+	if ( ! current_user_can($customer_view_role)) {
109
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
110 110
 		$render = false;
111 111
 	}
112 112
  
113
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
114
-		give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) );
113
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
114
+		give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give'));
115 115
 		$render = false;
116 116
 	}
117 117
 
118 118
 	$customer_id = (int) $_GET['id'];
119
-	$customer    = new Give_Customer( $customer_id );
119
+	$customer    = new Give_Customer($customer_id);
120 120
 
121
-	if ( empty( $customer->id ) ) {
122
-		give_set_error( 'give-invalid_customer', __( 'Invalid Donor ID Provided.', 'give' ) );
121
+	if (empty($customer->id)) {
122
+		give_set_error('give-invalid_customer', __('Invalid Donor ID Provided.', 'give'));
123 123
 		$render = false;
124 124
 	}
125 125
 
@@ -128,27 +128,27 @@  discard block
 block discarded – undo
128 128
 
129 129
 	<div class='wrap'>
130 130
 
131
-		<?php if ( give_get_errors() ) : ?>
131
+		<?php if (give_get_errors()) : ?>
132 132
 			<div class="error settings-error">
133
-				<?php give_print_errors( 0 ); ?>
133
+				<?php give_print_errors(0); ?>
134 134
 			</div>
135 135
 		<?php endif; ?>
136 136
 
137
-		<?php if ( $customer && $render ) : ?>
137
+		<?php if ($customer && $render) : ?>
138 138
 
139 139
 			<div id="customer-tab-wrapper">
140 140
 				<ul id="customer-tab-wrapper-list" class="nav-tab-wrapper">
141
-					<?php foreach ( $customer_tabs as $key => $tab ) : ?>
141
+					<?php foreach ($customer_tabs as $key => $tab) : ?>
142 142
 						<?php $active = $key === $view ? true : false; ?>
143 143
 						<?php $class = $active ? 'active' : 'inactive'; ?>
144 144
 
145
-						<li class="<?php echo sanitize_html_class( $class ); ?>">
146
-							<?php if ( ! $active ) : ?>
147
-							<a title="<?php echo esc_attr( $tab['title'] ); ?>" aria-label="<?php echo esc_attr( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>">
145
+						<li class="<?php echo sanitize_html_class($class); ?>">
146
+							<?php if ( ! $active) : ?>
147
+							<a title="<?php echo esc_attr($tab['title']); ?>" aria-label="<?php echo esc_attr($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>">
148 148
 								<?php endif; ?>
149 149
 
150
-								<span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php echo esc_attr( $tab['title'] ); ?>
151
-								<?php if ( ! $active ) : ?>
150
+								<span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php echo esc_attr($tab['title']); ?>
151
+								<?php if ( ! $active) : ?>
152 152
 							</a>
153 153
 						<?php endif; ?>
154 154
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			</div>
161 161
 
162 162
 			<div id="give-customer-card-wrapper">
163
-				<?php $callbacks[ $view ]( $customer ) ?>
163
+				<?php $callbacks[$view]($customer) ?>
164 164
 			</div>
165 165
 
166 166
 		<?php endif; ?>
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return void
182 182
  */
183
-function give_customers_view( $customer ) {
183
+function give_customers_view($customer) {
184 184
 
185
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
185
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
186 186
 
187 187
 	?>
188 188
 
189
-	<?php do_action( 'give_donor_card_top', $customer ); ?>
189
+	<?php do_action('give_donor_card_top', $customer); ?>
190 190
 
191 191
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
192 192
 
193
-		<form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>">
193
+		<form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>">
194 194
 
195 195
 			<div class="customer-info">
196 196
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 				<div class="donor-bio-header clearfix">
199 199
 
200 200
 					<div class="avatar-wrap left" id="customer-avatar">
201
-						<?php echo get_avatar( $customer->email ); ?>
201
+						<?php echo get_avatar($customer->email); ?>
202 202
 					</div>
203 203
 
204 204
 					<div class="customer-id" class="left">
205 205
 						#<?php echo $customer->id; ?>
206 206
 					</div>
207 207
 					<div id="customer-name-wrap" class="left">
208
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span>
208
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span>
209 209
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
210 210
 					</div>
211 211
 					<p class="customer-since info-item">
212
-						<?php _e( 'Donor since', 'give' ); ?>
213
-						<?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?>
212
+						<?php _e('Donor since', 'give'); ?>
213
+						<?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?>
214 214
 					</p>
215
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
216
-						<a title="<?php _e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
215
+					<?php if (current_user_can($customer_edit_role)): ?>
216
+						<a title="<?php _e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
217 217
 					<?php endif; ?>
218 218
 				</div>
219 219
 				<!-- /donor-bio-header -->
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
 					<table class="widefat">
224 224
 						<tbody>
225 225
 						<tr>
226
-							<td><label for="tablecell"><?php esc_attr_e( 'Email', 'give' ); ?></label>:</td>
226
+							<td><label for="tablecell"><?php esc_attr_e('Email', 'give'); ?></label>:</td>
227 227
 							<td class="row-title">
228
-								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e( 'Donor Email', 'give' ); ?>" /></span>
228
+								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php _e('Donor Email', 'give'); ?>" /></span>
229 229
 								<span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span>
230 230
 							</td>
231 231
 						</tr>
232 232
 						<tr class="alternate">
233
-							<td><label for="tablecell"><?php esc_attr_e( 'User ID', 'give' ); ?></label>:</td>
233
+							<td><label for="tablecell"><?php esc_attr_e('User ID', 'give'); ?></label>:</td>
234 234
 							<td class="row-title">
235 235
 								<span class="customer-user-id info-item edit-item">
236 236
 									<?php
@@ -246,38 +246,38 @@  discard block
 block discarded – undo
246 246
 										'data'  => $data_atts,
247 247
 									);
248 248
 
249
-									if ( ! empty( $user_id ) ) {
250
-										$userdata           = get_userdata( $user_id );
249
+									if ( ! empty($user_id)) {
250
+										$userdata           = get_userdata($user_id);
251 251
 										$user_args['value'] = $userdata->user_login;
252 252
 									}
253 253
 
254
-									echo Give()->html->ajax_user_search( $user_args );
254
+									echo Give()->html->ajax_user_search($user_args);
255 255
 									?>
256 256
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
257 257
 								</span>
258 258
 			
259 259
 								<span class="customer-user-id info-item editable">
260
-									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
260
+									<?php if (intval($customer->user_id) > 0) : ?>
261 261
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
262 262
 									<?php else : ?>
263
-										<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
263
+										<span data-key="user_id"><?php _e('None', 'give'); ?></span>
264 264
 									<?php endif; ?>
265
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
266
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span>
265
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?>
266
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php _e('Disconnect User', 'give'); ?></a></span>
267 267
 									<?php endif; ?>
268 268
 								</span>
269 269
 							</td>
270 270
 						</tr>
271
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
271
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
272 272
 
273 273
 							<tr>
274
-								<td><?php esc_attr_e( 'Address', 'give' ); ?>:</td>
274
+								<td><?php esc_attr_e('Address', 'give'); ?>:</td>
275 275
 								<td class="row-title">
276 276
 
277 277
 									<div class="customer-address-wrapper">
278 278
 
279 279
 										<?php
280
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
280
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
281 281
 										$defaults = array(
282 282
 											'line1'   => '',
283 283
 											'line2'   => '',
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 											'zip'     => ''
288 288
 										);
289 289
 
290
-										$address = wp_parse_args( $address, $defaults );
290
+										$address = wp_parse_args($address, $defaults);
291 291
 										?>
292 292
 
293
-										<?php if ( ! empty( $address ) ) { ?>
293
+										<?php if ( ! empty($address)) { ?>
294 294
 											<span class="customer-address info-item editable">
295 295
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
296 296
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -301,38 +301,38 @@  discard block
 block discarded – undo
301 301
 											</span>
302 302
 										<?php } ?>
303 303
 										<span class="customer-address info-item edit-item">
304
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
305
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
306
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
304
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
305
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
306
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
307 307
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
308 308
 												<?php
309 309
 
310 310
 												$selected_country = $address['country'];
311 311
 
312 312
 												$countries = give_get_country_list();
313
-												foreach ( $countries as $country_code => $country ) {
314
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
313
+												foreach ($countries as $country_code => $country) {
314
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
315 315
 												}
316 316
 												?>
317 317
 											</select>
318 318
 											<?php
319 319
 											$selected_state = give_get_state();
320
-											$states         = give_get_states( $selected_country );
320
+											$states         = give_get_states($selected_country);
321 321
 
322
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
322
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
323 323
 
324
-											if ( ! empty( $states ) ) : ?>
324
+											if ( ! empty($states)) : ?>
325 325
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
326 326
 													<?php
327
-													foreach ( $states as $state_code => $state ) {
328
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
327
+													foreach ($states as $state_code => $state) {
328
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
329 329
 													}
330 330
 													?>
331 331
 												</select>
332 332
 											<?php else : ?>
333
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
333
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e('State / Province', 'give'); ?>" />
334 334
 											<?php endif; ?>
335
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
335
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
336 336
 													</span>
337 337
 
338 338
 									</div>
@@ -350,120 +350,120 @@  discard block
 block discarded – undo
350 350
 
351 351
 			<span id="customer-edit-actions" class="edit-item">
352 352
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
353
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
353
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
354 354
 				<input type="hidden" name="give_action" value="edit-customer" />
355
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" />
356
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
355
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" />
356
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
357 357
 			</span>
358 358
 
359 359
 		</form>
360 360
 	</div>
361 361
 
362
-	<?php do_action( 'give_donor_before_stats', $customer ); ?>
362
+	<?php do_action('give_donor_before_stats', $customer); ?>
363 363
 
364 364
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
365 365
 		<ul>
366 366
 			<li>
367
-				<a title="<?php _e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
367
+				<a title="<?php _e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
368 368
 					<span class="dashicons dashicons-heart"></span>
369 369
 					<?php
370 370
 					//Completed Donations
371
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
372
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
371
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
372
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
373 373
 					?>
374 374
 				</a>
375 375
 			</li>
376 376
 			<li>
377 377
 				<span class="dashicons dashicons-chart-area"></span>
378
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
378
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php _e('Lifetime Donations', 'give'); ?>
379 379
 			</li>
380
-			<?php do_action( 'give_donor_stats_list', $customer ); ?>
380
+			<?php do_action('give_donor_stats_list', $customer); ?>
381 381
 		</ul>
382 382
 	</div>
383 383
 
384
-	<?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?>
384
+	<?php do_action('give_donor_before_tables_wrapper', $customer); ?>
385 385
 
386 386
 	<div id="customer-tables-wrapper" class="customer-section">
387 387
 
388
-		<?php do_action( 'give_donor_before_tables', $customer ); ?>
388
+		<?php do_action('give_donor_before_tables', $customer); ?>
389 389
 
390
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
390
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
391 391
 		<?php
392
-		$payment_ids = explode( ',', $customer->payment_ids );
393
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
394
-		$payments    = array_slice( $payments, 0, 10 );
392
+		$payment_ids = explode(',', $customer->payment_ids);
393
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
394
+		$payments    = array_slice($payments, 0, 10);
395 395
 		?>
396 396
 		<table class="wp-list-table widefat striped payments">
397 397
 			<thead>
398 398
 			<tr>
399
-				<th><?php _e( 'ID', 'give' ); ?></th>
400
-				<th><?php _e( 'Amount', 'give' ); ?></th>
401
-				<th><?php _e( 'Date', 'give' ); ?></th>
402
-				<th><?php _e( 'Status', 'give' ); ?></th>
403
-				<th><?php _e( 'Actions', 'give' ); ?></th>
399
+				<th><?php _e('ID', 'give'); ?></th>
400
+				<th><?php _e('Amount', 'give'); ?></th>
401
+				<th><?php _e('Date', 'give'); ?></th>
402
+				<th><?php _e('Status', 'give'); ?></th>
403
+				<th><?php _e('Actions', 'give'); ?></th>
404 404
 			</tr>
405 405
 			</thead>
406 406
 			<tbody>
407
-			<?php if ( ! empty( $payments ) ) : ?>
408
-				<?php foreach ( $payments as $payment ) : ?>
407
+			<?php if ( ! empty($payments)) : ?>
408
+				<?php foreach ($payments as $payment) : ?>
409 409
 					<tr>
410 410
 						<td><?php echo $payment->ID; ?></td>
411
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
412
-						<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td>
413
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
411
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
412
+						<td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td>
413
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
414 414
 						<td>
415
-							<a title="<?php _e( 'View Details for Donation', 'give' );
416
-							echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>">
417
-								<?php _e( 'View Details', 'give' ); ?>
415
+							<a title="<?php _e('View Details for Donation', 'give');
416
+							echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>">
417
+								<?php _e('View Details', 'give'); ?>
418 418
 							</a>
419
-							<?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?>
419
+							<?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?>
420 420
 						</td>
421 421
 					</tr>
422 422
 				<?php endforeach; ?>
423 423
 			<?php else: ?>
424 424
 				<tr>
425
-					<td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td>
425
+					<td colspan="5"><?php _e('No Donations Found', 'give'); ?></td>
426 426
 				</tr>
427 427
 			<?php endif; ?>
428 428
 			</tbody>
429 429
 		</table>
430 430
 
431
-		<h3><?php _e( 'Completed Donations', 'give' ); ?></h3>
431
+		<h3><?php _e('Completed Donations', 'give'); ?></h3>
432 432
 		<?php
433
-		$donations = give_get_users_completed_donations( $customer->email );
433
+		$donations = give_get_users_completed_donations($customer->email);
434 434
 		?>
435 435
 		<table class="wp-list-table widefat striped donations">
436 436
 			<thead>
437 437
 			<tr>
438 438
 				<th><?php echo give_get_forms_label_singular(); ?></th>
439
-				<th width="120px"><?php _e( 'Actions', 'give' ); ?></th>
439
+				<th width="120px"><?php _e('Actions', 'give'); ?></th>
440 440
 			</tr>
441 441
 			</thead>
442 442
 			<tbody>
443
-			<?php if ( ! empty( $donations ) ) : ?>
444
-				<?php foreach ( $donations as $donation ) : ?>
443
+			<?php if ( ! empty($donations)) : ?>
444
+				<?php foreach ($donations as $donation) : ?>
445 445
 					<tr>
446 446
 						<td><?php echo $donation->post_title; ?></td>
447 447
 						<td>
448
-							<a title="<?php echo esc_attr( sprintf( __( 'View %s', 'give' ), $donation->post_title ) ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); ?>">
449
-								<?php printf( __( 'View %s', 'give' ), give_get_forms_label_singular() ); ?>
448
+							<a title="<?php echo esc_attr(sprintf(__('View %s', 'give'), $donation->post_title)); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); ?>">
449
+								<?php printf(__('View %s', 'give'), give_get_forms_label_singular()); ?>
450 450
 							</a>
451 451
 						</td>
452 452
 					</tr>
453 453
 				<?php endforeach; ?>
454 454
 			<?php else: ?>
455 455
 				<tr>
456
-					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td>
456
+					<td colspan="2"><?php _e('No Completed Donations Found', 'give'); ?></td>
457 457
 				</tr>
458 458
 			<?php endif; ?>
459 459
 			</tbody>
460 460
 		</table>
461 461
 
462
-		<?php do_action( 'give_donor_after_tables', $customer ); ?>
462
+		<?php do_action('give_donor_after_tables', $customer); ?>
463 463
 
464 464
 	</div>
465 465
 
466
-	<?php do_action( 'give_donor_card_bottom', $customer ); ?>
466
+	<?php do_action('give_donor_card_bottom', $customer); ?>
467 467
 
468 468
 	<?php
469 469
 }
@@ -477,30 +477,30 @@  discard block
 block discarded – undo
477 477
  *
478 478
  * @return void
479 479
  */
480
-function give_customer_notes_view( $customer ) {
480
+function give_customer_notes_view($customer) {
481 481
 
482
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
483
-	$paged          = absint( $paged );
482
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
483
+	$paged          = absint($paged);
484 484
 	$note_count     = $customer->get_notes_count();
485
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
486
-	$total_pages    = ceil( $note_count / $per_page );
487
-	$customer_notes = $customer->get_notes( $per_page, $paged );
485
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
486
+	$total_pages    = ceil($note_count / $per_page);
487
+	$customer_notes = $customer->get_notes($per_page, $paged);
488 488
 	?>
489 489
 
490 490
 	<div id="customer-notes-wrapper">
491 491
 		<div class="customer-notes-header">
492
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
492
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
493 493
 		</div>
494
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
494
+		<h3><?php _e('Notes', 'give'); ?></h3>
495 495
 
496
-		<?php if ( 1 == $paged ) : ?>
496
+		<?php if (1 == $paged) : ?>
497 497
 			<div style="display: block; margin-bottom: 55px;">
498
-				<form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>">
498
+				<form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>">
499 499
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
500 500
 					<br />
501 501
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
502 502
 					<input type="hidden" name="give_action" value="add-customer-note" />
503
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
503
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
504 504
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
505 505
 				</form>
506 506
 			</div>
@@ -515,46 +515,46 @@  discard block
 block discarded – undo
515 515
 			'show_all' => true
516 516
 		);
517 517
 
518
-		echo paginate_links( $pagination_args );
518
+		echo paginate_links($pagination_args);
519 519
 		?>
520 520
 
521 521
 		<div id="give-customer-notes" class="postbox">
522
-			<?php if ( count( $customer_notes ) > 0 ) : ?>
523
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
522
+			<?php if (count($customer_notes) > 0) : ?>
523
+				<?php foreach ($customer_notes as $key => $note) : ?>
524 524
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
525 525
 					<span class="note-content-wrap">
526
-						<?php echo stripslashes( $note ); ?>
526
+						<?php echo stripslashes($note); ?>
527 527
 					</span>
528 528
 					</div>
529 529
 				<?php endforeach; ?>
530 530
 			<?php else: ?>
531 531
 				<div class="give-no-customer-notes">
532
-					<?php _e( 'No Donor Notes', 'give' ); ?>
532
+					<?php _e('No Donor Notes', 'give'); ?>
533 533
 				</div>
534 534
 			<?php endif; ?>
535 535
 		</div>
536 536
 
537
-		<?php echo paginate_links( $pagination_args ); ?>
537
+		<?php echo paginate_links($pagination_args); ?>
538 538
 
539 539
 	</div>
540 540
 
541 541
 	<?php
542 542
 }
543 543
 
544
-function give_customers_delete_view( $customer ) {
544
+function give_customers_delete_view($customer) {
545 545
 
546
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
546
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
547 547
 
548 548
 	?>
549 549
 
550
-	<?php do_action( 'give_customer_delete_top', $customer ); ?>
550
+	<?php do_action('give_customer_delete_top', $customer); ?>
551 551
 
552 552
 	<div class="info-wrapper customer-section">
553 553
 
554
-		<form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>">
554
+		<form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>">
555 555
 
556 556
 			<div class="customer-notes-header">
557
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
557
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
558 558
 			</div>
559 559
 
560 560
 
@@ -562,27 +562,27 @@  discard block
 block discarded – undo
562 562
 
563 563
 				<span class="delete-customer-options">
564 564
 					<p>
565
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
566
-						<label for="give-customer-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
565
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
566
+						<label for="give-customer-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
567 567
 					</p>
568 568
 
569 569
 					<p>
570
-						<?php echo Give()->html->checkbox( array(
570
+						<?php echo Give()->html->checkbox(array(
571 571
 							'name'    => 'give-customer-delete-records',
572
-							'options' => array( 'disabled' => true )
573
-						) ); ?>
574
-						<label for="give-customer-delete-records"><?php _e( 'Delete all associated payments and records?', 'give' ); ?></label>
572
+							'options' => array('disabled' => true)
573
+						)); ?>
574
+						<label for="give-customer-delete-records"><?php _e('Delete all associated payments and records?', 'give'); ?></label>
575 575
 					</p>
576 576
 
577
-					<?php do_action( 'give_customer_delete_inputs', $customer ); ?>
577
+					<?php do_action('give_customer_delete_inputs', $customer); ?>
578 578
 				</span>
579 579
 
580 580
 				<span id="customer-edit-actions">
581 581
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
582
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
582
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
583 583
 					<input type="hidden" name="give_action" value="delete-customer" />
584
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" />
585
-					<a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
584
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" />
585
+					<a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a>
586 586
 				</span>
587 587
 
588 588
 			</div>
@@ -592,5 +592,5 @@  discard block
 block discarded – undo
592 592
 
593 593
 	<?php
594 594
 
595
-	do_action( 'give_customer_delete_bottom', $customer );
595
+	do_action('give_customer_delete_bottom', $customer);
596 596
 }
Please login to merge, or discard this patch.
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -259,8 +259,11 @@  discard block
 block discarded – undo
259 259
 								<span class="customer-user-id info-item editable">
260 260
 									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
261 261
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
262
-									<?php else : ?>
263
-										<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
262
+									<?php else {
263
+	: ?>
264
+										<span data-key="user_id"><?php _e( 'None', 'give' );
265
+}
266
+?></span>
264 267
 									<?php endif; ?>
265 268
 									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
266 269
 										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php _e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php _e( 'Disconnect User', 'give' ); ?></a></span>
@@ -329,8 +332,11 @@  discard block
 block discarded – undo
329 332
 													}
330 333
 													?>
331 334
 												</select>
332
-											<?php else : ?>
333
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' ); ?>" />
335
+											<?php else {
336
+	: ?>
337
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php _e( 'State / Province', 'give' );
338
+}
339
+?>" />
334 340
 											<?php endif; ?>
335 341
 											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
336 342
 													</span>
@@ -420,9 +426,12 @@  discard block
 block discarded – undo
420 426
 						</td>
421 427
 					</tr>
422 428
 				<?php endforeach; ?>
423
-			<?php else: ?>
429
+			<?php else {
430
+	: ?>
424 431
 				<tr>
425
-					<td colspan="5"><?php _e( 'No Donations Found', 'give' ); ?></td>
432
+					<td colspan="5"><?php _e( 'No Donations Found', 'give' );
433
+}
434
+?></td>
426 435
 				</tr>
427 436
 			<?php endif; ?>
428 437
 			</tbody>
@@ -451,9 +460,12 @@  discard block
 block discarded – undo
451 460
 						</td>
452 461
 					</tr>
453 462
 				<?php endforeach; ?>
454
-			<?php else: ?>
463
+			<?php else {
464
+	: ?>
455 465
 				<tr>
456
-					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' ); ?></td>
466
+					<td colspan="2"><?php _e( 'No Completed Donations Found', 'give' );
467
+}
468
+?></td>
457 469
 				</tr>
458 470
 			<?php endif; ?>
459 471
 			</tbody>
@@ -527,9 +539,12 @@  discard block
 block discarded – undo
527 539
 					</span>
528 540
 					</div>
529 541
 				<?php endforeach; ?>
530
-			<?php else: ?>
542
+			<?php else {
543
+	: ?>
531 544
 				<div class="give-no-customer-notes">
532
-					<?php _e( 'No Donor Notes', 'give' ); ?>
545
+					<?php _e( 'No Donor Notes', 'give' );
546
+}
547
+?>
533 548
 				</div>
534 549
 			<?php endif; ?>
535 550
 		</div>
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return string $output Give forms dropdown
35 35
 	 */
36
-	public function forms_dropdown( $args = array() ) {
36
+	public function forms_dropdown($args = array()) {
37 37
 
38 38
 		$defaults = array(
39 39
 			'name'        => 'forms',
@@ -43,43 +43,43 @@  discard block
 block discarded – undo
43 43
 			'selected'    => 0,
44 44
 			'chosen'      => false,
45 45
 			'number'      => 30,
46
-			'placeholder' => sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() )
46
+			'placeholder' => sprintf(__('Select a %s', 'give'), give_get_forms_label_singular())
47 47
 		);
48 48
 
49
-		$args = wp_parse_args( $args, $defaults );
49
+		$args = wp_parse_args($args, $defaults);
50 50
 
51
-		$forms = get_posts( array(
51
+		$forms = get_posts(array(
52 52
 			'post_type'      => 'give_forms',
53 53
 			'orderby'        => 'title',
54 54
 			'order'          => 'ASC',
55 55
 			'posts_per_page' => $args['number']
56
-		) );
56
+		));
57 57
 
58 58
 		$options = array();
59 59
 
60
-		if ( $forms ) {
61
-			$options[0] = sprintf( __( 'Select a %s', 'give' ), give_get_forms_label_singular() );
62
-			foreach ( $forms as $form ) {
63
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
60
+		if ($forms) {
61
+			$options[0] = sprintf(__('Select a %s', 'give'), give_get_forms_label_singular());
62
+			foreach ($forms as $form) {
63
+				$options[absint($form->ID)] = esc_html($form->post_title);
64 64
 			}
65 65
 		} else {
66
-			$options[0] = __( 'No Give Forms Found', 'give' );
66
+			$options[0] = __('No Give Forms Found', 'give');
67 67
 		}
68 68
 
69 69
 		// This ensures that any selected forms are included in the drop down
70
-		if ( is_array( $args['selected'] ) ) {
71
-			foreach ( $args['selected'] as $item ) {
72
-				if ( ! in_array( $item, $options ) ) {
73
-					$options[ $item ] = get_the_title( $item );
70
+		if (is_array($args['selected'])) {
71
+			foreach ($args['selected'] as $item) {
72
+				if ( ! in_array($item, $options)) {
73
+					$options[$item] = get_the_title($item);
74 74
 				}
75 75
 			}
76
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
77
-			if ( ! in_array( $args['selected'], $options ) ) {
78
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
76
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
77
+			if ( ! in_array($args['selected'], $options)) {
78
+				$options[$args['selected']] = get_the_title($args['selected']);
79 79
 			}
80 80
 		}
81 81
 
82
-		$output = $this->select( array(
82
+		$output = $this->select(array(
83 83
 			'name'             => $args['name'],
84 84
 			'selected'         => $args['selected'],
85 85
 			'id'               => $args['id'],
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			'placeholder'      => $args['placeholder'],
91 91
 			'show_option_all'  => false,
92 92
 			'show_option_none' => false
93
-		) );
93
+		));
94 94
 
95 95
 		return $output;
96 96
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string $output Donor dropdown
107 107
 	 */
108
-	public function donor_dropdown( $args = array() ) {
108
+	public function donor_dropdown($args = array()) {
109 109
 
110 110
 		$defaults = array(
111 111
 			'name'        => 'customers',
@@ -114,38 +114,38 @@  discard block
 block discarded – undo
114 114
 			'multiple'    => false,
115 115
 			'selected'    => 0,
116 116
 			'chosen'      => true,
117
-			'placeholder' => __( 'Select a Donor', 'give' ),
117
+			'placeholder' => __('Select a Donor', 'give'),
118 118
 			'number'      => 30
119 119
 		);
120 120
 
121
-		$args = wp_parse_args( $args, $defaults );
121
+		$args = wp_parse_args($args, $defaults);
122 122
 
123
-		$customers = Give()->customers->get_customers( array(
123
+		$customers = Give()->customers->get_customers(array(
124 124
 			'number' => $args['number']
125
-		) );
125
+		));
126 126
 
127 127
 		$options = array();
128 128
 
129
-		if ( $customers ) {
130
-			$options[0] = __( 'No donor attached', 'give' );
131
-			foreach ( $customers as $customer ) {
132
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
129
+		if ($customers) {
130
+			$options[0] = __('No donor attached', 'give');
131
+			foreach ($customers as $customer) {
132
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
133 133
 			}
134 134
 		} else {
135
-			$options[0] = __( 'No donors found', 'give' );
135
+			$options[0] = __('No donors found', 'give');
136 136
 		}
137 137
 
138
-		if ( ! empty( $args['selected'] ) ) {
138
+		if ( ! empty($args['selected'])) {
139 139
 
140 140
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed
141 141
 
142
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
142
+			if ( ! array_key_exists($args['selected'], $options)) {
143 143
 
144
-				$customer = new Give_Customer( $args['selected'] );
144
+				$customer = new Give_Customer($args['selected']);
145 145
 
146
-				if ( $customer ) {
146
+				if ($customer) {
147 147
 
148
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
148
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
149 149
 
150 150
 				}
151 151
 
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 
154 154
 		}
155 155
 
156
-		$output = $this->select( array(
156
+		$output = $this->select(array(
157 157
 			'name'             => $args['name'],
158 158
 			'selected'         => $args['selected'],
159 159
 			'id'               => $args['id'],
160
-			'class'            => $args['class'] . ' give-customer-select',
160
+			'class'            => $args['class'].' give-customer-select',
161 161
 			'options'          => $options,
162 162
 			'multiple'         => $args['multiple'],
163 163
 			'chosen'           => $args['chosen'],
164 164
 			'show_option_all'  => false,
165 165
 			'show_option_none' => false
166
-		) );
166
+		));
167 167
 
168 168
 		return $output;
169 169
 	}
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string $output Category dropdown
182 182
 	 */
183
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
184
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
183
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
184
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
185 185
 		$options    = array();
186 186
 
187
-		foreach ( $categories as $category ) {
188
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
187
+		foreach ($categories as $category) {
188
+			$options[absint($category->term_id)] = esc_html($category->name);
189 189
 		}
190 190
 
191
-		$output = $this->select( array(
191
+		$output = $this->select(array(
192 192
 			'name'             => $name,
193 193
 			'selected'         => $selected,
194 194
 			'options'          => $options,
195
-			'show_option_all'  => __( 'All Categories', 'give' ),
195
+			'show_option_all'  => __('All Categories', 'give'),
196 196
 			'show_option_none' => false
197
-		) );
197
+		));
198 198
 
199 199
 		return $output;
200 200
 	}
@@ -212,25 +212,25 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return string $output Year dropdown
214 214
 	 */
215
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
216
-		$current    = date( 'Y' );
217
-		$start_year = $current - absint( $years_before );
218
-		$end_year   = $current + absint( $years_after );
219
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
215
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
216
+		$current    = date('Y');
217
+		$start_year = $current - absint($years_before);
218
+		$end_year   = $current + absint($years_after);
219
+		$selected   = empty($selected) ? date('Y') : $selected;
220 220
 		$options    = array();
221 221
 
222
-		while ( $start_year <= $end_year ) {
223
-			$options[ absint( $start_year ) ] = $start_year;
224
-			$start_year ++;
222
+		while ($start_year <= $end_year) {
223
+			$options[absint($start_year)] = $start_year;
224
+			$start_year++;
225 225
 		}
226 226
 
227
-		$output = $this->select( array(
227
+		$output = $this->select(array(
228 228
 			'name'             => $name,
229 229
 			'selected'         => $selected,
230 230
 			'options'          => $options,
231 231
 			'show_option_all'  => false,
232 232
 			'show_option_none' => false
233
-		) );
233
+		));
234 234
 
235 235
 		return $output;
236 236
 	}
@@ -247,23 +247,23 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @return string $output Month dropdown
249 249
 	 */
250
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
250
+	public function month_dropdown($name = 'month', $selected = 0) {
251 251
 		$month    = 1;
252 252
 		$options  = array();
253
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
253
+		$selected = empty($selected) ? date('n') : $selected;
254 254
 
255
-		while ( $month <= 12 ) {
256
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
257
-			$month ++;
255
+		while ($month <= 12) {
256
+			$options[absint($month)] = give_month_num_to_name($month);
257
+			$month++;
258 258
 		}
259 259
 
260
-		$output = $this->select( array(
260
+		$output = $this->select(array(
261 261
 			'name'             => $name,
262 262
 			'selected'         => $selected,
263 263
 			'options'          => $options,
264 264
 			'show_option_all'  => false,
265 265
 			'show_option_none' => false
266
-		) );
266
+		));
267 267
 
268 268
 		return $output;
269 269
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @return string
279 279
 	 */
280
-	public function select( $args = array() ) {
280
+	public function select($args = array()) {
281 281
 		$defaults = array(
282 282
 			'options'          => array(),
283 283
 			'name'             => null,
@@ -287,60 +287,60 @@  discard block
 block discarded – undo
287 287
 			'chosen'           => false,
288 288
 			'placeholder'      => null,
289 289
 			'multiple'         => false,
290
-			'show_option_all'  => __( 'All', 'give' ),
291
-			'show_option_none' => __( 'None', 'give' )
290
+			'show_option_all'  => __('All', 'give'),
291
+			'show_option_none' => __('None', 'give')
292 292
 		);
293 293
 
294
-		$args = wp_parse_args( $args, $defaults );
294
+		$args = wp_parse_args($args, $defaults);
295 295
 
296 296
 
297
-		if ( $args['multiple'] ) {
297
+		if ($args['multiple']) {
298 298
 			$multiple = ' MULTIPLE';
299 299
 		} else {
300 300
 			$multiple = '';
301 301
 		}
302 302
 
303
-		if ( $args['chosen'] ) {
303
+		if ($args['chosen']) {
304 304
 			$args['class'] .= ' give-select-chosen';
305 305
 		}
306 306
 
307
-		if ( $args['placeholder'] ) {
307
+		if ($args['placeholder']) {
308 308
 			$placeholder = $args['placeholder'];
309 309
 		} else {
310 310
 			$placeholder = '';
311 311
 		}
312 312
 
313
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">';
313
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">';
314 314
 
315
-		if ( $args['show_option_all'] ) {
316
-			if ( $args['multiple'] ) {
317
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
315
+		if ($args['show_option_all']) {
316
+			if ($args['multiple']) {
317
+				$selected = selected(true, in_array(0, $args['selected']), false);
318 318
 			} else {
319
-				$selected = selected( $args['selected'], 0, false );
319
+				$selected = selected($args['selected'], 0, false);
320 320
 			}
321
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
321
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
322 322
 		}
323 323
 
324
-		if ( ! empty( $args['options'] ) ) {
324
+		if ( ! empty($args['options'])) {
325 325
 
326
-			if ( $args['show_option_none'] ) {
327
-				if ( $args['multiple'] ) {
328
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
326
+			if ($args['show_option_none']) {
327
+				if ($args['multiple']) {
328
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
329 329
 				} else {
330
-					$selected = selected( $args['selected'], - 1, false );
330
+					$selected = selected($args['selected'], - 1, false);
331 331
 				}
332
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
332
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
333 333
 			}
334 334
 
335
-			foreach ( $args['options'] as $key => $option ) {
335
+			foreach ($args['options'] as $key => $option) {
336 336
 
337
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
338
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
337
+				if ($args['multiple'] && is_array($args['selected'])) {
338
+					$selected = selected(true, in_array($key, $args['selected']), false);
339 339
 				} else {
340
-					$selected = selected( $args['selected'], $key, false );
340
+					$selected = selected($args['selected'], $key, false);
341 341
 				}
342 342
 
343
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
343
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
344 344
 			}
345 345
 		}
346 346
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @return string
360 360
 	 */
361
-	public function checkbox( $args = array() ) {
361
+	public function checkbox($args = array()) {
362 362
 		$defaults = array(
363 363
 			'name'    => null,
364 364
 			'current' => null,
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
 			)
370 370
 		);
371 371
 
372
-		$args = wp_parse_args( $args, $defaults );
372
+		$args = wp_parse_args($args, $defaults);
373 373
 
374 374
 		$options = '';
375
-		if ( ! empty( $args['options']['disabled'] ) ) {
375
+		if ( ! empty($args['options']['disabled'])) {
376 376
 			$options .= ' disabled="disabled"';
377
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
377
+		} elseif ( ! empty($args['options']['readonly'])) {
378 378
 			$options .= ' readonly';
379 379
 		}
380 380
 
381
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
381
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
382 382
 
383 383
 		return $output;
384 384
 	}
@@ -392,22 +392,22 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return string Text field
394 394
 	 */
395
-	public function text( $args = array() ) {
395
+	public function text($args = array()) {
396 396
 		// Backwards compatabliity
397
-		if ( func_num_args() > 1 ) {
397
+		if (func_num_args() > 1) {
398 398
 			$args = func_get_args();
399 399
 
400 400
 			$name  = $args[0];
401
-			$value = isset( $args[1] ) ? $args[1] : '';
402
-			$label = isset( $args[2] ) ? $args[2] : '';
403
-			$desc  = isset( $args[3] ) ? $args[3] : '';
401
+			$value = isset($args[1]) ? $args[1] : '';
402
+			$label = isset($args[2]) ? $args[2] : '';
403
+			$desc  = isset($args[3]) ? $args[3] : '';
404 404
 		}
405 405
 
406 406
 		$defaults = array(
407
-			'name'         => isset( $name ) ? $name : 'text',
408
-			'value'        => isset( $value ) ? $value : null,
409
-			'label'        => isset( $label ) ? $label : null,
410
-			'desc'         => isset( $desc ) ? $desc : null,
407
+			'name'         => isset($name) ? $name : 'text',
408
+			'value'        => isset($value) ? $value : null,
409
+			'label'        => isset($label) ? $label : null,
410
+			'desc'         => isset($desc) ? $desc : null,
411 411
 			'placeholder'  => '',
412 412
 			'class'        => 'regular-text',
413 413
 			'disabled'     => false,
@@ -415,29 +415,29 @@  discard block
 block discarded – undo
415 415
 			'data'         => false
416 416
 		);
417 417
 
418
-		$args = wp_parse_args( $args, $defaults );
418
+		$args = wp_parse_args($args, $defaults);
419 419
 
420 420
 		$disabled = '';
421
-		if ( $args['disabled'] ) {
421
+		if ($args['disabled']) {
422 422
 			$disabled = ' disabled="disabled"';
423 423
 		}
424 424
 
425 425
 		$data = '';
426
-		if ( ! empty( $args['data'] ) ) {
427
-			foreach ( $args['data'] as $key => $value ) {
428
-				$data .= 'data-' . $key . '="' . $value . '" ';
426
+		if ( ! empty($args['data'])) {
427
+			foreach ($args['data'] as $key => $value) {
428
+				$data .= 'data-'.$key.'="'.$value.'" ';
429 429
 			}
430 430
 		}
431 431
 
432
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
432
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
433 433
 
434
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
434
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
435 435
 
436
-		if ( ! empty( $args['desc'] ) ) {
437
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
436
+		if ( ! empty($args['desc'])) {
437
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
438 438
 		}
439 439
 
440
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
440
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
441 441
 
442 442
 		$output .= '</span>';
443 443
 
@@ -453,15 +453,15 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return string Datepicker field
455 455
 	 */
456
-	public function date_field( $args = array() ) {
456
+	public function date_field($args = array()) {
457 457
 
458
-		if ( empty( $args['class'] ) ) {
458
+		if (empty($args['class'])) {
459 459
 			$args['class'] = 'give_datepicker';
460
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
460
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
461 461
 			$args['class'] .= ' give_datepicker';
462 462
 		}
463 463
 
464
-		return $this->text( $args );
464
+		return $this->text($args);
465 465
 	}
466 466
 
467 467
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return string textarea
476 476
 	 */
477
-	public function textarea( $args = array() ) {
477
+	public function textarea($args = array()) {
478 478
 		$defaults = array(
479 479
 			'name'     => 'textarea',
480 480
 			'value'    => null,
@@ -484,21 +484,21 @@  discard block
 block discarded – undo
484 484
 			'disabled' => false
485 485
 		);
486 486
 
487
-		$args = wp_parse_args( $args, $defaults );
487
+		$args = wp_parse_args($args, $defaults);
488 488
 
489 489
 		$disabled = '';
490
-		if ( $args['disabled'] ) {
490
+		if ($args['disabled']) {
491 491
 			$disabled = ' disabled="disabled"';
492 492
 		}
493 493
 
494
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
494
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
495 495
 
496
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
496
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
497 497
 
498
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
498
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
499 499
 
500
-		if ( ! empty( $args['desc'] ) ) {
501
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
500
+		if ( ! empty($args['desc'])) {
501
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
502 502
 		}
503 503
 
504 504
 		$output .= '</span>';
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @return string text field with ajax search
517 517
 	 */
518
-	public function ajax_user_search( $args = array() ) {
518
+	public function ajax_user_search($args = array()) {
519 519
 
520 520
 		$defaults = array(
521 521
 			'name'         => 'user_id',
522 522
 			'value'        => null,
523
-			'placeholder'  => __( 'Enter username', 'give' ),
523
+			'placeholder'  => __('Enter username', 'give'),
524 524
 			'label'        => null,
525 525
 			'desc'         => null,
526 526
 			'class'        => '',
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 			'data'         => false
530 530
 		);
531 531
 
532
-		$args = wp_parse_args( $args, $defaults );
532
+		$args = wp_parse_args($args, $defaults);
533 533
 
534
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
534
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
535 535
 
536 536
 		$output = '<span class="give_user_search_wrap">';
537
-		$output .= $this->text( $args );
538
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . __( 'Cancel', 'give' ) . '" aria-label="' . __( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
537
+		$output .= $this->text($args);
538
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.__('Cancel', 'give').'" aria-label="'.__('Cancel', 'give').'" href="#">x</a><span></span></span>';
539 539
 		$output .= '</span>';
540 540
 
541 541
 		return $output;
Please login to merge, or discard this patch.