Completed
Pull Request — master (#779)
by
unknown
20:35
created
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
  * @return void
38 38
  */
39 39
 function give_load_ajax_gateway() {
40
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
-		do_action( 'give_purchase_form', $_POST['give_form_id'] );
40
+	if (isset($_POST['give_payment_mode'])) {
41
+		do_action('give_purchase_form', $_POST['give_form_id']);
42 42
 		exit();
43 43
 	}
44 44
 }
45 45
 
46
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
47
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
46
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
47
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
48 48
 
49 49
 /**
50 50
  * Sets an error on checkout if no gateways are enabled
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 function give_no_gateway_error() {
56 56
 	$gateways = give_get_enabled_payment_gateways();
57 57
 
58
-	if ( empty( $gateways ) ) {
59
-		give_set_error( 'no_gateways', esc_html( 'You must enable a payment gateway to use Give.', 'give' ) );
58
+	if (empty($gateways)) {
59
+		give_set_error('no_gateways', esc_html('You must enable a payment gateway to use Give.', 'give'));
60 60
 	} else {
61
-		give_unset_error( 'no_gateways' );
61
+		give_unset_error('no_gateways');
62 62
 	}
63 63
 }
64 64
 
65
-add_action( 'init', 'give_no_gateway_error' );
66 65
\ No newline at end of file
66
+add_action('init', 'give_no_gateway_error');
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
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_html( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_html( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_html('Offline Donation', 'give'),
25
+		'checkout_label' => esc_html('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,56 +40,56 @@  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' );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60 60
 		/* translators: %s: form settings url */
61
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_html( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
62
-		echo wpautop( stripslashes( $offline_instructions ) );
61
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_html('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
62
+		echo wpautop(stripslashes($offline_instructions));
63 63
 		?>
64 64
 	</fieldset>
65
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
65
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
66 66
 	<?php
67 67
 	echo ob_get_clean();
68 68
 }
69 69
 
70
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
70
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
71 71
 
72 72
 /**
73 73
  * Give Offline Billing Field
74 74
  *
75 75
  * @param $form_id
76 76
  */
77
-function give_offline_billing_fields( $form_id ) {
77
+function give_offline_billing_fields($form_id) {
78 78
 	//Enable Default CC fields (billing info)
79
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
80
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
79
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
80
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
81 81
 
82
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
82
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
83 83
 
84 84
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
85
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
86
-		give_default_cc_address_fields( $form_id );
87
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
-		give_default_cc_address_fields( $form_id );
85
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
86
+		give_default_cc_address_fields($form_id);
87
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
+		give_default_cc_address_fields($form_id);
89 89
 	}
90 90
 }
91 91
 
92
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
92
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
93 93
 
94 94
 /**
95 95
  * Process the payment
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  *
101 101
  * @return void
102 102
  */
103
-function give_offline_process_payment( $purchase_data ) {
103
+function give_offline_process_payment($purchase_data) {
104 104
 
105
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
105
+	$purchase_summary = give_get_purchase_summary($purchase_data);
106 106
 
107 107
 	// setup the payment details
108 108
 	$payment_data = array(
109 109
 		'price'           => $purchase_data['price'],
110 110
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
111
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
112
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
111
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
112
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
113 113
 		'date'            => $purchase_data['date'],
114 114
 		'user_email'      => $purchase_data['user_email'],
115 115
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	// record the pending payment
124
-	$payment = give_insert_payment( $payment_data );
124
+	$payment = give_insert_payment($payment_data);
125 125
 
126
-	if ( $payment ) {
127
-		give_offline_send_admin_notice( $payment );
128
-		give_offline_send_donor_instructions( $payment );
126
+	if ($payment) {
127
+		give_offline_send_admin_notice($payment);
128
+		give_offline_send_donor_instructions($payment);
129 129
 		give_send_to_success_page();
130 130
 	} else {
131 131
 		// if errors are present, send the user back to the donation form so they can be corrected
132
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
132
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
133 133
 	}
134 134
 
135 135
 }
136 136
 
137
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
137
+add_action('give_gateway_offline', 'give_offline_process_payment');
138 138
 
139 139
 
140 140
 /**
@@ -147,47 +147,47 @@  discard block
 block discarded – undo
147 147
  * @since       1.0
148 148
  * @return void
149 149
  */
150
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
150
+function give_offline_send_donor_instructions($payment_id = 0) {
151 151
 
152
-	$payment_data                      = give_get_payment_meta( $payment_id );
153
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
152
+	$payment_data                      = give_get_payment_meta($payment_id);
153
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
154 154
 
155 155
 	//Customize email content depending on whether the single form has been customized
156
-	$email_content = give_get_option( 'global_offline_donation_email' );
156
+	$email_content = give_get_option('global_offline_donation_email');
157 157
 
158
-	if ( $post_offline_customization_option === 'yes' ) {
159
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
158
+	if ($post_offline_customization_option === 'yes') {
159
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
160 160
 	}
161 161
 
162
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
163
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
162
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
163
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
164 164
 
165
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
166
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
165
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
166
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
167 167
 
168
-	$to_email = give_get_payment_user_email( $payment_id );
168
+	$to_email = give_get_payment_user_email($payment_id);
169 169
 
170
-	$subject = give_get_option( 'offline_donation_subject', esc_html( 'Offline Donation Instructions', 'give' ) );
171
-	if ( $post_offline_customization_option === 'yes' ) {
172
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
170
+	$subject = give_get_option('offline_donation_subject', esc_html('Offline Donation Instructions', 'give'));
171
+	if ($post_offline_customization_option === 'yes') {
172
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
173 173
 	}
174 174
 
175
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
176
-	$subject = give_do_email_tags( $subject, $payment_id );
175
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
176
+	$subject = give_do_email_tags($subject, $payment_id);
177 177
 
178
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
179
-	$message     = give_do_email_tags( $email_content, $payment_id );
178
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
179
+	$message     = give_do_email_tags($email_content, $payment_id);
180 180
 
181 181
 	$emails = Give()->emails;
182 182
 
183
-	$emails->__set( 'from_name', $from_name );
184
-	$emails->__set( 'from_email', $from_email );
185
-	$emails->__set( 'heading', esc_html( 'Offline Donation Instructions', 'give' ) );
183
+	$emails->__set('from_name', $from_name);
184
+	$emails->__set('from_email', $from_email);
185
+	$emails->__set('heading', esc_html('Offline Donation Instructions', 'give'));
186 186
 
187
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
188
-	$emails->__set( 'headers', $headers );
187
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
188
+	$emails->__set('headers', $headers);
189 189
 
190
-	$emails->send( $to_email, $subject, $message, $attachments );
190
+	$emails->send($to_email, $subject, $message, $attachments);
191 191
 
192 192
 }
193 193
 
@@ -204,50 +204,50 @@  discard block
 block discarded – undo
204 204
  * @return void
205 205
  *
206 206
  */
207
-function give_offline_send_admin_notice( $payment_id = 0 ) {
207
+function give_offline_send_admin_notice($payment_id = 0) {
208 208
 
209 209
 	/* Send an email notification to the admin */
210 210
 	$admin_email = give_get_admin_notice_emails();
211
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
211
+	$user_info   = give_get_payment_meta_user_info($payment_id);
212 212
 
213
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
214
-		$user_data = get_userdata( $user_info['id'] );
213
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
214
+		$user_data = get_userdata($user_info['id']);
215 215
 		$name      = $user_data->display_name;
216
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
217
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
216
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
217
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
218 218
 	} else {
219 219
 		$name = $user_info['email'];
220 220
 	}
221 221
 
222
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
222
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
223 223
 
224
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_html( 'New Pending Donation', 'give' ), $payment_id );
224
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_html('New Pending Donation', 'give'), $payment_id);
225 225
 
226
-	$admin_message = esc_html( 'Dear Admin,', 'give' ) . "\n\n";
227
-	$admin_message .= esc_html( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
228
-	$admin_message .= esc_html( '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";
226
+	$admin_message = esc_html('Dear Admin,', 'give')."\n\n";
227
+	$admin_message .= esc_html('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
228
+	$admin_message .= esc_html('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";
229 229
 
230 230
 
231
-	$admin_message .= '<strong>' . esc_html( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
232
-	$admin_message .= '<strong>' . esc_html( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
231
+	$admin_message .= '<strong>'.esc_html('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
232
+	$admin_message .= '<strong>'.esc_html('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
233 233
 
234 234
 	$admin_message .= sprintf(
235 235
 		'<a href="%1$s">%2$s</a>',
236
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
237
-		esc_html( 'Click Here to View and/or Update Donation Details', 'give' )
238
-	) . "\n\n";
236
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
237
+		esc_html('Click Here to View and/or Update Donation Details', 'give')
238
+	)."\n\n";
239 239
 
240
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
241
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
242
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
240
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
241
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
242
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
243 243
 
244 244
 	//Send Email
245 245
 	$emails = Give()->emails;
246
-	if ( ! empty( $admin_headers ) ) {
247
-		$emails->__set( 'headers', $admin_headers );
246
+	if ( ! empty($admin_headers)) {
247
+		$emails->__set('headers', $admin_headers);
248 248
 	}
249 249
 
250
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
250
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
251 251
 
252 252
 }
253 253
 
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
  * @since  1.0
259 259
  * @return array
260 260
  */
261
-function give_offline_add_settings( $settings ) {
261
+function give_offline_add_settings($settings) {
262 262
 
263 263
 	//Vars
264 264
 	$prefix = '_give_';
265 265
 
266
-	$is_gateway_active = give_is_gateway_active( 'offline' );
266
+	$is_gateway_active = give_is_gateway_active('offline');
267 267
 
268 268
 	//this gateway isn't active
269
-	if ( ! $is_gateway_active ) {
269
+	if ( ! $is_gateway_active) {
270 270
 		//return settings and bounce
271 271
 		return $settings;
272 272
 	}
@@ -275,27 +275,27 @@  discard block
 block discarded – undo
275 275
 	$check_settings = array(
276 276
 
277 277
 		array(
278
-			'name'    => esc_html( 'Customize Offline Donations', 'give' ),
279
-			'desc'    => esc_html( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
280
-			'id'      => $prefix . 'customize_offline_donations',
278
+			'name'    => esc_html('Customize Offline Donations', 'give'),
279
+			'desc'    => esc_html('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
280
+			'id'      => $prefix.'customize_offline_donations',
281 281
 			'type'    => 'radio_inline',
282 282
 			'default' => 'no',
283 283
 			'options' => array(
284
-				'yes' => esc_html( 'Yes', 'give' ),
285
-				'no'  => esc_html( 'No', 'give' ),
284
+				'yes' => esc_html('Yes', 'give'),
285
+				'no'  => esc_html('No', 'give'),
286 286
 			),
287 287
 		),
288 288
 		array(
289
-			'name'        => esc_html( 'Request Billing Information', 'give' ),
290
-			'desc'        => esc_html( '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' ),
291
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
289
+			'name'        => esc_html('Request Billing Information', 'give'),
290
+			'desc'        => esc_html('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'),
291
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
292 292
 			'row_classes' => 'give-subfield',
293 293
 			'type'        => 'checkbox'
294 294
 		),
295 295
 		array(
296
-			'id'          => $prefix . 'offline_checkout_notes',
297
-			'name'        => esc_html( 'Offline Donation Instructions', 'give' ),
298
-			'desc'        => esc_html( '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' ),
296
+			'id'          => $prefix.'offline_checkout_notes',
297
+			'name'        => esc_html('Offline Donation Instructions', 'give'),
298
+			'desc'        => esc_html('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'),
299 299
 			'default'     => give_get_default_offline_donation_content(),
300 300
 			'type'        => 'wysiwyg',
301 301
 			'row_classes' => 'give-subfield',
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 			)
305 305
 		),
306 306
 		array(
307
-			'id'          => $prefix . 'offline_donation_subject',
308
-			'name'        => esc_html( 'Offline Donation Email Instructions Subject', 'give' ),
309
-			'desc'        => esc_html( 'Enter the subject line for the donation receipt email.', 'give' ),
310
-			'default'     => esc_html( '{donation} - Offline Donation Instructions', 'give' ),
307
+			'id'          => $prefix.'offline_donation_subject',
308
+			'name'        => esc_html('Offline Donation Email Instructions Subject', 'give'),
309
+			'desc'        => esc_html('Enter the subject line for the donation receipt email.', 'give'),
310
+			'default'     => esc_html('{donation} - Offline Donation Instructions', 'give'),
311 311
 			'row_classes' => 'give-subfield',
312 312
 			'type'        => 'text'
313 313
 		),
314 314
 		array(
315
-			'id'          => $prefix . 'offline_donation_email',
316
-			'name'        => esc_html( 'Offline Donation Email Instructions', 'give' ),
317
-			'desc'        => esc_html( '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' ),
315
+			'id'          => $prefix.'offline_donation_email',
316
+			'name'        => esc_html('Offline Donation Email Instructions', 'give'),
317
+			'desc'        => esc_html('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'),
318 318
 			'default'     => give_get_default_offline_donation_email_content(),
319 319
 			'type'        => 'wysiwyg',
320 320
 			'row_classes' => 'give-subfield',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 		)
325 325
 	);
326 326
 
327
-	return array_merge( $settings, $check_settings );
327
+	return array_merge($settings, $check_settings);
328 328
 }
329 329
 
330
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
330
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
331 331
 
332 332
 
333 333
 /**
@@ -339,32 +339,32 @@  discard block
 block discarded – undo
339 339
  */
340 340
 function give_get_default_offline_donation_content() {
341 341
 
342
-	$sitename = get_bloginfo( 'sitename' );
342
+	$sitename = get_bloginfo('sitename');
343 343
 
344
-	$default_text = '<p>' . esc_html( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
344
+	$default_text = '<p>'.esc_html('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
345 345
 	$default_text .= '<ol>';
346 346
 	$default_text .= '<li>';
347 347
 	$default_text .= sprintf(
348 348
 		/* translators: %s: site name */
349
-		esc_html( 'Make a check payable to "%s"', 'give' ),
349
+		esc_html('Make a check payable to "%s"', 'give'),
350 350
 		$sitename
351 351
 	);
352 352
 	$default_text .= '</li>';
353 353
 	$default_text .= '<li>';
354 354
 	$default_text .= sprintf(
355 355
 		/* translators: %s: site name */
356
-		esc_html( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
356
+		esc_html('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
357 357
 		$sitename
358 358
 	);
359 359
 	$default_text .= '</li>';
360
-	$default_text .= '<li>' . esc_html( 'Please mail your check to:', 'give' ) . '</li>';
360
+	$default_text .= '<li>'.esc_html('Please mail your check to:', 'give').'</li>';
361 361
 	$default_text .= '</ol>';
362
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
362
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
363 363
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
364 364
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
365
-	$default_text .= '<p>' . esc_html( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
365
+	$default_text .= '<p>'.esc_html('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
366 366
 
367
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
367
+	return apply_filters('give_default_offline_donation_content', $default_text);
368 368
 
369 369
 }
370 370
 
@@ -377,33 +377,33 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_get_default_offline_donation_email_content() {
379 379
 
380
-	$sitename      = get_bloginfo( 'sitename' );
381
-	$default_text  = '<p>' . esc_html( 'Dear {name},', 'give' ) . '</p>';
382
-	$default_text .= '<p>' . esc_html( '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>';
380
+	$sitename      = get_bloginfo('sitename');
381
+	$default_text  = '<p>'.esc_html('Dear {name},', 'give').'</p>';
382
+	$default_text .= '<p>'.esc_html('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>';
383 383
 	$default_text .= '<ol>';
384 384
 	$default_text .= '<li>';
385 385
 	$default_text .= sprintf(
386 386
 		/* translators: %s: site name */
387
-		esc_html( 'Make a check payable to "%s"', 'give' ),
387
+		esc_html('Make a check payable to "%s"', 'give'),
388 388
 		$sitename
389 389
 	);
390 390
 	$default_text .= '</li>';
391 391
 	$default_text .= '<li>';
392 392
 	$default_text .= sprintf(
393 393
 		/* translators: %s: site name */
394
-		esc_html( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
394
+		esc_html('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
395 395
 		$sitename
396 396
 	);
397 397
 	$default_text .= '</li>';
398
-	$default_text .= '<li>' . esc_html( 'Please mail your check to:', 'give' ) . '</li>';
398
+	$default_text .= '<li>'.esc_html('Please mail your check to:', 'give').'</li>';
399 399
 	$default_text .= '</ol>';
400
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
400
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
401 401
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
402 402
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
403
-	$default_text .= '<p>' . esc_html( '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>';
404
-	$default_text .= '<p>' . esc_html( 'Sincerely,', 'give' ) . '</p>';
405
-	$default_text .= '<p>' . $sitename . '</p>';
403
+	$default_text .= '<p>'.esc_html('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>';
404
+	$default_text .= '<p>'.esc_html('Sincerely,', 'give').'</p>';
405
+	$default_text .= '<p>'.$sitename.'</p>';
406 406
 
407
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
407
+	return apply_filters('give_default_offline_donation_content', $default_text);
408 408
 
409 409
 }
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -50,50 +50,50 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 
52 52
 	// https://gist.github.com/justinph/5197810
53
-	function validate_gravatar( $id_or_email ) {
53
+	function validate_gravatar($id_or_email) {
54 54
 		//id or email code borrowed from wp-includes/pluggable.php
55 55
 		$email = '';
56
-		if ( is_numeric( $id_or_email ) ) {
56
+		if (is_numeric($id_or_email)) {
57 57
 			$id   = (int) $id_or_email;
58
-			$user = get_userdata( $id );
59
-			if ( $user ) {
58
+			$user = get_userdata($id);
59
+			if ($user) {
60 60
 				$email = $user->user_email;
61 61
 			}
62
-		} elseif ( is_object( $id_or_email ) ) {
62
+		} elseif (is_object($id_or_email)) {
63 63
 			// No avatar for pingbacks or trackbacks
64
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
65
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
64
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
65
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
66 66
 				return false;
67 67
 			}
68 68
 
69
-			if ( ! empty( $id_or_email->user_id ) ) {
69
+			if ( ! empty($id_or_email->user_id)) {
70 70
 				$id   = (int) $id_or_email->user_id;
71
-				$user = get_userdata( $id );
72
-				if ( $user ) {
71
+				$user = get_userdata($id);
72
+				if ($user) {
73 73
 					$email = $user->user_email;
74 74
 				}
75
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
75
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
76 76
 				$email = $id_or_email->comment_author_email;
77 77
 			}
78 78
 		} else {
79 79
 			$email = $id_or_email;
80 80
 		}
81 81
 
82
-		$hashkey = md5( strtolower( trim( $email ) ) );
83
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
82
+		$hashkey = md5(strtolower(trim($email)));
83
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
84 84
 
85
-		$data = wp_cache_get( $hashkey );
86
-		if ( false === $data ) {
87
-			$response = wp_remote_head( $uri );
88
-			if ( is_wp_error( $response ) ) {
85
+		$data = wp_cache_get($hashkey);
86
+		if (false === $data) {
87
+			$response = wp_remote_head($uri);
88
+			if (is_wp_error($response)) {
89 89
 				$data = 'not200';
90 90
 			} else {
91 91
 				$data = $response['response']['code'];
92 92
 			}
93
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
93
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
94 94
 
95 95
 		}
96
-		if ( $data == '200' ) {
96
+		if ($data == '200') {
97 97
 			return true;
98 98
 		} else {
99 99
 			return false;
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param int $form_id
110 110
 	 */
111
-	function get_log_ids( $form_id = '' ) {
111
+	function get_log_ids($form_id = '') {
112 112
 
113 113
 		// get Give_Logging class
114 114
 		global $give_logs;
115 115
 
116 116
 		// get log for this form
117
-		$logs = $give_logs->get_logs( $form_id );
117
+		$logs = $give_logs->get_logs($form_id);
118 118
 
119
-		if ( $logs ) {
119
+		if ($logs) {
120 120
 			// make an array with all the donor IDs
121
-			foreach ( $logs as $log ) {
121
+			foreach ($logs as $log) {
122 122
 				$log_ids[] = $log->ID;
123 123
 			}
124 124
 
@@ -135,49 +135,49 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @since 1.0
137 137
 	 */
138
-	function get_payment_ids( $form_id = '' ) {
138
+	function get_payment_ids($form_id = '') {
139 139
 
140 140
 		global $give_options;
141 141
 
142
-		$log_ids = $this->get_log_ids( $form_id );
142
+		$log_ids = $this->get_log_ids($form_id);
143 143
 
144
-		if ( $log_ids ) {
144
+		if ($log_ids) {
145 145
 
146 146
 			$payment_ids = array();
147 147
 
148
-			foreach ( $log_ids as $id ) {
148
+			foreach ($log_ids as $id) {
149 149
 				// get the payment ID for each corresponding log ID
150
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
150
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
151 151
 			}
152 152
 
153 153
 			// remove donors who have purchased more than once so we can have unique avatars
154 154
 			$unique_emails = array();
155 155
 
156
-			foreach ( $payment_ids as $key => $id ) {
156
+			foreach ($payment_ids as $key => $id) {
157 157
 
158
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
158
+				$email = get_post_meta($id, '_give_payment_user_email', true);
159 159
 
160
-				if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) {
161
-					if ( ! $this->validate_gravatar( $email ) ) {
160
+				if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) {
161
+					if ( ! $this->validate_gravatar($email)) {
162 162
 						continue;
163 163
 					}
164 164
 				}
165 165
 
166
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
166
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
167 167
 
168 168
 			}
169 169
 
170 170
 			// strip duplicate emails
171
-			$unique_emails = array_unique( $unique_emails );
171
+			$unique_emails = array_unique($unique_emails);
172 172
 
173 173
 			// convert the unique IDs back into simple array
174
-			foreach ( $unique_emails as $id => $email ) {
174
+			foreach ($unique_emails as $id => $email) {
175 175
 				$unique_ids[] = $id;
176 176
 			}
177 177
 
178 178
 			// randomize the payment IDs if enabled
179
-			if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) {
180
-				shuffle( $unique_ids );
179
+			if (isset($give_options['give_donators_gravatars_random_gravatars'])) {
180
+				shuffle($unique_ids);
181 181
 			}
182 182
 
183 183
 			// return our unique IDs
@@ -193,22 +193,22 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @since 1.0
195 195
 	 */
196
-	function gravatars( $form_id = false, $title = '' ) {
196
+	function gravatars($form_id = false, $title = '') {
197 197
 
198 198
 		// unique $payment_ids 
199
-		$payment_ids = $this->get_payment_ids( $form_id );
199
+		$payment_ids = $this->get_payment_ids($form_id);
200 200
 
201 201
 		global $give_options;
202 202
 
203 203
 		// return if no ID
204
-		if ( ! $form_id ) {
204
+		if ( ! $form_id) {
205 205
 			return;
206 206
 		}
207 207
 
208 208
 		// minimum amount of purchases before showing gravatars
209 209
 		// if the number of items in array is not greater or equal to the number specified, then exit
210
-		if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) {
211
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) {
210
+		if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) {
211
+			if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) {
212 212
 				return;
213 213
 			}
214 214
 		}
@@ -219,51 +219,51 @@  discard block
 block discarded – undo
219 219
 		echo '<div id="give-purchase-gravatars">';
220 220
 
221 221
 
222
-		if ( isset ( $title ) ) {
222
+		if (isset ($title)) {
223 223
 
224
-			if ( $title ) {
225
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_html( $title ) . '</h3>' );
226
-			} elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) {
227
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_html( $give_options['give_donators_gravatars_heading'] ) . '</h2>' );
224
+			if ($title) {
225
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_html($title).'</h3>');
226
+			} elseif (isset($give_options['give_donators_gravatars_heading'])) {
227
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_html($give_options['give_donators_gravatars_heading']).'</h2>');
228 228
 			}
229 229
 
230 230
 		}
231 231
 		echo '<ul class="give-purchase-gravatars-list">';
232 232
 		$i = 0;
233 233
 
234
-		if ( $payment_ids ) {
235
-			foreach ( $payment_ids as $id ) {
234
+		if ($payment_ids) {
235
+			foreach ($payment_ids as $id) {
236 236
 
237 237
 				// Give saves a blank option even when the control is turned off, hence the extra check
238
-				if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) {
238
+				if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) {
239 239
 					continue;
240 240
 				}
241 241
 
242 242
 				// get the payment meta
243
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
243
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
244 244
 
245 245
 				// unserialize the payment meta
246
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
246
+				$user_info = maybe_unserialize($payment_meta['user_info']);
247 247
 
248 248
 				// get donor's first name
249 249
 				$name = $user_info['first_name'];
250 250
 
251 251
 				// get donor's email
252
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
252
+				$email = get_post_meta($id, '_give_payment_user_email', true);
253 253
 
254 254
 				// set gravatar size and provide filter
255
-				$size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : '';
255
+				$size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : '';
256 256
 
257 257
 				// default image
258
-				$default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false );
258
+				$default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false);
259 259
 
260 260
 				// assemble output
261 261
 				$output .= '<li>';
262 262
 
263
-				$output .= get_avatar( $email, $size, $default_image, $name );
263
+				$output .= get_avatar($email, $size, $default_image, $name);
264 264
 				$output .= '</li>';
265 265
 
266
-				$i ++;
266
+				$i++;
267 267
 
268 268
 			} // end foreach
269 269
 		}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		echo '</ul>';
273 273
 		echo '</div>';
274 274
 
275
-		return apply_filters( 'give_donators_gravatars', ob_get_clean() );
275
+		return apply_filters('give_donators_gravatars', ob_get_clean());
276 276
 	}
277 277
 
278 278
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @since 1.0
282 282
 	 */
283 283
 	function register_widget() {
284
-		register_widget( 'Give_Donators_Gravatars_Widget' );
284
+		register_widget('Give_Donators_Gravatars_Widget');
285 285
 	}
286 286
 
287 287
 	/**
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 	 * @since 1.0
291 291
 	 * @todo  set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
292 292
 	 */
293
-	function shortcode( $atts, $content = null ) {
293
+	function shortcode($atts, $content = null) {
294 294
 
295
-		$atts = shortcode_atts( array(
295
+		$atts = shortcode_atts(array(
296 296
 			'id'    => '',
297 297
 			'title' => ''
298
-		), $atts, 'give_donators_gravatars' );
298
+		), $atts, 'give_donators_gravatars');
299 299
 
300 300
 		// if no ID is passed on single give_forms pages, get the correct ID
301
-		if ( is_singular( 'give_forms' ) ) {
301
+		if (is_singular('give_forms')) {
302 302
 			$id = get_the_ID();
303 303
 		}
304 304
 
305
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
305
+		$content = $this->gravatars($atts['id'], $atts['title']);
306 306
 
307 307
 		return $content;
308 308
 
@@ -313,57 +313,57 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @since 1.0
315 315
 	 */
316
-	function settings( $settings ) {
316
+	function settings($settings) {
317 317
 
318 318
 		$give_gravatar_settings = array(
319 319
 			array(
320
-				'name' => esc_html( 'Donator Gravatars', 'give' ),
320
+				'name' => esc_html('Donator Gravatars', 'give'),
321 321
 				'desc' => '<hr>',
322 322
 				'id'   => 'give_title',
323 323
 				'type' => 'give_title'
324 324
 			),
325 325
 			array(
326
-				'name' => esc_html( 'Heading', 'give' ),
327
-				'desc' => esc_html( 'The heading to display above the Gravatars', 'give' ),
326
+				'name' => esc_html('Heading', 'give'),
327
+				'desc' => esc_html('The heading to display above the Gravatars', 'give'),
328 328
 				'type' => 'text',
329 329
 				'id'   => 'give_donators_gravatars_heading'
330 330
 			),
331 331
 			array(
332
-				'name'    => esc_html( 'Gravatar Size', 'give' ),
333
-				'desc'    => esc_html( 'The size of each Gravatar in pixels (512px maximum)', 'give' ),
332
+				'name'    => esc_html('Gravatar Size', 'give'),
333
+				'desc'    => esc_html('The size of each Gravatar in pixels (512px maximum)', 'give'),
334 334
 				'type'    => 'text_small',
335 335
 				'id'      => 'give_donators_gravatars_gravatar_size',
336 336
 				'default' => '64'
337 337
 			),
338 338
 			array(
339
-				'name' => esc_html( 'Minimum Unique Purchases Required', 'give' ),
339
+				'name' => esc_html('Minimum Unique Purchases Required', 'give'),
340 340
 				/* translators: %s: form singular label */
341
-				'desc' => sprintf( esc_html( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
341
+				'desc' => sprintf(esc_html('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
342 342
 				'type' => 'text_small',
343 343
 				'id'   => 'give_donators_gravatars_min_purchases_required',
344 344
 			),
345 345
 			array(
346
-				'name'    => esc_html( 'Maximum Gravatars To Show', 'give' ),
347
-				'desc'    => esc_html( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
346
+				'name'    => esc_html('Maximum Gravatars To Show', 'give'),
347
+				'desc'    => esc_html('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
348 348
 				'type'    => 'text',
349 349
 				'id'      => 'give_donators_gravatars_maximum_number',
350 350
 				'default' => '20',
351 351
 			),
352 352
 			array(
353
-				'name' => esc_html( 'Gravatar Visibility', 'give' ),
354
-				'desc' => esc_html( 'Only show donators with a Gravatar account', 'give' ),
353
+				'name' => esc_html('Gravatar Visibility', 'give'),
354
+				'desc' => esc_html('Only show donators with a Gravatar account', 'give'),
355 355
 				'id'   => 'give_donators_gravatars_has_gravatar_account',
356 356
 				'type' => 'checkbox',
357 357
 			),
358 358
 			array(
359
-				'name' => esc_html( 'Randomize Gravatars', 'give' ),
360
-				'desc' => esc_html( 'Randomize the Gravatars', 'give' ),
359
+				'name' => esc_html('Randomize Gravatars', 'give'),
360
+				'desc' => esc_html('Randomize the Gravatars', 'give'),
361 361
 				'id'   => 'give_donators_gravatars_random_gravatars',
362 362
 				'type' => 'checkbox',
363 363
 			),
364 364
 		);
365 365
 
366
-		return array_merge( $settings, $give_gravatar_settings );
366
+		return array_merge($settings, $give_gravatar_settings);
367 367
 	}
368 368
 
369 369
 }
@@ -381,13 +381,13 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public function __construct() {
383 383
 
384
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
384
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
385 385
 
386 386
 		// widget settings
387 387
 		$widget_ops = array(
388 388
 			'classname'   => 'give-donators-gravatars',
389 389
 			/* translators: 1: form singular label 2: form singular label */
390
-			'description' => sprintf( esc_html( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular )
390
+			'description' => sprintf(esc_html('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular)
391 391
 		);
392 392
 
393 393
 		// widget control settings
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		// create the widget
401 401
 		parent::__construct(
402 402
 			'give_donators_gravatars_widget',
403
-			esc_html( 'Give Donators Gravatars', 'give' ),
403
+			esc_html('Give Donators Gravatars', 'give'),
404 404
 			$widget_ops,
405 405
 			$control_ops
406 406
 		);
@@ -411,30 +411,30 @@  discard block
 block discarded – undo
411 411
 	/*
412 412
 	 * Outputs the content of the widget
413 413
 	 */
414
-	function widget( $args, $instance ) {
414
+	function widget($args, $instance) {
415 415
 		global $give_options;
416 416
 
417 417
 		//@TODO: Don't extract it!!!
418
-		extract( $args );
418
+		extract($args);
419 419
 
420
-		if ( ! is_singular( 'give_forms' ) ) {
420
+		if ( ! is_singular('give_forms')) {
421 421
 			return;
422 422
 		}
423 423
 
424 424
 		// Variables from widget settings
425
-		$title = apply_filters( 'widget_title', $instance['title'] );
425
+		$title = apply_filters('widget_title', $instance['title']);
426 426
 
427 427
 		// Used by themes. Opens the widget
428 428
 		echo $before_widget;
429 429
 
430 430
 		// Display the widget title
431
-		if ( $title ) {
432
-			echo $before_title . $title . $after_title;
431
+		if ($title) {
432
+			echo $before_title.$title.$after_title;
433 433
 		}
434 434
 
435 435
 		$gravatars = new Give_Donators_Gravatars();
436 436
 
437
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
437
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
438 438
 
439 439
 		// Used by themes. Closes the widget
440 440
 		echo $after_widget;
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	/*
445 445
 	 * Update function. Processes widget options to be saved
446 446
 	 */
447
-	function update( $new_instance, $old_instance ) {
447
+	function update($new_instance, $old_instance) {
448 448
 
449 449
 		$instance = $old_instance;
450 450
 
451
-		$instance['title'] = strip_tags( $new_instance['title'] );
451
+		$instance['title'] = strip_tags($new_instance['title']);
452 452
 
453 453
 		return $instance;
454 454
 
@@ -457,19 +457,19 @@  discard block
 block discarded – undo
457 457
 	/*
458 458
 	 * Form function. Displays the actual form on the widget page
459 459
 	 */
460
-	function form( $instance ) {
460
+	function form($instance) {
461 461
 
462 462
 		// Set up some default widget settings.
463 463
 		$defaults = array(
464 464
 			'title' => '',
465 465
 		);
466 466
 
467
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
467
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
468 468
 
469 469
 		<!-- Title -->
470 470
 		<p>
471
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
472
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
471
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
472
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
473 473
 		</p>
474 474
 
475 475
 
Please login to merge, or discard this patch.
includes/admin/plugins.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return array $links
28 28
  */
29
-function give_plugin_action_links( $links, $file ) {
30
-	$settings_link = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings' ) . '">' . esc_html( 'Settings', 'give' ) . '</a>';
31
-	if ( $file == 'give/give.php' ) {
32
-		array_unshift( $links, $settings_link );
29
+function give_plugin_action_links($links, $file) {
30
+	$settings_link = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings').'">'.esc_html('Settings', 'give').'</a>';
31
+	if ($file == 'give/give.php') {
32
+		array_unshift($links, $settings_link);
33 33
 	}
34 34
 
35 35
 	return $links;
36 36
 }
37 37
 
38
-add_filter( 'plugin_action_links', 'give_plugin_action_links', 10, 2 );
38
+add_filter('plugin_action_links', 'give_plugin_action_links', 10, 2);
39 39
 
40 40
 
41 41
 /**
@@ -48,33 +48,33 @@  discard block
 block discarded – undo
48 48
  *
49 49
  * @return array $input
50 50
  */
51
-function give_plugin_row_meta( $input, $file ) {
52
-	if ( $file != 'give/give.php' ) {
51
+function give_plugin_row_meta($input, $file) {
52
+	if ($file != 'give/give.php') {
53 53
 		return $input;
54 54
 	}
55 55
 
56
-	$give_addons_link = esc_url( add_query_arg( array(
56
+	$give_addons_link = esc_url(add_query_arg(array(
57 57
 			'utm_source'   => 'plugins-page',
58 58
 			'utm_medium'   => 'plugin-row',
59 59
 			'utm_campaign' => 'admin',
60
-		), 'https://givewp.com/addons/' )
60
+		), 'https://givewp.com/addons/')
61 61
 	);
62 62
 
63
-	$give_docs_link = esc_url( add_query_arg( array(
63
+	$give_docs_link = esc_url(add_query_arg(array(
64 64
 			'utm_source'   => 'plugins-page',
65 65
 			'utm_medium'   => 'plugin-row',
66 66
 			'utm_campaign' => 'admin',
67
-		), 'https://givewp.com/documentation/' )
67
+		), 'https://givewp.com/documentation/')
68 68
 	);
69 69
 
70 70
 	$links = array(
71
-		'<a href="' . $give_docs_link . '" target="_blank">' . esc_html( 'Documentation', 'give' ) . '</a>',
72
-		'<a href="' . $give_addons_link . '" target="_blank">' . esc_html( 'Add-ons', 'give' ) . '</a>',
71
+		'<a href="'.$give_docs_link.'" target="_blank">'.esc_html('Documentation', 'give').'</a>',
72
+		'<a href="'.$give_addons_link.'" target="_blank">'.esc_html('Add-ons', 'give').'</a>',
73 73
 	);
74 74
 
75
-	$input = array_merge( $input, $links );
75
+	$input = array_merge($input, $links);
76 76
 
77 77
 	return $input;
78 78
 }
79 79
 
80
-add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 );
80
+add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2);
Please login to merge, or discard this patch.
includes/admin/admin-footer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: 1: plugin name - "Give". 2: Link to 5 star rating */
33
-			esc_html( 'If you like %1$s please leave us a %2$s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			sprintf( '<strong>%s</strong>', esc_html( 'Give', 'give' ) ),
35
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_attr( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			esc_html('If you like %1$s please leave us a %2$s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			sprintf('<strong>%s</strong>', esc_html('Give', 'give')),
35
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_attr('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
36 36
 		);
37 37
 
38 38
 		return $rate_text;
@@ -41,4 +41,4 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 }
43 43
 
44
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
44
+add_filter('admin_footer_text', 'give_admin_rate_us');
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 2 patches
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -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 esc_html( '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 esc_html('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( esc_html( 'Search Donors', 'give' ), 'give-donors' );
80
+			$customers_table->search_box(esc_html('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', esc_html( 'You are not permitted to view this data.', 'give' ) );
108
+	if ( ! current_user_can($customer_view_role)) {
109
+		give_set_error('give-no-access', esc_html('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', esc_html( 'Invalid Donor ID Provided.', 'give' ) );
113
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
114
+		give_set_error('give-invalid_customer', esc_html('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', esc_html( 'Invalid Donor ID Provided.', 'give' ) );
121
+	if (empty($customer->id)) {
122
+		give_set_error('give-invalid_customer', esc_html('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 esc_attr_e( $tab['title'] ); ?>" aria-label="<?php esc_attr_e( $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 esc_attr_e($tab['title']); ?>" aria-label="<?php esc_attr_e($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 esc_html_e( $tab['title'] ); ?>
151
-								<?php if ( ! $active ) : ?>
150
+								<span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($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 esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_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 esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_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 esc_html_e( 'Donor since', 'give' ); ?>
213
-						<?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?>
212
+						<?php esc_html_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 esc_attr_e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
215
+					<?php if (current_user_can($customer_edit_role)): ?>
216
+						<a title="<?php esc_attr_e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_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_html_e( 'Email', 'give' ); ?></label>:</td>
226
+							<td><label for="tablecell"><?php esc_html_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 esc_attr_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 esc_attr_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_html_e( 'User ID', 'give' ); ?></label>:</td>
233
+							<td><label for="tablecell"><?php esc_html_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 esc_html_e( 'None', 'give' ); ?></span>
263
+										<span data-key="user_id"><?php esc_html_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 esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_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 esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_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_html_e( 'Address', 'give' ); ?>:</td>
274
+								<td><?php esc_html_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 esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
305
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
306
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
304
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
305
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
306
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_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 esc_attr_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 esc_attr_e('State / Province', 'give'); ?>" />
334 334
 											<?php endif; ?>
335
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
335
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
336 336
 													</span>
337 337
 
338 338
 									</div>
@@ -350,112 +350,112 @@  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 esc_attr_e( 'Update Donor', 'give' ); ?>" />
356
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
355
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
356
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_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 esc_attr_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 esc_attr_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 esc_html_e( 'Lifetime Donations', 'give' ); ?>
378
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_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 esc_html_e( 'Recent Donations', 'give' ); ?></h3>
390
+		<h3><?php esc_html_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 esc_html_e( 'ID', 'give' ); ?></th>
400
-				<th><?php esc_html_e( 'Amount', 'give' ); ?></th>
401
-				<th><?php esc_html_e( 'Date', 'give' ); ?></th>
402
-				<th><?php esc_html_e( 'Status', 'give' ); ?></th>
403
-				<th><?php esc_html_e( 'Actions', 'give' ); ?></th>
399
+				<th><?php esc_html_e('ID', 'give'); ?></th>
400
+				<th><?php esc_html_e('Amount', 'give'); ?></th>
401
+				<th><?php esc_html_e('Date', 'give'); ?></th>
402
+				<th><?php esc_html_e('Status', 'give'); ?></th>
403
+				<th><?php esc_html_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 esc_attr_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 esc_html_e( 'View Details', 'give' ); ?>
415
+							<a title="<?php esc_attr_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 esc_html_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 esc_html_e( 'No Donations Found', 'give' ); ?></td>
425
+					<td colspan="5"><?php esc_html_e('No Donations Found', 'give'); ?></td>
426 426
 				</tr>
427 427
 			<?php endif; ?>
428 428
 			</tbody>
429 429
 		</table>
430 430
 
431
-		<h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3>
431
+		<h3><?php esc_html_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 esc_html_e( 'Actions', 'give' ); ?></th>
439
+				<th width="120px"><?php esc_html_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 448
 							<a title="<?php
449 449
 								printf(
450 450
 									/* translators: %s: post title */
451
-									esc_attr( 'View %s', 'give' ),
451
+									esc_attr('View %s', 'give'),
452 452
 									$donation->post_title
453
-								); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) );
453
+								); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID));
454 454
 							?>">
455 455
 								<?php
456 456
 									printf(
457 457
 										/* translators: %s: forms singular label */
458
-										esc_html( 'View %s', 'give' ),
458
+										esc_html('View %s', 'give'),
459 459
 										give_get_forms_label_singular()
460 460
 									);
461 461
 								?>
@@ -465,17 +465,17 @@  discard block
 block discarded – undo
465 465
 				<?php endforeach; ?>
466 466
 			<?php else: ?>
467 467
 				<tr>
468
-					<td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td>
468
+					<td colspan="2"><?php esc_html_e('No Completed Donations Found', 'give'); ?></td>
469 469
 				</tr>
470 470
 			<?php endif; ?>
471 471
 			</tbody>
472 472
 		</table>
473 473
 
474
-		<?php do_action( 'give_donor_after_tables', $customer ); ?>
474
+		<?php do_action('give_donor_after_tables', $customer); ?>
475 475
 
476 476
 	</div>
477 477
 
478
-	<?php do_action( 'give_donor_card_bottom', $customer ); ?>
478
+	<?php do_action('give_donor_card_bottom', $customer); ?>
479 479
 
480 480
 	<?php
481 481
 }
@@ -489,30 +489,30 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @return void
491 491
  */
492
-function give_customer_notes_view( $customer ) {
492
+function give_customer_notes_view($customer) {
493 493
 
494
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
495
-	$paged          = absint( $paged );
494
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
495
+	$paged          = absint($paged);
496 496
 	$note_count     = $customer->get_notes_count();
497
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
498
-	$total_pages    = ceil( $note_count / $per_page );
499
-	$customer_notes = $customer->get_notes( $per_page, $paged );
497
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
498
+	$total_pages    = ceil($note_count / $per_page);
499
+	$customer_notes = $customer->get_notes($per_page, $paged);
500 500
 	?>
501 501
 
502 502
 	<div id="customer-notes-wrapper">
503 503
 		<div class="customer-notes-header">
504
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
504
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
505 505
 		</div>
506
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
506
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
507 507
 
508
-		<?php if ( 1 == $paged ) : ?>
508
+		<?php if (1 == $paged) : ?>
509 509
 			<div style="display: block; margin-bottom: 55px;">
510
-				<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 ); ?>">
510
+				<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); ?>">
511 511
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
512 512
 					<br />
513 513
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
514 514
 					<input type="hidden" name="give_action" value="add-customer-note" />
515
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
515
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
516 516
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
517 517
 				</form>
518 518
 			</div>
@@ -527,46 +527,46 @@  discard block
 block discarded – undo
527 527
 			'show_all' => true
528 528
 		);
529 529
 
530
-		echo paginate_links( $pagination_args );
530
+		echo paginate_links($pagination_args);
531 531
 		?>
532 532
 
533 533
 		<div id="give-customer-notes" class="postbox">
534
-			<?php if ( count( $customer_notes ) > 0 ) : ?>
535
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
534
+			<?php if (count($customer_notes) > 0) : ?>
535
+				<?php foreach ($customer_notes as $key => $note) : ?>
536 536
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
537 537
 					<span class="note-content-wrap">
538
-						<?php echo stripslashes( $note ); ?>
538
+						<?php echo stripslashes($note); ?>
539 539
 					</span>
540 540
 					</div>
541 541
 				<?php endforeach; ?>
542 542
 			<?php else: ?>
543 543
 				<div class="give-no-customer-notes">
544
-					<?php esc_html_e( 'No Donor Notes', 'give' ); ?>
544
+					<?php esc_html_e('No Donor Notes', 'give'); ?>
545 545
 				</div>
546 546
 			<?php endif; ?>
547 547
 		</div>
548 548
 
549
-		<?php echo paginate_links( $pagination_args ); ?>
549
+		<?php echo paginate_links($pagination_args); ?>
550 550
 
551 551
 	</div>
552 552
 
553 553
 	<?php
554 554
 }
555 555
 
556
-function give_customers_delete_view( $customer ) {
556
+function give_customers_delete_view($customer) {
557 557
 
558
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
558
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
559 559
 
560 560
 	?>
561 561
 
562
-	<?php do_action( 'give_customer_delete_top', $customer ); ?>
562
+	<?php do_action('give_customer_delete_top', $customer); ?>
563 563
 
564 564
 	<div class="info-wrapper customer-section">
565 565
 
566
-		<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 ); ?>">
566
+		<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); ?>">
567 567
 
568 568
 			<div class="customer-notes-header">
569
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
569
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
570 570
 			</div>
571 571
 
572 572
 
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 
575 575
 				<span class="delete-customer-options">
576 576
 					<p>
577
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
578
-						<label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
577
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
578
+						<label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
579 579
 					</p>
580 580
 
581 581
 					<p>
582
-						<?php echo Give()->html->checkbox( array(
582
+						<?php echo Give()->html->checkbox(array(
583 583
 							'name'    => 'give-customer-delete-records',
584
-							'options' => array( 'disabled' => true )
585
-						) ); ?>
586
-						<label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label>
584
+							'options' => array('disabled' => true)
585
+						)); ?>
586
+						<label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label>
587 587
 					</p>
588 588
 
589
-					<?php do_action( 'give_customer_delete_inputs', $customer ); ?>
589
+					<?php do_action('give_customer_delete_inputs', $customer); ?>
590 590
 				</span>
591 591
 
592 592
 				<span id="customer-edit-actions">
593 593
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
594
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
594
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
595 595
 					<input type="hidden" name="give_action" value="delete-customer" />
596
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
597
-					<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 esc_html_e( 'Cancel', 'give' ); ?></a>
596
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
597
+					<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 esc_html_e('Cancel', 'give'); ?></a>
598 598
 				</span>
599 599
 
600 600
 			</div>
@@ -604,5 +604,5 @@  discard block
 block discarded – undo
604 604
 
605 605
 	<?php
606 606
 
607
-	do_action( 'give_customer_delete_bottom', $customer );
607
+	do_action('give_customer_delete_bottom', $customer);
608 608
 }
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 esc_html_e( 'None', 'give' ); ?></span>
262
+									<?php else {
263
+	: ?>
264
+										<span data-key="user_id"><?php esc_html_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 esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_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 esc_attr_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 esc_attr_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 esc_attr_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 esc_html_e( 'No Donations Found', 'give' ); ?></td>
432
+					<td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' );
433
+}
434
+?></td>
426 435
 				</tr>
427 436
 			<?php endif; ?>
428 437
 			</tbody>
@@ -463,9 +472,12 @@  discard block
 block discarded – undo
463 472
 						</td>
464 473
 					</tr>
465 474
 				<?php endforeach; ?>
466
-			<?php else: ?>
475
+			<?php else {
476
+	: ?>
467 477
 				<tr>
468
-					<td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td>
478
+					<td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' );
479
+}
480
+?></td>
469 481
 				</tr>
470 482
 			<?php endif; ?>
471 483
 			</tbody>
@@ -539,9 +551,12 @@  discard block
 block discarded – undo
539 551
 					</span>
540 552
 					</div>
541 553
 				<?php endforeach; ?>
542
-			<?php else: ?>
554
+			<?php else {
555
+	: ?>
543 556
 				<div class="give-no-customer-notes">
544
-					<?php esc_html_e( 'No Donor Notes', 'give' ); ?>
557
+					<?php esc_html_e( 'No Donor Notes', 'give' );
558
+}
559
+?>
545 560
 				</div>
546 561
 			<?php endif; ?>
547 562
 		</div>
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 1 patch
Spacing   +128 added lines, -128 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,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( esc_html( 'You do not have permission to edit this donor.', 'give' ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(esc_html('You do not have permission to edit this donor.', 'give'));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( esc_html( 'Cheatin\' eh?!', 'give' ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(esc_html('Cheatin\' eh?!', 'give'));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		'user_id' => 0
55 55
 	);
56 56
 
57
-	$customer_info = wp_parse_args( $customer_info, $defaults );
57
+	$customer_info = wp_parse_args($customer_info, $defaults);
58 58
 
59
-	if ( ! is_email( $customer_info['email'] ) ) {
60
-		give_set_error( 'give-invalid-email', esc_html( 'Please enter a valid email address.', 'give' ) );
59
+	if ( ! is_email($customer_info['email'])) {
60
+		give_set_error('give-invalid-email', esc_html('Please enter a valid email address.', 'give'));
61 61
 	}
62 62
 
63
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
63
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a customer
66
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
67
-			give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
66
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
67
+			give_set_error('give-invalid-customer-user_id', sprintf(esc_html('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user
71
-		$user = get_user_by( 'id', $customer_info['user_id'] );
72
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
73
-			give_set_error( 'give-invalid-user_id', sprintf( esc_html( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
71
+		$user = get_user_by('id', $customer_info['user_id']);
72
+		if ( ! empty($customer_info['user_id']) && false === $user) {
73
+			give_set_error('give-invalid-user_id', sprintf(esc_html('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
74 74
 		}
75 75
 
76 76
 	}
@@ -78,82 +78,82 @@  discard block
 block discarded – undo
78 78
 	// Record this for later
79 79
 	$previous_user_id = $customer->user_id;
80 80
 
81
-	if ( give_get_errors() ) {
81
+	if (give_get_errors()) {
82 82
 		return;
83 83
 	}
84 84
 
85 85
 	// Setup the customer address, if present
86 86
 	$address = array();
87
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
87
+	if (intval($customer_info['user_id']) > 0) {
88 88
 
89
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
89
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
90 90
 
91
-		if ( false === $current_address ) {
92
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
93
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
94
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
95
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
96
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
97
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
91
+		if (false === $current_address) {
92
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
93
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
94
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
95
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
96
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
97
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
98 98
 		} else {
99
-			$current_address    = wp_parse_args( $current_address, array(
99
+			$current_address    = wp_parse_args($current_address, array(
100 100
 				'line1',
101 101
 				'line2',
102 102
 				'city',
103 103
 				'zip',
104 104
 				'state',
105 105
 				'country'
106
-			) );
107
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
108
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
109
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
110
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
111
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
112
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
106
+			));
107
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
108
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
109
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
110
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
111
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
112
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
113 113
 		}
114 114
 
115 115
 	}
116 116
 
117 117
 	// Sanitize the inputs
118 118
 	$customer_data            = array();
119
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
119
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
120 120
 	$customer_data['email']   = $customer_info['email'];
121 121
 	$customer_data['user_id'] = $customer_info['user_id'];
122 122
 
123
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
124
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
123
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
124
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
125 125
 
126
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
127
-	$address       = array_map( 'sanitize_text_field', $address );
126
+	$customer_data = array_map('sanitize_text_field', $customer_data);
127
+	$address       = array_map('sanitize_text_field', $address);
128 128
 
129
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
129
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
130 130
 
131 131
 	$output         = array();
132 132
 	$previous_email = $customer->email;
133 133
 
134
-	if ( $customer->update( $customer_data ) ) {
134
+	if ($customer->update($customer_data)) {
135 135
 
136
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
137
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
136
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
137
+			update_user_meta($customer->user_id, '_give_user_address', $address);
138 138
 		}
139 139
 
140 140
 		// Update some payment meta if we need to
141
-		$payments_array = explode( ',', $customer->payment_ids );
141
+		$payments_array = explode(',', $customer->payment_ids);
142 142
 
143
-		if ( $customer->email != $previous_email ) {
144
-			foreach ( $payments_array as $payment_id ) {
145
-				give_update_payment_meta( $payment_id, 'email', $customer->email );
143
+		if ($customer->email != $previous_email) {
144
+			foreach ($payments_array as $payment_id) {
145
+				give_update_payment_meta($payment_id, 'email', $customer->email);
146 146
 			}
147 147
 		}
148 148
 
149
-		if ( $customer->user_id != $previous_user_id ) {
150
-			foreach ( $payments_array as $payment_id ) {
151
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
149
+		if ($customer->user_id != $previous_user_id) {
150
+			foreach ($payments_array as $payment_id) {
151
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
152 152
 			}
153 153
 		}
154 154
 
155 155
 		$output['success']       = true;
156
-		$customer_data           = array_merge( $customer_data, $address );
156
+		$customer_data           = array_merge($customer_data, $address);
157 157
 		$output['customer_info'] = $customer_data;
158 158
 
159 159
 	} else {
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 
163 163
 	}
164 164
 
165
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
165
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
166 166
 
167
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
168
-		header( 'Content-Type: application/json' );
169
-		echo json_encode( $output );
167
+	if (defined('DOING_AJAX') && DOING_AJAX) {
168
+		header('Content-Type: application/json');
169
+		echo json_encode($output);
170 170
 		wp_die();
171 171
 	}
172 172
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 }
176 176
 
177
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
177
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
178 178
 
179 179
 /**
180 180
  * Save a customer note being added
@@ -185,53 +185,53 @@  discard block
 block discarded – undo
185 185
  *
186 186
  * @return int         The Note ID that was saved, or 0 if nothing was saved
187 187
  */
188
-function give_customer_save_note( $args ) {
188
+function give_customer_save_note($args) {
189 189
 
190
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
190
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
191 191
 
192
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
193
-		wp_die( esc_html( 'You do not have permission to edit this donor.', 'give' ) );
192
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
193
+		wp_die(esc_html('You do not have permission to edit this donor.', 'give'));
194 194
 	}
195 195
 
196
-	if ( empty( $args ) ) {
196
+	if (empty($args)) {
197 197
 		return;
198 198
 	}
199 199
 
200
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
200
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
201 201
 	$customer_id   = (int) $args['customer_id'];
202 202
 	$nonce         = $args['add_customer_note_nonce'];
203 203
 
204
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
205
-		wp_die( esc_html( 'Cheatin\' eh?!', 'give' ) );
204
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
205
+		wp_die(esc_html('Cheatin\' eh?!', 'give'));
206 206
 	}
207 207
 
208
-	if ( empty( $customer_note ) ) {
209
-		give_set_error( 'empty-customer-note', esc_html( 'A note is required.', 'give' ) );
208
+	if (empty($customer_note)) {
209
+		give_set_error('empty-customer-note', esc_html('A note is required.', 'give'));
210 210
 	}
211 211
 
212
-	if ( give_get_errors() ) {
212
+	if (give_get_errors()) {
213 213
 		return;
214 214
 	}
215 215
 
216
-	$customer = new Give_Customer( $customer_id );
217
-	$new_note = $customer->add_note( $customer_note );
216
+	$customer = new Give_Customer($customer_id);
217
+	$new_note = $customer->add_note($customer_note);
218 218
 
219
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
219
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
220 220
 
221
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
221
+	if ( ! empty($new_note) && ! empty($customer->id)) {
222 222
 
223 223
 		ob_start();
224 224
 		?>
225 225
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
226 226
 			<span class="note-content-wrap">
227
-				<?php echo stripslashes( $new_note ); ?>
227
+				<?php echo stripslashes($new_note); ?>
228 228
 			</span>
229 229
 		</div>
230 230
 		<?php
231 231
 		$output = ob_get_contents();
232 232
 		ob_end_clean();
233 233
 
234
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
234
+		if (defined('DOING_AJAX') && DOING_AJAX) {
235 235
 			echo $output;
236 236
 			exit;
237 237
 		}
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 }
246 246
 
247
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
247
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
248 248
 
249 249
 /**
250 250
  * Delete a customer
@@ -255,87 +255,87 @@  discard block
 block discarded – undo
255 255
  *
256 256
  * @return int Whether it was a successful deletion
257 257
  */
258
-function give_customer_delete( $args ) {
258
+function give_customer_delete($args) {
259 259
 
260
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
260
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
261 261
 
262
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
263
-		wp_die( esc_html( 'You do not have permission to delete donors.', 'give' ) );
262
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
263
+		wp_die(esc_html('You do not have permission to delete donors.', 'give'));
264 264
 	}
265 265
 
266
-	if ( empty( $args ) ) {
266
+	if (empty($args)) {
267 267
 		return;
268 268
 	}
269 269
 
270 270
 	$customer_id = (int) $args['customer_id'];
271
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
272
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
271
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
272
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
273 273
 	$nonce       = $args['_wpnonce'];
274 274
 
275
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
276
-		wp_die( esc_html( 'Cheatin\' eh?!', 'give' ) );
275
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
276
+		wp_die(esc_html('Cheatin\' eh?!', 'give'));
277 277
 	}
278 278
 
279
-	if ( ! $confirm ) {
280
-		give_set_error( 'customer-delete-no-confirm', esc_html( 'Please confirm you want to delete this donor.', 'give' ) );
279
+	if ( ! $confirm) {
280
+		give_set_error('customer-delete-no-confirm', esc_html('Please confirm you want to delete this donor.', 'give'));
281 281
 	}
282 282
 
283
-	if ( give_get_errors() ) {
284
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
283
+	if (give_get_errors()) {
284
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
285 285
 		exit;
286 286
 	}
287 287
 
288
-	$customer = new Give_Customer( $customer_id );
288
+	$customer = new Give_Customer($customer_id);
289 289
 
290
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
290
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
291 291
 
292 292
 	$success = false;
293 293
 
294
-	if ( $customer->id > 0 ) {
294
+	if ($customer->id > 0) {
295 295
 
296
-		$payments_array = explode( ',', $customer->payment_ids );
297
-		$success        = Give()->customers->delete( $customer->id );
296
+		$payments_array = explode(',', $customer->payment_ids);
297
+		$success        = Give()->customers->delete($customer->id);
298 298
 
299
-		if ( $success ) {
299
+		if ($success) {
300 300
 
301
-			if ( $remove_data ) {
301
+			if ($remove_data) {
302 302
 
303 303
 				// Remove all payments, logs, etc
304
-				foreach ( $payments_array as $payment_id ) {
305
-					give_delete_purchase( $payment_id );
304
+				foreach ($payments_array as $payment_id) {
305
+					give_delete_purchase($payment_id);
306 306
 				}
307 307
 
308 308
 			} else {
309 309
 
310 310
 				// Just set the payments to customer_id of 0
311
-				foreach ( $payments_array as $payment_id ) {
312
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
311
+				foreach ($payments_array as $payment_id) {
312
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
313 313
 				}
314 314
 
315 315
 			}
316 316
 
317
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
317
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
318 318
 
319 319
 		} else {
320 320
 
321
-			give_set_error( 'give-donor-delete-failed', esc_html( 'Error deleting donor.', 'give' ) );
322
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
321
+			give_set_error('give-donor-delete-failed', esc_html('Error deleting donor.', 'give'));
322
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
323 323
 
324 324
 		}
325 325
 
326 326
 	} else {
327 327
 
328
-		give_set_error( 'give-customer-delete-invalid-id', esc_html( 'Invalid Donor ID.', 'give' ) );
329
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
328
+		give_set_error('give-customer-delete-invalid-id', esc_html('Invalid Donor ID.', 'give'));
329
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
330 330
 
331 331
 	}
332 332
 
333
-	wp_redirect( $redirect );
333
+	wp_redirect($redirect);
334 334
 	exit;
335 335
 
336 336
 }
337 337
 
338
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
338
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
339 339
 
340 340
 /**
341 341
  * Disconnect a user ID from a donor
@@ -346,39 +346,39 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return bool        If the disconnect was successful
348 348
  */
349
-function give_disconnect_customer_user_id( $args ) {
349
+function give_disconnect_customer_user_id($args) {
350 350
 
351
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
351
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
352 352
 
353
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
354
-		wp_die( esc_html( 'You do not have permission to edit this donor.', 'give' ) );
353
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
354
+		wp_die(esc_html('You do not have permission to edit this donor.', 'give'));
355 355
 	}
356 356
 
357
-	if ( empty( $args ) ) {
357
+	if (empty($args)) {
358 358
 		return;
359 359
 	}
360 360
 
361 361
 	$customer_id = (int) $args['customer_id'];
362 362
 	$nonce       = $args['_wpnonce'];
363 363
 
364
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
365
-		wp_die( esc_html( 'Cheatin\' eh?!', 'give' ) );
364
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
365
+		wp_die(esc_html('Cheatin\' eh?!', 'give'));
366 366
 	}
367 367
 
368
-	$customer = new Give_Customer( $customer_id );
369
-	if ( empty( $customer->id ) ) {
368
+	$customer = new Give_Customer($customer_id);
369
+	if (empty($customer->id)) {
370 370
 		return false;
371 371
 	}
372 372
 
373
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id );
373
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id);
374 374
 
375
-	$customer_args = array( 'user_id' => 0 );
375
+	$customer_args = array('user_id' => 0);
376 376
 
377
-	if ( $customer->update( $customer_args ) ) {
377
+	if ($customer->update($customer_args)) {
378 378
 		global $wpdb;
379 379
 
380
-		if ( ! empty( $customer->payment_ids ) ) {
381
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
380
+		if ( ! empty($customer->payment_ids)) {
381
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
382 382
 		}
383 383
 
384 384
 		$output['success'] = true;
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 	} else {
387 387
 
388 388
 		$output['success'] = false;
389
-		give_set_error( 'give-disconnect-user-fail', esc_html( 'Failed to disconnect user from donor.', 'give' ) );
389
+		give_set_error('give-disconnect-user-fail', esc_html('Failed to disconnect user from donor.', 'give'));
390 390
 	}
391 391
 
392
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
392
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
393 393
 
394
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
395
-		header( 'Content-Type: application/json' );
396
-		echo json_encode( $output );
394
+	if (defined('DOING_AJAX') && DOING_AJAX) {
395
+		header('Content-Type: application/json');
396
+		echo json_encode($output);
397 397
 		wp_die();
398 398
 	}
399 399
 
@@ -401,4 +401,4 @@  discard block
 block discarded – undo
401 401
 
402 402
 }
403 403
 
404
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
404
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,326 +48,326 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => esc_html( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => esc_html('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => esc_html( 'Donation Option', 'give' ),
61
-					'description' => esc_html( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => esc_html('Donation Option', 'give'),
61
+					'description' => esc_html('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => esc_html( 'Set Donation', 'give' ),
67
-						'multi' => esc_html( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => esc_html('Set Donation', 'give'),
67
+						'multi' => esc_html('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => esc_html( 'Set Donation', 'give' ),
72
-					'description'  => esc_html( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => esc_html('Set Donation', 'give'),
72
+					'description'  => esc_html('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
77
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
76
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
77
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
78 78
 					'attributes'   => array(
79
-						'placeholder' => give_format_amount( '1.00' ),
80
-						'value'       => give_format_amount( $price ),
79
+						'placeholder' => give_format_amount('1.00'),
80
+						'value'       => give_format_amount($price),
81 81
 						'class'       => 'cmb-type-text-small give-money-field',
82 82
 					),
83 83
 				),
84 84
 				//Donation levels: Header
85 85
 				array(
86
-					'id'   => $prefix . 'levels_header',
86
+					'id'   => $prefix.'levels_header',
87 87
 					'type' => 'levels_repeater_header',
88 88
 				),
89 89
 				//Donation Levels: Repeatable CMB2 Group
90 90
 				array(
91
-					'id'          => $prefix . 'donation_levels',
91
+					'id'          => $prefix.'donation_levels',
92 92
 					'type'        => 'group',
93 93
 					'row_classes' => 'give-subfield',
94 94
 					'options'     => array(
95
-						'add_button'    => esc_html( 'Add Level', 'give' ),
95
+						'add_button'    => esc_html('Add Level', 'give'),
96 96
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
97 97
 						'sortable'      => true, // beta
98 98
 					),
99 99
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
100
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
100
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
101 101
 						array(
102
-							'name' => esc_html( 'ID', 'give' ),
103
-							'id'   => $prefix . 'id',
102
+							'name' => esc_html('ID', 'give'),
103
+							'id'   => $prefix.'id',
104 104
 							'type' => 'levels_id',
105 105
 						),
106 106
 						array(
107
-							'name'         => esc_html( 'Amount', 'give' ),
108
-							'id'           => $prefix . 'amount',
107
+							'name'         => esc_html('Amount', 'give'),
108
+							'id'           => $prefix.'amount',
109 109
 							'type'         => 'text_small',
110
-							'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
111
-							'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
110
+							'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
111
+							'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
112 112
 							'attributes'   => array(
113
-								'placeholder' => give_format_amount( '1.00' ),
113
+								'placeholder' => give_format_amount('1.00'),
114 114
 								'class'       => 'cmb-type-text-small give-money-field',
115 115
 							),
116 116
 							'before'       => 'give_format_admin_multilevel_amount',
117 117
 						),
118 118
 						array(
119
-							'name'       => esc_html( 'Text', 'give' ),
120
-							'id'         => $prefix . 'text',
119
+							'name'       => esc_html('Text', 'give'),
120
+							'id'         => $prefix.'text',
121 121
 							'type'       => 'text',
122 122
 							'attributes' => array(
123
-								'placeholder' => esc_attr( 'Donation Level', 'give' ),
123
+								'placeholder' => esc_attr('Donation Level', 'give'),
124 124
 								'class'       => 'give-multilevel-text-field',
125 125
 							),
126 126
 						),
127 127
 						array(
128
-							'name' => esc_html( 'Default', 'give' ),
129
-							'id'   => $prefix . 'default',
128
+							'name' => esc_html('Default', 'give'),
129
+							'id'   => $prefix.'default',
130 130
 							'type' => 'give_default_radio_inline'
131 131
 						),
132
-					) ),
132
+					)),
133 133
 				),
134 134
 				//Display Style
135 135
 				array(
136
-					'name'        => esc_html( 'Display Style', 'give' ),
137
-					'description' => esc_html( 'Set how the donations levels will display on the form.', 'give' ),
138
-					'id'          => $prefix . 'display_style',
136
+					'name'        => esc_html('Display Style', 'give'),
137
+					'description' => esc_html('Set how the donations levels will display on the form.', 'give'),
138
+					'id'          => $prefix.'display_style',
139 139
 					'type'        => 'radio_inline',
140 140
 					'default'     => 'buttons',
141 141
 					'options'     => array(
142
-						'buttons'  => esc_html( 'Buttons', 'give' ),
143
-						'radios'   => esc_html( 'Radios', 'give' ),
144
-						'dropdown' => esc_html( 'Dropdown', 'give' ),
142
+						'buttons'  => esc_html('Buttons', 'give'),
143
+						'radios'   => esc_html('Radios', 'give'),
144
+						'dropdown' => esc_html('Dropdown', 'give'),
145 145
 					),
146 146
 				),
147 147
 				//Custom Amount
148 148
 				array(
149
-					'name'        => esc_html( 'Custom Amount', 'give' ),
150
-					'description' => esc_html( 'Do you want the user to be able to input their own donation amount?', 'give' ),
151
-					'id'          => $prefix . 'custom_amount',
149
+					'name'        => esc_html('Custom Amount', 'give'),
150
+					'description' => esc_html('Do you want the user to be able to input their own donation amount?', 'give'),
151
+					'id'          => $prefix.'custom_amount',
152 152
 					'type'        => 'radio_inline',
153 153
 					'default'     => 'no',
154 154
 					'options'     => array(
155
-						'yes' => esc_html( 'Yes', 'give' ),
156
-						'no'  => esc_html( 'No', 'give' ),
155
+						'yes' => esc_html('Yes', 'give'),
156
+						'no'  => esc_html('No', 'give'),
157 157
 					),
158 158
 				),
159 159
 				array(
160
-					'name'         => esc_html( 'Custom Amount Minimum', 'give' ),
161
-					'description'  => esc_html( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
162
-					'id'           => $prefix . 'custom_amount_minimum',
160
+					'name'         => esc_html('Custom Amount Minimum', 'give'),
161
+					'description'  => esc_html('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
162
+					'id'           => $prefix.'custom_amount_minimum',
163 163
 					'type'         => 'text_small',
164 164
 					'row_classes'  => 'give-subfield',
165
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
166
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
165
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
166
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
167 167
 					'attributes'   => array(
168
-						'placeholder' => give_format_amount( '1.00' ),
169
-						'value'       => give_format_amount( $custom_amount_minimum ),
168
+						'placeholder' => give_format_amount('1.00'),
169
+						'value'       => give_format_amount($custom_amount_minimum),
170 170
 						'class'       => 'cmb-type-text-small give-money-field',
171 171
 					),
172 172
 				),
173 173
 				array(
174
-					'name'        => esc_html( 'Custom Amount Text', 'give' ),
175
-					'description' => esc_html( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
176
-					'id'          => $prefix . 'custom_amount_text',
174
+					'name'        => esc_html('Custom Amount Text', 'give'),
175
+					'description' => esc_html('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
176
+					'id'          => $prefix.'custom_amount_text',
177 177
 					'type'        => 'text',
178 178
 					'row_classes' => 'give-subfield',
179 179
 					'attributes'  => array(
180 180
 						'rows'        => 3,
181
-						'placeholder' => esc_attr( 'Give a Custom Amount', 'give' ),
181
+						'placeholder' => esc_attr('Give a Custom Amount', 'give'),
182 182
 					),
183 183
 				),
184 184
 				//Goals
185 185
 				array(
186
-					'name'        => esc_html( 'Goal', 'give' ),
187
-					'description' => esc_html( 'Do you want to set a donation goal for this form?', 'give' ),
188
-					'id'          => $prefix . 'goal_option',
186
+					'name'        => esc_html('Goal', 'give'),
187
+					'description' => esc_html('Do you want to set a donation goal for this form?', 'give'),
188
+					'id'          => $prefix.'goal_option',
189 189
 					'type'        => 'radio_inline',
190 190
 					'default'     => 'no',
191 191
 					'options'     => array(
192
-						'yes' => esc_html( 'Yes', 'give' ),
193
-						'no'  => esc_html( 'No', 'give' ),
192
+						'yes' => esc_html('Yes', 'give'),
193
+						'no'  => esc_html('No', 'give'),
194 194
 					),
195 195
 				),
196 196
 				array(
197
-					'name'         => esc_html( 'Goal Amount', 'give' ),
198
-					'description'  => esc_html( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
199
-					'id'           => $prefix . 'set_goal',
197
+					'name'         => esc_html('Goal Amount', 'give'),
198
+					'description'  => esc_html('This is the monetary goal amount you want to reach for this donation form.', 'give'),
199
+					'id'           => $prefix.'set_goal',
200 200
 					'type'         => 'text_small',
201 201
 					'row_classes'  => 'give-subfield',
202
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
203
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
202
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
203
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
204 204
 					'attributes'   => array(
205
-						'placeholder' => give_format_amount( '0.00' ),
206
-						'value'       => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '',
205
+						'placeholder' => give_format_amount('0.00'),
206
+						'value'       => isset($goal) ? esc_attr(give_format_amount($goal)) : '',
207 207
 						'class'       => 'cmb-type-text-small give-money-field',
208 208
 					),
209 209
 				),
210 210
 
211 211
 				array(
212
-					'name'        => esc_html( 'Goal Format', 'give' ),
213
-					'description' => esc_html( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
214
-					'id'          => $prefix . 'goal_format',
212
+					'name'        => esc_html('Goal Format', 'give'),
213
+					'description' => esc_html('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
214
+					'id'          => $prefix.'goal_format',
215 215
 					'type'        => 'radio_inline',
216 216
 					'default'     => 'amount',
217 217
 					'row_classes' => 'give-subfield',
218 218
 					'options'     => array(
219
-						'amount'     => esc_html( 'Amount ', 'give' ),
220
-						'percentage' => esc_html( 'Percentage', 'give' ),
219
+						'amount'     => esc_html('Amount ', 'give'),
220
+						'percentage' => esc_html('Percentage', 'give'),
221 221
 					),
222 222
 				),
223 223
 				array(
224
-					'name'        => esc_html( 'Goal Progress Bar Color', 'give' ),
225
-					'id'          => $prefix . 'goal_color',
224
+					'name'        => esc_html('Goal Progress Bar Color', 'give'),
225
+					'id'          => $prefix.'goal_color',
226 226
 					'type'        => 'colorpicker',
227 227
 					'row_classes' => 'give-subfield',
228 228
 					'default'     => '#2bc253',
229 229
 				),
230 230
 
231 231
 				array(
232
-					'name'        => esc_html( 'Close Form when Goal Achieved', 'give' ),
233
-					'desc'        => esc_html( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
234
-					'id'          => $prefix . 'close_form_when_goal_achieved',
232
+					'name'        => esc_html('Close Form when Goal Achieved', 'give'),
233
+					'desc'        => esc_html('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
234
+					'id'          => $prefix.'close_form_when_goal_achieved',
235 235
 					'type'        => 'radio_inline',
236 236
 					'row_classes' => 'give-subfield',
237 237
 					'options'     => array(
238
-						'yes' => esc_html( 'Yes', 'give' ),
239
-						'no'  => esc_html( 'No', 'give' ),
238
+						'yes' => esc_html('Yes', 'give'),
239
+						'no'  => esc_html('No', 'give'),
240 240
 					),
241 241
 					'default'     => 'no',
242 242
 				),
243 243
 				array(
244
-					'name'        => esc_html( 'Goal Achieved Message', 'give' ),
245
-					'desc'        => esc_html( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
246
-					'id'          => $prefix . 'form_goal_achieved_message',
244
+					'name'        => esc_html('Goal Achieved Message', 'give'),
245
+					'desc'        => esc_html('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
246
+					'id'          => $prefix.'form_goal_achieved_message',
247 247
 					'type'        => 'textarea',
248 248
 					'row_classes' => 'give-subfield',
249 249
 					'attributes'  => array(
250
-						'placeholder' => esc_attr( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
250
+						'placeholder' => esc_attr('Thank you to all our donors, we have met our fundraising goal.', 'give'),
251 251
 					),
252 252
 				)
253 253
 			)
254 254
 		)
255
-	) );
255
+	));
256 256
 
257 257
 
258 258
 	/**
259 259
 	 * Content Field
260 260
 	 */
261
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
261
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
262 262
 		'id'           => 'form_content_options',
263
-		'title'        => esc_html( 'Form Content', 'give' ),
264
-		'object_types' => array( 'give_forms' ),
263
+		'title'        => esc_html('Form Content', 'give'),
264
+		'object_types' => array('give_forms'),
265 265
 		'context'      => 'normal',
266 266
 		'priority'     => 'high', //Show above Content WYSIWYG
267
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
267
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
268 268
 				//Donation Option
269 269
 				array(
270
-					'name'        => esc_html( 'Display Content', 'give' ),
271
-					'description' => esc_html( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ),
272
-					'id'          => $prefix . 'content_option',
270
+					'name'        => esc_html('Display Content', 'give'),
271
+					'description' => esc_html('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
272
+					'id'          => $prefix.'content_option',
273 273
 					'type'        => 'select',
274
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
275
-							'none'           => esc_html( 'No content', 'give' ),
276
-							'give_pre_form'  => esc_html( 'Yes, display content ABOVE the form fields', 'give' ),
277
-							'give_post_form' => esc_html( 'Yes, display content BELOW the form fields', 'give' ),
274
+					'options'     => apply_filters('give_forms_content_options_select', array(
275
+							'none'           => esc_html('No content', 'give'),
276
+							'give_pre_form'  => esc_html('Yes, display content ABOVE the form fields', 'give'),
277
+							'give_post_form' => esc_html('Yes, display content BELOW the form fields', 'give'),
278 278
 						)
279 279
 					),
280 280
 					'default'     => 'none',
281 281
 				),
282 282
 				array(
283
-					'name'        => esc_html( 'Content', 'give' ),
284
-					'description' => esc_html( 'This content will display on the single give form page.', 'give' ),
285
-					'id'          => $prefix . 'form_content',
283
+					'name'        => esc_html('Content', 'give'),
284
+					'description' => esc_html('This content will display on the single give form page.', 'give'),
285
+					'id'          => $prefix.'form_content',
286 286
 					'row_classes' => 'give-subfield',
287 287
 					'type'        => 'wysiwyg'
288 288
 				),
289 289
 			)
290 290
 		)
291
-	) );
291
+	));
292 292
 
293 293
 
294 294
 	/**
295 295
 	 * Display Options
296 296
 	 */
297
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
297
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
298 298
 			'id'           => 'form_display_options',
299
-			'title'        => esc_html( 'Form Display Options', 'give' ),
300
-			'object_types' => array( 'give_forms' ),
299
+			'title'        => esc_html('Form Display Options', 'give'),
300
+			'object_types' => array('give_forms'),
301 301
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
302 302
 			'priority'     => 'high', //Show above Content WYSIWYG
303 303
 			'show_names'   => true, // Show field names on the left
304
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
304
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
305 305
 					array(
306
-						'name'    => esc_html( 'Payment Fields', 'give' ),
307
-						'desc'    => esc_html( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
308
-						'id'      => $prefix . 'payment_display',
306
+						'name'    => esc_html('Payment Fields', 'give'),
307
+						'desc'    => esc_html('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
308
+						'id'      => $prefix.'payment_display',
309 309
 						'type'    => 'select',
310 310
 						'options' => array(
311
-							'onpage' => esc_html( 'Show on Page', 'give' ),
312
-							'reveal' => esc_html( 'Reveal Upon Click', 'give' ),
313
-							'modal'  => esc_html( 'Modal Window Upon Click', 'give' ),
311
+							'onpage' => esc_html('Show on Page', 'give'),
312
+							'reveal' => esc_html('Reveal Upon Click', 'give'),
313
+							'modal'  => esc_html('Modal Window Upon Click', 'give'),
314 314
 						),
315 315
 						'default' => 'onpage',
316 316
 					),
317 317
 					array(
318
-						'id'          => $prefix . 'reveal_label',
319
-						'name'        => esc_html( 'Reveal / Modal Open Text', 'give' ),
320
-						'desc'        => esc_html( 'The button label for completing the donation.', 'give' ),
318
+						'id'          => $prefix.'reveal_label',
319
+						'name'        => esc_html('Reveal / Modal Open Text', 'give'),
320
+						'desc'        => esc_html('The button label for completing the donation.', 'give'),
321 321
 						'type'        => 'text_small',
322 322
 						'row_classes' => 'give-subfield',
323 323
 						'attributes'  => array(
324
-							'placeholder' => esc_attr( 'Donate Now', 'give' ),
324
+							'placeholder' => esc_attr('Donate Now', 'give'),
325 325
 						),
326 326
 					),
327 327
 					array(
328
-						'id'         => $prefix . 'checkout_label',
329
-						'name'       => esc_html( 'Complete Donation Text', 'give' ),
330
-						'desc'       => esc_html( 'The button label for completing a donation.', 'give' ),
328
+						'id'         => $prefix.'checkout_label',
329
+						'name'       => esc_html('Complete Donation Text', 'give'),
330
+						'desc'       => esc_html('The button label for completing a donation.', 'give'),
331 331
 						'type'       => 'text_small',
332 332
 						'attributes' => array(
333
-							'placeholder' => esc_attr( 'Donate Now', 'give' ),
333
+							'placeholder' => esc_attr('Donate Now', 'give'),
334 334
 						),
335 335
 					),
336 336
 					array(
337
-						'name' => esc_html( 'Default Gateway', 'give' ),
338
-						'desc' => esc_html( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
339
-						'id'   => $prefix . 'default_gateway',
337
+						'name' => esc_html('Default Gateway', 'give'),
338
+						'desc' => esc_html('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
339
+						'id'   => $prefix.'default_gateway',
340 340
 						'type' => 'default_gateway'
341 341
 					),
342 342
 					array(
343
-						'name' => esc_html( 'Disable Guest Donations', 'give' ),
344
-						'desc' => esc_html( 'Do you want to require users be logged-in to make donations?', 'give' ),
345
-						'id'   => $prefix . 'logged_in_only',
343
+						'name' => esc_html('Disable Guest Donations', 'give'),
344
+						'desc' => esc_html('Do you want to require users be logged-in to make donations?', 'give'),
345
+						'id'   => $prefix.'logged_in_only',
346 346
 						'type' => 'checkbox'
347 347
 					),
348 348
 					array(
349
-						'name'    => esc_html( 'Register / Login Form', 'give' ),
350
-						'desc'    => esc_html( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
351
-						'id'      => $prefix . 'show_register_form',
349
+						'name'    => esc_html('Register / Login Form', 'give'),
350
+						'desc'    => esc_html('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
351
+						'id'      => $prefix.'show_register_form',
352 352
 						'type'    => 'select',
353 353
 						'options' => array(
354
-							'both'         => esc_html( 'Registration and Login Forms', 'give' ),
355
-							'registration' => esc_html( 'Registration Form Only', 'give' ),
356
-							'login'        => esc_html( 'Login Form Only', 'give' ),
357
-							'none'         => esc_html( 'None', 'give' ),
354
+							'both'         => esc_html('Registration and Login Forms', 'give'),
355
+							'registration' => esc_html('Registration Form Only', 'give'),
356
+							'login'        => esc_html('Login Form Only', 'give'),
357
+							'none'         => esc_html('None', 'give'),
358 358
 						),
359 359
 						'default' => 'none',
360 360
 					),
361 361
 					array(
362
-						'name'    => esc_html( 'Floating Labels', 'give' ),
362
+						'name'    => esc_html('Floating Labels', 'give'),
363 363
 						/* translators: %s: forms http://bradfrost.com/blog/post/float-label-pattern/ */
364
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ),
365
-						'id'      => $prefix . 'form_floating_labels',
364
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
365
+						'id'      => $prefix.'form_floating_labels',
366 366
 						'type'    => 'select',
367 367
 						'options' => array(
368
-							''         => esc_html( 'Use the global setting', 'give' ),
369
-							'enabled'  => esc_html( 'Enabled', 'give' ),
370
-							'disabled' => esc_html( 'Disabled', 'give' ),
368
+							''         => esc_html('Use the global setting', 'give'),
369
+							'enabled'  => esc_html('Enabled', 'give'),
370
+							'disabled' => esc_html('Disabled', 'give'),
371 371
 						),
372 372
 						'default' => 'none',
373 373
 					)
@@ -379,47 +379,47 @@  discard block
 block discarded – undo
379 379
 	/**
380 380
 	 * Terms & Conditions
381 381
 	 */
382
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
382
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
383 383
 		'id'           => 'form_terms_options',
384
-		'title'        => esc_html( 'Terms and Conditions', 'give' ),
385
-		'object_types' => array( 'give_forms' ),
384
+		'title'        => esc_html('Terms and Conditions', 'give'),
385
+		'object_types' => array('give_forms'),
386 386
 		'context'      => 'normal',
387 387
 		'priority'     => 'high', //Show above Content WYSIWYG
388
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
388
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
389 389
 				//Donation Option
390 390
 				array(
391
-					'name'        => esc_html( 'Terms and Conditions', 'give' ),
392
-					'description' => esc_html( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
393
-					'id'          => $prefix . 'terms_option',
391
+					'name'        => esc_html('Terms and Conditions', 'give'),
392
+					'description' => esc_html('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
393
+					'id'          => $prefix.'terms_option',
394 394
 					'type'        => 'select',
395
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
396
-							'none' => esc_html( 'No', 'give' ),
397
-							'yes'  => esc_html( 'Yes', 'give' ),
395
+					'options'     => apply_filters('give_forms_content_options_select', array(
396
+							'none' => esc_html('No', 'give'),
397
+							'yes'  => esc_html('Yes', 'give'),
398 398
 						)
399 399
 					),
400 400
 					'default'     => 'none',
401 401
 				),
402 402
 				array(
403
-					'id'          => $prefix . 'agree_label',
404
-					'name'        => esc_html( 'Agree to Terms Label', 'give' ),
405
-					'desc'        => esc_html( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
403
+					'id'          => $prefix.'agree_label',
404
+					'name'        => esc_html('Agree to Terms Label', 'give'),
405
+					'desc'        => esc_html('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
406 406
 					'type'        => 'text',
407 407
 					'row_classes' => 'give-subfield',
408 408
 					'size'        => 'regular',
409 409
 					'attributes'  => array(
410
-						'placeholder' => esc_attr( 'Agree to Terms?', 'give' ),
410
+						'placeholder' => esc_attr('Agree to Terms?', 'give'),
411 411
 					),
412 412
 				),
413 413
 				array(
414
-					'id'          => $prefix . 'agree_text',
414
+					'id'          => $prefix.'agree_text',
415 415
 					'row_classes' => 'give-subfield',
416
-					'name'        => esc_html( 'Agreement Text', 'give' ),
417
-					'desc'        => esc_html( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
416
+					'name'        => esc_html('Agreement Text', 'give'),
417
+					'desc'        => esc_html('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
418 418
 					'type'        => 'wysiwyg'
419 419
 				),
420 420
 			)
421 421
 		)
422
-	) );
422
+	));
423 423
 
424 424
 	return $meta_boxes;
425 425
 
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 
434 434
 	<div class="table-container">
435 435
 		<div class="table-row">
436
-			<div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div>
437
-			<div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div>
438
-			<div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div>
439
-			<?php do_action( 'give_donation_levels_table_head' ); ?>
440
-			<div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div>
436
+			<div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
437
+			<div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
438
+			<div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
439
+			<?php do_action('give_donation_levels_table_head'); ?>
440
+			<div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
441 441
 
442 442
 		</div>
443 443
 	</div>
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	<?php
446 446
 }
447 447
 
448
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
448
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
449 449
 
450 450
 
451 451
 /**
@@ -462,25 +462,25 @@  discard block
 block discarded – undo
462 462
  * @param $object_type
463 463
  * @param $field_type_object
464 464
  */
465
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
465
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
466 466
 
467
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
467
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
468 468
 
469 469
 	$field_options_array = array(
470 470
 		'class' => 'give-hidden give-level-id-input',
471
-		'name'  => $field_type_object->_name( '[level_id]' ),
472
-		'id'    => $field_type_object->_id( '_level_id' ),
471
+		'name'  => $field_type_object->_name('[level_id]'),
472
+		'id'    => $field_type_object->_id('_level_id'),
473 473
 		'value' => $escaped_value,
474 474
 		'type'  => 'number',
475 475
 		'desc'  => '',
476 476
 	);
477 477
 
478
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
479
-	echo $field_type_object->input( $field_options_array );
478
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
479
+	echo $field_type_object->input($field_options_array);
480 480
 
481 481
 }
482 482
 
483
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
483
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
484 484
 
485 485
 
486 486
 /**
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
  * @param $object_type
493 493
  * @param $field_type_object
494 494
  */
495
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
496
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
497
-	echo '<label for="' . $field_object->args['id'] . '">Default</label>';
495
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
496
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
497
+	echo '<label for="'.$field_object->args['id'].'">Default</label>';
498 498
 
499 499
 }
500 500
 
501
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
501
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
502 502
 
503 503
 
504 504
 /**
@@ -508,20 +508,20 @@  discard block
 block discarded – undo
508 508
  */
509 509
 function give_add_shortcode_to_publish_metabox() {
510 510
 
511
-	if ( 'give_forms' !== get_post_type() ) {
511
+	if ('give_forms' !== get_post_type()) {
512 512
 		return false;
513 513
 	}
514 514
 
515 515
 	global $post;
516 516
 
517 517
 	//Only enqueue scripts for CPT on post type screen
518
-	if ( 'give_forms' === $post->post_type ) {
518
+	if ('give_forms' === $post->post_type) {
519 519
 		//Shortcode column with select all input
520
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
521
-		echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
520
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
521
+		echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
522 522
 
523 523
 	}
524 524
 
525 525
 }
526 526
 
527
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
527
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52 52
 			/* translators: %s: upgrade URL */
53
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
54
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
53
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
54
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
55 55
 		);
56 56
 	}
57 57
 
58 58
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
59
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
59
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
60 60
 		printf(
61 61
 			/* translators: %s: upgrade URL */
62
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
63
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
62
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
63
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
64 64
 		);
65 65
 	}
66 66
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 }
72 72
 
73
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
73
+add_action('admin_notices', 'give_show_upgrade_notices');
74 74
 
75 75
 /**
76 76
  * Triggers all upgrade functions
@@ -82,26 +82,26 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function give_trigger_upgrades() {
84 84
 
85
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
86
-		wp_die( esc_html( 'You do not have permission to do Give upgrades.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) );
85
+	if ( ! current_user_can('manage_give_settings')) {
86
+		wp_die(esc_html('You do not have permission to do Give upgrades.', 'give'), esc_html('Error', 'give'), array('response' => 403));
87 87
 	}
88 88
 
89
-	$give_version = get_option( 'give_version' );
89
+	$give_version = get_option('give_version');
90 90
 
91
-	if ( ! $give_version ) {
91
+	if ( ! $give_version) {
92 92
 		// 1.0 is the first version to use this option so we must add it
93 93
 		$give_version = '1.0';
94
-		add_option( 'give_version', $give_version );
94
+		add_option('give_version', $give_version);
95 95
 	}
96 96
 
97
-	update_option( 'give_version', GIVE_VERSION );
97
+	update_option('give_version', GIVE_VERSION);
98 98
 
99
-	if ( DOING_AJAX ) {
100
-		die( 'complete' );
99
+	if (DOING_AJAX) {
100
+		die('complete');
101 101
 	} // Let AJAX know that the upgrade is complete
102 102
 }
103 103
 
104
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
104
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
105 105
 
106 106
 /**
107 107
  * Check if the upgrade routine has been run for a specific action
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
  *
113 113
  * @return bool                   If the action has been added to the completed actions array
114 114
  */
115
-function give_has_upgrade_completed( $upgrade_action = '' ) {
115
+function give_has_upgrade_completed($upgrade_action = '') {
116 116
 
117
-	if ( empty( $upgrade_action ) ) {
117
+	if (empty($upgrade_action)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	$completed_upgrades = give_get_completed_upgrades();
122 122
 
123
-	return in_array( $upgrade_action, $completed_upgrades );
123
+	return in_array($upgrade_action, $completed_upgrades);
124 124
 
125 125
 }
126 126
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return bool                   If the function was successfully added
135 135
  */
136
-function give_set_upgrade_complete( $upgrade_action = '' ) {
136
+function give_set_upgrade_complete($upgrade_action = '') {
137 137
 
138
-	if ( empty( $upgrade_action ) ) {
138
+	if (empty($upgrade_action)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	$completed_upgrades[] = $upgrade_action;
144 144
 
145 145
 	// Remove any blanks, and only show uniques
146
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
146
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
147 147
 
148
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
148
+	return update_option('give_completed_upgrades', $completed_upgrades);
149 149
 }
150 150
 
151 151
 /**
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_get_completed_upgrades() {
158 158
 
159
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
159
+	$completed_upgrades = get_option('give_completed_upgrades');
160 160
 
161
-	if ( false === $completed_upgrades ) {
161
+	if (false === $completed_upgrades) {
162 162
 		$completed_upgrades = array();
163 163
 	}
164 164
 
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_v132_upgrade_give_payment_customer_id() {
179 179
 	global $wpdb;
180
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
181
-		wp_die( esc_html( 'You do not have permission to do Give upgrades.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) );
180
+	if ( ! current_user_can('manage_give_settings')) {
181
+		wp_die(esc_html('You do not have permission to do Give upgrades.', 'give'), esc_html('Error', 'give'), array('response' => 403));
182 182
 	}
183 183
 
184
-	ignore_user_abort( true );
184
+	ignore_user_abort(true);
185 185
 
186
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
187
-		@set_time_limit( 0 );
186
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
187
+		@set_time_limit(0);
188 188
 	}
189 189
 
190 190
 	//UPDATE DB METAKEYS
191 191
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
192
-	$query = $wpdb->query( $sql );
192
+	$query = $wpdb->query($sql);
193 193
 
194
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
195
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
196
-	delete_option( 'give_doing_upgrade' );
197
-	wp_redirect( admin_url() );
194
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
195
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
196
+	delete_option('give_doing_upgrade');
197
+	wp_redirect(admin_url());
198 198
 	exit;
199 199
 
200 200
 
201 201
 }
202 202
 
203
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
203
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
204 204
 
205 205
 /**
206 206
  * Upgrades the Offline Status
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 
215 215
 	global $wpdb;
216 216
 
217
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
218
-		wp_die( esc_html( 'You do not have permission to do Give upgrades.', 'give' ), esc_html( 'Error', 'give' ), array( 'response' => 403 ) );
217
+	if ( ! current_user_can('manage_give_settings')) {
218
+		wp_die(esc_html('You do not have permission to do Give upgrades.', 'give'), esc_html('Error', 'give'), array('response' => 403));
219 219
 	}
220 220
 
221
-	ignore_user_abort( true );
221
+	ignore_user_abort(true);
222 222
 
223
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
224
-		@set_time_limit( 0 );
223
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
224
+		@set_time_limit(0);
225 225
 	}
226 226
 
227 227
 	// Get abandoned offline payments
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 	$where .= "AND ( p.post_status = 'abandoned' )";
232 232
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
233 233
 
234
-	$sql            = $select . $join . $where;
235
-	$found_payments = $wpdb->get_col( $sql );
234
+	$sql            = $select.$join.$where;
235
+	$found_payments = $wpdb->get_col($sql);
236 236
 
237 237
 
238
-	foreach ( $found_payments as $payment ) {
238
+	foreach ($found_payments as $payment) {
239 239
 
240 240
 		//Only change ones marked abandoned since our release last week
241 241
 		//because the admin may have marked some abandoned themselves
242
-		$modified_time = get_post_modified_time( 'U', false, $payment );
242
+		$modified_time = get_post_modified_time('U', false, $payment);
243 243
 
244 244
 		//1450124863 =  12/10/2015 20:42:25
245
-		if ( $modified_time >= 1450124863 ) {
245
+		if ($modified_time >= 1450124863) {
246 246
 
247
-			give_update_payment_status( $payment, 'pending' );
247
+			give_update_payment_status($payment, 'pending');
248 248
 
249 249
 		}
250 250
 
251 251
 	}
252 252
 
253
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
254
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
255
-	delete_option( 'give_doing_upgrade' );
256
-	wp_redirect( admin_url() );
253
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
254
+	give_set_upgrade_complete('upgrade_give_offline_status');
255
+	delete_option('give_doing_upgrade');
256
+	wp_redirect(admin_url());
257 257
 	exit;
258 258
 
259 259
 
260 260
 }
261 261
 
262
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
262
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
263 263
 
264 264
 
265 265
 /**
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
  */
272 272
 function give_v152_cleanup_users() {
273 273
 
274
-	$give_version = get_option( 'give_version' );
274
+	$give_version = get_option('give_version');
275 275
 
276
-	if ( ! $give_version ) {
276
+	if ( ! $give_version) {
277 277
 		// 1.0 is the first version to use this option so we must add it
278 278
 		$give_version = '1.0';
279 279
 	}
280 280
 
281
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
281
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
282 282
 
283 283
 	//v1.5.2 Upgrades
284
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
284
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
285 285
 
286 286
 		//Delete all caps with "ss"
287 287
 		//Also delete all unused "campaign" roles
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 		);
329 329
 	
330 330
 		global $wp_roles;
331
-		foreach ( $delete_caps as $cap ) {
332
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
333
-				$wp_roles->remove_cap( $role, $cap );
331
+		foreach ($delete_caps as $cap) {
332
+			foreach (array_keys($wp_roles->roles) as $role) {
333
+				$wp_roles->remove_cap($role, $cap);
334 334
 			}
335 335
 		}
336 336
 	
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
 		$roles->add_caps();
341 341
 		
342 342
 		//The Update Ran
343
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
344
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
345
-		delete_option( 'give_doing_upgrade' );
343
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
344
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
345
+		delete_option('give_doing_upgrade');
346 346
 
347 347
 	}
348 348
 
349 349
 }
350 350
 
351
-add_action( 'admin_init', 'give_v152_cleanup_users' );
352 351
\ No newline at end of file
352
+add_action('admin_init', 'give_v152_cleanup_users');
353 353
\ No newline at end of file
Please login to merge, or discard this patch.