Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/gateways/offline-donations.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,10 +249,10 @@
 block discarded – undo
249 249
 	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
250 250
 
251 251
 	$admin_message .= sprintf(
252
-		                  '<a href="%1$s">%2$s</a>',
253
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
254
-		                  __( 'View Donation Details &raquo;', 'give' )
255
-	                  ) . "\n\n";
252
+						  '<a href="%1$s">%2$s</a>',
253
+						  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
254
+						  __( 'View Donation Details &raquo;', 'give' )
255
+					  ) . "\n\n";
256 256
 
257 257
 	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
258 258
 	$admin_message = give_do_email_tags( $admin_message, $payment_id );
Please login to merge, or discard this patch.
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' ),
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give'),
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,9 +40,9 @@  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
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
     <fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
     </fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89 89
 	if (
90
-		( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) )
91
-		|| ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) )
90
+		(give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields))
91
+		|| (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields))
92 92
 	) {
93
-		give_default_cc_address_fields( $form_id );
93
+		give_default_cc_address_fields($form_id);
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
97
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
98 98
 
99 99
 /**
100 100
  * Process the payment
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return void
107 107
  */
108
-function give_offline_process_payment( $purchase_data ) {
108
+function give_offline_process_payment($purchase_data) {
109 109
 
110 110
 	// Setup the payment details.
111 111
 	$payment_data = array(
112 112
 		'price'           => $purchase_data['price'],
113 113
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
114
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
115
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
114
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
115
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
116 116
 		'date'            => $purchase_data['date'],
117 117
 		'user_email'      => $purchase_data['user_email'],
118 118
 		'purchase_key'    => $purchase_data['purchase_key'],
119
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
119
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
120 120
 		'user_info'       => $purchase_data['user_info'],
121 121
 		'status'          => 'pending',
122 122
 		'gateway'         => 'offline',
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 	// record the pending payment
127
-	$payment = give_insert_payment( $payment_data );
127
+	$payment = give_insert_payment($payment_data);
128 128
 
129
-	if ( $payment ) {
129
+	if ($payment) {
130 130
 		give_send_to_success_page();
131 131
 	} else {
132 132
 		// if errors are present, send the user back to the donation form so they can be corrected
133
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
133
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
134 134
 	}
135 135
 
136 136
 }
137 137
 
138
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
138
+add_action('give_gateway_offline', 'give_offline_process_payment');
139 139
 
140 140
 
141 141
 /**
@@ -148,59 +148,59 @@  discard block
 block discarded – undo
148 148
  * @since       1.0
149 149
  * @return void
150 150
  */
151
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
151
+function give_offline_send_donor_instructions($payment_id = 0) {
152 152
 
153
-	$payment_data                      = give_get_payment_meta( $payment_id );
154
-	$post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
153
+	$payment_data                      = give_get_payment_meta($payment_id);
154
+	$post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
155 155
 
156 156
 	//Customize email content depending on whether the single form has been customized
157
-	$email_content = give_get_option( 'global_offline_donation_email' );
157
+	$email_content = give_get_option('global_offline_donation_email');
158 158
 
159
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
160
-		$email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
159
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
160
+		$email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true);
161 161
 	}
162 162
 
163
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
163
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
164 164
 
165 165
 	/**
166 166
 	 * Filters the from name.
167 167
 	 *
168 168
 	 * @since 1.7
169 169
 	 */
170
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
170
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
171 171
 
172
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
172
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
173 173
 
174 174
 	/**
175 175
 	 * Filters the from email.
176 176
 	 *
177 177
 	 * @since 1.7
178 178
 	 */
179
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
179
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
180 180
 
181
-	$to_email = give_get_payment_user_email( $payment_id );
181
+	$to_email = give_get_payment_user_email($payment_id);
182 182
 
183
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
184
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
185
-		$subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
183
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
184
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
185
+		$subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
186 186
 	}
187 187
 
188
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
189
-	$subject = give_do_email_tags( $subject, $payment_id );
188
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
189
+	$subject = give_do_email_tags($subject, $payment_id);
190 190
 
191
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
192
-	$message     = give_do_email_tags( $email_content, $payment_id );
191
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
192
+	$message     = give_do_email_tags($email_content, $payment_id);
193 193
 
194 194
 	$emails = Give()->emails;
195 195
 
196
-	$emails->__set( 'from_name', $from_name );
197
-	$emails->__set( 'from_email', $from_email );
198
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
196
+	$emails->__set('from_name', $from_name);
197
+	$emails->__set('from_email', $from_email);
198
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
199 199
 
200
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
201
-	$emails->__set( 'headers', $headers );
200
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
201
+	$emails->__set('headers', $headers);
202 202
 
203
-	$emails->send( $to_email, $subject, $message, $attachments );
203
+	$emails->send($to_email, $subject, $message, $attachments);
204 204
 
205 205
 }
206 206
 
@@ -217,54 +217,54 @@  discard block
 block discarded – undo
217 217
  * @return void
218 218
  *
219 219
  */
220
-function give_offline_send_admin_notice( $payment_id = 0 ) {
220
+function give_offline_send_admin_notice($payment_id = 0) {
221 221
 
222 222
 	/* Send an email notification to the admin */
223 223
 	$admin_email = give_get_admin_notice_emails();
224
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
224
+	$user_info   = give_get_payment_meta_user_info($payment_id);
225 225
 
226
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
227
-		$user_data = get_userdata( $user_info['id'] );
226
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
227
+		$user_data = get_userdata($user_info['id']);
228 228
 		$name      = $user_data->display_name;
229
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
230
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
229
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
230
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
231 231
 	} else {
232 232
 		$name = $user_info['email'];
233 233
 	}
234 234
 
235
-	$amount = give_donation_amount( $payment_id );
235
+	$amount = give_donation_amount($payment_id);
236 236
 
237
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
237
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
238 238
 
239
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
240
-	$admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n";
241
-	$admin_message .= __( '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";
239
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
240
+	$admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n";
241
+	$admin_message .= __('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";
242 242
 
243 243
 
244
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
245
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
244
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
245
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
246 246
 
247 247
 	$admin_message .= sprintf(
248 248
 		                  '<a href="%1$s">%2$s</a>',
249
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
250
-		                  __( 'View Donation Details &raquo;', 'give' )
251
-	                  ) . "\n\n";
249
+		                  admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id),
250
+		                  __('View Donation Details &raquo;', 'give')
251
+	                  )."\n\n";
252 252
 
253
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
254
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
253
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
254
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
255 255
 
256
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
257
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
256
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
257
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
258 258
 
259 259
 	//Send Email
260 260
 	$emails = Give()->emails;
261
-	$emails->__set( 'heading', __( 'New Offline Donation', 'give' ) );
261
+	$emails->__set('heading', __('New Offline Donation', 'give'));
262 262
 
263
-	if ( ! empty( $admin_headers ) ) {
264
-		$emails->__set( 'headers', $admin_headers );
263
+	if ( ! empty($admin_headers)) {
264
+		$emails->__set('headers', $admin_headers);
265 265
 	}
266 266
 
267
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
267
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
268 268
 
269 269
 }
270 270
 
@@ -277,20 +277,20 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return array
279 279
  */
280
-function give_offline_add_settings( $settings ) {
280
+function give_offline_add_settings($settings) {
281 281
 
282 282
 	// Bailout: Do not show offline gateways setting in to metabox if its disabled globally.
283
-	if ( in_array( 'offline', (array) give_get_option( 'gateways' ) ) ) {
283
+	if (in_array('offline', (array) give_get_option('gateways'))) {
284 284
 		return $settings;
285 285
 	}
286 286
 
287 287
 	//Vars
288 288
 	$prefix = '_give_';
289 289
 
290
-	$is_gateway_active = give_is_gateway_active( 'offline' );
290
+	$is_gateway_active = give_is_gateway_active('offline');
291 291
 
292 292
 	//this gateway isn't active
293
-	if ( ! $is_gateway_active ) {
293
+	if ( ! $is_gateway_active) {
294 294
 		//return settings and bounce
295 295
 		return $settings;
296 296
 	}
@@ -299,34 +299,34 @@  discard block
 block discarded – undo
299 299
 	$check_settings = array(
300 300
 
301 301
 		array(
302
-			'name'    => __( 'Offline Donations', 'give' ),
303
-			'desc'    => __( 'Do you want to customize the donation instructions for this form?', 'give' ),
304
-			'id'      => $prefix . 'customize_offline_donations',
302
+			'name'    => __('Offline Donations', 'give'),
303
+			'desc'    => __('Do you want to customize the donation instructions for this form?', 'give'),
304
+			'id'      => $prefix.'customize_offline_donations',
305 305
 			'type'    => 'radio_inline',
306 306
 			'default' => 'global',
307
-			'options' => apply_filters( 'give_forms_content_options_select', array(
308
-					'global'   => __( 'Global Option', 'give' ),
309
-					'enabled'  => __( 'Customize', 'give' ),
310
-					'disabled' => __( 'Disable', 'give' ),
307
+			'options' => apply_filters('give_forms_content_options_select', array(
308
+					'global'   => __('Global Option', 'give'),
309
+					'enabled'  => __('Customize', 'give'),
310
+					'disabled' => __('Disable', 'give'),
311 311
 				)
312 312
 			),
313 313
 		),
314 314
 		array(
315
-			'name'        => __( 'Billing Fields', 'give' ),
316
-			'desc'        => __( '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' ),
317
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
315
+			'name'        => __('Billing Fields', 'give'),
316
+			'desc'        => __('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'),
317
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
318 318
 			'row_classes' => 'give-subfield give-hidden',
319 319
 			'type'        => 'radio_inline',
320 320
 			'default'     => 'disabled',
321 321
 			'options'     => array(
322
-				'enabled'  => __( 'Enabled', 'give' ),
323
-				'disabled' => __( 'Disabled', 'give' ),
322
+				'enabled'  => __('Enabled', 'give'),
323
+				'disabled' => __('Disabled', 'give'),
324 324
 			),
325 325
 		),
326 326
 		array(
327
-			'id'          => $prefix . 'offline_checkout_notes',
328
-			'name'        => __( 'Donation Instructions', 'give' ),
329
-			'desc'        => __( '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' ),
327
+			'id'          => $prefix.'offline_checkout_notes',
328
+			'name'        => __('Donation Instructions', 'give'),
329
+			'desc'        => __('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'),
330 330
 			'default'     => give_get_default_offline_donation_content(),
331 331
 			'type'        => 'wysiwyg',
332 332
 			'row_classes' => 'give-subfield give-hidden',
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 			'name'  => 'offline_docs',
339 339
 			'type'  => 'docs_link',
340 340
 			'url'   => 'http://docs.givewp.com/settings-gateway-offline-donations',
341
-			'title' => __( 'Offline Donations', 'give' ),
341
+			'title' => __('Offline Donations', 'give'),
342 342
 		),
343 343
 	);
344 344
 
345
-	return array_merge( $settings, $check_settings );
345
+	return array_merge($settings, $check_settings);
346 346
 }
347 347
 
348
-add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' );
348
+add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings');
349 349
 
350 350
 
351 351
 /**
@@ -357,32 +357,32 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function give_get_default_offline_donation_content() {
359 359
 
360
-	$sitename = get_bloginfo( 'sitename' );
360
+	$sitename = get_bloginfo('sitename');
361 361
 
362
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
362
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
363 363
 	$default_text .= '<ol>';
364 364
 	$default_text .= '<li>';
365 365
 	$default_text .= sprintf(
366 366
 	/* translators: %s: site name */
367
-		__( 'Make a check payable to "%s"', 'give' ),
367
+		__('Make a check payable to "%s"', 'give'),
368 368
 		$sitename
369 369
 	);
370 370
 	$default_text .= '</li>';
371 371
 	$default_text .= '<li>';
372 372
 	$default_text .= sprintf(
373 373
 	/* translators: %s: site name */
374
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
374
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
375 375
 		$sitename
376 376
 	);
377 377
 	$default_text .= '</li>';
378
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
378
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
379 379
 	$default_text .= '</ol>';
380
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
380
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
381 381
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
382 382
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
383
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
383
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
384 384
 
385
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
385
+	return apply_filters('give_default_offline_donation_content', $default_text);
386 386
 
387 387
 }
388 388
 
@@ -395,34 +395,34 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function give_get_default_offline_donation_email_content() {
397 397
 
398
-	$sitename     = get_bloginfo( 'sitename' );
399
-	$default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
400
-	$default_text .= '<p>' . __( '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>';
398
+	$sitename     = get_bloginfo('sitename');
399
+	$default_text = '<p>'.__('Dear {name},', 'give').'</p>';
400
+	$default_text .= '<p>'.__('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>';
401 401
 	$default_text .= '<ol>';
402 402
 	$default_text .= '<li>';
403 403
 	$default_text .= sprintf(
404 404
 	/* translators: %s: site name */
405
-		__( 'Make a check payable to "%s"', 'give' ),
405
+		__('Make a check payable to "%s"', 'give'),
406 406
 		$sitename
407 407
 	);
408 408
 	$default_text .= '</li>';
409 409
 	$default_text .= '<li>';
410 410
 	$default_text .= sprintf(
411 411
 	/* translators: %s: site name */
412
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
412
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
413 413
 		$sitename
414 414
 	);
415 415
 	$default_text .= '</li>';
416
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
416
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
417 417
 	$default_text .= '</ol>';
418
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
418
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
419 419
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
420 420
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
421
-	$default_text .= '<p>' . __( '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>';
422
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
423
-	$default_text .= '<p>' . $sitename . '</p>';
421
+	$default_text .= '<p>'.__('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>';
422
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
423
+	$default_text .= '<p>'.$sitename.'</p>';
424 424
 
425
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
425
+	return apply_filters('give_default_offline_donation_content', $default_text);
426 426
 
427 427
 }
428 428
 
@@ -436,27 +436,27 @@  discard block
 block discarded – undo
436 436
  *
437 437
  * @return string
438 438
  */
439
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
439
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
440 440
 	// Bailout.
441
-	if ( ! $form_id ) {
441
+	if ( ! $form_id) {
442 442
 		return '';
443 443
 	}
444 444
 
445
-	$post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
446
-	$post_offline_instructions         = give_get_meta( $form_id, '_give_offline_checkout_notes', true );
447
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
445
+	$post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
446
+	$post_offline_instructions         = give_get_meta($form_id, '_give_offline_checkout_notes', true);
447
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
448 448
 	$offline_instructions              = $global_offline_instruction;
449 449
 
450
-	if ( give_is_setting_enabled( $post_offline_customization_option ) ) {
450
+	if (give_is_setting_enabled($post_offline_customization_option)) {
451 451
 		$offline_instructions = $post_offline_instructions;
452 452
 	}
453 453
 
454
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
454
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
455 455
 
456 456
 	/* translators: %s: form settings url */
457
-	$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
457
+	$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
458 458
 
459
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
459
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
460 460
 }
461 461
 
462 462
 
@@ -470,21 +470,21 @@  discard block
 block discarded – undo
470 470
  *
471 471
  * @return array
472 472
  */
473
-function give_filter_offline_gateway( $gateway_list, $form_id ) {
473
+function give_filter_offline_gateway($gateway_list, $form_id) {
474 474
 	if (
475 475
 		// Show offline payment gateway if enable for new donation form.
476
-		( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) )
476
+		(false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms'))
477 477
 		&& $form_id
478
-		&& ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( 'enabled', 'global' ) )
478
+		&& ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array('enabled', 'global'))
479 479
 	) {
480
-		unset( $gateway_list['offline'] );
480
+		unset($gateway_list['offline']);
481 481
 	}
482 482
 
483 483
 	// Output.
484 484
 	return $gateway_list;
485 485
 }
486 486
 
487
-add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 );
487
+add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2);
488 488
 
489 489
 /**
490 490
  * Set default gateway to global default payment gateway
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
  *
499 499
  * @return void
500 500
  */
501
-function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) {
501
+function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) {
502 502
 	if (
503
-		! give_is_setting_enabled( $meta_value, array( 'global', 'enabled' ) )
504
-		&& ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) )
503
+		! give_is_setting_enabled($meta_value, array('global', 'enabled'))
504
+		&& ('offline' === give_get_meta($postid, '_give_default_gateway', true))
505 505
 	) {
506
-		give_update_meta( $postid, '_give_default_gateway', 'global' );
506
+		give_update_meta($postid, '_give_default_gateway', 'global');
507 507
 	}
508 508
 }
509 509
 
510
-add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 );
510
+add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3);
Please login to merge, or discard this patch.
includes/admin/tools/export/export-functions.php 1 patch
Spacing   +27 added lines, -28 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
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_ajax_export() {
27 27
 
28
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
28
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
29 29
 
30
-	parse_str( $_POST['form'], $form );
30
+	parse_str($_POST['form'], $form);
31 31
 
32 32
 	$_REQUEST = $form = (array) $form;
33 33
 
34
-	if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) {
35
-		die( '-2' );
34
+	if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) {
35
+		die('-2');
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param string $class Export class.
44 44
 	 */
45
-	do_action( 'give_batch_export_class_include', $form['give-export-class'] );
45
+	do_action('give_batch_export_class_include', $form['give-export-class']);
46 46
 
47
-	$step   = absint( $_POST['step'] );
48
-	$class  = sanitize_text_field( $form['give-export-class'] );
47
+	$step   = absint($_POST['step']);
48
+	$class  = sanitize_text_field($form['give-export-class']);
49 49
 
50 50
 	/* @var Give_Batch_Export $export */
51
-	$export = new $class( $step );
51
+	$export = new $class($step);
52 52
 
53
-	if ( ! $export->can_export() ) {
54
-		die( '-1' );
53
+	if ( ! $export->can_export()) {
54
+		die('-1');
55 55
 	}
56 56
 
57
-	if ( ! $export->is_writable ) {
57
+	if ( ! $export->is_writable) {
58 58
 		$json_args = array(
59 59
 			'error'   => true,
60
-			'message' => esc_html__( 'Export location or file not writable.', 'give' )
60
+			'message' => esc_html__('Export location or file not writable.', 'give')
61 61
 		);
62 62
 		echo json_encode($json_args);
63 63
 		exit;
64 64
 	}
65 65
 
66
-	$export->set_properties( give_clean( $_REQUEST ) );
66
+	$export->set_properties(give_clean($_REQUEST));
67 67
 
68 68
 	$export->pre_fetch();
69 69
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 	$percentage = $export->get_percentage_complete();
73 73
 
74
-	if ( $ret ) {
74
+	if ($ret) {
75 75
 
76 76
 		$step += 1;
77 77
 		$json_data = array(
@@ -79,18 +79,17 @@  discard block
 block discarded – undo
79 79
 			'percentage' => $percentage
80 80
 		);
81 81
 
82
-	} elseif ( true === $export->is_empty ) {
82
+	} elseif (true === $export->is_empty) {
83 83
 
84 84
 		$json_data = array(
85 85
 			'error'   => true,
86
-			'message' => esc_html__( 'No data found for export parameters.', 'give' )
86
+			'message' => esc_html__('No data found for export parameters.', 'give')
87 87
 		);
88 88
 
89
-	} elseif ( true === $export->done && true === $export->is_void ) {
89
+	} elseif (true === $export->done && true === $export->is_void) {
90 90
 
91
-		$message = ! empty( $export->message ) ?
92
-			$export->message :
93
-			esc_html__( 'Batch Processing Complete', 'give' );
91
+		$message = ! empty($export->message) ?
92
+			$export->message : esc_html__('Batch Processing Complete', 'give');
94 93
 
95 94
 		$json_data = array(
96 95
 			'success' => true,
@@ -99,23 +98,23 @@  discard block
 block discarded – undo
99 98
 
100 99
 	} else {
101 100
 		
102
-		$args = array_merge( $_REQUEST, array(
101
+		$args = array_merge($_REQUEST, array(
103 102
 			'step'        => $step,
104 103
 			'class'       => $class,
105
-			'nonce'       => wp_create_nonce( 'give-batch-export' ),
104
+			'nonce'       => wp_create_nonce('give-batch-export'),
106 105
 			'give_action' => 'form_batch_export',
107
-		) );
106
+		));
108 107
 
109 108
 		$json_data = array(
110 109
 			'step' => 'done',
111
-			'url' => add_query_arg( $args, admin_url() )
110
+			'url' => add_query_arg($args, admin_url())
112 111
 		);
113 112
 
114 113
 	}
115 114
 
116
-	$export->unset_properties( give_clean( $_REQUEST ), $export );
117
-	echo json_encode( $json_data );
115
+	$export->unset_properties(give_clean($_REQUEST), $export);
116
+	echo json_encode($json_data);
118 117
 	exit;
119 118
 }
120 119
 
121
-add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' );
120
+add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export');
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-donors.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 
246 246
 					// Continue if donor already included.
247 247
 					if ( empty( $payment->customer_id ) ||
248
-					     in_array( $payment->customer_id, $cached_donor_ids )
248
+						 in_array( $payment->customer_id, $cached_donor_ids )
249 249
 					) {
250 250
 						continue;
251 251
 					}
Please login to merge, or discard this patch.
Spacing   +108 added lines, -110 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @param int $_step
72 72
 	 */
73
-	public function __construct( $_step = 1 ) {
73
+	public function __construct($_step = 1) {
74 74
 
75
-		parent::__construct( $_step );
75
+		parent::__construct($_step);
76 76
 
77 77
 		// Filter to change the filename.
78
-		add_filter( 'give_export_filename', array( $this, 'give_export_filename' ), 10, 2 );
78
+		add_filter('give_export_filename', array($this, 'give_export_filename'), 10, 2);
79 79
 	}
80 80
 
81 81
 	/**
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return string $filename file name.
90 90
 	 */
91
-	public function give_export_filename( $filename, $export_type ) {
91
+	public function give_export_filename($filename, $export_type) {
92 92
 
93
-		if ( $this->export_type !== $export_type ) {
93
+		if ($this->export_type !== $export_type) {
94 94
 			return $filename;
95 95
 		}
96 96
 
97
-		$forms = empty( $_GET['forms'] ) ? 0 : absint( $_GET['forms'] );
97
+		$forms = empty($_GET['forms']) ? 0 : absint($_GET['forms']);
98 98
 
99
-		if ( $forms ) {
100
-			$slug     = get_post_field( 'post_name', get_post( $forms ) );
101
-			$filename = 'give-export-donors-' . $slug . '-' . date( 'm-d-Y' );
99
+		if ($forms) {
100
+			$slug     = get_post_field('post_name', get_post($forms));
101
+			$filename = 'give-export-donors-'.$slug.'-'.date('m-d-Y');
102 102
 		} else {
103
-			$filename = 'give-export-donors-all-forms-' . date( 'm-d-Y' );
103
+			$filename = 'give-export-donors-all-forms-'.date('m-d-Y');
104 104
 		}
105 105
 
106 106
 		return $filename;
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param array $request The Form Data passed into the batch processing
115 115
 	 */
116
-	public function set_properties( $request ) {
116
+	public function set_properties($request) {
117 117
 
118 118
 		// Set data from form submission
119
-		if ( isset( $_POST['form'] ) ) {
120
-			parse_str( $_POST['form'], $this->data );
119
+		if (isset($_POST['form'])) {
120
+			parse_str($_POST['form'], $this->data);
121 121
 		}
122 122
 
123 123
 		$this->form = $this->data['forms'];
124 124
 
125 125
 		// Setup donor ids cache.
126
-		if ( ! empty( $this->form ) ) {
126
+		if ( ! empty($this->form)) {
127 127
 			// Cache donor ids to output unique list of donor.
128
-			$this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] );
128
+			$this->query_id = give_clean($_REQUEST['give_export_option']['query_id']);
129 129
 			$this->cache_donor_ids();
130 130
 		}
131 131
 
132
-		$this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
132
+		$this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
133 133
 	}
134 134
 
135 135
 	/**
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 		// Fetch already cached donor ids.
143 143
 		$donor_ids = $this->donor_ids;
144 144
 
145
-		if ( $cached_donor_ids = Give_Cache::get( $this->query_id, true ) ) {
146
-			$donor_ids = array_unique( array_merge( $cached_donor_ids, $this->donor_ids ) );
145
+		if ($cached_donor_ids = Give_Cache::get($this->query_id, true)) {
146
+			$donor_ids = array_unique(array_merge($cached_donor_ids, $this->donor_ids));
147 147
 		}
148 148
 
149
-		$donor_ids = array_values( $donor_ids );
150
-		Give_Cache::set( $this->query_id, $donor_ids, HOUR_IN_SECONDS, true );
149
+		$donor_ids = array_values($donor_ids);
150
+		Give_Cache::set($this->query_id, $donor_ids, HOUR_IN_SECONDS, true);
151 151
 	}
152 152
 
153 153
 	/**
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function csv_cols() {
161 161
 
162
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
162
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
163 163
 
164 164
 		// We need columns.
165
-		if ( empty( $columns ) ) {
165
+		if (empty($columns)) {
166 166
 			return false;
167 167
 		}
168 168
 
169
-		$cols = $this->get_cols( $columns );
169
+		$cols = $this->get_cols($columns);
170 170
 
171 171
 		return $cols;
172 172
 	}
@@ -178,38 +178,38 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return array
180 180
 	 */
181
-	private function get_cols( $columns ) {
181
+	private function get_cols($columns) {
182 182
 
183 183
 		$cols = array();
184 184
 
185
-		foreach ( $columns as $key => $value ) {
185
+		foreach ($columns as $key => $value) {
186 186
 
187
-			switch ( $key ) {
187
+			switch ($key) {
188 188
 				case 'full_name' :
189
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
189
+					$cols['full_name'] = esc_html__('Full Name', 'give');
190 190
 					break;
191 191
 				case 'email' :
192
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
192
+					$cols['email'] = esc_html__('Email Address', 'give');
193 193
 					break;
194 194
 				case 'address' :
195
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
196
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
197
-					$cols['address_city']    = esc_html__( 'City', 'give' );
198
-					$cols['address_state']   = esc_html__( 'State', 'give' );
199
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
200
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
195
+					$cols['address_line1']   = esc_html__('Address', 'give');
196
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
197
+					$cols['address_city']    = esc_html__('City', 'give');
198
+					$cols['address_state']   = esc_html__('State', 'give');
199
+					$cols['address_zip']     = esc_html__('Zip', 'give');
200
+					$cols['address_country'] = esc_html__('Country', 'give');
201 201
 					break;
202 202
 				case 'userid' :
203
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
203
+					$cols['userid'] = esc_html__('User ID', 'give');
204 204
 					break;
205 205
 				case 'donor_created_date' :
206
-					$cols['donor_created_date'] = esc_html__( 'Donor Created Date', 'give' );
206
+					$cols['donor_created_date'] = esc_html__('Donor Created Date', 'give');
207 207
 					break;
208 208
 				case 'donations' :
209
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
209
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
210 210
 					break;
211 211
 				case 'donation_sum' :
212
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
212
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
213 213
 					break;
214 214
 			}
215 215
 		}
@@ -230,29 +230,29 @@  discard block
 block discarded – undo
230 230
 		$i = 0;
231 231
 
232 232
 		$data             = array();
233
-		$cached_donor_ids = Give_Cache::get( $this->query_id, true );
233
+		$cached_donor_ids = Give_Cache::get($this->query_id, true);
234 234
 
235
-		if ( ! empty( $this->form ) ) {
235
+		if ( ! empty($this->form)) {
236 236
 
237 237
 			// Export donors for a specific donation form and also within specified timeframe
238 238
 			$args = array(
239 239
 				'output'     => 'payments', // Use 'posts' to get standard post objects
240
-				'post_type'  => array( 'give_payment' ),
240
+				'post_type'  => array('give_payment'),
241 241
 				'number'     => 30,
242 242
 				'paged'      => $this->step,
243 243
 				'status'     => 'publish',
244 244
 				'meta_key'   => '_give_payment_form_id',
245
-				'meta_value' => absint( $this->form ),
245
+				'meta_value' => absint($this->form),
246 246
 			);
247 247
 
248 248
 			// Check for date option filter
249
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
250
-				$args['start_date'] = ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' );
251
-				$args['end_date']   = ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) );
249
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
250
+				$args['start_date'] = ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00');
251
+				$args['end_date']   = ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp'));
252 252
 			}
253 253
 
254 254
 			// Check for price option.
255
-			if ( null !== $this->price_id ) {
255
+			if (null !== $this->price_id) {
256 256
 				$args['meta_query'] = array(
257 257
 					array(
258 258
 						'key'   => '_give_payment_price_id',
@@ -261,44 +261,42 @@  discard block
 block discarded – undo
261 261
 				);
262 262
 			}
263 263
 
264
-			$payments_query = new Give_Payments_Query( $args );
264
+			$payments_query = new Give_Payments_Query($args);
265 265
 			$payments       = $payments_query->get_payments();
266 266
 
267
-			if ( $payments ) {
267
+			if ($payments) {
268 268
 				/* @var Give_Payment $payment */
269
-				foreach ( $payments as $payment ) {
269
+				foreach ($payments as $payment) {
270 270
 					// Set donation sum.
271
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] = isset( $this->payment_stats[ $payment->customer_id ]['donation_sum'] ) ?
272
-						$this->payment_stats[ $payment->customer_id ]['donation_sum'] :
273
-						0;
274
-					$this->payment_stats[ $payment->customer_id ]['donation_sum'] += $payment->total;
271
+					$this->payment_stats[$payment->customer_id]['donation_sum'] = isset($this->payment_stats[$payment->customer_id]['donation_sum']) ?
272
+						$this->payment_stats[$payment->customer_id]['donation_sum'] : 0;
273
+					$this->payment_stats[$payment->customer_id]['donation_sum'] += $payment->total;
275 274
 
276 275
 					// Set donation count.
277
-					$this->payment_stats[ $payment->customer_id ]['donations'] = isset( $this->payment_stats[ $payment->customer_id ]['donations'] ) ?
278
-						++ $this->payment_stats[ $payment->customer_id ]['donations'] :
279
-						1;
276
+					$this->payment_stats[$payment->customer_id]['donations'] = isset($this->payment_stats[$payment->customer_id]['donations']) ?
277
+						++$this->payment_stats[$payment->customer_id]['donations'] : 1;
280 278
 
281 279
 					// Set donation form name.
282
-					$this->payment_stats[ $payment->customer_id ]['form_title'] = $payment->form_title;
280
+					$this->payment_stats[$payment->customer_id]['form_title'] = $payment->form_title;
283 281
 
284 282
 					// Continue if donor already included.
285
-					if ( empty( $payment->customer_id ) ||
286
-					     in_array( $payment->customer_id, $cached_donor_ids )
283
+					if (empty($payment->customer_id) ||
284
+					     in_array($payment->customer_id, $cached_donor_ids)
287 285
 					) {
288 286
 						continue;
289 287
 					}
290 288
 
291 289
 					$this->donor_ids[] = $cached_donor_ids[] = $payment->customer_id;
292 290
 
293
-					$i ++;
291
+					$i++;
294 292
 				}
295 293
 
296
-				if ( ! empty( $this->donor_ids ) ) {
297
-					foreach ( $this->donor_ids as $donor_id ) {
298
-						$donor                 = Give()->donors->get_donor_by( 'id', $donor_id );
299
-						$donor->purchase_count = $this->payment_stats[ $donor_id ]['donations'];
300
-						$donor->purchase_value = $this->payment_stats[ $donor_id ]['donation_sum'];
301
-						$data[]                = $this->set_donor_data( $i, $data, $donor );
294
+				if ( ! empty($this->donor_ids)) {
295
+					foreach ($this->donor_ids as $donor_id) {
296
+						$donor                 = Give()->donors->get_donor_by('id', $donor_id);
297
+						$donor->purchase_count = $this->payment_stats[$donor_id]['donations'];
298
+						$donor->purchase_value = $this->payment_stats[$donor_id]['donation_sum'];
299
+						$data[]                = $this->set_donor_data($i, $data, $donor);
302 300
 					}
303 301
 
304 302
 					// Cache donor ids only if admin export donor for specific form.
@@ -308,7 +306,7 @@  discard block
 block discarded – undo
308 306
 		} else {
309 307
 
310 308
 			// Export all donors.
311
-			$offset = 30 * ( $this->step - 1 );
309
+			$offset = 30 * ($this->step - 1);
312 310
 
313 311
 			$args = array(
314 312
 				'number' => 30,
@@ -316,29 +314,29 @@  discard block
 block discarded – undo
316 314
 			);
317 315
 
318 316
 			// Check for date option filter
319
-			if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) {
317
+			if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) {
320 318
 				$args['date'] = array(
321
-					'start' => ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ),
322
-					'end'   => ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ),
319
+					'start' => ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'),
320
+					'end'   => ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')),
323 321
 				);
324 322
 			}
325 323
 
326
-			$donors = Give()->donors->get_donors( $args );
324
+			$donors = Give()->donors->get_donors($args);
327 325
 
328
-			foreach ( $donors as $donor ) {
326
+			foreach ($donors as $donor) {
329 327
 
330 328
 				// Continue if donor already included.
331
-				if ( empty( $donor->id ) || empty( $donor->payment_ids ) ) {
329
+				if (empty($donor->id) || empty($donor->payment_ids)) {
332 330
 					continue;
333 331
 				}
334 332
 
335
-				$data[] = $this->set_donor_data( $i, $data, $donor );
336
-				$i ++;
333
+				$data[] = $this->set_donor_data($i, $data, $donor);
334
+				$i++;
337 335
 			}
338 336
 		}// End if().
339 337
 
340
-		$data = apply_filters( 'give_export_get_data', $data );
341
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
338
+		$data = apply_filters('give_export_get_data', $data);
339
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
342 340
 
343 341
 		return $data;
344 342
 	}
@@ -354,18 +352,18 @@  discard block
 block discarded – undo
354 352
 		$percentage = 0;
355 353
 
356 354
 		// We can't count the number when getting them for a specific form.
357
-		if ( empty( $this->form ) ) {
355
+		if (empty($this->form)) {
358 356
 
359 357
 			$total = Give()->donors->count();
360 358
 
361
-			if ( $total > 0 ) {
359
+			if ($total > 0) {
362 360
 
363
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
361
+				$percentage = ((30 * $this->step) / $total) * 100;
364 362
 
365 363
 			}
366 364
 		}
367 365
 
368
-		if ( $percentage > 100 ) {
366
+		if ($percentage > 100) {
369 367
 			$percentage = 100;
370 368
 		}
371 369
 
@@ -381,48 +379,48 @@  discard block
 block discarded – undo
381 379
 	 *
382 380
 	 * @return mixed
383 381
 	 */
384
-	private function set_donor_data( $i, $data, $donor ) {
382
+	private function set_donor_data($i, $data, $donor) {
385 383
 
386 384
 		$columns = $this->csv_cols();
387 385
 
388 386
 		// Set address variable.
389 387
 		$address = '';
390
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
391
-			$address = give_get_donor_address( $donor->user_id );
388
+		if (isset($donor->user_id) && $donor->user_id > 0) {
389
+			$address = give_get_donor_address($donor->user_id);
392 390
 		}
393 391
 
394 392
 		// Set columns
395
-		if ( ! empty( $columns['full_name'] ) ) {
396
-			$data[ $i ]['full_name'] = $donor->name;
393
+		if ( ! empty($columns['full_name'])) {
394
+			$data[$i]['full_name'] = $donor->name;
397 395
 		}
398
-		if ( ! empty( $columns['email'] ) ) {
399
-			$data[ $i ]['email'] = $donor->email;
396
+		if ( ! empty($columns['email'])) {
397
+			$data[$i]['email'] = $donor->email;
400 398
 		}
401
-		if ( ! empty( $columns['address_line1'] ) ) {
402
-
403
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
404
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
405
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
406
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
407
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
408
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
399
+		if ( ! empty($columns['address_line1'])) {
400
+
401
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
402
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
403
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
404
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
405
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
406
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
409 407
 		}
410
-		if ( ! empty( $columns['userid'] ) ) {
411
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
408
+		if ( ! empty($columns['userid'])) {
409
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
412 410
 		}
413
-		if ( ! empty( $columns['donor_created_date'] ) ) {
414
-			$data[ $i ]['donor_created_date'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
411
+		if ( ! empty($columns['donor_created_date'])) {
412
+			$data[$i]['donor_created_date'] = date_i18n(give_date_format(), strtotime($donor->date_created));
415 413
 		}
416
-		if ( ! empty( $columns['donations'] ) ) {
417
-			$data[ $i ]['donations'] = $donor->purchase_count;
414
+		if ( ! empty($columns['donations'])) {
415
+			$data[$i]['donations'] = $donor->purchase_count;
418 416
 		}
419
-		if ( ! empty( $columns['donation_sum'] ) ) {
420
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) );
417
+		if ( ! empty($columns['donation_sum'])) {
418
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value, array('sanitize' => false));
421 419
 		}
422 420
 
423
-		$data[ $i ] = apply_filters( 'give_export_set_donor_data', $data[ $i ], $donor );
421
+		$data[$i] = apply_filters('give_export_set_donor_data', $data[$i], $donor);
424 422
 
425
-		return $data[ $i ];
423
+		return $data[$i];
426 424
 
427 425
 	}
428 426
 
@@ -432,9 +430,9 @@  discard block
 block discarded – undo
432 430
 	 * @param array $request
433 431
 	 * @param Give_Batch_Export $export
434 432
 	 */
435
-	public function unset_properties( $request, $export ) {
436
-		if ( $export->done ) {
437
-			Give_Cache::delete( "give_cache_{$this->query_id}" );
433
+	public function unset_properties($request, $export) {
434
+		if ($export->done) {
435
+			Give_Cache::delete("give_cache_{$this->query_id}");
438 436
 		}
439 437
 	}
440 438
 }
441 439
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param int $_step
120 120
 	 */
121
-	public function __construct( $_step = 1 ) {
121
+	public function __construct($_step = 1) {
122 122
 
123 123
 		$upload_dir     = wp_upload_dir();
124 124
 		$this->filetype = '.csv';
125
-		$this->filename = 'give-' . $this->export_type . $this->filetype;
126
-		$this->file     = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
125
+		$this->filename = 'give-'.$this->export_type.$this->filetype;
126
+		$this->file     = trailingslashit($upload_dir['basedir']).$this->filename;
127 127
 
128
-		if ( ! is_writeable( $upload_dir['basedir'] ) ) {
128
+		if ( ! is_writeable($upload_dir['basedir'])) {
129 129
 			$this->is_writable = false;
130 130
 		}
131 131
 
@@ -141,22 +141,22 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function process_step() {
143 143
 
144
-		if ( ! $this->can_export() ) {
145
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array(
144
+		if ( ! $this->can_export()) {
145
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array(
146 146
 				'response' => 403,
147
-			) );
147
+			));
148 148
 		}
149 149
 
150
-		if ( $this->step < 2 ) {
150
+		if ($this->step < 2) {
151 151
 
152 152
 			// Make sure we start with a fresh file on step 1.
153
-			@unlink( $this->file );
153
+			@unlink($this->file);
154 154
 			$this->print_csv_cols();
155 155
 		}
156 156
 
157 157
 		$rows = $this->print_csv_rows();
158 158
 
159
-		if ( $rows ) {
159
+		if ($rows) {
160 160
 			return true;
161 161
 		} else {
162 162
 			return false;
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 		$col_data = '';
177 177
 		$cols     = $this->get_csv_cols();
178 178
 		$i        = 1;
179
-		foreach ( $cols as $col_id => $column ) {
180
-			$col_data .= '"' . addslashes( $column ) . '"';
181
-			$col_data .= $i == count( $cols ) ? '' : ',';
182
-			$i ++;
179
+		foreach ($cols as $col_id => $column) {
180
+			$col_data .= '"'.addslashes($column).'"';
181
+			$col_data .= $i == count($cols) ? '' : ',';
182
+			$i++;
183 183
 		}
184 184
 		$col_data .= "\r\n";
185 185
 
186
-		$this->stash_step_data( $col_data );
186
+		$this->stash_step_data($col_data);
187 187
 
188 188
 		return $col_data;
189 189
 
@@ -202,23 +202,23 @@  discard block
 block discarded – undo
202 202
 		$data     = $this->get_data();
203 203
 		$cols     = $this->get_csv_cols();
204 204
 
205
-		if ( $data ) {
205
+		if ($data) {
206 206
 
207 207
 			// Output each row
208
-			foreach ( $data as $row ) {
208
+			foreach ($data as $row) {
209 209
 				$i = 1;
210
-				foreach ( $row as $col_id => $column ) {
210
+				foreach ($row as $col_id => $column) {
211 211
 					// Make sure the column is valid
212
-					if ( array_key_exists( $col_id, $cols ) ) {
213
-						$row_data .= '"' . addslashes( preg_replace( '/"/', "'", $column ) ) . '"';
214
-						$row_data .= $i == count( $cols ) ? '' : ',';
215
-						$i ++;
212
+					if (array_key_exists($col_id, $cols)) {
213
+						$row_data .= '"'.addslashes(preg_replace('/"/', "'", $column)).'"';
214
+						$row_data .= $i == count($cols) ? '' : ',';
215
+						$i++;
216 216
 					}
217 217
 				}
218 218
 				$row_data .= "\r\n";
219 219
 			}
220 220
 
221
-			$this->stash_step_data( $row_data );
221
+			$this->stash_step_data($row_data);
222 222
 
223 223
 			return $row_data;
224 224
 		}
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$file = '';
248 248
 
249
-		if ( @file_exists( $this->file ) ) {
249
+		if (@file_exists($this->file)) {
250 250
 
251
-			if ( ! is_writeable( $this->file ) ) {
251
+			if ( ! is_writeable($this->file)) {
252 252
 				$this->is_writable = false;
253 253
 			}
254 254
 
255
-			$file = @file_get_contents( $this->file );
255
+			$file = @file_get_contents($this->file);
256 256
 
257 257
 		} else {
258 258
 
259
-			@file_put_contents( $this->file, '' );
260
-			@chmod( $this->file, 0664 );
259
+			@file_put_contents($this->file, '');
260
+			@chmod($this->file, 0664);
261 261
 
262 262
 		}
263 263
 
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return void
275 275
 	 */
276
-	protected function stash_step_data( $data = '' ) {
276
+	protected function stash_step_data($data = '') {
277 277
 
278 278
 		$file = $this->get_file();
279 279
 		$file .= $data;
280
-		@file_put_contents( $this->file, $file );
280
+		@file_put_contents($this->file, $file);
281 281
 
282 282
 		// If we have no rows after this step, mark it as an empty export.
283
-		$file_rows    = file( $this->file, FILE_SKIP_EMPTY_LINES );
283
+		$file_rows    = file($this->file, FILE_SKIP_EMPTY_LINES);
284 284
 		$default_cols = $this->get_csv_cols();
285
-		$default_cols = empty( $default_cols ) ? 0 : 1;
285
+		$default_cols = empty($default_cols) ? 0 : 1;
286 286
 
287
-		$this->is_empty = count( $file_rows ) == $default_cols ? true : false;
287
+		$this->is_empty = count($file_rows) == $default_cols ? true : false;
288 288
 
289 289
 	}
290 290
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$file = $this->get_file();
304 304
 
305
-		@unlink( $this->file );
305
+		@unlink($this->file);
306 306
 
307 307
 		echo $file;
308 308
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		 *
312 312
 		 * @since 1.8
313 313
 		 */
314
-		do_action( 'give_file_export_complete', $_REQUEST );
314
+		do_action('give_file_export_complete', $_REQUEST);
315 315
 
316 316
 		give_die();
317 317
 	}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 *
324 324
 	 * @param array $request The Form Data passed into the batch processing.
325 325
 	 */
326
-	public function set_properties( $request ) {
326
+	public function set_properties($request) {
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 * @param array             $request The Form Data passed into the batch processing.
335 335
 	 * @param Give_Batch_Export $export
336 336
 	 */
337
-	public function unset_properties( $request, $export ) {
337
+	public function unset_properties($request, $export) {
338 338
 	}
339 339
 
340 340
 	/**
Please login to merge, or discard this patch.
includes/admin/reports/class-donor-reports-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 	 *
144 144
 	 * @access public
145 145
 	 * @since  1.0
146
-	 * @return mixed string If search is present, false otherwise
146
+	 * @return string|false string If search is present, false otherwise
147 147
 	 */
148 148
 	public function get_search() {
149 149
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
68
-			'ajax'     => false,// Does this table support ajax?
69
-		) );
65
+		parent::__construct(array(
66
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
68
+			'ajax'     => false, // Does this table support ajax?
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return false;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search" role="search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,33 +124,33 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' === $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' === $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<?php if ( 'top' === $which ) { ?>
135
+			<?php if ('top' === $which) { ?>
136 136
 				<h2 class="alignleft reports-earnings-title">
137
-					<?php esc_html_e( 'Donors Report', 'give' ); ?>
137
+					<?php esc_html_e('Donors Report', 'give'); ?>
138 138
 				</h2>
139 139
 			<?php } ?>
140 140
 
141 141
 			<div class="alignright tablenav-right">
142 142
 				<div class="actions bulkactions">
143 143
 					<?php
144
-					if ( 'top' === $which ) {
145
-						$this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' );
144
+					if ('top' === $which) {
145
+						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search');
146 146
 					}
147 147
 
148
-					$this->bulk_actions( $which ); ?>
148
+					$this->bulk_actions($which); ?>
149 149
 
150 150
 				</div>
151 151
 				<?php
152
-				$this->extra_tablenav( $which );
153
-				$this->pagination( $which );
152
+				$this->extra_tablenav($which);
153
+				$this->pagination($which);
154 154
 				?>
155 155
 			</div>
156 156
 
@@ -172,35 +172,35 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string Column Name
174 174
 	 */
175
-	public function column_default( $item, $column_name ) {
175
+	public function column_default($item, $column_name) {
176 176
 
177
-		switch ( $column_name ) {
177
+		switch ($column_name) {
178 178
 
179 179
 			case 'name' :
180
-				$name = '#' . $item['id'] . ' ';
181
-				$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
182
-				$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
183
-				$value    = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>';
180
+				$name = '#'.$item['id'].' ';
181
+				$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
182
+				$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
183
+				$value    = '<a href="'.esc_url($view_url).'">'.$name.'</a>';
184 184
 				break;
185 185
 
186 186
 			case 'num_donations' :
187 187
 				$value = sprintf(
188 188
 					'<a href="%s">%s</a>',
189
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $item['id'] ) ),
190
-						esc_html( $item['num_donations'] )
189
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($item['id'])),
190
+						esc_html($item['num_donations'])
191 191
 					);
192 192
 				break;
193 193
 
194 194
 			case 'amount_spent' :
195
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ], array( 'sanitize' => false ) ) );
195
+				$value = give_currency_filter(give_format_amount($item[$column_name], array('sanitize' => false)));
196 196
 				break;
197 197
 
198 198
 			default:
199
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
199
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
200 200
 				break;
201 201
 		}
202 202
 
203
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
203
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
204 204
 	}
205 205
 
206 206
 	/**
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function get_columns() {
214 214
 		$columns = array(
215
-			'name'          => __( 'Name', 'give' ),
216
-			'email'         => __( 'Email', 'give' ),
217
-			'num_donations' => __( 'Donations', 'give' ),
218
-			'amount_spent'  => __( 'Total Donated', 'give' ),
215
+			'name'          => __('Name', 'give'),
216
+			'email'         => __('Email', 'give'),
217
+			'num_donations' => __('Donations', 'give'),
218
+			'amount_spent'  => __('Total Donated', 'give'),
219 219
 		);
220 220
 
221
-		return apply_filters( 'give_report_donor_columns', $columns );
221
+		return apply_filters('give_report_donor_columns', $columns);
222 222
 
223 223
 	}
224 224
 
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function get_sortable_columns() {
233 233
 		return array(
234
-			'id'            => array( 'id', true ),
235
-			'name'          => array( 'name', true ),
236
-			'num_donations' => array( 'purchase_count', false ),
237
-			'amount_spent'  => array( 'purchase_value', false ),
234
+			'id'            => array('id', true),
235
+			'name'          => array('name', true),
236
+			'num_donations' => array('purchase_count', false),
237
+			'amount_spent'  => array('purchase_value', false),
238 238
 		);
239 239
 	}
240 240
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @since  1.0
246 246
 	 * @return void
247 247
 	 */
248
-	public function bulk_actions( $which = '' ) {
248
+	public function bulk_actions($which = '') {
249 249
 
250 250
 	}
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @return int Current page number
258 258
 	 */
259 259
 	public function get_paged() {
260
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
260
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
261 261
 	}
262 262
 
263 263
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return mixed string If search is present, false otherwise
269 269
 	 */
270 270
 	public function get_search() {
271
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
271
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
272 272
 	}
273 273
 
274 274
 	/**
@@ -287,15 +287,15 @@  discard block
 block discarded – undo
287 287
 
288 288
 		// Get donor query.
289 289
 		$args   = $this->get_donor_query();
290
-		$donors = Give()->donors->get_donors( $args );
290
+		$donors = Give()->donors->get_donors($args);
291 291
 
292
-		if ( $donors ) {
292
+		if ($donors) {
293 293
 
294
-			$this->count = count( $donors );
294
+			$this->count = count($donors);
295 295
 
296
-			foreach ( $donors as $donor ) {
296
+			foreach ($donors as $donor) {
297 297
 
298
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
298
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
299 299
 
300 300
 				$data[] = array(
301 301
 					'id'            => $donor->id,
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 
324 324
 		$_donor_query['number'] = -1;
325 325
 		$_donor_query['offset'] = 0;
326
-		$donors = Give()->donors->get_donors( $_donor_query );
326
+		$donors = Give()->donors->get_donors($_donor_query);
327 327
 
328
-		return count( $donors );
328
+		return count($donors);
329 329
 	}
330 330
 
331 331
 	/**
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	public function get_donor_query() {
339 339
 		$paged   = $this->get_paged();
340
-		$offset  = $this->per_page * ( $paged - 1 );
340
+		$offset  = $this->per_page * ($paged - 1);
341 341
 		$search  = $this->get_search();
342
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
343
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
342
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
343
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
344 344
 
345 345
 		$args = array(
346 346
 			'number'  => $this->per_page,
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 			'orderby' => $orderby,
350 350
 		);
351 351
 
352
-		if( $search ) {
353
-			if ( is_email( $search ) ) {
352
+		if ($search) {
353
+			if (is_email($search)) {
354 354
 				$args['email'] = $search;
355
-			} elseif ( is_numeric( $search ) ) {
355
+			} elseif (is_numeric($search)) {
356 356
 				$args['id'] = $search;
357 357
 			} else {
358 358
 				$args['name'] = $search;
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 		$hidden   = array(); // No hidden columns
380 380
 		$sortable = $this->get_sortable_columns();
381 381
 
382
-		$this->_column_headers = array( $columns, $hidden, $sortable );
382
+		$this->_column_headers = array($columns, $hidden, $sortable);
383 383
 
384 384
 		$this->items = $this->reports_data();
385 385
 
386 386
 		$this->total = $this->get_donor_count();
387 387
 
388
-		$this->set_pagination_args( array(
388
+		$this->set_pagination_args(array(
389 389
 			'total_items' => $this->total,
390 390
 			'per_page'    => $this->per_page,
391
-			'total_pages' => ceil( $this->total / $this->per_page ),
392
-		) );
391
+			'total_pages' => ceil($this->total / $this->per_page),
392
+		));
393 393
 	}
394 394
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-donors.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * Return the calculated completion percentage.
217 217
 	 *
218 218
 	 * @since 1.8.12
219
-	 * @return int
219
+	 * @return double
220 220
 	 */
221 221
 	public function get_percentage_complete() {
222 222
 		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
@@ -353,6 +353,9 @@  discard block
 block discarded – undo
353 353
 		return true;
354 354
 	}
355 355
 
356
+	/**
357
+	 * @param integer $page
358
+	 */
356 359
 	public function get_delete_ids( $donation_ids, $page ) {
357 360
 		$index            = $page --;
358 361
 		$count            = count( $donation_ids );
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 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
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * Constructor.
100 100
 	 */
101
-	public function __construct( $_step = 1 ) {
102
-		parent::__construct( $_step );
101
+	public function __construct($_step = 1) {
102
+		parent::__construct($_step);
103 103
 
104 104
 		$this->is_writable = true;
105 105
 	}
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 		$donor_ids    = array();
119 119
 
120 120
 		// Check if the ajax request if running for the first time.
121
-		if ( 1 === (int) $this->step ) {
121
+		if (1 === (int) $this->step) {
122 122
 			// Delete all the donation ids.
123
-			$this->delete_option( $this->donation_key );
123
+			$this->delete_option($this->donation_key);
124 124
 			// Delete all the donor ids.
125
-			$this->delete_option( $this->donor_key );
125
+			$this->delete_option($this->donor_key);
126 126
 
127 127
 			// Delete all the step and set to 'count' which if the first step in the process of deleting the donors.
128
-			$this->update_option( $this->step_key, 'count' );
128
+			$this->update_option($this->step_key, 'count');
129 129
 
130 130
 			// Delete tha page count of the step.
131
-			$this->update_option( $this->step_on_key, '0' );
131
+			$this->update_option($this->step_on_key, '0');
132 132
 		} else {
133 133
 			// Get the old donors list.
134
-			$donor_ids = $this->get_option( $this->donor_key );
134
+			$donor_ids = $this->get_option($this->donor_key);
135 135
 
136 136
 			// Get the old donation list.
137
-			$donation_ids = $this->get_option( $this->donation_key );
137
+			$donation_ids = $this->get_option($this->donation_key);
138 138
 		}
139 139
 
140 140
 		// Get the step and check for it if it's on the first step( 'count' ) or not.
141 141
 		$step = (int) $this->get_step();
142
-		if ( 1 === $step ) {
142
+		if (1 === $step) {
143 143
 			/**
144 144
 			 * Will add or update the donation and donor data by running wp query.
145 145
 			 */
146
-			$this->count( $step, $donation_ids, $donor_ids );
146
+			$this->count($step, $donation_ids, $donor_ids);
147 147
 		}
148 148
 	}
149 149
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 * @param array $donation_ids Contain the list of all the donation id's that has being add before this
155 155
 	 * @param array $donor_ids Contain the list of all the donors id's that has being add before this
156 156
 	 */
157
-	private function count( $step, $donation_ids = array(), $donor_ids = array() ) {
157
+	private function count($step, $donation_ids = array(), $donor_ids = array()) {
158 158
 
159 159
 		// Get the Page count by default it's zero.
160 160
 		$paged = (int) $this->get_step_page();
161 161
 		// Incresed the page count by one.
162
-		++ $paged;
162
+		++$paged;
163 163
 
164 164
 		/**
165 165
 		 * Filter add to alter the argument before the wp quest run
166 166
 		 */
167
-		$args = apply_filters( 'give_tools_reset_stats_total_args', array(
167
+		$args = apply_filters('give_tools_reset_stats_total_args', array(
168 168
 			'post_type'      => 'give_payment',
169 169
 			'post_status'    => 'any',
170 170
 			'posts_per_page' => $this->per_step,
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 			// ONLY TEST MODE TRANSACTIONS!!!
173 173
 			'meta_key'       => '_give_payment_mode',
174 174
 			'meta_value'     => 'test',
175
-		) );
175
+		));
176 176
 
177 177
 		// Reset the post data.
178 178
 		wp_reset_postdata();
179 179
 		// Getting the new donation.
180
-		$donation_posts = new WP_Query( $args );
180
+		$donation_posts = new WP_Query($args);
181 181
 
182 182
 		// The Loop.
183
-		if ( $donation_posts->have_posts() ) {
184
-			while ( $donation_posts->have_posts() ) {
183
+		if ($donation_posts->have_posts()) {
184
+			while ($donation_posts->have_posts()) {
185 185
 				$donation_posts->the_post();
186 186
 				global $post;
187 187
 				// Add the donation id in side the array.
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 		$max_num_pages = (int) $donation_posts->max_num_pages;
201 201
 
202 202
 		// Check current page is less then max number of page or not
203
-		if ( $paged < $max_num_pages ) {
203
+		if ($paged < $max_num_pages) {
204 204
 			// Update the curretn page virable for the next step
205
-			$this->update_option( $this->step_on_key, $paged );
205
+			$this->update_option($this->step_on_key, $paged);
206 206
 
207 207
 			// Calculating percentage.
208 208
 			$page_remain          = $max_num_pages - $paged;
209
-			$this->total_step     = (int) $max_num_pages + ( $total_donation / $this->per_step ) + ( ( $page_remain * 2 ) * count( $donor_ids ) );
209
+			$this->total_step     = (int) $max_num_pages + ($total_donation / $this->per_step) + (($page_remain * 2) * count($donor_ids));
210 210
 			$this->step_completed = $paged;
211 211
 		} else {
212
-			$donation_ids_count = count( $donor_ids );
213
-			$this->update_option( $this->step_key, 'donation' );
214
-			$this->update_option( $this->step_on_key, '0' );
212
+			$donation_ids_count = count($donor_ids);
213
+			$this->update_option($this->step_key, 'donation');
214
+			$this->update_option($this->step_on_key, '0');
215 215
 		}
216 216
 
217
-		$donor_ids = array_unique( $donor_ids );
218
-		$this->update_option( $this->donor_key, $donor_ids );
219
-		$this->update_option( $this->donation_key, $donation_ids );
217
+		$donor_ids = array_unique($donor_ids);
218
+		$this->update_option($this->donor_key, $donor_ids);
219
+		$this->update_option($this->donation_key, $donation_ids);
220 220
 
221 221
 		wp_reset_postdata();
222 222
 	}
@@ -228,33 +228,33 @@  discard block
 block discarded – undo
228 228
 	 * @return int
229 229
 	 */
230 230
 	public function get_percentage_complete() {
231
-		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
231
+		return ceil((100 * $this->step_completed) / $this->total_step);
232 232
 	}
233 233
 
234 234
 	public function process_step() {
235 235
 
236
-		if ( ! $this->can_export() ) {
236
+		if ( ! $this->can_export()) {
237 237
 			wp_die(
238
-				esc_html__( 'You do not have permission to delete test transactions.', 'give' ),
239
-				esc_html__( 'Error', 'give' ),
240
-				array( 'response' => 403 )
238
+				esc_html__('You do not have permission to delete test transactions.', 'give'),
239
+				esc_html__('Error', 'give'),
240
+				array('response' => 403)
241 241
 			);
242 242
 		}
243 243
 
244 244
 		$had_data = $this->get_data();
245 245
 
246
-		if ( $had_data ) {
246
+		if ($had_data) {
247 247
 			$this->done = false;
248 248
 
249 249
 			return true;
250 250
 		} else {
251
-			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
252
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
251
+			update_option('give_earnings_total', give_get_total_earnings(true));
252
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
253 253
 
254
-			$this->delete_option( $this->donation_key );
254
+			$this->delete_option($this->donation_key);
255 255
 
256 256
 			$this->done    = true;
257
-			$this->message = __( 'Test donor and transactions successfully deleted.', 'give' );
257
+			$this->message = __('Test donor and transactions successfully deleted.', 'give');
258 258
 
259 259
 			return false;
260 260
 		}
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 	public function get_data() {
273 273
 
274 274
 		// Get the donation id's.
275
-		$donation_ids = $this->get_option( $this->donation_key );
275
+		$donation_ids = $this->get_option($this->donation_key);
276 276
 
277 277
 		/**
278 278
 		 * Return false id not test donation is found.
279 279
 		 */
280
-		if ( empty( $donation_ids ) ) {
280
+		if (empty($donation_ids)) {
281 281
 			$this->is_empty   = true;
282 282
 			$this->total_step = 1;
283 283
 
@@ -288,68 +288,68 @@  discard block
 block discarded – undo
288 288
 		$step = (int) $this->get_step();
289 289
 
290 290
 		// get teh donor ids.
291
-		$donor_ids = $this->get_option( $this->donor_key );
291
+		$donor_ids = $this->get_option($this->donor_key);
292 292
 
293 293
 		// In step to we delete all the donation in loop.
294
-		if ( 2 === $step ) {
294
+		if (2 === $step) {
295 295
 			$pass_to_donor = false;
296 296
 			$page          = (int) $this->get_step_page();
297
-			$page ++;
298
-			$count = count( $donation_ids );
297
+			$page++;
298
+			$count = count($donation_ids);
299 299
 
300
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
300
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
301 301
 			$this->step_completed = $page;
302 302
 
303
-			if ( $count > $this->per_step ) {
303
+			if ($count > $this->per_step) {
304 304
 
305
-				$this->update_option( $this->step_on_key, $page );
306
-				$donation_ids = $this->get_delete_ids( $donation_ids, $page );
307
-				$current_page = (int) ceil( $count / $this->per_step );
305
+				$this->update_option($this->step_on_key, $page);
306
+				$donation_ids = $this->get_delete_ids($donation_ids, $page);
307
+				$current_page = (int) ceil($count / $this->per_step);
308 308
 
309
-				if ( $page === $current_page ) {
309
+				if ($page === $current_page) {
310 310
 					$pass_to_donor = true;
311 311
 				}
312 312
 			} else {
313 313
 				$pass_to_donor = true;
314 314
 			}
315 315
 
316
-			if ( true === $pass_to_donor ) {
317
-				$this->update_option( $this->step_key, 'donor' );
318
-				$this->update_option( $this->step_on_key, '0' );
316
+			if (true === $pass_to_donor) {
317
+				$this->update_option($this->step_key, 'donor');
318
+				$this->update_option($this->step_on_key, '0');
319 319
 			}
320 320
 
321
-			foreach ( $donation_ids as $item ) {
321
+			foreach ($donation_ids as $item) {
322 322
 				// Delete the main payment.
323
-				give_delete_donation( absint( $item ) );
323
+				give_delete_donation(absint($item));
324 324
 			}
325
-			do_action( 'give_delete_log_cache' );
325
+			do_action('give_delete_log_cache');
326 326
 		}
327 327
 
328 328
 		// Here we delete all the donor
329
-		if ( 3 === $step ) {
329
+		if (3 === $step) {
330 330
 			$page  = (int) $this->get_step_page();
331
-			$count = count( $donor_ids );
331
+			$count = count($donor_ids);
332 332
 
333
-			$this->total_step     = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
334
-			$this->step_completed = $page + ( count( $donation_ids ) / $this->per_step );
333
+			$this->total_step     = ((count($donation_ids) / $this->per_step) * 2) + count($donor_ids);
334
+			$this->step_completed = $page + (count($donation_ids) / $this->per_step);
335 335
 
336
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
336
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
337 337
 				'post_type'      => 'give_payment',
338 338
 				'post_status'    => 'any',
339 339
 				'posts_per_page' => 1,
340 340
 				'meta_key'       => '_give_payment_mode',
341 341
 				'meta_value'     => 'live',
342
-				'author'         => $donor_ids[ $page ],
343
-			) );
342
+				'author'         => $donor_ids[$page],
343
+			));
344 344
 
345
-			$donation_posts = get_posts( $args );
346
-			if ( empty( $donation_posts ) ) {
347
-				Give()->donors->delete_by_user_id( $donor_ids[ $page ] );
345
+			$donation_posts = get_posts($args);
346
+			if (empty($donation_posts)) {
347
+				Give()->donors->delete_by_user_id($donor_ids[$page]);
348 348
 			}
349 349
 
350
-			$page ++;
351
-			$this->update_option( $this->step_on_key, $page );
352
-			if ( $count === $page ) {
350
+			$page++;
351
+			$this->update_option($this->step_on_key, $page);
352
+			if ($count === $page) {
353 353
 				$this->is_empty = false;
354 354
 
355 355
 				return false;
@@ -361,24 +361,24 @@  discard block
 block discarded – undo
361 361
 		return true;
362 362
 	}
363 363
 
364
-	public function get_delete_ids( $donation_ids, $page ) {
365
-		$index            = $page --;
366
-		$count            = count( $donation_ids );
364
+	public function get_delete_ids($donation_ids, $page) {
365
+		$index            = $page--;
366
+		$count            = count($donation_ids);
367 367
 		$temp             = 0;
368 368
 		$current_page     = 0;
369 369
 		$post_delete      = $this->per_step;
370 370
 		$page_donation_id = array();
371 371
 
372
-		foreach ( $donation_ids as $item ) {
373
-			$temp ++;
374
-			$page_donation_id[ $current_page ][] = $item;
375
-			if ( $temp === $post_delete ) {
376
-				$current_page ++;
372
+		foreach ($donation_ids as $item) {
373
+			$temp++;
374
+			$page_donation_id[$current_page][] = $item;
375
+			if ($temp === $post_delete) {
376
+				$current_page++;
377 377
 				$temp = 0;
378 378
 			}
379 379
 		}
380 380
 
381
-		return $page_donation_id[ $page ];
381
+		return $page_donation_id[$page];
382 382
 	}
383 383
 
384 384
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @return mixed       Returns the data from the database
392 392
 	 */
393
-	public function get_option( $key, $defalut_value = false ) {
394
-		return get_option( $key, $defalut_value );
393
+	public function get_option($key, $defalut_value = false) {
394
+		return get_option($key, $defalut_value);
395 395
 	}
396 396
 
397 397
 	/**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	 *
405 405
 	 * @return void
406 406
 	 */
407
-	public function update_option( $key, $value ) {
408
-		update_option( $key, $value, false );
407
+	public function update_option($key, $value) {
408
+		update_option($key, $value, false);
409 409
 	}
410 410
 
411 411
 	/**
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * @return void
419 419
 	 */
420
-	public function delete_option( $key ) {
421
-		delete_option( $key );
420
+	public function delete_option($key) {
421
+		delete_option($key);
422 422
 	}
423 423
 
424 424
 	/**
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return int|string
430 430
 	 */
431 431
 	private function get_step() {
432
-		$step_key = (string) $this->get_option( $this->step_key, false );
433
-		if ( 'count' === $step_key ) {
432
+		$step_key = (string) $this->get_option($this->step_key, false);
433
+		if ('count' === $step_key) {
434 434
 			return 1;
435
-		} elseif ( 'donation' === $step_key ) {
435
+		} elseif ('donation' === $step_key) {
436 436
 			return 2;
437
-		} elseif ( 'donor' === $step_key ) {
437
+		} elseif ('donor' === $step_key) {
438 438
 			return 3;
439 439
 		} else {
440 440
 			return $step_key;
@@ -445,6 +445,6 @@  discard block
 block discarded – undo
445 445
 	 * Get the current $page value in the ajax.
446 446
 	 */
447 447
 	private function get_step_page() {
448
-		return $this->get_option( $this->step_on_key, false );
448
+		return $this->get_option($this->step_on_key, false);
449 449
 	}
450 450
 }
Please login to merge, or discard this patch.
includes/formatting.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@
 block discarded – undo
340 340
  * @since 1.0
341 341
  *
342 342
  * @param int|float|string $amount   Formatted or sanitized price
343
- * @param int|bool         $dp       number of decimals
343
+ * @param boolean         $dp       number of decimals
344 344
  * @param bool             $sanitize Whether or not sanitize number
345 345
  *
346 346
  * @return string $amount Newly formatted amount or Price Not Available
Please login to merge, or discard this patch.
Spacing   +183 added lines, -187 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,37 +23,37 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return mixed
25 25
  */
26
-function give_get_currency_formatting_settings( $id_or_currency_code = null ) {
26
+function give_get_currency_formatting_settings($id_or_currency_code = null) {
27 27
 	$give_options = give_get_settings();
28 28
 	$setting      = array();
29 29
 
30
-	if ( ! empty( $id_or_currency_code ) ) {
31
-		$currencies = give_get_currencies( 'all' );
30
+	if ( ! empty($id_or_currency_code)) {
31
+		$currencies = give_get_currencies('all');
32 32
 
33 33
 		// Set default formatting setting only if currency not set as global currency.
34 34
 		if (
35
-			is_string( $id_or_currency_code ) &&
36
-			! empty( $give_options['currency'] ) &&
35
+			is_string($id_or_currency_code) &&
36
+			! empty($give_options['currency']) &&
37 37
 			$id_or_currency_code !== $give_options['currency'] &&
38
-			array_key_exists( $id_or_currency_code, $currencies )
38
+			array_key_exists($id_or_currency_code, $currencies)
39 39
 		) {
40
-			$setting = $currencies[ $id_or_currency_code ]['setting'];
41
-		} elseif ( is_numeric( $id_or_currency_code ) && 'give_payment' === get_post_type( $id_or_currency_code ) ) {
42
-			$currency = give_get_meta( $id_or_currency_code, '_give_payment_currency', true );
40
+			$setting = $currencies[$id_or_currency_code]['setting'];
41
+		} elseif (is_numeric($id_or_currency_code) && 'give_payment' === get_post_type($id_or_currency_code)) {
42
+			$currency = give_get_meta($id_or_currency_code, '_give_payment_currency', true);
43 43
 
44 44
 			if (
45
-				! empty( $currency) &&
45
+				! empty($currency) &&
46 46
 				$give_options['currency'] !== $currency
47 47
 			) {
48
-				$setting = $currencies[ $currency ]['setting'];
48
+				$setting = $currencies[$currency]['setting'];
49 49
 			}
50 50
 		}
51 51
 	}
52 52
 
53
-	if ( empty( $setting ) ) {
53
+	if (empty($setting)) {
54 54
 		// Set thousand separator.
55
-		$thousand_separator = isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',';
56
-		$thousand_separator = empty( $thousand_separator ) ? ' ' : $thousand_separator;
55
+		$thousand_separator = isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',';
56
+		$thousand_separator = empty($thousand_separator) ? ' ' : $thousand_separator;
57 57
 
58 58
 		// Set decimal separator.
59 59
 		$default_decimal_separators = array(
@@ -61,17 +61,16 @@  discard block
 block discarded – undo
61 61
 			',' => '.',
62 62
 		);
63 63
 
64
-		$default_decimal_separator = in_array( $thousand_separator, $default_decimal_separators ) ?
65
-			$default_decimal_separators[ $thousand_separator ] :
66
-			'.';
64
+		$default_decimal_separator = in_array($thousand_separator, $default_decimal_separators) ?
65
+			$default_decimal_separators[$thousand_separator] : '.';
67 66
 
68
-		$decimal_separator = ! empty( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : $default_decimal_separator;
67
+		$decimal_separator = ! empty($give_options['decimal_separator']) ? $give_options['decimal_separator'] : $default_decimal_separator;
69 68
 
70 69
 		$setting = array(
71
-			'currency_position'   => give_get_option( 'currency_position', 'before' ),
70
+			'currency_position'   => give_get_option('currency_position', 'before'),
72 71
 			'thousands_separator' => $thousand_separator,
73 72
 			'decimal_separator'   => $decimal_separator,
74
-			'number_decimals'     => give_get_option( 'number_decimals', 0 ),
73
+			'number_decimals'     => give_get_option('number_decimals', 0),
75 74
 		);
76 75
 	}
77 76
 
@@ -80,7 +79,7 @@  discard block
 block discarded – undo
80 79
 	 *
81 80
 	 * @since 1.8.15
82 81
 	 */
83
-	return apply_filters( 'give_get_currency_formatting_settings', $setting, $id_or_currency_code );
82
+	return apply_filters('give_get_currency_formatting_settings', $setting, $id_or_currency_code);
84 83
 }
85 84
 
86 85
 /**
@@ -92,16 +91,16 @@  discard block
 block discarded – undo
92 91
  *
93 92
  * @return mixed
94 93
  */
95
-function give_get_price_decimals( $id_or_currency_code = null ) {
94
+function give_get_price_decimals($id_or_currency_code = null) {
96 95
 	// Set currency on basis of donation id.
97
-	if ( empty( $id_or_currency_code ) ) {
96
+	if (empty($id_or_currency_code)) {
98 97
 		$id_or_currency_code = give_get_currency();
99 98
 	}
100 99
 
101 100
 	$number_of_decimals = 0;
102 101
 
103
-	if ( ! give_is_zero_based_currency( $id_or_currency_code ) ) {
104
-		$setting            = give_get_currency_formatting_settings( $id_or_currency_code );
102
+	if ( ! give_is_zero_based_currency($id_or_currency_code)) {
103
+		$setting            = give_get_currency_formatting_settings($id_or_currency_code);
105 104
 		$number_of_decimals = $setting['number_decimals'];
106 105
 	}
107 106
 
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 	 *
111 110
 	 * @since 1.6
112 111
 	 */
113
-	return apply_filters( 'give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code );
112
+	return apply_filters('give_sanitize_amount_decimals', $number_of_decimals, $id_or_currency_code);
114 113
 }
115 114
 
116 115
 /**
@@ -122,15 +121,15 @@  discard block
 block discarded – undo
122 121
  *
123 122
  * @return mixed
124 123
  */
125
-function give_get_price_thousand_separator( $id_or_currency_code = null ) {
126
-	$setting = give_get_currency_formatting_settings( $id_or_currency_code );
124
+function give_get_price_thousand_separator($id_or_currency_code = null) {
125
+	$setting = give_get_currency_formatting_settings($id_or_currency_code);
127 126
 
128 127
 	/**
129 128
 	 * Filter the thousand separator
130 129
 	 *
131 130
 	 * @since 1.6
132 131
 	 */
133
-	return apply_filters( 'give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code );
132
+	return apply_filters('give_get_price_thousand_separator', $setting['thousands_separator'], $id_or_currency_code);
134 133
 }
135 134
 
136 135
 /**
@@ -142,15 +141,15 @@  discard block
 block discarded – undo
142 141
  *
143 142
  * @return mixed
144 143
  */
145
-function give_get_price_decimal_separator( $id_or_currency_code = null ) {
146
-	$setting = give_get_currency_formatting_settings( $id_or_currency_code );
144
+function give_get_price_decimal_separator($id_or_currency_code = null) {
145
+	$setting = give_get_currency_formatting_settings($id_or_currency_code);
147 146
 
148 147
 	/**
149 148
 	 * Filter the thousand separator
150 149
 	 *
151 150
 	 * @since 1.6
152 151
 	 */
153
-	return apply_filters( 'give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code );
152
+	return apply_filters('give_get_price_decimal_separator', $setting['decimal_separator'], $id_or_currency_code);
154 153
 }
155 154
 
156 155
 
@@ -163,8 +162,8 @@  discard block
 block discarded – undo
163 162
  *
164 163
  * @return string $amount Newly sanitized amount
165 164
  */
166
-function give_sanitize_amount_for_db( $number ) {
167
-	return give_maybe_sanitize_amount( $number, array( 'number_decimals' => 6 ) );
165
+function give_sanitize_amount_for_db($number) {
166
+	return give_maybe_sanitize_amount($number, array('number_decimals' => 6));
168 167
 }
169 168
 
170 169
 /**
@@ -177,19 +176,19 @@  discard block
 block discarded – undo
177 176
  *
178 177
  * @return string $amount Newly sanitized amount
179 178
  */
180
-function give_maybe_sanitize_amount( $number, $args = array() ) {
179
+function give_maybe_sanitize_amount($number, $args = array()) {
181 180
 	// Bailout.
182
-	if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) {
181
+	if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) {
183 182
 		return $number;
184 183
 	}
185 184
 
186 185
 	$func_args = func_get_args();
187 186
 
188 187
 	// Backward compatibility.
189
-	if ( isset( $func_args[1] ) && ( is_bool( $func_args[1] ) || is_numeric( $func_args[1] ) ) ) {
188
+	if (isset($func_args[1]) && (is_bool($func_args[1]) || is_numeric($func_args[1]))) {
190 189
 		$args = array(
191 190
 			'number_decimals' => $func_args[1],
192
-			'trim_zeros'      => isset( $func_args[2] ) ? $func_args[2] : false,
191
+			'trim_zeros'      => isset($func_args[2]) ? $func_args[2] : false,
193 192
 		);
194 193
 	}
195 194
 
@@ -202,23 +201,22 @@  discard block
 block discarded – undo
202 201
 		)
203 202
 	);
204 203
 
205
-	$thousand_separator = give_get_price_thousand_separator( $args['currency'] );
206
-	$decimal_separator  = give_get_price_decimal_separator( $args['currency'] );
207
-	$number_decimals    = is_bool( $args['number_decimals'] ) ?
208
-		give_get_price_decimals() :
209
-		$args['number_decimals'];
204
+	$thousand_separator = give_get_price_thousand_separator($args['currency']);
205
+	$decimal_separator  = give_get_price_decimal_separator($args['currency']);
206
+	$number_decimals    = is_bool($args['number_decimals']) ?
207
+		give_get_price_decimals() : $args['number_decimals'];
210 208
 
211 209
 	// Explode number by . decimal separator.
212
-	$number_parts = explode( '.', $number );
210
+	$number_parts = explode('.', $number);
213 211
 
214 212
 	// Remove currency symbols from number if any.
215
-	$number = trim( str_replace( give_currency_symbols( true ), '', $number ) );
213
+	$number = trim(str_replace(give_currency_symbols(true), '', $number));
216 214
 
217 215
 	if (
218 216
 		// Non formatted number.
219 217
 		(
220
-			( false === strpos( $number, $thousand_separator ) ) &&
221
-			( false === strpos( $number, $decimal_separator ) )
218
+			(false === strpos($number, $thousand_separator)) &&
219
+			(false === strpos($number, $decimal_separator))
222 220
 		) ||
223 221
 
224 222
 		// Decimal formatted number.
@@ -228,35 +226,35 @@  discard block
 block discarded – undo
228 226
 		(
229 227
 			$number_decimals &&
230 228
 			'.' === $thousand_separator &&
231
-			false !== strpos( $number, $thousand_separator ) &&
232
-			false === strpos( $number, $decimal_separator ) &&
233
-			2 === count( $number_parts ) &&
234
-			( $number_decimals >= strlen( $number_parts[1] ) )
229
+			false !== strpos($number, $thousand_separator) &&
230
+			false === strpos($number, $decimal_separator) &&
231
+			2 === count($number_parts) &&
232
+			($number_decimals >= strlen($number_parts[1]))
235 233
 		)
236 234
 	) {
237
-		return number_format( $number, $number_decimals, '.', '' );
235
+		return number_format($number, $number_decimals, '.', '');
238 236
 	}
239 237
 
240 238
 	// Handle thousand separator as '.'
241 239
 	// Handle sanitize database values.
242
-	$is_db_sanitize_val = ( 2 === count( $number_parts ) &&
243
-							is_numeric( $number_parts[0] ) &&
244
-							is_numeric( $number_parts[1] ) &&
245
-							( 6 === strlen( $number_parts[1] ) ) );
240
+	$is_db_sanitize_val = (2 === count($number_parts) &&
241
+							is_numeric($number_parts[0]) &&
242
+							is_numeric($number_parts[1]) &&
243
+							(6 === strlen($number_parts[1])));
246 244
 
247
-	if ( $is_db_sanitize_val ) {
245
+	if ($is_db_sanitize_val) {
248 246
 		// Sanitize database value.
249
-		return number_format( $number, $number_decimals, '.', '' );
247
+		return number_format($number, $number_decimals, '.', '');
250 248
 
251 249
 	} elseif (
252 250
 		'.' === $thousand_separator &&
253
-		false !== strpos( $number, $thousand_separator )
251
+		false !== strpos($number, $thousand_separator)
254 252
 	) {
255 253
 		// Fix point thousand separator value.
256
-		$number = str_replace( '.', '', $number );
254
+		$number = str_replace('.', '', $number);
257 255
 	}
258 256
 
259
-	return give_sanitize_amount( $number, $args );
257
+	return give_sanitize_amount($number, $args);
260 258
 }
261 259
 
262 260
 /**
@@ -273,10 +271,10 @@  discard block
 block discarded – undo
273 271
  *
274 272
  * @return string $amount Newly sanitized amount
275 273
  */
276
-function give_sanitize_amount( $number, $args = array() ) {
274
+function give_sanitize_amount($number, $args = array()) {
277 275
 
278 276
 	// Bailout.
279
-	if ( empty( $number ) || ( ! is_numeric( $number ) && ! is_string( $number ) ) ) {
277
+	if (empty($number) || ( ! is_numeric($number) && ! is_string($number))) {
280 278
 		return $number;
281 279
 	}
282 280
 
@@ -284,10 +282,10 @@  discard block
 block discarded – undo
284 282
 	$func_args = func_get_args();
285 283
 
286 284
 	// Backward compatibility.
287
-	if ( isset( $func_args[1] ) && ( is_bool( $func_args[1] ) || is_numeric( $func_args[1] ) ) ) {
285
+	if (isset($func_args[1]) && (is_bool($func_args[1]) || is_numeric($func_args[1]))) {
288 286
 		$args = array(
289 287
 			'number_decimals' => $func_args[1],
290
-			'trim_zeros'      => isset( $func_args[2] ) ? $func_args[2] : false,
288
+			'trim_zeros'      => isset($func_args[2]) ? $func_args[2] : false,
291 289
 		);
292 290
 	}
293 291
 
@@ -303,58 +301,58 @@  discard block
 block discarded – undo
303 301
 	// Remove slash from amount.
304 302
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
305 303
 	// To prevent notices and warning remove slash from amount/number.
306
-	$number = wp_unslash( $number );
304
+	$number = wp_unslash($number);
307 305
 
308
-	$thousand_separator = give_get_price_thousand_separator( $args['currency'] );
306
+	$thousand_separator = give_get_price_thousand_separator($args['currency']);
309 307
 
310 308
 	$locale   = localeconv();
311 309
 	$decimals = array(
312
-		give_get_price_decimal_separator( $args['currency'] ),
310
+		give_get_price_decimal_separator($args['currency']),
313 311
 		$locale['decimal_point'],
314 312
 		$locale['mon_decimal_point'],
315 313
 	);
316 314
 
317 315
 	// Remove locale from string
318
-	if ( ! is_float( $number ) ) {
319
-		$number = str_replace( $decimals, '.', $number );
316
+	if ( ! is_float($number)) {
317
+		$number = str_replace($decimals, '.', $number);
320 318
 	}
321 319
 
322 320
 	// Remove thousand amount formatting if amount has.
323 321
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
324 322
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
325
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
326
-		$number = str_replace( $thousand_separator, '', $number );
327
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
328
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
323
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
324
+		$number = str_replace($thousand_separator, '', $number);
325
+	} elseif (in_array($thousand_separator, $decimals)) {
326
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
329 327
 	}
330 328
 
331 329
 	// Remove non numeric entity before decimal separator.
332
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
333
-	$default_dp = give_get_price_decimals( $args['currency'] );
330
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
331
+	$default_dp = give_get_price_decimals($args['currency']);
334 332
 
335 333
 	// Reset negative amount to zero.
336
-	if ( 0 > $number ) {
337
-		$number = number_format( 0, $default_dp, '.' );
334
+	if (0 > $number) {
335
+		$number = number_format(0, $default_dp, '.');
338 336
 	}
339 337
 
340 338
 	// If number does not have decimal then add number of decimals to it.
341 339
 	if (
342
-		false === strpos( $number, '.' )
343
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
340
+		false === strpos($number, '.')
341
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
344 342
 	) {
345
-		$number = number_format( $number, $default_dp, '.', '' );
343
+		$number = number_format($number, $default_dp, '.', '');
346 344
 	}
347 345
 
348 346
 	// Format number by custom number of decimals.
349
-	if ( false !== $args['number_decimals'] ) {
350
-		$dp     = intval( is_bool( $args['number_decimals'] ) ? $default_dp : $args['number_decimals'] );
351
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
352
-		$number = number_format( floatval( $number ), $dp, '.', '' );
347
+	if (false !== $args['number_decimals']) {
348
+		$dp     = intval(is_bool($args['number_decimals']) ? $default_dp : $args['number_decimals']);
349
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
350
+		$number = number_format(floatval($number), $dp, '.', '');
353 351
 	}
354 352
 
355 353
 	// Trim zeros.
356
-	if ( $args['trim_zeros'] && strstr( $number, '.' ) ) {
357
-		$number = rtrim( rtrim( $number, '0' ), '.' );
354
+	if ($args['trim_zeros'] && strstr($number, '.')) {
355
+		$number = rtrim(rtrim($number, '0'), '.');
358 356
 	}
359 357
 
360 358
 	/**
@@ -362,7 +360,7 @@  discard block
 block discarded – undo
362 360
 	 *
363 361
 	 * @since 1.0
364 362
 	 */
365
-	return apply_filters( 'give_sanitize_amount', $number );
363
+	return apply_filters('give_sanitize_amount', $number);
366 364
 }
367 365
 
368 366
 /**
@@ -375,9 +373,9 @@  discard block
 block discarded – undo
375 373
  *
376 374
  * @return string $amount   Newly formatted amount or Price Not Available
377 375
  */
378
-function give_format_amount( $amount, $args = array() ) {
376
+function give_format_amount($amount, $args = array()) {
379 377
 	// Backward compatibility.
380
-	if ( is_bool( $args ) ) {
378
+	if (is_bool($args)) {
381 379
 		$args = array(
382 380
 			'decimal' => $args,
383 381
 		);
@@ -390,60 +388,59 @@  discard block
 block discarded – undo
390 388
 		'currency'    => '',
391 389
 	);
392 390
 
393
-	$args = wp_parse_args( $args, $default_args );
391
+	$args = wp_parse_args($args, $default_args);
394 392
 
395 393
 	// Set Currency based on donation id, if required.
396
-	if ( $args['donation_id'] && empty( $args['currency'] ) ) {
397
-		$args['currency'] = give_get_meta( $args['donation_id'], '_give_payment_currency', true );
394
+	if ($args['donation_id'] && empty($args['currency'])) {
395
+		$args['currency'] = give_get_meta($args['donation_id'], '_give_payment_currency', true);
398 396
 	}
399 397
 
400 398
 	$formatted     = 0;
401
-	$currency      = ! empty( $args['currency'] ) ? $args['currency'] : give_get_currency( $args['donation_id'] );
402
-	$thousands_sep = give_get_price_thousand_separator( $currency );
403
-	$decimal_sep   = give_get_price_decimal_separator( $currency );
404
-	$decimals      = ! empty( $args['decimal'] ) ? give_get_price_decimals( $currency ) : 0;
399
+	$currency      = ! empty($args['currency']) ? $args['currency'] : give_get_currency($args['donation_id']);
400
+	$thousands_sep = give_get_price_thousand_separator($currency);
401
+	$decimal_sep   = give_get_price_decimal_separator($currency);
402
+	$decimals      = ! empty($args['decimal']) ? give_get_price_decimals($currency) : 0;
405 403
 
406
-	if ( ! empty( $amount ) ) {
404
+	if ( ! empty($amount)) {
407 405
 		// Sanitize amount before formatting.
408
-		$amount = ! empty( $args['sanitize'] ) ?
409
-			give_maybe_sanitize_amount( $amount, array( 'number_decimals' => $decimals, 'currency' => $currency ) ) :
410
-			number_format( $amount, $decimals, '.', '' );
406
+		$amount = ! empty($args['sanitize']) ?
407
+			give_maybe_sanitize_amount($amount, array('number_decimals' => $decimals, 'currency' => $currency)) : number_format($amount, $decimals, '.', '');
411 408
 
412
-		switch ( $currency ) {
409
+		switch ($currency) {
413 410
 			case 'INR':
414 411
 				$decimal_amount = '';
415 412
 
416 413
 				// Extract decimals from amount
417
-				if ( ( $pos = strpos( $amount, '.' ) ) !== false ) {
418
-					if ( ! empty( $decimals ) ) {
419
-						$decimal_amount = substr( round( substr( $amount, $pos ), $decimals ), 1 );
420
-						$amount         = substr( $amount, 0, $pos );
421
-
422
-						if ( ! $decimal_amount ) {
423
-							$decimal_amount = substr( "{$decimal_sep}0000000000", 0, ( $decimals + 1 ) );
424
-						} elseif ( ( $decimals + 1 ) > strlen( $decimal_amount ) ) {
425
-							$decimal_amount = substr( "{$decimal_amount}000000000", 0, ( $decimals + 1 ) );
414
+				if (($pos = strpos($amount, '.')) !== false) {
415
+					if ( ! empty($decimals)) {
416
+						$decimal_amount = substr(round(substr($amount, $pos), $decimals), 1);
417
+						$amount         = substr($amount, 0, $pos);
418
+
419
+						if ( ! $decimal_amount) {
420
+							$decimal_amount = substr("{$decimal_sep}0000000000", 0, ($decimals + 1));
421
+						} elseif (($decimals + 1) > strlen($decimal_amount)) {
422
+							$decimal_amount = substr("{$decimal_amount}000000000", 0, ($decimals + 1));
426 423
 						}
427 424
 					} else {
428
-						$amount = number_format( $amount, $decimals, $decimal_sep, '' );
425
+						$amount = number_format($amount, $decimals, $decimal_sep, '');
429 426
 					}
430 427
 				}
431 428
 
432 429
 				// Extract last 3 from amount
433
-				$result = substr( $amount, - 3 );
434
-				$amount = substr( $amount, 0, - 3 );
430
+				$result = substr($amount, - 3);
431
+				$amount = substr($amount, 0, - 3);
435 432
 
436 433
 				// Apply digits 2 by 2
437
-				while ( strlen( $amount ) > 0 ) {
438
-					$result = substr( $amount, - 2 ) . $thousands_sep . $result;
439
-					$amount = substr( $amount, 0, - 2 );
434
+				while (strlen($amount) > 0) {
435
+					$result = substr($amount, - 2).$thousands_sep.$result;
436
+					$amount = substr($amount, 0, - 2);
440 437
 				}
441 438
 
442
-				$formatted = $result . $decimal_amount;
439
+				$formatted = $result.$decimal_amount;
443 440
 				break;
444 441
 
445 442
 			default:
446
-				$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
443
+				$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
447 444
 		}
448 445
 	}
449 446
 
@@ -452,7 +449,7 @@  discard block
 block discarded – undo
452 449
 	 *
453 450
 	 * @since 1.0
454 451
 	 */
455
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args );
452
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $currency, $args);
456 453
 }
457 454
 
458 455
 
@@ -470,17 +467,17 @@  discard block
 block discarded – undo
470 467
  *
471 468
  * @return string  formatted amount number with large number names.
472 469
  */
473
-function give_human_format_large_amount( $amount, $args = array() ) {
470
+function give_human_format_large_amount($amount, $args = array()) {
474 471
 	// Sanitize amount.
475
-	$sanitize_amount = give_maybe_sanitize_amount( $amount );
472
+	$sanitize_amount = give_maybe_sanitize_amount($amount);
476 473
 
477 474
 	// Bailout.
478
-	if ( ! floatval( $sanitize_amount ) ) {
475
+	if ( ! floatval($sanitize_amount)) {
479 476
 		return '0';
480 477
 	};
481 478
 
482 479
 	// Set default currency;
483
-	if ( empty( $args['currency'] ) ) {
480
+	if (empty($args['currency'])) {
484 481
 		$args['currency'] = give_get_currency();
485 482
 	}
486 483
 
@@ -488,37 +485,37 @@  discard block
 block discarded – undo
488 485
 	$thousands_sep = give_get_price_thousand_separator();
489 486
 
490 487
 	// Explode amount to calculate name of large numbers.
491
-	$amount_array = explode( $thousands_sep, $amount );
488
+	$amount_array = explode($thousands_sep, $amount);
492 489
 
493 490
 	// Calculate amount parts count.
494
-	$amount_count_parts = count( $amount_array );
491
+	$amount_count_parts = count($amount_array);
495 492
 
496 493
 	// Human format amount (default).
497 494
 	$human_format_amount = $amount;
498 495
 
499
-	switch ( $args['currency'] ) {
496
+	switch ($args['currency']) {
500 497
 		case 'INR':
501 498
 			// Calculate large number formatted amount.
502
-			if ( 4 < $amount_count_parts ) {
503
-				$human_format_amount = sprintf( esc_html__( '%s arab', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
504
-			} elseif ( 3 < $amount_count_parts ) {
505
-				$human_format_amount = sprintf( esc_html__( '%s crore', 'give' ), round( ( $sanitize_amount / 10000000 ), 2 ) );
506
-			} elseif ( 2 < $amount_count_parts ) {
507
-				$human_format_amount = sprintf( esc_html__( '%s lakh', 'give' ), round( ( $sanitize_amount / 100000 ), 2 ) );
499
+			if (4 < $amount_count_parts) {
500
+				$human_format_amount = sprintf(esc_html__('%s arab', 'give'), round(($sanitize_amount / 1000000000), 2));
501
+			} elseif (3 < $amount_count_parts) {
502
+				$human_format_amount = sprintf(esc_html__('%s crore', 'give'), round(($sanitize_amount / 10000000), 2));
503
+			} elseif (2 < $amount_count_parts) {
504
+				$human_format_amount = sprintf(esc_html__('%s lakh', 'give'), round(($sanitize_amount / 100000), 2));
508 505
 			}
509 506
 			break;
510 507
 		default:
511 508
 			// Calculate large number formatted amount.
512
-			if ( 4 < $amount_count_parts ) {
513
-				$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
514
-			} elseif ( 3 < $amount_count_parts ) {
515
-				$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
516
-			} elseif ( 2 < $amount_count_parts ) {
517
-				$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
509
+			if (4 < $amount_count_parts) {
510
+				$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
511
+			} elseif (3 < $amount_count_parts) {
512
+				$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
513
+			} elseif (2 < $amount_count_parts) {
514
+				$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
518 515
 			}
519 516
 	}
520 517
 
521
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
518
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
522 519
 }
523 520
 
524 521
 /**
@@ -532,17 +529,16 @@  discard block
 block discarded – undo
532 529
  *
533 530
  * @return string $amount Newly formatted amount or Price Not Available
534 531
  */
535
-function give_format_decimal( $amount, $dp = false, $sanitize = true ) {
532
+function give_format_decimal($amount, $dp = false, $sanitize = true) {
536 533
 	$decimal_separator = give_get_price_decimal_separator();
537 534
 	$formatted_amount  = $sanitize ?
538
-		give_maybe_sanitize_amount( $amount, array( 'number_decimals' => $dp ) ) :
539
-		number_format( $amount, ( is_bool( $dp ) ? give_get_price_decimals() : $dp ), '.', '' );
535
+		give_maybe_sanitize_amount($amount, array('number_decimals' => $dp)) : number_format($amount, (is_bool($dp) ? give_get_price_decimals() : $dp), '.', '');
540 536
 
541
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
542
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
537
+	if (false !== strpos($formatted_amount, '.')) {
538
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
543 539
 	}
544 540
 
545
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
541
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
546 542
 }
547 543
 
548 544
 /**
@@ -554,7 +550,7 @@  discard block
 block discarded – undo
554 550
  *
555 551
  * @return string                  Date format string
556 552
  */
557
-function give_date_format( $date_context = '' ) {
553
+function give_date_format($date_context = '') {
558 554
 	/**
559 555
 	 * Filter the date context
560 556
 	 *
@@ -575,19 +571,19 @@  discard block
 block discarded – undo
575 571
 	 *
576 572
 	 *    }
577 573
 	 */
578
-	$date_format_contexts = apply_filters( 'give_date_format_contexts', array() );
574
+	$date_format_contexts = apply_filters('give_date_format_contexts', array());
579 575
 
580 576
 	// Set date format to default date format.
581
-	$date_format = get_option( 'date_format' );
577
+	$date_format = get_option('date_format');
582 578
 
583 579
 	// Update date format if we have non empty date format context array and non empty date format string for that context.
584
-	if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) {
585
-		$date_format = ! empty( $date_format_contexts[ $date_context ] )
586
-			? $date_format_contexts[ $date_context ]
580
+	if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) {
581
+		$date_format = ! empty($date_format_contexts[$date_context])
582
+			? $date_format_contexts[$date_context]
587 583
 			: $date_format;
588 584
 	}
589 585
 
590
-	return apply_filters( 'give_date_format', $date_format );
586
+	return apply_filters('give_date_format', $date_format);
591 587
 }
592 588
 
593 589
 /**
@@ -601,8 +597,8 @@  discard block
 block discarded – undo
601 597
  *
602 598
  * @return string
603 599
  */
604
-function give_get_cache_key( $action, $query_args ) {
605
-	return Give_Cache::get_key( $action, $query_args );
600
+function give_get_cache_key($action, $query_args) {
601
+	return Give_Cache::get_key($action, $query_args);
606 602
 }
607 603
 
608 604
 /**
@@ -615,11 +611,11 @@  discard block
 block discarded – undo
615 611
  *
616 612
  * @return string|array
617 613
  */
618
-function give_clean( $var ) {
619
-	if ( is_array( $var ) ) {
620
-		return array_map( 'give_clean', $var );
614
+function give_clean($var) {
615
+	if (is_array($var)) {
616
+		return array_map('give_clean', $var);
621 617
 	} else {
622
-		return is_scalar( $var ) ? sanitize_text_field( wp_unslash( $var ) ) : $var;
618
+		return is_scalar($var) ? sanitize_text_field(wp_unslash($var)) : $var;
623 619
 	}
624 620
 }
625 621
 
@@ -632,10 +628,10 @@  discard block
 block discarded – undo
632 628
  *
633 629
  * @return int
634 630
  */
635
-function give_let_to_num( $size ) {
636
-	$l   = substr( $size, - 1 );
637
-	$ret = substr( $size, 0, - 1 );
638
-	switch ( strtoupper( $l ) ) {
631
+function give_let_to_num($size) {
632
+	$l   = substr($size, - 1);
633
+	$ret = substr($size, 0, - 1);
634
+	switch (strtoupper($l)) {
639 635
 		case 'P':
640 636
 			$ret *= 1024;
641 637
 		case 'T':
@@ -662,22 +658,22 @@  discard block
 block discarded – undo
662 658
  *
663 659
  * @return bool
664 660
  */
665
-function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) {
661
+function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) {
666 662
 
667 663
 	// Verify nonce.
668
-	$verify_nonce = wp_verify_nonce( $nonce, $action );
664
+	$verify_nonce = wp_verify_nonce($nonce, $action);
669 665
 
670 666
 	// On ajax request send nonce verification status.
671
-	if ( wp_doing_ajax() ) {
667
+	if (wp_doing_ajax()) {
672 668
 		return $verify_nonce;
673 669
 	}
674 670
 
675
-	if ( ! $verify_nonce ) {
671
+	if ( ! $verify_nonce) {
676 672
 		$wp_die_args = wp_parse_args(
677 673
 			$wp_die_args,
678 674
 			array(
679
-				'message' => __( 'Nonce verification has failed.', 'give' ),
680
-				'title'   => __( 'Error', 'give' ),
675
+				'message' => __('Nonce verification has failed.', 'give'),
676
+				'title'   => __('Error', 'give'),
681 677
 				'args'    => array(
682 678
 					'response' => 403,
683 679
 				),
@@ -704,16 +700,16 @@  discard block
 block discarded – undo
704 700
  *
705 701
  * @return bool
706 702
  */
707
-function give_verify_donation_form_nonce( $nonce = '', $form_id ) {
703
+function give_verify_donation_form_nonce($nonce = '', $form_id) {
708 704
 
709 705
 	// Form nonce action.
710 706
 	$nonce_action = "give_donation_form_nonce_{$form_id}";
711 707
 
712 708
 	// Nonce validation.
713
-	$verify_nonce = give_validate_nonce( $nonce, $nonce_action );
709
+	$verify_nonce = give_validate_nonce($nonce, $nonce_action);
714 710
 
715
-	if ( ! $verify_nonce ) {
716
-		give_set_error( 'donation_form_nonce', __( 'Nonce verification has failed.', 'give' ) );
711
+	if ( ! $verify_nonce) {
712
+		give_set_error('donation_form_nonce', __('Nonce verification has failed.', 'give'));
717 713
 	}
718 714
 
719 715
 	return $verify_nonce;
@@ -733,43 +729,43 @@  discard block
 block discarded – undo
733 729
  *
734 730
  * @return mixed
735 731
  */
736
-function give_check_variable( $variable, $conditional = '', $default = false, $array_key_name = '' ) {
732
+function give_check_variable($variable, $conditional = '', $default = false, $array_key_name = '') {
737 733
 	// Get value from array if array key non empty.
738
-	if( empty( $array_key_name ) ) {
739
-		switch ( $conditional ) {
734
+	if (empty($array_key_name)) {
735
+		switch ($conditional) {
740 736
 			case 'isset_empty':
741
-				$variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default;
737
+				$variable = (isset($variable) && ! empty($variable)) ? $variable : $default;
742 738
 				break;
743 739
 
744 740
 			case 'empty':
745
-				$variable = ! empty( $variable ) ? $variable : $default;
741
+				$variable = ! empty($variable) ? $variable : $default;
746 742
 				break;
747 743
 
748 744
 			case 'null':
749
-				$variable = ! is_null( $variable ) ? $variable : $default;
745
+				$variable = ! is_null($variable) ? $variable : $default;
750 746
 				break;
751 747
 
752 748
 			default:
753
-				$variable = isset( $variable ) ? $variable : $default;
749
+				$variable = isset($variable) ? $variable : $default;
754 750
 		}
755 751
 	} else {
756
-		$isset = array_key_exists( $array_key_name, $variable );
752
+		$isset = array_key_exists($array_key_name, $variable);
757 753
 
758
-		switch ( $conditional ) {
754
+		switch ($conditional) {
759 755
 			case 'isset_empty':
760
-				$variable = ( $isset && ! empty( $variable[ $array_key_name ] ) ) ? $variable[ $array_key_name ] : $default;
756
+				$variable = ($isset && ! empty($variable[$array_key_name])) ? $variable[$array_key_name] : $default;
761 757
 				break;
762 758
 
763 759
 			case 'empty':
764
-				$variable = ! empty( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
760
+				$variable = ! empty($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
765 761
 				break;
766 762
 
767 763
 			case 'null':
768
-				$variable = $isset && ! is_null( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
764
+				$variable = $isset && ! is_null($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
769 765
 				break;
770 766
 
771 767
 			default:
772
-				$variable = $isset && isset( $variable[ $array_key_name ] ) ? $variable[ $array_key_name ] : $default;
768
+				$variable = $isset && isset($variable[$array_key_name]) ? $variable[$array_key_name] : $default;
773 769
 		}
774 770
 	}
775 771
 
Please login to merge, or discard this patch.
includes/admin/upgrades/views/plugins-update-section.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* @var Give_Updates $give_updates */
3
-$plugins = $give_updates->get_updates( 'plugin' );
4
-if ( empty( $plugins ) ) {
3
+$plugins = $give_updates->get_updates('plugin');
4
+if (empty($plugins)) {
5 5
 	return;
6 6
 }
7 7
 
8 8
 ob_start();
9
-foreach ( $plugins as $plugin_data ) {
10
-	if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) {
9
+foreach ($plugins as $plugin_data) {
10
+	if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
11 11
 		continue;
12 12
 	}
13 13
 
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	$author_name = $plugin_data['Author'];
16 16
 
17 17
 	// Link the plugin name to the plugin URL if available.
18
-	if ( ! empty( $plugin_data['PluginURI'] ) ) {
18
+	if ( ! empty($plugin_data['PluginURI'])) {
19 19
 		$plugin_name = sprintf(
20 20
 			'<a href="%s" title="%s">%s</a> (%s)',
21
-			esc_url( $plugin_data['PluginURI'] ),
22
-			esc_attr__( 'Visit plugin homepage', 'give' ),
21
+			esc_url($plugin_data['PluginURI']),
22
+			esc_attr__('Visit plugin homepage', 'give'),
23 23
 			$plugin_name,
24
-			esc_html( $plugin_data['Version'] )
24
+			esc_html($plugin_data['Version'])
25 25
 		);
26 26
 	}
27 27
 
28 28
 	// Link the author name to the author URL if available.
29
-	if ( ! empty( $plugin_data['AuthorURI'] ) ) {
29
+	if ( ! empty($plugin_data['AuthorURI'])) {
30 30
 		$author_name = sprintf(
31 31
 			'<a href="%s" title="%s">%s</a>',
32
-			esc_url( $plugin_data['AuthorURI'] ),
33
-			esc_attr__( 'Visit author homepage', 'give' ),
32
+			esc_url($plugin_data['AuthorURI']),
33
+			esc_attr__('Visit author homepage', 'give'),
34 34
 			$author_name
35 35
 		);
36 36
 	}
37 37
 	?>
38
-	<tr <?php echo( true !== $plugin_data['License'] ? 'data-tooltip="' . __( 'Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give' ) . '"' : '' ); ?>>
39
-		<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
38
+	<tr <?php echo(true !== $plugin_data['License'] ? 'data-tooltip="'.__('Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give').'"' : ''); ?>>
39
+		<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
40 40
 		<td>
41 41
 			<?php
42
-			echo ( true === $plugin_data['License'] ) ? '<span class="dashicons dashicons-yes"></span>' . __( 'Licensed', 'give' ) : '<span class="dashicons dashicons-no-alt"></span>' . __( 'Unlicensed', 'give' );
42
+			echo (true === $plugin_data['License']) ? '<span class="dashicons dashicons-yes"></span>'.__('Licensed', 'give') : '<span class="dashicons dashicons-no-alt"></span>'.__('Unlicensed', 'give');
43 43
 
44 44
 			echo sprintf(
45 45
 				' &ndash; %s &ndash; %s',
46
-				sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ),
47
-				sprintf( __( '(Latest Version: %s)' ), $plugin_data['update']->new_version )
46
+				sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))),
47
+				sprintf(__('(Latest Version: %s)'), $plugin_data['update']->new_version)
48 48
 			);
49 49
 			?>
50 50
 		</td>
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
28 28
 
29
-		parent::__construct( 'give_goal' );
29
+		parent::__construct('give_goal');
30 30
 	}
31 31
 
32 32
 	/**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$create_form_link = sprintf(
40 40
 		/* translators: %s: create new form URL */
41
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42
-			admin_url( 'post-new.php?post_type=give_forms' )
41
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
42
+			admin_url('post-new.php?post_type=give_forms')
43 43
 		);
44 44
 
45 45
 		return array(
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
 					'meta_value' => 'enabled',
52 52
 				),
53 53
 				'name'        => 'id',
54
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
55
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
54
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
55
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
56 56
 				'required'    => array(
57
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
57
+					'alert' => esc_html__('You must first select a Form!', 'give'),
58
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
59 59
 				),
60 60
 			),
61 61
 			array(
62 62
 				'type' => 'container',
63
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
63
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
64 64
 			),
65 65
 			array(
66 66
 				'type'    => 'listbox',
67 67
 				'name'    => 'show_text',
68
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
69
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
68
+				'label'   => esc_attr__('Show Text:', 'give'),
69
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'show_bar',
78
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
79
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
78
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
79
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
80 80
 				'options' => array(
81
-					'true'  => esc_html__( 'Show', 'give' ),
82
-					'false' => esc_html__( 'Hide', 'give' ),
81
+					'true'  => esc_html__('Show', 'give'),
82
+					'false' => esc_html__('Hide', 'give'),
83 83
 				),
84 84
 			),
85 85
 		);
Please login to merge, or discard this patch.