@@ -10,13 +10,13 @@ discard block |
||
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 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,34 +158,34 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <?php $localized_date_format = give_get_localized_date_format_to_js(); ?> |
178 | 178 | <p> |
179 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
180 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/> |
|
179 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
180 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/> |
|
181 | 181 | </p> |
182 | 182 | </div> |
183 | 183 | |
184 | 184 | <div class="give-admin-box-inside"> |
185 | 185 | <p> |
186 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
187 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
186 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
187 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
188 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
189 | 189 | </p> |
190 | 190 | </div> |
191 | 191 | |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @param int $payment_id Payment id. |
201 | 201 | */ |
202 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
202 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
203 | 203 | ?> |
204 | 204 | |
205 | 205 | <div class="give-order-payment give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
208 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
209 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
207 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
208 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
209 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
210 | 210 | </p> |
211 | 211 | </div> |
212 | 212 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param int $payment_id Payment id. |
220 | 220 | */ |
221 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
221 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
222 | 222 | ?> |
223 | 223 | |
224 | 224 | </div> |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param int $payment_id Payment id. |
238 | 238 | */ |
239 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
239 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <div id="major-publishing-actions"> |
243 | 243 | <div id="publishing-action"> |
244 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
244 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
245 | 245 | <?php |
246 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
246 | + if (give_is_payment_complete($payment_id)) { |
|
247 | 247 | $url = add_query_arg( |
248 | 248 | array( |
249 | 249 | 'give-action' => 'email_links', |
250 | 250 | 'purchase_id' => $payment_id, |
251 | 251 | ), |
252 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ) |
|
252 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id) |
|
253 | 253 | ); |
254 | 254 | |
255 | 255 | echo sprintf( |
256 | 256 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
257 | - esc_url( $url ), |
|
258 | - esc_html__( 'Resend Receipt', 'give' ) |
|
257 | + esc_url($url), |
|
258 | + esc_html__('Resend Receipt', 'give') |
|
259 | 259 | ); |
260 | 260 | } |
261 | 261 | ?> |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param int $payment_id Payment id. |
272 | 272 | */ |
273 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
273 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
274 | 274 | ?> |
275 | 275 | |
276 | 276 | </div> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | <div id="give-order-details" class="postbox give-order-data"> |
283 | 283 | |
284 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
284 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
285 | 285 | |
286 | 286 | <div class="inside"> |
287 | 287 | <div class="give-admin-box"> |
@@ -294,30 +294,30 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @param int $payment_id Payment id. |
296 | 296 | */ |
297 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
297 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
298 | 298 | |
299 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
300 | - if ( $gateway ) : |
|
299 | + $gateway = give_get_payment_gateway($payment_id); |
|
300 | + if ($gateway) : |
|
301 | 301 | ?> |
302 | 302 | <div class="give-order-gateway give-admin-box-inside"> |
303 | 303 | <p> |
304 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
305 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
304 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
305 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
306 | 306 | </p> |
307 | 307 | </div> |
308 | 308 | <?php endif; ?> |
309 | 309 | |
310 | 310 | <div class="give-order-payment-key give-admin-box-inside"> |
311 | 311 | <p> |
312 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
313 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
312 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
313 | + <?php echo give_get_payment_key($payment_id); ?> |
|
314 | 314 | </p> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="give-order-ip give-admin-box-inside"> |
318 | 318 | <p> |
319 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
320 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
319 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
320 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
321 | 321 | </p> |
322 | 322 | </div> |
323 | 323 | |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | // Display the transaction ID present. |
326 | 326 | // The transaction ID is the charge ID from the gateway. |
327 | 327 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
328 | - if ( $transaction_id != $payment_id ) : ?> |
|
328 | + if ($transaction_id != $payment_id) : ?> |
|
329 | 329 | <div class="give-order-tx-id give-admin-box-inside"> |
330 | 330 | <p> |
331 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
332 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
331 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
332 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
333 | 333 | </p> |
334 | 334 | </div> |
335 | 335 | <?php endif; ?> |
336 | 336 | |
337 | 337 | <div class="give-admin-box-inside"> |
338 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
339 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
338 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
339 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
340 | 340 | </p> |
341 | 341 | </div> |
342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param int $payment_id Payment id. |
350 | 350 | */ |
351 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
351 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
352 | 352 | ?> |
353 | 353 | |
354 | 354 | </div> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param int $payment_id Payment id. |
370 | 370 | */ |
371 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
371 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
372 | 372 | ?> |
373 | 373 | |
374 | 374 | </div> |
@@ -388,31 +388,31 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @param int $payment_id Payment id. |
390 | 390 | */ |
391 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
391 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
392 | 392 | ?> |
393 | 393 | |
394 | 394 | <?php $column_count = 'columns-3'; ?> |
395 | 395 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
396 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
396 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
397 | 397 | |
398 | 398 | <div class="inside"> |
399 | 399 | |
400 | 400 | <div class="column-container"> |
401 | 401 | <div class="column"> |
402 | 402 | <p> |
403 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
403 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
404 | 404 | <?php |
405 | - if ( $payment_meta['form_id'] ) : |
|
405 | + if ($payment_meta['form_id']) : |
|
406 | 406 | printf( |
407 | 407 | '<a href="%1$s">%2$s</a>', |
408 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
408 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
409 | 409 | $payment_meta['form_id'] |
410 | 410 | ); |
411 | 411 | endif; |
412 | 412 | ?> |
413 | 413 | </p> |
414 | 414 | <p> |
415 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
415 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
416 | 416 | <?php |
417 | 417 | echo Give()->html->forms_dropdown( |
418 | 418 | array( |
@@ -428,21 +428,21 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | <div class="column"> |
430 | 430 | <p> |
431 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
432 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
431 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
432 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
433 | 433 | </p> |
434 | 434 | <p> |
435 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
435 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
436 | 436 | <span class="give-donation-level"> |
437 | 437 | <?php |
438 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
439 | - if ( empty( $var_prices ) ) { |
|
440 | - _e( 'n/a', 'give' ); |
|
438 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
439 | + if (empty($var_prices)) { |
|
440 | + _e('n/a', 'give'); |
|
441 | 441 | } else { |
442 | 442 | $prices_atts = array(); |
443 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
444 | - foreach ( $variable_prices as $variable_price ) { |
|
445 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
443 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
444 | + foreach ($variable_prices as $variable_price) { |
|
445 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | // Variable price dropdown options. |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | 'name' => 'give-variable-price', |
452 | 452 | 'chosen' => true, |
453 | 453 | 'show_option_all' => '', |
454 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
455 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
454 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
455 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
456 | 456 | 'selected' => $payment_meta['price_id'], |
457 | 457 | ); |
458 | 458 | // Render variable prices select tag html. |
459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
460 | 460 | } |
461 | 461 | ?> |
462 | 462 | </span> |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | </div> |
465 | 465 | <div class="column"> |
466 | 466 | <p> |
467 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
468 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
467 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
468 | + <?php echo give_donation_amount($payment, true); ?> |
|
469 | 469 | </p> |
470 | 470 | |
471 | - <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ): ?> |
|
471 | + <?php if (give_is_anonymous_donation_field_enabled($payment->form_id)): ?> |
|
472 | 472 | <div> |
473 | - <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong> |
|
473 | + <strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong> |
|
474 | 474 | <ul class="give-radio-inline"> |
475 | 475 | <li> |
476 | 476 | <label> |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | name="give_anonymous_donation" |
479 | 479 | value="1" |
480 | 480 | type="radio" |
481 | - <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
482 | - ><?php _e( 'Yes', 'give' ); ?> |
|
481 | + <?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
482 | + ><?php _e('Yes', 'give'); ?> |
|
483 | 483 | </label> |
484 | 484 | </li> |
485 | 485 | <li> |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | name="give_anonymous_donation" |
489 | 489 | value="0" |
490 | 490 | type="radio" |
491 | - <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?> |
|
492 | - ><?php _e( 'No', 'give' ); ?> |
|
491 | + <?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?> |
|
492 | + ><?php _e('No', 'give'); ?> |
|
493 | 493 | </label> |
494 | 494 | </li> |
495 | 495 | </ul> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @param int $payment_id Payment id. |
508 | 508 | */ |
509 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
509 | + do_action('give_donation_details_thead_before', $payment_id); |
|
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * |
519 | 519 | * @param int $payment_id Payment id. |
520 | 520 | */ |
521 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
521 | + do_action('give_donation_details_thead_after', $payment_id); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @param int $payment_id Payment id. |
531 | 531 | */ |
532 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
532 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @param int $payment_id Payment id. |
542 | 542 | */ |
543 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
543 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
544 | 544 | ?> |
545 | 545 | </p> |
546 | 546 | </div> |
@@ -560,66 +560,66 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @param int $payment_id Payment id. |
562 | 562 | */ |
563 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
563 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
564 | 564 | ?> |
565 | 565 | |
566 | 566 | <div id="give-donor-details" class="postbox"> |
567 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
567 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
568 | 568 | |
569 | 569 | <div class="inside"> |
570 | 570 | |
571 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
571 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
572 | 572 | |
573 | 573 | <div class="column-container donor-info"> |
574 | 574 | <div class="column"> |
575 | 575 | <p> |
576 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
576 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
577 | 577 | <?php |
578 | - if ( ! empty( $donor->id ) ) { |
|
578 | + if ( ! empty($donor->id)) { |
|
579 | 579 | printf( |
580 | 580 | '<a href="%1$s">%2$s</a>', |
581 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ), |
|
582 | - intval( $donor->id ) |
|
581 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)), |
|
582 | + intval($donor->id) |
|
583 | 583 | ); |
584 | 584 | } |
585 | 585 | ?> |
586 | - <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
586 | + <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span> |
|
587 | 587 | </p> |
588 | 588 | <p> |
589 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
590 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
589 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
590 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
591 | 591 | </p> |
592 | 592 | </div> |
593 | 593 | <div class="column"> |
594 | 594 | <p> |
595 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
595 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
596 | 596 | <?php |
597 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
598 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
597 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
598 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
599 | 599 | |
600 | 600 | // Check whether the donor name and WP_User name is same or not. |
601 | - if ( $donor_billing_name !== $donor_name ) { |
|
601 | + if ($donor_billing_name !== $donor_name) { |
|
602 | 602 | echo sprintf( |
603 | 603 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
604 | - esc_html( $donor_billing_name ), |
|
605 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
606 | - esc_html( $donor_name ) |
|
604 | + esc_html($donor_billing_name), |
|
605 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
606 | + esc_html($donor_name) |
|
607 | 607 | ); |
608 | 608 | } else { |
609 | - echo esc_html( $donor_name ); |
|
609 | + echo esc_html($donor_name); |
|
610 | 610 | } |
611 | 611 | ?> |
612 | 612 | </p> |
613 | 613 | <p> |
614 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
614 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
615 | 615 | <?php |
616 | 616 | // Show Donor donation email first and Primary email on parenthesis if not match both email. |
617 | - echo hash_equals( $donor->email, $payment->email ) |
|
617 | + echo hash_equals($donor->email, $payment->email) |
|
618 | 618 | ? $payment->email |
619 | 619 | : sprintf( |
620 | 620 | '%1$s (<a href="%2$s" target="_blank">%3$s</a>)', |
621 | 621 | $payment->email, |
622 | - esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ), |
|
622 | + esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")), |
|
623 | 623 | $donor->email |
624 | 624 | ); |
625 | 625 | ?> |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | </div> |
628 | 628 | <div class="column"> |
629 | 629 | <p> |
630 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
630 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
631 | 631 | <?php |
632 | 632 | echo Give()->html->donor_dropdown( |
633 | 633 | array( |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | ?> |
639 | 639 | </p> |
640 | 640 | <p> |
641 | - <?php if ( ! empty( $company_name ) ) { |
|
641 | + <?php if ( ! empty($company_name)) { |
|
642 | 642 | ?> |
643 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
643 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
644 | 644 | <?php |
645 | 645 | echo $company_name; |
646 | 646 | } ?> |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | <div class="column-container new-donor" style="display: none"> |
652 | 652 | <div class="column"> |
653 | 653 | <p> |
654 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
654 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
655 | 655 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
656 | 656 | </p> |
657 | 657 | </div> |
658 | 658 | <div class="column"> |
659 | 659 | <p> |
660 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
660 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
661 | 661 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
662 | 662 | </p> |
663 | 663 | </div> |
664 | 664 | <div class="column"> |
665 | 665 | <p> |
666 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
666 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
667 | 667 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
668 | 668 | </p> |
669 | 669 | </div> |
@@ -671,9 +671,9 @@ discard block |
||
671 | 671 | <p> |
672 | 672 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
673 | 673 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
674 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
674 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
675 | 675 | <br> |
676 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
676 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
677 | 677 | </p> |
678 | 678 | </div> |
679 | 679 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param array $payment_meta Payment meta. |
689 | 689 | * @param array $user_info User information. |
690 | 690 | */ |
691 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
691 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * Fires on the donation details page, in the donor-details metabox. |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @param int $payment_id Payment id. |
699 | 699 | */ |
700 | - do_action( 'give_payment_view_details', $payment_id ); |
|
700 | + do_action('give_payment_view_details', $payment_id); |
|
701 | 701 | ?> |
702 | 702 | |
703 | 703 | </div> |
@@ -713,11 +713,11 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @param int $payment_id Payment id. |
715 | 715 | */ |
716 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
716 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
717 | 717 | ?> |
718 | 718 | |
719 | 719 | <div id="give-billing-details" class="postbox"> |
720 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
720 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
721 | 721 | |
722 | 722 | <div class="inside"> |
723 | 723 | |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | <div class="data column-container"> |
728 | 728 | |
729 | 729 | <?php |
730 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
730 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
731 | 731 | |
732 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
732 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
733 | 733 | |
734 | 734 | // Get the country list that does not have any states init. |
735 | 735 | $no_states_country = give_no_states_country_list(); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | |
738 | 738 | <div class="row"> |
739 | 739 | <div id="give-order-address-country-wrap"> |
740 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
740 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
741 | 741 | <?php |
742 | 742 | echo Give()->html->select( |
743 | 743 | array( |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | 'show_option_all' => false, |
748 | 748 | 'show_option_none' => false, |
749 | 749 | 'chosen' => true, |
750 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
751 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
750 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
751 | + 'data' => array('search-type' => 'no_ajax'), |
|
752 | 752 | ) |
753 | 753 | ); |
754 | 754 | ?> |
@@ -757,35 +757,35 @@ discard block |
||
757 | 757 | |
758 | 758 | <div class="row"> |
759 | 759 | <div class="give-wrap-address-line1"> |
760 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
761 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
760 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
761 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
762 | 762 | </div> |
763 | 763 | </div> |
764 | 764 | |
765 | 765 | <div class="row"> |
766 | 766 | <div class="give-wrap-address-line2"> |
767 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
768 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
767 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
768 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
769 | 769 | </div> |
770 | 770 | </div> |
771 | 771 | |
772 | 772 | <div class="row"> |
773 | 773 | <div class="give-wrap-address-city"> |
774 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
775 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
774 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
775 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
776 | 776 | </div> |
777 | 777 | </div> |
778 | 778 | |
779 | 779 | <?php |
780 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
780 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
781 | 781 | ?> |
782 | 782 | <div class="row"> |
783 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
784 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
785 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
783 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
784 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
785 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
786 | 786 | <?php |
787 | - $states = give_get_states( $address['country'] ); |
|
788 | - if ( ! empty( $states ) ) { |
|
787 | + $states = give_get_states($address['country']); |
|
788 | + if ( ! empty($states)) { |
|
789 | 789 | echo Give()->html->select( |
790 | 790 | array( |
791 | 791 | 'options' => $states, |
@@ -794,23 +794,23 @@ discard block |
||
794 | 794 | 'show_option_all' => false, |
795 | 795 | 'show_option_none' => false, |
796 | 796 | 'chosen' => true, |
797 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
798 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
797 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
798 | + 'data' => array('search-type' => 'no_ajax'), |
|
799 | 799 | ) |
800 | 800 | ); |
801 | 801 | } else { |
802 | 802 | ?> |
803 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
803 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
804 | 804 | <?php |
805 | 805 | } |
806 | 806 | ?> |
807 | 807 | </div> |
808 | 808 | </div> |
809 | 809 | |
810 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
810 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
811 | 811 | <div class="give-wrap-address-zip"> |
812 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
813 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
812 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
813 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
814 | 814 | </div> |
815 | 815 | </div> |
816 | 816 | </div> |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | * |
830 | 830 | * @param int $payment_id Payment id. |
831 | 831 | */ |
832 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
832 | + do_action('give_payment_billing_details', $payment_id); |
|
833 | 833 | ?> |
834 | 834 | |
835 | 835 | </div> |
@@ -845,34 +845,34 @@ discard block |
||
845 | 845 | * |
846 | 846 | * @param int $payment_id Payment id. |
847 | 847 | */ |
848 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
848 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
849 | 849 | ?> |
850 | 850 | |
851 | 851 | <div id="give-payment-notes" class="postbox"> |
852 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
852 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
853 | 853 | |
854 | 854 | <div class="inside"> |
855 | 855 | <div id="give-payment-notes-inner"> |
856 | 856 | <?php |
857 | - $notes = give_get_payment_notes( $payment_id ); |
|
858 | - if ( ! empty( $notes ) ) { |
|
857 | + $notes = give_get_payment_notes($payment_id); |
|
858 | + if ( ! empty($notes)) { |
|
859 | 859 | $no_notes_display = ' style="display:none;"'; |
860 | - foreach ( $notes as $note ) : |
|
860 | + foreach ($notes as $note) : |
|
861 | 861 | |
862 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
862 | + echo give_get_payment_note_html($note, $payment_id); |
|
863 | 863 | |
864 | 864 | endforeach; |
865 | 865 | } else { |
866 | 866 | $no_notes_display = ''; |
867 | 867 | } |
868 | 868 | |
869 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
869 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
870 | 870 | ?> |
871 | 871 | </div> |
872 | 872 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
873 | 873 | |
874 | 874 | <div class="give-clearfix"> |
875 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
875 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
876 | 876 | </div> |
877 | 877 | |
878 | 878 | </div> |
@@ -888,18 +888,18 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @param int $payment_id Payment id. |
890 | 890 | */ |
891 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
891 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
892 | 892 | ?> |
893 | 893 | |
894 | - <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?> |
|
894 | + <?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?> |
|
895 | 895 | <div id="give-payment-donor-comment" class="postbox"> |
896 | - <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3> |
|
896 | + <h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3> |
|
897 | 897 | |
898 | 898 | <div class="inside"> |
899 | 899 | <div id="give-payment-donor-comment-inner"> |
900 | 900 | <p> |
901 | 901 | <?php |
902 | - $donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id ); |
|
902 | + $donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id); |
|
903 | 903 | |
904 | 904 | echo sprintf( |
905 | 905 | '<input type="hidden" name="give_comment_id" value="%s">', |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | echo sprintf( |
910 | 910 | '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>', |
911 | - __( 'Add a comment', 'give' ), |
|
911 | + __('Add a comment', 'give'), |
|
912 | 912 | $donor_comment instanceof WP_Comment ? $donor_comment->comment_content : '' |
913 | 913 | ); |
914 | 914 | ?> |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * |
930 | 930 | * @param int $payment_id Payment id. |
931 | 931 | */ |
932 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
932 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
933 | 933 | ?> |
934 | 934 | |
935 | 935 | </div> |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | * |
952 | 952 | * @param int $payment_id Payment id. |
953 | 953 | */ |
954 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
954 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
955 | 955 | |
956 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
956 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
957 | 957 | ?> |
958 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
958 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
959 | 959 | <input type="hidden" name="give_action" value="update_payment_details"/> |
960 | 960 | </form> |
961 | 961 | <?php |
@@ -966,6 +966,6 @@ discard block |
||
966 | 966 | * |
967 | 967 | * @param int $payment_id Payment id. |
968 | 968 | */ |
969 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
969 | + do_action('give_view_donation_details_after', $payment_id); |
|
970 | 970 | ?> |
971 | 971 | </div><!-- /.wrap --> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -25,70 +25,70 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | |
77 | - case version_compare( $give_version, '2.0', '<' ) : |
|
77 | + case version_compare($give_version, '2.0', '<') : |
|
78 | 78 | give_v20_upgrades(); |
79 | 79 | $did_upgrade = true; |
80 | 80 | |
81 | - case version_compare( $give_version, '2.0.1', '<' ) : |
|
81 | + case version_compare($give_version, '2.0.1', '<') : |
|
82 | 82 | // Do nothing on fresh install. |
83 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
83 | + if ( ! doing_action('give_upgrades')) { |
|
84 | 84 | give_v201_create_tables(); |
85 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
85 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
86 | 86 | Give_Updates::$background_updater->dispatch(); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $did_upgrade = true; |
90 | 90 | |
91 | - case version_compare( $give_version, '2.0.2', '<' ) : |
|
91 | + case version_compare($give_version, '2.0.2', '<') : |
|
92 | 92 | // Remove 2.0.1 update to rerun on 2.0.2 |
93 | 93 | $completed_upgrades = give_get_completed_upgrades(); |
94 | 94 | $v201_updates = array( |
@@ -98,43 +98,43 @@ discard block |
||
98 | 98 | 'v201_logs_upgrades', |
99 | 99 | ); |
100 | 100 | |
101 | - foreach ( $v201_updates as $v201_update ) { |
|
102 | - if ( in_array( $v201_update, $completed_upgrades ) ) { |
|
103 | - unset( $completed_upgrades[ array_search( $v201_update, $completed_upgrades ) ] ); |
|
101 | + foreach ($v201_updates as $v201_update) { |
|
102 | + if (in_array($v201_update, $completed_upgrades)) { |
|
103 | + unset($completed_upgrades[array_search($v201_update, $completed_upgrades)]); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - update_option( 'give_completed_upgrades', $completed_upgrades, false ); |
|
107 | + update_option('give_completed_upgrades', $completed_upgrades, false); |
|
108 | 108 | |
109 | 109 | // Do nothing on fresh install. |
110 | - if ( ! doing_action( 'give_upgrades' ) ) { |
|
110 | + if ( ! doing_action('give_upgrades')) { |
|
111 | 111 | give_v201_create_tables(); |
112 | - Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() ); |
|
112 | + Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance()); |
|
113 | 113 | Give_Updates::$background_updater->dispatch(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $did_upgrade = true; |
117 | 117 | |
118 | - case version_compare( $give_version, '2.0.3', '<' ) : |
|
118 | + case version_compare($give_version, '2.0.3', '<') : |
|
119 | 119 | give_v203_upgrades(); |
120 | 120 | $did_upgrade = true; |
121 | 121 | |
122 | - case version_compare( $give_version, '2.2.0', '<' ) : |
|
122 | + case version_compare($give_version, '2.2.0', '<') : |
|
123 | 123 | give_v220_upgrades(); |
124 | 124 | $did_upgrade = true; |
125 | 125 | |
126 | - case version_compare( $give_version, '2.2.1', '<' ) : |
|
126 | + case version_compare($give_version, '2.2.1', '<') : |
|
127 | 127 | give_v221_upgrades(); |
128 | 128 | $did_upgrade = true; |
129 | 129 | } |
130 | 130 | |
131 | - if ( $did_upgrade ) { |
|
132 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false ); |
|
131 | + if ($did_upgrade) { |
|
132 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
137 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
136 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
137 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Display Upgrade Notices. |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return void |
150 | 150 | */ |
151 | -function give_show_upgrade_notices( $give_updates ) { |
|
151 | +function give_show_upgrade_notices($give_updates) { |
|
152 | 152 | // v1.3.2 Upgrades |
153 | 153 | $give_updates->register( |
154 | 154 | array( |
@@ -214,32 +214,32 @@ discard block |
||
214 | 214 | ); |
215 | 215 | |
216 | 216 | // v1.8.17 Upgrades for donations. |
217 | - $give_updates->register( array( |
|
217 | + $give_updates->register(array( |
|
218 | 218 | 'id' => 'v1817_update_donation_iranian_currency_code', |
219 | 219 | 'version' => '1.8.17', |
220 | 220 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
221 | - ) ); |
|
221 | + )); |
|
222 | 222 | |
223 | 223 | // v1.8.17 Upgrades for cleanup of user roles. |
224 | - $give_updates->register( array( |
|
224 | + $give_updates->register(array( |
|
225 | 225 | 'id' => 'v1817_cleanup_user_roles', |
226 | 226 | 'version' => '1.8.17', |
227 | 227 | 'callback' => 'give_v1817_cleanup_user_roles', |
228 | - ) ); |
|
228 | + )); |
|
229 | 229 | |
230 | 230 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
231 | - $give_updates->register( array( |
|
231 | + $give_updates->register(array( |
|
232 | 232 | 'id' => 'v1818_assign_custom_amount_set_donation', |
233 | 233 | 'version' => '1.8.18', |
234 | 234 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | 237 | // v1.8.18 Cleanup the Give Worker Role Caps. |
238 | - $give_updates->register( array( |
|
238 | + $give_updates->register(array( |
|
239 | 239 | 'id' => 'v1818_give_worker_role_cleanup', |
240 | 240 | 'version' => '1.8.18', |
241 | 241 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
242 | - ) ); |
|
242 | + )); |
|
243 | 243 | |
244 | 244 | // v2.0.0 Upgrades |
245 | 245 | $give_updates->register( |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'id' => 'v20_move_metadata_into_new_table', |
294 | 294 | 'version' => '2.0.0', |
295 | 295 | 'callback' => 'give_v20_move_metadata_into_new_table_callback', |
296 | - 'depend' => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ), |
|
296 | + 'depend' => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'), |
|
297 | 297 | ) |
298 | 298 | ); |
299 | 299 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'id' => 'v201_move_metadata_into_new_table', |
340 | 340 | 'version' => '2.0.1', |
341 | 341 | 'callback' => 'give_v201_move_metadata_into_new_table_callback', |
342 | - 'depend' => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ), |
|
342 | + 'depend' => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'), |
|
343 | 343 | ) |
344 | 344 | ); |
345 | 345 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'id' => 'v213_delete_donation_meta', |
368 | 368 | 'version' => '2.1.3', |
369 | 369 | 'callback' => 'give_v213_delete_donation_meta_callback', |
370 | - 'depends' => array( 'v201_move_metadata_into_new_table' ) |
|
370 | + 'depends' => array('v201_move_metadata_into_new_table') |
|
371 | 371 | ) |
372 | 372 | ); |
373 | 373 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | ); |
382 | 382 | } |
383 | 383 | |
384 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
384 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
385 | 385 | |
386 | 386 | /** |
387 | 387 | * Triggers all upgrade functions |
@@ -393,29 +393,29 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function give_trigger_upgrades() { |
395 | 395 | |
396 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
397 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
396 | + if ( ! current_user_can('manage_give_settings')) { |
|
397 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
398 | 398 | 'response' => 403, |
399 | - ) ); |
|
399 | + )); |
|
400 | 400 | } |
401 | 401 | |
402 | - $give_version = get_option( 'give_version' ); |
|
402 | + $give_version = get_option('give_version'); |
|
403 | 403 | |
404 | - if ( ! $give_version ) { |
|
404 | + if ( ! $give_version) { |
|
405 | 405 | // 1.0 is the first version to use this option so we must add it. |
406 | 406 | $give_version = '1.0'; |
407 | - add_option( 'give_version', $give_version, '', false ); |
|
407 | + add_option('give_version', $give_version, '', false); |
|
408 | 408 | } |
409 | 409 | |
410 | - update_option( 'give_version', GIVE_VERSION, false ); |
|
411 | - delete_option( 'give_doing_upgrade' ); |
|
410 | + update_option('give_version', GIVE_VERSION, false); |
|
411 | + delete_option('give_doing_upgrade'); |
|
412 | 412 | |
413 | - if ( DOING_AJAX ) { |
|
414 | - die( 'complete' ); |
|
413 | + if (DOING_AJAX) { |
|
414 | + die('complete'); |
|
415 | 415 | } // End if(). |
416 | 416 | } |
417 | 417 | |
418 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
418 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
419 | 419 | |
420 | 420 | |
421 | 421 | /** |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | |
434 | 434 | // UPDATE DB METAKEYS. |
435 | 435 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
436 | - $query = $wpdb->query( $sql ); |
|
436 | + $query = $wpdb->query($sql); |
|
437 | 437 | |
438 | 438 | $give_updates->percentage = 100; |
439 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
439 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -460,24 +460,24 @@ discard block |
||
460 | 460 | $where .= "AND ( p.post_status = 'abandoned' )"; |
461 | 461 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
462 | 462 | |
463 | - $sql = $select . $join . $where; |
|
464 | - $found_payments = $wpdb->get_col( $sql ); |
|
463 | + $sql = $select.$join.$where; |
|
464 | + $found_payments = $wpdb->get_col($sql); |
|
465 | 465 | |
466 | - foreach ( $found_payments as $payment ) { |
|
466 | + foreach ($found_payments as $payment) { |
|
467 | 467 | |
468 | 468 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
469 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
469 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
470 | 470 | |
471 | 471 | // 1450124863 = 12/10/2015 20:42:25. |
472 | - if ( $modified_time >= 1450124863 ) { |
|
472 | + if ($modified_time >= 1450124863) { |
|
473 | 473 | |
474 | - give_update_payment_status( $payment, 'pending' ); |
|
474 | + give_update_payment_status($payment, 'pending'); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | 479 | $give_updates->percentage = 100; |
480 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
480 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | */ |
491 | 491 | function give_v152_cleanup_users() { |
492 | 492 | |
493 | - $give_version = get_option( 'give_version' ); |
|
493 | + $give_version = get_option('give_version'); |
|
494 | 494 | |
495 | - if ( ! $give_version ) { |
|
495 | + if ( ! $give_version) { |
|
496 | 496 | // 1.0 is the first version to use this option so we must add it. |
497 | 497 | $give_version = '1.0'; |
498 | 498 | } |
499 | 499 | |
500 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
500 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
501 | 501 | |
502 | 502 | // v1.5.2 Upgrades |
503 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
503 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
504 | 504 | |
505 | 505 | // Delete all caps with "ss". |
506 | 506 | // Also delete all unused "campaign" roles. |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | ); |
548 | 548 | |
549 | 549 | global $wp_roles; |
550 | - foreach ( $delete_caps as $cap ) { |
|
551 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
552 | - $wp_roles->remove_cap( $role, $cap ); |
|
550 | + foreach ($delete_caps as $cap) { |
|
551 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
552 | + $wp_roles->remove_cap($role, $cap); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -559,15 +559,15 @@ discard block |
||
559 | 559 | $roles->add_caps(); |
560 | 560 | |
561 | 561 | // The Update Ran. |
562 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ), false ); |
|
563 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
564 | - delete_option( 'give_doing_upgrade' ); |
|
562 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION), false); |
|
563 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
564 | + delete_option('give_doing_upgrade'); |
|
565 | 565 | |
566 | 566 | }// End if(). |
567 | 567 | |
568 | 568 | } |
569 | 569 | |
570 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
570 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
571 | 571 | |
572 | 572 | /** |
573 | 573 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -610,53 +610,53 @@ discard block |
||
610 | 610 | |
611 | 611 | // Get addons license key. |
612 | 612 | $addons = array(); |
613 | - foreach ( $give_options as $key => $value ) { |
|
614 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
615 | - $addons[ $key ] = $value; |
|
613 | + foreach ($give_options as $key => $value) { |
|
614 | + if (false !== strpos($key, '_license_key')) { |
|
615 | + $addons[$key] = $value; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | // Bailout: We do not have any addon license data to upgrade. |
620 | - if ( empty( $addons ) ) { |
|
620 | + if (empty($addons)) { |
|
621 | 621 | return false; |
622 | 622 | } |
623 | 623 | |
624 | - foreach ( $addons as $key => $addon_license ) { |
|
624 | + foreach ($addons as $key => $addon_license) { |
|
625 | 625 | |
626 | 626 | // Get addon shortname. |
627 | - $shortname = str_replace( '_license_key', '', $key ); |
|
627 | + $shortname = str_replace('_license_key', '', $key); |
|
628 | 628 | |
629 | 629 | // Addon license option name. |
630 | - $addon_license_option_name = $shortname . '_license_active'; |
|
630 | + $addon_license_option_name = $shortname.'_license_active'; |
|
631 | 631 | |
632 | 632 | // bailout if license is empty. |
633 | - if ( empty( $addon_license ) ) { |
|
634 | - delete_option( $addon_license_option_name ); |
|
633 | + if (empty($addon_license)) { |
|
634 | + delete_option($addon_license_option_name); |
|
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | |
638 | 638 | // Get addon name. |
639 | 639 | $addon_name = array(); |
640 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
641 | - foreach ( $addon_name_parts as $name_part ) { |
|
640 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
641 | + foreach ($addon_name_parts as $name_part) { |
|
642 | 642 | |
643 | 643 | // Fix addon name |
644 | - switch ( $name_part ) { |
|
644 | + switch ($name_part) { |
|
645 | 645 | case 'authorizenet' : |
646 | 646 | $name_part = 'authorize.net'; |
647 | 647 | break; |
648 | 648 | } |
649 | 649 | |
650 | - $addon_name[] = ucfirst( $name_part ); |
|
650 | + $addon_name[] = ucfirst($name_part); |
|
651 | 651 | } |
652 | 652 | |
653 | - $addon_name = implode( ' ', $addon_name ); |
|
653 | + $addon_name = implode(' ', $addon_name); |
|
654 | 654 | |
655 | 655 | // Data to send to the API. |
656 | 656 | $api_params = array( |
657 | 657 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
658 | 658 | 'license' => $addon_license, |
659 | - 'item_name' => urlencode( $addon_name ), |
|
659 | + 'item_name' => urlencode($addon_name), |
|
660 | 660 | 'url' => home_url(), |
661 | 661 | ); |
662 | 662 | |
@@ -671,17 +671,17 @@ discard block |
||
671 | 671 | ); |
672 | 672 | |
673 | 673 | // Make sure there are no errors. |
674 | - if ( is_wp_error( $response ) ) { |
|
675 | - delete_option( $addon_license_option_name ); |
|
674 | + if (is_wp_error($response)) { |
|
675 | + delete_option($addon_license_option_name); |
|
676 | 676 | continue; |
677 | 677 | } |
678 | 678 | |
679 | 679 | // Tell WordPress to look for updates. |
680 | - set_site_transient( 'update_plugins', null ); |
|
680 | + set_site_transient('update_plugins', null); |
|
681 | 681 | |
682 | 682 | // Decode license data. |
683 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
684 | - update_option( $addon_license_option_name, $license_data, false ); |
|
683 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
684 | + update_option($addon_license_option_name, $license_data, false); |
|
685 | 685 | }// End foreach(). |
686 | 686 | } |
687 | 687 | |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | ); |
712 | 712 | |
713 | 713 | global $wp_roles; |
714 | - foreach ( $delete_caps as $cap ) { |
|
715 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
716 | - $wp_roles->remove_cap( $role, $cap ); |
|
714 | + foreach ($delete_caps as $cap) { |
|
715 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
716 | + $wp_roles->remove_cap($role, $cap); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | function give_v18_upgrades_core_setting() { |
748 | 748 | // Core settings which changes from checkbox to radio. |
749 | 749 | $core_setting_names = array_merge( |
750 | - array_keys( give_v18_renamed_core_settings() ), |
|
750 | + array_keys(give_v18_renamed_core_settings()), |
|
751 | 751 | array( |
752 | 752 | 'uninstall_on_delete', |
753 | 753 | 'scripts_footer', |
@@ -759,48 +759,48 @@ discard block |
||
759 | 759 | ); |
760 | 760 | |
761 | 761 | // Bailout: If not any setting define. |
762 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
762 | + if ($give_settings = get_option('give_settings')) { |
|
763 | 763 | |
764 | 764 | $setting_changed = false; |
765 | 765 | |
766 | 766 | // Loop: check each setting field. |
767 | - foreach ( $core_setting_names as $setting_name ) { |
|
767 | + foreach ($core_setting_names as $setting_name) { |
|
768 | 768 | // New setting name. |
769 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
769 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
770 | 770 | |
771 | 771 | // Continue: If setting already set. |
772 | 772 | if ( |
773 | - array_key_exists( $new_setting_name, $give_settings ) |
|
774 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
773 | + array_key_exists($new_setting_name, $give_settings) |
|
774 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
775 | 775 | ) { |
776 | 776 | continue; |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Set checkbox value to radio value. |
780 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
780 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
781 | 781 | |
782 | 782 | // @see https://github.com/WordImpress/Give/issues/1063. |
783 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
783 | + if (false !== strpos($setting_name, 'disable_')) { |
|
784 | 784 | |
785 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
786 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
785 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
786 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
787 | 787 | |
788 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
788 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | // Tell bot to update core setting to db. |
792 | - if ( ! $setting_changed ) { |
|
792 | + if ( ! $setting_changed) { |
|
793 | 793 | $setting_changed = true; |
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | 797 | // Update setting only if they changed. |
798 | - if ( $setting_changed ) { |
|
799 | - update_option( 'give_settings', $give_settings, false ); |
|
798 | + if ($setting_changed) { |
|
799 | + update_option('give_settings', $give_settings, false); |
|
800 | 800 | } |
801 | 801 | }// End if(). |
802 | 802 | |
803 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
803 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | $give_updates = Give_Updates::get_instance(); |
815 | 815 | |
816 | 816 | // form query |
817 | - $forms = new WP_Query( array( |
|
817 | + $forms = new WP_Query(array( |
|
818 | 818 | 'paged' => $give_updates->step, |
819 | 819 | 'status' => 'any', |
820 | 820 | 'order' => 'ASC', |
@@ -823,41 +823,41 @@ discard block |
||
823 | 823 | ) |
824 | 824 | ); |
825 | 825 | |
826 | - if ( $forms->have_posts() ) { |
|
827 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
826 | + if ($forms->have_posts()) { |
|
827 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
828 | 828 | |
829 | - while ( $forms->have_posts() ) { |
|
829 | + while ($forms->have_posts()) { |
|
830 | 830 | $forms->the_post(); |
831 | 831 | |
832 | 832 | // Form content. |
833 | 833 | // Note in version 1.8 display content setting split into display content and content placement setting. |
834 | 834 | // You can delete _give_content_option in future. |
835 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
836 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
837 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
838 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
835 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
836 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
837 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
838 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
839 | 839 | |
840 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
841 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
840 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
841 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | // "Disable" Guest Donation. Checkbox. |
845 | 845 | // See: https://github.com/WordImpress/Give/issues/1470. |
846 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
847 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
848 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
846 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
847 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
848 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
849 | 849 | |
850 | 850 | // Offline Donations. |
851 | 851 | // See: https://github.com/WordImpress/Give/issues/1579. |
852 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
853 | - if ( 'no' === $offline_donation ) { |
|
852 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
853 | + if ('no' === $offline_donation) { |
|
854 | 854 | $offline_donation_newval = 'global'; |
855 | - } elseif ( 'yes' === $offline_donation ) { |
|
855 | + } elseif ('yes' === $offline_donation) { |
|
856 | 856 | $offline_donation_newval = 'enabled'; |
857 | 857 | } else { |
858 | 858 | $offline_donation_newval = 'disabled'; |
859 | 859 | } |
860 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
860 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
861 | 861 | |
862 | 862 | // Convert yes/no setting field to enabled/disabled. |
863 | 863 | $form_radio_settings = array( |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | '_give_offline_donation_enable_billing_fields_single', |
878 | 878 | ); |
879 | 879 | |
880 | - foreach ( $form_radio_settings as $meta_key ) { |
|
880 | + foreach ($form_radio_settings as $meta_key) { |
|
881 | 881 | // Get value. |
882 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
882 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
883 | 883 | |
884 | 884 | // Convert meta value only if it is in yes/no/none. |
885 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
885 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
886 | 886 | |
887 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
888 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
887 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
888 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | }// End while(). |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | |
895 | 895 | } else { |
896 | 896 | // No more forms found, finish up. |
897 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
897 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | '%_transient_give_stats_%', |
962 | 962 | 'give_cache%', |
963 | 963 | '%_transient_give_add_ons_feed%', |
964 | - '%_transient__give_ajax_works' . |
|
964 | + '%_transient__give_ajax_works'. |
|
965 | 965 | '%_transient_give_total_api_keys%', |
966 | 966 | '%_transient_give_i18n_give_promo_hide%', |
967 | 967 | '%_transient_give_contributors%', |
@@ -988,24 +988,24 @@ discard block |
||
988 | 988 | ARRAY_A |
989 | 989 | ); |
990 | 990 | |
991 | - if ( ! empty( $user_apikey_options ) ) { |
|
992 | - foreach ( $user_apikey_options as $user ) { |
|
993 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
994 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
995 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
991 | + if ( ! empty($user_apikey_options)) { |
|
992 | + foreach ($user_apikey_options as $user) { |
|
993 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
994 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
995 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
999 | - if ( ! empty( $cached_options ) ) { |
|
1000 | - foreach ( $cached_options as $option ) { |
|
1001 | - switch ( true ) { |
|
1002 | - case ( false !== strpos( $option, 'transient' ) ): |
|
1003 | - $option = str_replace( '_transient_', '', $option ); |
|
1004 | - delete_transient( $option ); |
|
999 | + if ( ! empty($cached_options)) { |
|
1000 | + foreach ($cached_options as $option) { |
|
1001 | + switch (true) { |
|
1002 | + case (false !== strpos($option, 'transient')): |
|
1003 | + $option = str_replace('_transient_', '', $option); |
|
1004 | + delete_transient($option); |
|
1005 | 1005 | break; |
1006 | 1006 | |
1007 | 1007 | default: |
1008 | - delete_option( $option ); |
|
1008 | + delete_option($option); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | global $wp_roles; |
1024 | 1024 | |
1025 | 1025 | // Get the role object. |
1026 | - $give_worker = get_role( 'give_worker' ); |
|
1026 | + $give_worker = get_role('give_worker'); |
|
1027 | 1027 | |
1028 | 1028 | // A list of capabilities to add for give workers. |
1029 | 1029 | $caps_to_add = array( |
@@ -1031,9 +1031,9 @@ discard block |
||
1031 | 1031 | 'edit_pages', |
1032 | 1032 | ); |
1033 | 1033 | |
1034 | - foreach ( $caps_to_add as $cap ) { |
|
1034 | + foreach ($caps_to_add as $cap) { |
|
1035 | 1035 | // Add the capability. |
1036 | - $give_worker->add_cap( $cap ); |
|
1036 | + $give_worker->add_cap($cap); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $give_updates = Give_Updates::get_instance(); |
1051 | 1051 | |
1052 | 1052 | // form query. |
1053 | - $donation_forms = new WP_Query( array( |
|
1053 | + $donation_forms = new WP_Query(array( |
|
1054 | 1054 | 'paged' => $give_updates->step, |
1055 | 1055 | 'status' => 'any', |
1056 | 1056 | 'order' => 'ASC', |
@@ -1059,10 +1059,10 @@ discard block |
||
1059 | 1059 | ) |
1060 | 1060 | ); |
1061 | 1061 | |
1062 | - if ( $donation_forms->have_posts() ) { |
|
1063 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1062 | + if ($donation_forms->have_posts()) { |
|
1063 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1064 | 1064 | |
1065 | - while ( $donation_forms->have_posts() ) { |
|
1065 | + while ($donation_forms->have_posts()) { |
|
1066 | 1066 | $donation_forms->the_post(); |
1067 | 1067 | $form_id = get_the_ID(); |
1068 | 1068 | |
@@ -1070,41 +1070,41 @@ discard block |
||
1070 | 1070 | update_post_meta( |
1071 | 1071 | $form_id, |
1072 | 1072 | '_give_set_price', |
1073 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
1073 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
1074 | 1074 | ); |
1075 | 1075 | |
1076 | 1076 | // Remove formatting from _give_custom_amount_minimum. |
1077 | 1077 | update_post_meta( |
1078 | 1078 | $form_id, |
1079 | 1079 | '_give_custom_amount_minimum', |
1080 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
1080 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
1081 | 1081 | ); |
1082 | 1082 | |
1083 | 1083 | // Bailout. |
1084 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
1084 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
1085 | 1085 | continue; |
1086 | 1086 | } |
1087 | 1087 | |
1088 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
1088 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
1089 | 1089 | |
1090 | - if ( ! empty( $donation_levels ) ) { |
|
1090 | + if ( ! empty($donation_levels)) { |
|
1091 | 1091 | |
1092 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
1093 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
1094 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
1092 | + foreach ($donation_levels as $index => $donation_level) { |
|
1093 | + if (isset($donation_level['_give_amount'])) { |
|
1094 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
1098 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
1099 | 1099 | |
1100 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
1100 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
1101 | 1101 | |
1102 | - $min_amount = min( $donation_levels_amounts ); |
|
1103 | - $max_amount = max( $donation_levels_amounts ); |
|
1102 | + $min_amount = min($donation_levels_amounts); |
|
1103 | + $max_amount = max($donation_levels_amounts); |
|
1104 | 1104 | |
1105 | 1105 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
1106 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
1107 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
1106 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
1107 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | wp_reset_postdata(); |
1114 | 1114 | } else { |
1115 | 1115 | // The Update Ran. |
1116 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
1116 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | } |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | */ |
1164 | 1164 | function give_v20_upgrades() { |
1165 | 1165 | // Update cache setting. |
1166 | - give_update_option( 'cache', 'enabled' ); |
|
1166 | + give_update_option('cache', 'enabled'); |
|
1167 | 1167 | |
1168 | 1168 | // Upgrade email settings. |
1169 | 1169 | give_v20_upgrades_email_setting(); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $all_setting = give_get_settings(); |
1183 | 1183 | |
1184 | 1184 | // Bailout on fresh install. |
1185 | - if ( empty( $all_setting ) ) { |
|
1185 | + if (empty($all_setting)) { |
|
1186 | 1186 | return; |
1187 | 1187 | } |
1188 | 1188 | |
@@ -1201,19 +1201,19 @@ discard block |
||
1201 | 1201 | 'admin_notices' => 'new-donation_notification', |
1202 | 1202 | ); |
1203 | 1203 | |
1204 | - foreach ( $settings as $old_setting => $new_setting ) { |
|
1204 | + foreach ($settings as $old_setting => $new_setting) { |
|
1205 | 1205 | // Do not update already modified |
1206 | - if ( ! is_array( $new_setting ) ) { |
|
1207 | - if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) { |
|
1206 | + if ( ! is_array($new_setting)) { |
|
1207 | + if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) { |
|
1208 | 1208 | continue; |
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - switch ( $old_setting ) { |
|
1212 | + switch ($old_setting) { |
|
1213 | 1213 | case 'admin_notices': |
1214 | - $notification_status = give_get_option( $old_setting, 'enabled' ); |
|
1214 | + $notification_status = give_get_option($old_setting, 'enabled'); |
|
1215 | 1215 | |
1216 | - give_update_option( $new_setting, $notification_status ); |
|
1216 | + give_update_option($new_setting, $notification_status); |
|
1217 | 1217 | |
1218 | 1218 | // @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon. |
1219 | 1219 | // give_delete_option( $old_setting ); |
@@ -1224,19 +1224,19 @@ discard block |
||
1224 | 1224 | case 'admin_notice_emails': |
1225 | 1225 | $recipients = give_get_admin_notice_emails(); |
1226 | 1226 | |
1227 | - foreach ( $new_setting as $setting ) { |
|
1227 | + foreach ($new_setting as $setting) { |
|
1228 | 1228 | // bailout if setting already exist. |
1229 | - if ( array_key_exists( $setting, $all_setting ) ) { |
|
1229 | + if (array_key_exists($setting, $all_setting)) { |
|
1230 | 1230 | continue; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - give_update_option( $setting, $recipients ); |
|
1233 | + give_update_option($setting, $recipients); |
|
1234 | 1234 | } |
1235 | 1235 | break; |
1236 | 1236 | |
1237 | 1237 | default: |
1238 | - give_update_option( $new_setting, give_get_option( $old_setting ) ); |
|
1239 | - give_delete_option( $old_setting ); |
|
1238 | + give_update_option($new_setting, give_get_option($old_setting)); |
|
1239 | + give_delete_option($old_setting); |
|
1240 | 1240 | } |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1253,22 +1253,22 @@ discard block |
||
1253 | 1253 | $give_settings = give_get_settings(); |
1254 | 1254 | $give_setting_updated = false; |
1255 | 1255 | |
1256 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
1256 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
1257 | 1257 | $give_settings['number_decimals'] = 0; |
1258 | 1258 | $give_settings['decimal_separator'] = ''; |
1259 | 1259 | $give_setting_updated = true; |
1260 | 1260 | |
1261 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
1261 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
1262 | 1262 | $give_settings['number_decimals'] = 0; |
1263 | 1263 | $give_setting_updated = true; |
1264 | 1264 | |
1265 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
1265 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
1266 | 1266 | $give_settings['number_decimals'] = 5; |
1267 | 1267 | $give_setting_updated = true; |
1268 | 1268 | } |
1269 | 1269 | |
1270 | - if ( $give_setting_updated ) { |
|
1271 | - update_option( 'give_settings', $give_settings, false ); |
|
1270 | + if ($give_setting_updated) { |
|
1271 | + update_option('give_settings', $give_settings, false); |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1287,69 +1287,69 @@ discard block |
||
1287 | 1287 | $give_updates = Give_Updates::get_instance(); |
1288 | 1288 | |
1289 | 1289 | // form query. |
1290 | - $donation_forms = new WP_Query( array( |
|
1290 | + $donation_forms = new WP_Query(array( |
|
1291 | 1291 | 'paged' => $give_updates->step, |
1292 | 1292 | 'status' => 'any', |
1293 | 1293 | 'order' => 'ASC', |
1294 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1294 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1295 | 1295 | 'posts_per_page' => 20, |
1296 | 1296 | ) |
1297 | 1297 | ); |
1298 | - if ( $donation_forms->have_posts() ) { |
|
1299 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1298 | + if ($donation_forms->have_posts()) { |
|
1299 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1300 | 1300 | |
1301 | - while ( $donation_forms->have_posts() ) { |
|
1301 | + while ($donation_forms->have_posts()) { |
|
1302 | 1302 | $donation_forms->the_post(); |
1303 | 1303 | global $post; |
1304 | 1304 | |
1305 | - $meta = get_post_meta( $post->ID ); |
|
1305 | + $meta = get_post_meta($post->ID); |
|
1306 | 1306 | |
1307 | - switch ( $post->post_type ) { |
|
1307 | + switch ($post->post_type) { |
|
1308 | 1308 | case 'give_forms': |
1309 | 1309 | // _give_set_price. |
1310 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1311 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1310 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1311 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | // _give_custom_amount_minimum. |
1315 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1316 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1315 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1316 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | // _give_levels_minimum_amount. |
1320 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1321 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1320 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1321 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | // _give_levels_maximum_amount. |
1325 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1326 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1325 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1326 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1327 | 1327 | } |
1328 | 1328 | |
1329 | 1329 | // _give_set_goal. |
1330 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1331 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1330 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1331 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | // _give_form_earnings. |
1335 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1336 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1335 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1336 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | // _give_custom_amount_minimum. |
1340 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1341 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1340 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1341 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1342 | 1342 | |
1343 | - foreach ( $donation_levels as $index => $level ) { |
|
1344 | - if ( empty( $level['_give_amount'] ) ) { |
|
1343 | + foreach ($donation_levels as $index => $level) { |
|
1344 | + if (empty($level['_give_amount'])) { |
|
1345 | 1345 | continue; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1348 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | $meta['_give_donation_levels'] = $donation_levels; |
1352 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1352 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | |
@@ -1357,8 +1357,8 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | case 'give_payment': |
1359 | 1359 | // _give_payment_total. |
1360 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1361 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1360 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1361 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | break; |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | wp_reset_postdata(); |
1370 | 1370 | } else { |
1371 | 1371 | // The Update Ran. |
1372 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1372 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,22 +1388,22 @@ discard block |
||
1388 | 1388 | $give_updates = Give_Updates::get_instance(); |
1389 | 1389 | |
1390 | 1390 | // form query. |
1391 | - $donors = Give()->donors->get_donors( array( |
|
1391 | + $donors = Give()->donors->get_donors(array( |
|
1392 | 1392 | 'number' => 20, |
1393 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1393 | + 'offset' => $give_updates->get_offset(20), |
|
1394 | 1394 | ) |
1395 | 1395 | ); |
1396 | 1396 | |
1397 | - if ( ! empty( $donors ) ) { |
|
1398 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1397 | + if ( ! empty($donors)) { |
|
1398 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1399 | 1399 | |
1400 | 1400 | /* @var Object $donor */ |
1401 | - foreach ( $donors as $donor ) { |
|
1402 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1401 | + foreach ($donors as $donor) { |
|
1402 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1403 | 1403 | } |
1404 | 1404 | } else { |
1405 | 1405 | // The Update Ran. |
1406 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1406 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | |
@@ -1417,25 +1417,25 @@ discard block |
||
1417 | 1417 | $give_updates = Give_Updates::get_instance(); |
1418 | 1418 | |
1419 | 1419 | // Fetch all the existing donors. |
1420 | - $donors = Give()->donors->get_donors( array( |
|
1420 | + $donors = Give()->donors->get_donors(array( |
|
1421 | 1421 | 'number' => 20, |
1422 | - 'offset' => $give_updates->get_offset( 20 ), |
|
1422 | + 'offset' => $give_updates->get_offset(20), |
|
1423 | 1423 | ) |
1424 | 1424 | ); |
1425 | 1425 | |
1426 | - if ( ! empty( $donors ) ) { |
|
1427 | - $give_updates->set_percentage( Give()->donors->count(), $give_updates->get_offset( 20 ) ); |
|
1426 | + if ( ! empty($donors)) { |
|
1427 | + $give_updates->set_percentage(Give()->donors->count(), $give_updates->get_offset(20)); |
|
1428 | 1428 | |
1429 | 1429 | /* @var Object $donor */ |
1430 | - foreach ( $donors as $donor ) { |
|
1430 | + foreach ($donors as $donor) { |
|
1431 | 1431 | $user_id = $donor->user_id; |
1432 | 1432 | |
1433 | 1433 | // Proceed, if donor is attached with user. |
1434 | - if ( $user_id ) { |
|
1435 | - $user = get_userdata( $user_id ); |
|
1434 | + if ($user_id) { |
|
1435 | + $user = get_userdata($user_id); |
|
1436 | 1436 | |
1437 | 1437 | // Update user role, if user has subscriber role. |
1438 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1438 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1439 | 1439 | wp_update_user( |
1440 | 1440 | array( |
1441 | 1441 | 'ID' => $user_id, |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | } |
1448 | 1448 | } else { |
1449 | 1449 | // The Update Ran. |
1450 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1450 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1451 | 1451 | } |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | */ |
1460 | 1460 | function give_v1813_upgrades() { |
1461 | 1461 | // Update admin setting. |
1462 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1462 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1463 | 1463 | |
1464 | 1464 | // Update Give roles. |
1465 | 1465 | $roles = new Give_Roles(); |
@@ -1477,33 +1477,33 @@ discard block |
||
1477 | 1477 | $give_updates = Give_Updates::get_instance(); |
1478 | 1478 | |
1479 | 1479 | // form query. |
1480 | - $payments = new WP_Query( array( |
|
1480 | + $payments = new WP_Query(array( |
|
1481 | 1481 | 'paged' => $give_updates->step, |
1482 | 1482 | 'status' => 'any', |
1483 | 1483 | 'order' => 'ASC', |
1484 | - 'post_type' => array( 'give_payment' ), |
|
1484 | + 'post_type' => array('give_payment'), |
|
1485 | 1485 | 'posts_per_page' => 100, |
1486 | 1486 | ) |
1487 | 1487 | ); |
1488 | 1488 | |
1489 | - if ( $payments->have_posts() ) { |
|
1490 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) ); |
|
1489 | + if ($payments->have_posts()) { |
|
1490 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100)); |
|
1491 | 1491 | |
1492 | - while ( $payments->have_posts() ) { |
|
1492 | + while ($payments->have_posts()) { |
|
1493 | 1493 | $payments->the_post(); |
1494 | 1494 | |
1495 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1495 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1496 | 1496 | |
1497 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1497 | + if ('RIAL' === $payment_meta['currency']) { |
|
1498 | 1498 | $payment_meta['currency'] = 'IRR'; |
1499 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1499 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1500 | 1500 | } |
1501 | 1501 | |
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | } else { |
1505 | 1505 | // The Update Ran. |
1506 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1506 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1516,9 +1516,9 @@ discard block |
||
1516 | 1516 | function give_v1817_upgrades() { |
1517 | 1517 | $give_settings = give_get_settings(); |
1518 | 1518 | |
1519 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1519 | + if ('RIAL' === $give_settings['currency']) { |
|
1520 | 1520 | $give_settings['currency'] = 'IRR'; |
1521 | - update_option( 'give_settings', $give_settings, false ); |
|
1521 | + update_option('give_settings', $give_settings, false); |
|
1522 | 1522 | } |
1523 | 1523 | } |
1524 | 1524 | |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | |
1532 | 1532 | global $wp_roles; |
1533 | 1533 | |
1534 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1534 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1535 | 1535 | return; |
1536 | 1536 | } |
1537 | 1537 | |
@@ -1555,15 +1555,15 @@ discard block |
||
1555 | 1555 | ), |
1556 | 1556 | ); |
1557 | 1557 | |
1558 | - foreach ( $add_caps as $role => $caps ) { |
|
1559 | - foreach ( $caps as $cap ) { |
|
1560 | - $wp_roles->add_cap( $role, $cap ); |
|
1558 | + foreach ($add_caps as $role => $caps) { |
|
1559 | + foreach ($caps as $cap) { |
|
1560 | + $wp_roles->add_cap($role, $cap); |
|
1561 | 1561 | } |
1562 | 1562 | } |
1563 | 1563 | |
1564 | - foreach ( $remove_caps as $role => $caps ) { |
|
1565 | - foreach ( $caps as $cap ) { |
|
1566 | - $wp_roles->remove_cap( $role, $cap ); |
|
1564 | + foreach ($remove_caps as $role => $caps) { |
|
1565 | + foreach ($caps as $cap) { |
|
1566 | + $wp_roles->remove_cap($role, $cap); |
|
1567 | 1567 | } |
1568 | 1568 | } |
1569 | 1569 | |
@@ -1587,7 +1587,7 @@ discard block |
||
1587 | 1587 | $roles->add_roles(); |
1588 | 1588 | $roles->add_caps(); |
1589 | 1589 | |
1590 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1590 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | /** |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | function give_v1818_upgrades() { |
1599 | 1599 | |
1600 | 1600 | // Remove email_access_installed from give_settings. |
1601 | - give_delete_option( 'email_access_installed' ); |
|
1601 | + give_delete_option('email_access_installed'); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | /** |
@@ -1611,23 +1611,23 @@ discard block |
||
1611 | 1611 | /* @var Give_Updates $give_updates */ |
1612 | 1612 | $give_updates = Give_Updates::get_instance(); |
1613 | 1613 | |
1614 | - $donations = new WP_Query( array( |
|
1614 | + $donations = new WP_Query(array( |
|
1615 | 1615 | 'paged' => $give_updates->step, |
1616 | 1616 | 'status' => 'any', |
1617 | 1617 | 'order' => 'ASC', |
1618 | - 'post_type' => array( 'give_payment' ), |
|
1618 | + 'post_type' => array('give_payment'), |
|
1619 | 1619 | 'posts_per_page' => 100, |
1620 | 1620 | ) |
1621 | 1621 | ); |
1622 | 1622 | |
1623 | - if ( $donations->have_posts() ) { |
|
1624 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 ); |
|
1623 | + if ($donations->have_posts()) { |
|
1624 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 100); |
|
1625 | 1625 | |
1626 | - while ( $donations->have_posts() ) { |
|
1626 | + while ($donations->have_posts()) { |
|
1627 | 1627 | $donations->the_post(); |
1628 | 1628 | |
1629 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1630 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1629 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1630 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1631 | 1631 | |
1632 | 1632 | // Update Donation meta with price_id set as custom, only if it is: |
1633 | 1633 | // 1. Donation Type = Set Donation. |
@@ -1636,19 +1636,19 @@ discard block |
||
1636 | 1636 | if ( |
1637 | 1637 | $form->ID && |
1638 | 1638 | $form->is_set_type_donation_form() && |
1639 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1640 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1639 | + ('custom' !== $donation_meta['price_id']) && |
|
1640 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1641 | 1641 | ) { |
1642 | 1642 | $donation_meta['price_id'] = 'custom'; |
1643 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1644 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1643 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1644 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1645 | 1645 | } |
1646 | 1646 | } |
1647 | 1647 | |
1648 | 1648 | wp_reset_postdata(); |
1649 | 1649 | } else { |
1650 | 1650 | // Update Ran Successfully. |
1651 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1651 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | |
1667 | 1667 | global $wp_roles; |
1668 | 1668 | |
1669 | - if ( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1669 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1670 | 1670 | return; |
1671 | 1671 | } |
1672 | 1672 | |
@@ -1684,9 +1684,9 @@ discard block |
||
1684 | 1684 | ), |
1685 | 1685 | ); |
1686 | 1686 | |
1687 | - foreach ( $remove_caps as $role => $caps ) { |
|
1688 | - foreach ( $caps as $cap ) { |
|
1689 | - $wp_roles->remove_cap( $role, $cap ); |
|
1687 | + foreach ($remove_caps as $role => $caps) { |
|
1688 | + foreach ($caps as $cap) { |
|
1689 | + $wp_roles->remove_cap($role, $cap); |
|
1690 | 1690 | } |
1691 | 1691 | } |
1692 | 1692 | |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | $roles->add_roles(); |
1698 | 1698 | $roles->add_caps(); |
1699 | 1699 | |
1700 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1700 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | /** |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $give_updates = Give_Updates::get_instance(); |
1712 | 1712 | |
1713 | 1713 | // form query |
1714 | - $forms = new WP_Query( array( |
|
1714 | + $forms = new WP_Query(array( |
|
1715 | 1715 | 'paged' => $give_updates->step, |
1716 | 1716 | 'status' => 'any', |
1717 | 1717 | 'order' => 'ASC', |
@@ -1720,22 +1720,22 @@ discard block |
||
1720 | 1720 | ) |
1721 | 1721 | ); |
1722 | 1722 | |
1723 | - if ( $forms->have_posts() ) { |
|
1724 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1723 | + if ($forms->have_posts()) { |
|
1724 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1725 | 1725 | |
1726 | - while ( $forms->have_posts() ) { |
|
1726 | + while ($forms->have_posts()) { |
|
1727 | 1727 | $forms->the_post(); |
1728 | 1728 | global $post; |
1729 | 1729 | |
1730 | 1730 | // Update offline instruction email notification status. |
1731 | - $offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
1732 | - $offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array( |
|
1731 | + $offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
1732 | + $offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array( |
|
1733 | 1733 | 'enabled', |
1734 | 1734 | 'global', |
1735 | - ) ) |
|
1735 | + )) |
|
1736 | 1736 | ? $offline_instruction_notification_status |
1737 | 1737 | : 'global'; |
1738 | - update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status ); |
|
1738 | + update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status); |
|
1739 | 1739 | |
1740 | 1740 | // Update offline instruction email message. |
1741 | 1741 | update_post_meta( |
@@ -1767,7 +1767,7 @@ discard block |
||
1767 | 1767 | wp_reset_postdata(); |
1768 | 1768 | } else { |
1769 | 1769 | // No more forms found, finish up. |
1770 | - give_set_upgrade_complete( 'v20_upgrades_form_metadata' ); |
|
1770 | + give_set_upgrade_complete('v20_upgrades_form_metadata'); |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1784,7 +1784,7 @@ discard block |
||
1784 | 1784 | $give_updates = Give_Updates::get_instance(); |
1785 | 1785 | |
1786 | 1786 | // form query |
1787 | - $forms = new WP_Query( array( |
|
1787 | + $forms = new WP_Query(array( |
|
1788 | 1788 | 'paged' => $give_updates->step, |
1789 | 1789 | 'status' => 'any', |
1790 | 1790 | 'order' => 'ASC', |
@@ -1793,19 +1793,19 @@ discard block |
||
1793 | 1793 | ) |
1794 | 1794 | ); |
1795 | 1795 | |
1796 | - if ( $forms->have_posts() ) { |
|
1797 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) ); |
|
1796 | + if ($forms->have_posts()) { |
|
1797 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100)); |
|
1798 | 1798 | |
1799 | - while ( $forms->have_posts() ) { |
|
1799 | + while ($forms->have_posts()) { |
|
1800 | 1800 | $forms->the_post(); |
1801 | 1801 | global $post; |
1802 | 1802 | |
1803 | 1803 | // Split _give_payment_meta meta. |
1804 | 1804 | // @todo Remove _give_payment_meta after releases 2.0 |
1805 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
1805 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
1806 | 1806 | |
1807 | - if ( ! empty( $payment_meta ) ) { |
|
1808 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
1807 | + if ( ! empty($payment_meta)) { |
|
1808 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
1809 | 1809 | } |
1810 | 1810 | |
1811 | 1811 | $deprecated_meta_keys = array( |
@@ -1814,9 +1814,9 @@ discard block |
||
1814 | 1814 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
1815 | 1815 | ); |
1816 | 1816 | |
1817 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
1817 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
1818 | 1818 | // Do not add new meta key if already exist. |
1819 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
1819 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
1820 | 1820 | continue; |
1821 | 1821 | } |
1822 | 1822 | |
@@ -1825,25 +1825,25 @@ discard block |
||
1825 | 1825 | array( |
1826 | 1826 | 'post_id' => $post->ID, |
1827 | 1827 | 'meta_key' => $new_meta_key, |
1828 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
1828 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
1829 | 1829 | ) |
1830 | 1830 | ); |
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | // Bailout |
1834 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
1834 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
1835 | 1835 | /* @var Give_Donor $donor */ |
1836 | - $donor = new Give_Donor( $donor_id ); |
|
1836 | + $donor = new Give_Donor($donor_id); |
|
1837 | 1837 | |
1838 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
1839 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
1840 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
1841 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
1842 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
1843 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
1838 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
1839 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
1840 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
1841 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
1842 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
1843 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
1844 | 1844 | |
1845 | 1845 | // Save address. |
1846 | - $donor->add_address( 'billing[]', $address ); |
|
1846 | + $donor->add_address('billing[]', $address); |
|
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | }// End while(). |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
1855 | 1855 | |
1856 | 1856 | // No more forms found, finish up. |
1857 | - give_set_upgrade_complete( 'v20_upgrades_payment_metadata' ); |
|
1857 | + give_set_upgrade_complete('v20_upgrades_payment_metadata'); |
|
1858 | 1858 | } |
1859 | 1859 | } |
1860 | 1860 | |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | $give_updates = Give_Updates::get_instance(); |
1871 | 1871 | |
1872 | 1872 | // form query |
1873 | - $forms = new WP_Query( array( |
|
1873 | + $forms = new WP_Query(array( |
|
1874 | 1874 | 'paged' => $give_updates->step, |
1875 | 1875 | 'order' => 'DESC', |
1876 | 1876 | 'post_type' => 'give_log', |
@@ -1879,20 +1879,20 @@ discard block |
||
1879 | 1879 | ) |
1880 | 1880 | ); |
1881 | 1881 | |
1882 | - if ( $forms->have_posts() ) { |
|
1883 | - $give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 ); |
|
1882 | + if ($forms->have_posts()) { |
|
1883 | + $give_updates->set_percentage($forms->found_posts, $give_updates->step * 100); |
|
1884 | 1884 | |
1885 | - while ( $forms->have_posts() ) { |
|
1885 | + while ($forms->have_posts()) { |
|
1886 | 1886 | $forms->the_post(); |
1887 | 1887 | global $post; |
1888 | 1888 | |
1889 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
1889 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
1890 | 1890 | continue; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
1894 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
1895 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
1893 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
1894 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
1895 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
1896 | 1896 | |
1897 | 1897 | $log_data = array( |
1898 | 1898 | 'ID' => $post->ID, |
@@ -1905,29 +1905,29 @@ discard block |
||
1905 | 1905 | ); |
1906 | 1906 | $log_meta = array(); |
1907 | 1907 | |
1908 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
1909 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
1910 | - switch ( $meta_key ) { |
|
1908 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
1909 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
1910 | + switch ($meta_key) { |
|
1911 | 1911 | case '_give_log_payment_id': |
1912 | - $log_data['log_parent'] = current( $meta_value ); |
|
1912 | + $log_data['log_parent'] = current($meta_value); |
|
1913 | 1913 | $log_meta['_give_log_form_id'] = $post->post_parent; |
1914 | 1914 | break; |
1915 | 1915 | |
1916 | 1916 | default: |
1917 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
1917 | + $log_meta[$meta_key] = current($meta_value); |
|
1918 | 1918 | } |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - if ( 'api_request' === $term_name ) { |
|
1922 | + if ('api_request' === $term_name) { |
|
1923 | 1923 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
1926 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
1927 | 1927 | |
1928 | - if ( ! empty( $log_meta ) ) { |
|
1929 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
1930 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
1928 | + if ( ! empty($log_meta)) { |
|
1929 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
1930 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
1931 | 1931 | } |
1932 | 1932 | } |
1933 | 1933 | |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | Give()->logs->delete_cache(); |
1970 | 1970 | |
1971 | 1971 | // No more forms found, finish up. |
1972 | - give_set_upgrade_complete( 'v20_logs_upgrades' ); |
|
1972 | + give_set_upgrade_complete('v20_logs_upgrades'); |
|
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | |
@@ -1985,19 +1985,19 @@ discard block |
||
1985 | 1985 | $give_updates = Give_Updates::get_instance(); |
1986 | 1986 | |
1987 | 1987 | // form query |
1988 | - $payments = new WP_Query( array( |
|
1988 | + $payments = new WP_Query(array( |
|
1989 | 1989 | 'paged' => $give_updates->step, |
1990 | 1990 | 'status' => 'any', |
1991 | 1991 | 'order' => 'ASC', |
1992 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1992 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1993 | 1993 | 'posts_per_page' => 100, |
1994 | 1994 | ) |
1995 | 1995 | ); |
1996 | 1996 | |
1997 | - if ( $payments->have_posts() ) { |
|
1998 | - $give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 ); |
|
1997 | + if ($payments->have_posts()) { |
|
1998 | + $give_updates->set_percentage($payments->found_posts, $give_updates->step * 100); |
|
1999 | 1999 | |
2000 | - while ( $payments->have_posts() ) { |
|
2000 | + while ($payments->have_posts()) { |
|
2001 | 2001 | $payments->the_post(); |
2002 | 2002 | global $post; |
2003 | 2003 | |
@@ -2009,19 +2009,19 @@ discard block |
||
2009 | 2009 | ARRAY_A |
2010 | 2010 | ); |
2011 | 2011 | |
2012 | - if ( ! empty( $meta_data ) ) { |
|
2013 | - foreach ( $meta_data as $index => $data ) { |
|
2012 | + if ( ! empty($meta_data)) { |
|
2013 | + foreach ($meta_data as $index => $data) { |
|
2014 | 2014 | // Check for duplicate meta values. |
2015 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2015 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2016 | 2016 | continue; |
2017 | 2017 | } |
2018 | 2018 | |
2019 | - switch ( $post->post_type ) { |
|
2019 | + switch ($post->post_type) { |
|
2020 | 2020 | case 'give_forms': |
2021 | 2021 | $data['form_id'] = $data['post_id']; |
2022 | - unset( $data['post_id'] ); |
|
2022 | + unset($data['post_id']); |
|
2023 | 2023 | |
2024 | - Give()->form_meta->insert( $data ); |
|
2024 | + Give()->form_meta->insert($data); |
|
2025 | 2025 | // @todo: delete form meta from post meta table after releases 2.0. |
2026 | 2026 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2027 | 2027 | |
@@ -2029,9 +2029,9 @@ discard block |
||
2029 | 2029 | |
2030 | 2030 | case 'give_payment': |
2031 | 2031 | $data['payment_id'] = $data['post_id']; |
2032 | - unset( $data['post_id'] ); |
|
2032 | + unset($data['post_id']); |
|
2033 | 2033 | |
2034 | - Give()->payment_meta->insert( $data ); |
|
2034 | + Give()->payment_meta->insert($data); |
|
2035 | 2035 | |
2036 | 2036 | // @todo: delete donation meta from post meta table after releases 2.0. |
2037 | 2037 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2046,7 +2046,7 @@ discard block |
||
2046 | 2046 | wp_reset_postdata(); |
2047 | 2047 | } else { |
2048 | 2048 | // No more forms found, finish up. |
2049 | - give_set_upgrade_complete( 'v20_move_metadata_into_new_table' ); |
|
2049 | + give_set_upgrade_complete('v20_move_metadata_into_new_table'); |
|
2050 | 2050 | } |
2051 | 2051 | |
2052 | 2052 | } |
@@ -2062,44 +2062,44 @@ discard block |
||
2062 | 2062 | /* @var Give_Updates $give_updates */ |
2063 | 2063 | $give_updates = Give_Updates::get_instance(); |
2064 | 2064 | |
2065 | - $donors = Give()->donors->get_donors( array( |
|
2065 | + $donors = Give()->donors->get_donors(array( |
|
2066 | 2066 | 'paged' => $give_updates->step, |
2067 | 2067 | 'number' => 100, |
2068 | - ) ); |
|
2068 | + )); |
|
2069 | 2069 | |
2070 | - if ( $donors ) { |
|
2071 | - $give_updates->set_percentage( count( $donors ), $give_updates->step * 100 ); |
|
2070 | + if ($donors) { |
|
2071 | + $give_updates->set_percentage(count($donors), $give_updates->step * 100); |
|
2072 | 2072 | // Loop through Donors |
2073 | - foreach ( $donors as $donor ) { |
|
2073 | + foreach ($donors as $donor) { |
|
2074 | 2074 | |
2075 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2076 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2077 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2075 | + $donor_name = explode(' ', $donor->name, 2); |
|
2076 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2077 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2078 | 2078 | |
2079 | 2079 | // If first name meta of donor is not created, then create it. |
2080 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2081 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2080 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2081 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2082 | 2082 | } |
2083 | 2083 | |
2084 | 2084 | // If last name meta of donor is not created, then create it. |
2085 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2086 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2085 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2086 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2087 | 2087 | } |
2088 | 2088 | |
2089 | 2089 | // If Donor is connected with WP User then update user meta. |
2090 | - if ( $donor->user_id ) { |
|
2091 | - if ( isset( $donor_name[0] ) ) { |
|
2092 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2090 | + if ($donor->user_id) { |
|
2091 | + if (isset($donor_name[0])) { |
|
2092 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2093 | 2093 | } |
2094 | - if ( isset( $donor_name[1] ) ) { |
|
2095 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2094 | + if (isset($donor_name[1])) { |
|
2095 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2096 | 2096 | } |
2097 | 2097 | } |
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | } else { |
2101 | 2101 | // The Update Ran. |
2102 | - give_set_upgrade_complete( 'v20_upgrades_donor_name' ); |
|
2102 | + give_set_upgrade_complete('v20_upgrades_donor_name'); |
|
2103 | 2103 | } |
2104 | 2104 | |
2105 | 2105 | } |
@@ -2128,15 +2128,15 @@ discard block |
||
2128 | 2128 | |
2129 | 2129 | $users = $user_query->get_results(); |
2130 | 2130 | |
2131 | - if ( $users ) { |
|
2132 | - $give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 ); |
|
2131 | + if ($users) { |
|
2132 | + $give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100); |
|
2133 | 2133 | |
2134 | 2134 | // Loop through Donors |
2135 | - foreach ( $users as $user ) { |
|
2135 | + foreach ($users as $user) { |
|
2136 | 2136 | /* @var Give_Donor $donor */ |
2137 | - $donor = new Give_Donor( $user->ID, true ); |
|
2137 | + $donor = new Give_Donor($user->ID, true); |
|
2138 | 2138 | |
2139 | - if ( ! $donor->id ) { |
|
2139 | + if ( ! $donor->id) { |
|
2140 | 2140 | continue; |
2141 | 2141 | } |
2142 | 2142 | |
@@ -2152,10 +2152,10 @@ discard block |
||
2152 | 2152 | ) |
2153 | 2153 | ); |
2154 | 2154 | |
2155 | - if ( ! empty( $address ) ) { |
|
2156 | - $address = maybe_unserialize( $address ); |
|
2157 | - $donor->add_address( 'personal', $address ); |
|
2158 | - $donor->add_address( 'billing[]', $address ); |
|
2155 | + if ( ! empty($address)) { |
|
2156 | + $address = maybe_unserialize($address); |
|
2157 | + $donor->add_address('personal', $address); |
|
2158 | + $donor->add_address('billing[]', $address); |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | // @todo: delete _give_user_address from user meta after releases 2.0. |
@@ -2165,7 +2165,7 @@ discard block |
||
2165 | 2165 | |
2166 | 2166 | } else { |
2167 | 2167 | // The Update Ran. |
2168 | - give_set_upgrade_complete( 'v20_upgrades_user_address' ); |
|
2168 | + give_set_upgrade_complete('v20_upgrades_user_address'); |
|
2169 | 2169 | } |
2170 | 2170 | |
2171 | 2171 | } |
@@ -2189,15 +2189,15 @@ discard block |
||
2189 | 2189 | ); |
2190 | 2190 | |
2191 | 2191 | // Alter customer table |
2192 | - foreach ( $tables as $old_table => $new_table ) { |
|
2192 | + foreach ($tables as $old_table => $new_table) { |
|
2193 | 2193 | if ( |
2194 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) && |
|
2195 | - ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) ) |
|
2194 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) && |
|
2195 | + ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table)) |
|
2196 | 2196 | ) { |
2197 | - $wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" ); |
|
2197 | + $wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}"); |
|
2198 | 2198 | |
2199 | - if ( "{$wpdb->prefix}give_donormeta" === $new_table ) { |
|
2200 | - $wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" ); |
|
2199 | + if ("{$wpdb->prefix}give_donormeta" === $new_table) { |
|
2200 | + $wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)"); |
|
2201 | 2201 | } |
2202 | 2202 | } |
2203 | 2203 | } |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | $give_updates->percentage = 100; |
2206 | 2206 | |
2207 | 2207 | // No more forms found, finish up. |
2208 | - give_set_upgrade_complete( 'v20_rename_donor_tables' ); |
|
2208 | + give_set_upgrade_complete('v20_rename_donor_tables'); |
|
2209 | 2209 | |
2210 | 2210 | // Re initiate donor classes. |
2211 | 2211 | Give()->donors = new Give_DB_Donors(); |
@@ -2223,19 +2223,19 @@ discard block |
||
2223 | 2223 | function give_v201_create_tables() { |
2224 | 2224 | global $wpdb; |
2225 | 2225 | |
2226 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) { |
|
2226 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) { |
|
2227 | 2227 | Give()->payment_meta->create_table(); |
2228 | 2228 | } |
2229 | 2229 | |
2230 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) { |
|
2230 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) { |
|
2231 | 2231 | Give()->form_meta->create_table(); |
2232 | 2232 | } |
2233 | 2233 | |
2234 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) { |
|
2234 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) { |
|
2235 | 2235 | Give()->logs->log_db->create_table(); |
2236 | 2236 | } |
2237 | 2237 | |
2238 | - if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) { |
|
2238 | + if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) { |
|
2239 | 2239 | Give()->logs->logmeta_db->create_table(); |
2240 | 2240 | } |
2241 | 2241 | } |
@@ -2260,31 +2260,31 @@ discard block |
||
2260 | 2260 | $wpdb->posts.post_date >= '2018-01-08 00:00:00' |
2261 | 2261 | ) |
2262 | 2262 | AND $wpdb->posts.post_type = 'give_payment' |
2263 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2263 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2264 | 2264 | ORDER BY $wpdb->posts.post_date ASC |
2265 | 2265 | LIMIT 100 |
2266 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2266 | + OFFSET ".$give_updates->get_offset(100) |
|
2267 | 2267 | ); |
2268 | 2268 | |
2269 | - if ( ! empty( $payments ) ) { |
|
2270 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_payment' ), ( $give_updates->step * 100 ) ); |
|
2269 | + if ( ! empty($payments)) { |
|
2270 | + $give_updates->set_percentage(give_get_total_post_type_count('give_payment'), ($give_updates->step * 100)); |
|
2271 | 2271 | |
2272 | - foreach ( $payments as $payment_id ) { |
|
2273 | - $post = get_post( $payment_id ); |
|
2274 | - setup_postdata( $post ); |
|
2272 | + foreach ($payments as $payment_id) { |
|
2273 | + $post = get_post($payment_id); |
|
2274 | + setup_postdata($post); |
|
2275 | 2275 | |
2276 | 2276 | // Do not add new meta keys if already refactored. |
2277 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) { |
|
2277 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) { |
|
2278 | 2278 | continue; |
2279 | 2279 | } |
2280 | 2280 | |
2281 | 2281 | |
2282 | 2282 | // Split _give_payment_meta meta. |
2283 | 2283 | // @todo Remove _give_payment_meta after releases 2.0 |
2284 | - $payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true ); |
|
2284 | + $payment_meta = give_get_meta($post->ID, '_give_payment_meta', true); |
|
2285 | 2285 | |
2286 | - if ( ! empty( $payment_meta ) ) { |
|
2287 | - _give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta ); |
|
2286 | + if ( ! empty($payment_meta)) { |
|
2287 | + _give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta); |
|
2288 | 2288 | } |
2289 | 2289 | |
2290 | 2290 | $deprecated_meta_keys = array( |
@@ -2293,9 +2293,9 @@ discard block |
||
2293 | 2293 | '_give_payment_user_ip' => '_give_payment_donor_ip', |
2294 | 2294 | ); |
2295 | 2295 | |
2296 | - foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) { |
|
2296 | + foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) { |
|
2297 | 2297 | // Do not add new meta key if already exist. |
2298 | - if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) { |
|
2298 | + if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) { |
|
2299 | 2299 | continue; |
2300 | 2300 | } |
2301 | 2301 | |
@@ -2304,25 +2304,25 @@ discard block |
||
2304 | 2304 | array( |
2305 | 2305 | 'post_id' => $post->ID, |
2306 | 2306 | 'meta_key' => $new_meta_key, |
2307 | - 'meta_value' => give_get_meta( $post->ID, $old_meta_key, true ), |
|
2307 | + 'meta_value' => give_get_meta($post->ID, $old_meta_key, true), |
|
2308 | 2308 | ) |
2309 | 2309 | ); |
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | // Bailout |
2313 | - if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) { |
|
2313 | + if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) { |
|
2314 | 2314 | /* @var Give_Donor $donor */ |
2315 | - $donor = new Give_Donor( $donor_id ); |
|
2315 | + $donor = new Give_Donor($donor_id); |
|
2316 | 2316 | |
2317 | - $address['line1'] = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' ); |
|
2318 | - $address['line2'] = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' ); |
|
2319 | - $address['city'] = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' ); |
|
2320 | - $address['state'] = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' ); |
|
2321 | - $address['zip'] = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' ); |
|
2322 | - $address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' ); |
|
2317 | + $address['line1'] = give_get_meta($post->ID, '_give_donor_billing_address1', true, ''); |
|
2318 | + $address['line2'] = give_get_meta($post->ID, '_give_donor_billing_address2', true, ''); |
|
2319 | + $address['city'] = give_get_meta($post->ID, '_give_donor_billing_city', true, ''); |
|
2320 | + $address['state'] = give_get_meta($post->ID, '_give_donor_billing_state', true, ''); |
|
2321 | + $address['zip'] = give_get_meta($post->ID, '_give_donor_billing_zip', true, ''); |
|
2322 | + $address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, ''); |
|
2323 | 2323 | |
2324 | 2324 | // Save address. |
2325 | - $donor->add_address( 'billing[]', $address ); |
|
2325 | + $donor->add_address('billing[]', $address); |
|
2326 | 2326 | } |
2327 | 2327 | |
2328 | 2328 | }// End while(). |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | // $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) ); |
2334 | 2334 | |
2335 | 2335 | // No more forms found, finish up. |
2336 | - give_set_upgrade_complete( 'v201_upgrades_payment_metadata' ); |
|
2336 | + give_set_upgrade_complete('v201_upgrades_payment_metadata'); |
|
2337 | 2337 | } |
2338 | 2338 | } |
2339 | 2339 | |
@@ -2353,21 +2353,21 @@ discard block |
||
2353 | 2353 | SELECT ID FROM $wpdb->posts |
2354 | 2354 | WHERE 1=1 |
2355 | 2355 | AND ( $wpdb->posts.post_type = 'give_payment' OR $wpdb->posts.post_type = 'give_forms' ) |
2356 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2356 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2357 | 2357 | ORDER BY $wpdb->posts.post_date ASC |
2358 | 2358 | LIMIT 100 |
2359 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2359 | + OFFSET ".$give_updates->get_offset(100) |
|
2360 | 2360 | ); |
2361 | 2361 | |
2362 | - if ( ! empty( $payments ) ) { |
|
2363 | - $give_updates->set_percentage( give_get_total_post_type_count( array( |
|
2362 | + if ( ! empty($payments)) { |
|
2363 | + $give_updates->set_percentage(give_get_total_post_type_count(array( |
|
2364 | 2364 | 'give_forms', |
2365 | 2365 | 'give_payment', |
2366 | - ) ), $give_updates->step * 100 ); |
|
2366 | + )), $give_updates->step * 100); |
|
2367 | 2367 | |
2368 | - foreach ( $payments as $payment_id ) { |
|
2369 | - $post = get_post( $payment_id ); |
|
2370 | - setup_postdata( $post ); |
|
2368 | + foreach ($payments as $payment_id) { |
|
2369 | + $post = get_post($payment_id); |
|
2370 | + setup_postdata($post); |
|
2371 | 2371 | |
2372 | 2372 | $meta_data = $wpdb->get_results( |
2373 | 2373 | $wpdb->prepare( |
@@ -2377,19 +2377,19 @@ discard block |
||
2377 | 2377 | ARRAY_A |
2378 | 2378 | ); |
2379 | 2379 | |
2380 | - if ( ! empty( $meta_data ) ) { |
|
2381 | - foreach ( $meta_data as $index => $data ) { |
|
2380 | + if ( ! empty($meta_data)) { |
|
2381 | + foreach ($meta_data as $index => $data) { |
|
2382 | 2382 | // Check for duplicate meta values. |
2383 | - if ( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) . " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) { |
|
2383 | + if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) { |
|
2384 | 2384 | continue; |
2385 | 2385 | } |
2386 | 2386 | |
2387 | - switch ( $post->post_type ) { |
|
2387 | + switch ($post->post_type) { |
|
2388 | 2388 | case 'give_forms': |
2389 | 2389 | $data['form_id'] = $data['post_id']; |
2390 | - unset( $data['post_id'] ); |
|
2390 | + unset($data['post_id']); |
|
2391 | 2391 | |
2392 | - Give()->form_meta->insert( $data ); |
|
2392 | + Give()->form_meta->insert($data); |
|
2393 | 2393 | // @todo: delete form meta from post meta table after releases 2.0. |
2394 | 2394 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
2395 | 2395 | |
@@ -2397,9 +2397,9 @@ discard block |
||
2397 | 2397 | |
2398 | 2398 | case 'give_payment': |
2399 | 2399 | $data['payment_id'] = $data['post_id']; |
2400 | - unset( $data['post_id'] ); |
|
2400 | + unset($data['post_id']); |
|
2401 | 2401 | |
2402 | - Give()->payment_meta->insert( $data ); |
|
2402 | + Give()->payment_meta->insert($data); |
|
2403 | 2403 | |
2404 | 2404 | // @todo: delete donation meta from post meta table after releases 2.0. |
2405 | 2405 | /*delete_post_meta( get_the_ID(), $data['meta_key'] );*/ |
@@ -2414,7 +2414,7 @@ discard block |
||
2414 | 2414 | wp_reset_postdata(); |
2415 | 2415 | } else { |
2416 | 2416 | // No more forms found, finish up. |
2417 | - give_set_upgrade_complete( 'v201_move_metadata_into_new_table' ); |
|
2417 | + give_set_upgrade_complete('v201_move_metadata_into_new_table'); |
|
2418 | 2418 | } |
2419 | 2419 | |
2420 | 2420 | } |
@@ -2435,26 +2435,26 @@ discard block |
||
2435 | 2435 | SELECT ID FROM $wpdb->posts |
2436 | 2436 | WHERE 1=1 |
2437 | 2437 | AND $wpdb->posts.post_type = 'give_log' |
2438 | - AND {$wpdb->posts}.post_status IN ('" . implode( "','", array_keys( give_get_payment_statuses() ) ) . "') |
|
2438 | + AND {$wpdb->posts}.post_status IN ('".implode("','", array_keys(give_get_payment_statuses()))."') |
|
2439 | 2439 | ORDER BY $wpdb->posts.post_date ASC |
2440 | 2440 | LIMIT 100 |
2441 | - OFFSET " . $give_updates->get_offset( 100 ) |
|
2441 | + OFFSET ".$give_updates->get_offset(100) |
|
2442 | 2442 | ); |
2443 | 2443 | |
2444 | - if ( ! empty( $logs ) ) { |
|
2445 | - $give_updates->set_percentage( give_get_total_post_type_count( 'give_log' ), $give_updates->step * 100 ); |
|
2444 | + if ( ! empty($logs)) { |
|
2445 | + $give_updates->set_percentage(give_get_total_post_type_count('give_log'), $give_updates->step * 100); |
|
2446 | 2446 | |
2447 | - foreach ( $logs as $log_id ) { |
|
2448 | - $post = get_post( $log_id ); |
|
2449 | - setup_postdata( $post ); |
|
2447 | + foreach ($logs as $log_id) { |
|
2448 | + $post = get_post($log_id); |
|
2449 | + setup_postdata($post); |
|
2450 | 2450 | |
2451 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) { |
|
2451 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) { |
|
2452 | 2452 | continue; |
2453 | 2453 | } |
2454 | 2454 | |
2455 | - $term = get_the_terms( $post->ID, 'give_log_type' ); |
|
2456 | - $term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array(); |
|
2457 | - $term_name = ! empty( $term ) ? $term->slug : ''; |
|
2455 | + $term = get_the_terms($post->ID, 'give_log_type'); |
|
2456 | + $term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array(); |
|
2457 | + $term_name = ! empty($term) ? $term->slug : ''; |
|
2458 | 2458 | |
2459 | 2459 | $log_data = array( |
2460 | 2460 | 'ID' => $post->ID, |
@@ -2467,29 +2467,29 @@ discard block |
||
2467 | 2467 | ); |
2468 | 2468 | $log_meta = array(); |
2469 | 2469 | |
2470 | - if ( $old_log_meta = get_post_meta( $post->ID ) ) { |
|
2471 | - foreach ( $old_log_meta as $meta_key => $meta_value ) { |
|
2472 | - switch ( $meta_key ) { |
|
2470 | + if ($old_log_meta = get_post_meta($post->ID)) { |
|
2471 | + foreach ($old_log_meta as $meta_key => $meta_value) { |
|
2472 | + switch ($meta_key) { |
|
2473 | 2473 | case '_give_log_payment_id': |
2474 | - $log_data['log_parent'] = current( $meta_value ); |
|
2474 | + $log_data['log_parent'] = current($meta_value); |
|
2475 | 2475 | $log_meta['_give_log_form_id'] = $post->post_parent; |
2476 | 2476 | break; |
2477 | 2477 | |
2478 | 2478 | default: |
2479 | - $log_meta[ $meta_key ] = current( $meta_value ); |
|
2479 | + $log_meta[$meta_key] = current($meta_value); |
|
2480 | 2480 | } |
2481 | 2481 | } |
2482 | 2482 | } |
2483 | 2483 | |
2484 | - if ( 'api_request' === $term_name ) { |
|
2484 | + if ('api_request' === $term_name) { |
|
2485 | 2485 | $log_meta['_give_log_api_query'] = $post->post_excerpt; |
2486 | 2486 | } |
2487 | 2487 | |
2488 | - $wpdb->insert( "{$wpdb->prefix}give_logs", $log_data ); |
|
2488 | + $wpdb->insert("{$wpdb->prefix}give_logs", $log_data); |
|
2489 | 2489 | |
2490 | - if ( ! empty( $log_meta ) ) { |
|
2491 | - foreach ( $log_meta as $meta_key => $meta_value ) { |
|
2492 | - Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value ); |
|
2490 | + if ( ! empty($log_meta)) { |
|
2491 | + foreach ($log_meta as $meta_key => $meta_value) { |
|
2492 | + Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value); |
|
2493 | 2493 | } |
2494 | 2494 | } |
2495 | 2495 | |
@@ -2502,7 +2502,7 @@ discard block |
||
2502 | 2502 | Give()->logs->delete_cache(); |
2503 | 2503 | |
2504 | 2504 | // No more forms found, finish up. |
2505 | - give_set_upgrade_complete( 'v201_logs_upgrades' ); |
|
2505 | + give_set_upgrade_complete('v201_logs_upgrades'); |
|
2506 | 2506 | } |
2507 | 2507 | } |
2508 | 2508 | |
@@ -2517,51 +2517,51 @@ discard block |
||
2517 | 2517 | global $wpdb; |
2518 | 2518 | give_v201_create_tables(); |
2519 | 2519 | |
2520 | - if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) { |
|
2521 | - $customers = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' ); |
|
2522 | - $donors = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' ); |
|
2520 | + if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) { |
|
2521 | + $customers = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id'); |
|
2522 | + $donors = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id'); |
|
2523 | 2523 | $donor_data = array(); |
2524 | 2524 | |
2525 | - if ( $missing_donors = array_diff( $customers, $donors ) ) { |
|
2526 | - foreach ( $missing_donors as $donor_id ) { |
|
2525 | + if ($missing_donors = array_diff($customers, $donors)) { |
|
2526 | + foreach ($missing_donors as $donor_id) { |
|
2527 | 2527 | $donor_data[] = array( |
2528 | - 'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ), |
|
2529 | - 'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ), |
|
2528 | + 'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)), |
|
2529 | + 'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)), |
|
2530 | 2530 | |
2531 | 2531 | ); |
2532 | 2532 | } |
2533 | 2533 | } |
2534 | 2534 | |
2535 | - if ( ! empty( $donor_data ) ) { |
|
2535 | + if ( ! empty($donor_data)) { |
|
2536 | 2536 | $donor_table_name = Give()->donors->table_name; |
2537 | 2537 | $donor_meta_table_name = Give()->donor_meta->table_name; |
2538 | 2538 | |
2539 | 2539 | Give()->donors->table_name = "{$wpdb->prefix}give_donors"; |
2540 | 2540 | Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta"; |
2541 | 2541 | |
2542 | - foreach ( $donor_data as $donor ) { |
|
2542 | + foreach ($donor_data as $donor) { |
|
2543 | 2543 | $donor['info'][0] = (array) $donor['info'][0]; |
2544 | 2544 | |
2545 | 2545 | // Prevent duplicate meta id issue. |
2546 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ) { |
|
2546 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) { |
|
2547 | 2547 | continue; |
2548 | 2548 | } |
2549 | 2549 | |
2550 | - $donor_id = Give()->donors->add( $donor['info'][0] ); |
|
2550 | + $donor_id = Give()->donors->add($donor['info'][0]); |
|
2551 | 2551 | |
2552 | - if ( ! empty( $donor['meta'] ) ) { |
|
2553 | - foreach ( $donor['meta'] as $donor_meta ) { |
|
2552 | + if ( ! empty($donor['meta'])) { |
|
2553 | + foreach ($donor['meta'] as $donor_meta) { |
|
2554 | 2554 | $donor_meta = (array) $donor_meta; |
2555 | 2555 | |
2556 | 2556 | // Prevent duplicate meta id issue. |
2557 | - if ( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ) { |
|
2558 | - unset( $donor_meta['meta_id'] ); |
|
2557 | + if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) { |
|
2558 | + unset($donor_meta['meta_id']); |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | $donor_meta['donor_id'] = $donor_meta['customer_id']; |
2562 | - unset( $donor_meta['customer_id'] ); |
|
2562 | + unset($donor_meta['customer_id']); |
|
2563 | 2563 | |
2564 | - Give()->donor_meta->insert( $donor_meta ); |
|
2564 | + Give()->donor_meta->insert($donor_meta); |
|
2565 | 2565 | } |
2566 | 2566 | } |
2567 | 2567 | |
@@ -2580,35 +2580,35 @@ discard block |
||
2580 | 2580 | ) |
2581 | 2581 | ); |
2582 | 2582 | |
2583 | - $donor = new Give_Donor( $donor_id ); |
|
2583 | + $donor = new Give_Donor($donor_id); |
|
2584 | 2584 | |
2585 | - if ( ! empty( $address ) ) { |
|
2586 | - $address = maybe_unserialize( $address ); |
|
2587 | - $donor->add_address( 'personal', $address ); |
|
2588 | - $donor->add_address( 'billing[]', $address ); |
|
2585 | + if ( ! empty($address)) { |
|
2586 | + $address = maybe_unserialize($address); |
|
2587 | + $donor->add_address('personal', $address); |
|
2588 | + $donor->add_address('billing[]', $address); |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | - $donor_name = explode( ' ', $donor->name, 2 ); |
|
2592 | - $donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' ); |
|
2593 | - $donor_last_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' ); |
|
2591 | + $donor_name = explode(' ', $donor->name, 2); |
|
2592 | + $donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name'); |
|
2593 | + $donor_last_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name'); |
|
2594 | 2594 | |
2595 | 2595 | // If first name meta of donor is not created, then create it. |
2596 | - if ( ! $donor_first_name && isset( $donor_name[0] ) ) { |
|
2597 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] ); |
|
2596 | + if ( ! $donor_first_name && isset($donor_name[0])) { |
|
2597 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]); |
|
2598 | 2598 | } |
2599 | 2599 | |
2600 | 2600 | // If last name meta of donor is not created, then create it. |
2601 | - if ( ! $donor_last_name && isset( $donor_name[1] ) ) { |
|
2602 | - Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] ); |
|
2601 | + if ( ! $donor_last_name && isset($donor_name[1])) { |
|
2602 | + Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]); |
|
2603 | 2603 | } |
2604 | 2604 | |
2605 | 2605 | // If Donor is connected with WP User then update user meta. |
2606 | - if ( $donor->user_id ) { |
|
2607 | - if ( isset( $donor_name[0] ) ) { |
|
2608 | - update_user_meta( $donor->user_id, 'first_name', $donor_name[0] ); |
|
2606 | + if ($donor->user_id) { |
|
2607 | + if (isset($donor_name[0])) { |
|
2608 | + update_user_meta($donor->user_id, 'first_name', $donor_name[0]); |
|
2609 | 2609 | } |
2610 | - if ( isset( $donor_name[1] ) ) { |
|
2611 | - update_user_meta( $donor->user_id, 'last_name', $donor_name[1] ); |
|
2610 | + if (isset($donor_name[1])) { |
|
2611 | + update_user_meta($donor->user_id, 'last_name', $donor_name[1]); |
|
2612 | 2612 | } |
2613 | 2613 | } |
2614 | 2614 | } |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | } |
2620 | 2620 | |
2621 | 2621 | Give_Updates::get_instance()->percentage = 100; |
2622 | - give_set_upgrade_complete( 'v201_add_missing_donors' ); |
|
2622 | + give_set_upgrade_complete('v201_add_missing_donors'); |
|
2623 | 2623 | } |
2624 | 2624 | |
2625 | 2625 | |
@@ -2632,14 +2632,14 @@ discard block |
||
2632 | 2632 | global $wpdb; |
2633 | 2633 | |
2634 | 2634 | // Do not auto load option. |
2635 | - $wpdb->update( $wpdb->options, array( 'autoload' => 'no' ), array( 'option_name' => 'give_completed_upgrades' ) ); |
|
2635 | + $wpdb->update($wpdb->options, array('autoload' => 'no'), array('option_name' => 'give_completed_upgrades')); |
|
2636 | 2636 | |
2637 | 2637 | // Remove from cache. |
2638 | 2638 | $all_options = wp_load_alloptions(); |
2639 | 2639 | |
2640 | - if ( isset( $all_options['give_completed_upgrades'] ) ) { |
|
2641 | - unset( $all_options['give_completed_upgrades'] ); |
|
2642 | - wp_cache_set( 'alloptions', $all_options, 'options' ); |
|
2640 | + if (isset($all_options['give_completed_upgrades'])) { |
|
2641 | + unset($all_options['give_completed_upgrades']); |
|
2642 | + wp_cache_set('alloptions', $all_options, 'options'); |
|
2643 | 2643 | } |
2644 | 2644 | |
2645 | 2645 | } |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | * |
2651 | 2651 | * @since 2.2.0 |
2652 | 2652 | */ |
2653 | -function give_v220_upgrades(){ |
|
2653 | +function give_v220_upgrades() { |
|
2654 | 2654 | global $wpdb; |
2655 | 2655 | |
2656 | 2656 | /** |
@@ -2703,11 +2703,11 @@ discard block |
||
2703 | 2703 | " |
2704 | 2704 | ); |
2705 | 2705 | |
2706 | - if( ! empty( $option_like ) ) { |
|
2707 | - $options = array_merge( $options, $option_like ); |
|
2706 | + if ( ! empty($option_like)) { |
|
2707 | + $options = array_merge($options, $option_like); |
|
2708 | 2708 | } |
2709 | 2709 | |
2710 | - $options_str = '\'' . implode( "','", $options ) . '\''; |
|
2710 | + $options_str = '\''.implode("','", $options).'\''; |
|
2711 | 2711 | |
2712 | 2712 | $wpdb->query( |
2713 | 2713 | " |
@@ -2731,7 +2731,7 @@ discard block |
||
2731 | 2731 | * |
2732 | 2732 | * Change column length |
2733 | 2733 | */ |
2734 | - $wpdb->query( "ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL" ); |
|
2734 | + $wpdb->query("ALTER TABLE $wpdb->donors MODIFY email varchar(255) NOT NULL"); |
|
2735 | 2735 | } |
2736 | 2736 | |
2737 | 2737 | /** |
@@ -2744,7 +2744,7 @@ discard block |
||
2744 | 2744 | $give_updates = Give_Updates::get_instance(); |
2745 | 2745 | |
2746 | 2746 | // form query. |
2747 | - $donation_forms = new WP_Query( array( |
|
2747 | + $donation_forms = new WP_Query(array( |
|
2748 | 2748 | 'paged' => $give_updates->step, |
2749 | 2749 | 'status' => 'any', |
2750 | 2750 | 'order' => 'ASC', |
@@ -2753,16 +2753,16 @@ discard block |
||
2753 | 2753 | ) |
2754 | 2754 | ); |
2755 | 2755 | |
2756 | - if ( $donation_forms->have_posts() ) { |
|
2757 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
2756 | + if ($donation_forms->have_posts()) { |
|
2757 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
2758 | 2758 | |
2759 | - while ( $donation_forms->have_posts() ) { |
|
2759 | + while ($donation_forms->have_posts()) { |
|
2760 | 2760 | $donation_forms->the_post(); |
2761 | 2761 | $form_id = get_the_ID(); |
2762 | 2762 | |
2763 | - $form_closed_status = give_get_meta( $form_id, '_give_form_status', true ); |
|
2764 | - if ( empty( $form_closed_status ) ) { |
|
2765 | - give_set_form_closed_status( $form_id ); |
|
2763 | + $form_closed_status = give_get_meta($form_id, '_give_form_status', true); |
|
2764 | + if (empty($form_closed_status)) { |
|
2765 | + give_set_form_closed_status($form_id); |
|
2766 | 2766 | } |
2767 | 2767 | } |
2768 | 2768 | |
@@ -2772,7 +2772,7 @@ discard block |
||
2772 | 2772 | } else { |
2773 | 2773 | |
2774 | 2774 | // The Update Ran. |
2775 | - give_set_upgrade_complete( 'v210_verify_form_status_upgrades' ); |
|
2775 | + give_set_upgrade_complete('v210_verify_form_status_upgrades'); |
|
2776 | 2776 | } |
2777 | 2777 | } |
2778 | 2778 | |
@@ -2791,22 +2791,22 @@ discard block |
||
2791 | 2791 | SELECT DISTINCT payment_id |
2792 | 2792 | FROM {$donation_meta_table} |
2793 | 2793 | LIMIT 20 |
2794 | - OFFSET {$give_updates->get_offset( 20 )} |
|
2794 | + OFFSET {$give_updates->get_offset(20)} |
|
2795 | 2795 | " |
2796 | 2796 | ); |
2797 | 2797 | |
2798 | - if ( ! empty( $donations ) ) { |
|
2799 | - foreach ( $donations as $donation ) { |
|
2800 | - $donation_obj = get_post( $donation ); |
|
2798 | + if ( ! empty($donations)) { |
|
2799 | + foreach ($donations as $donation) { |
|
2800 | + $donation_obj = get_post($donation); |
|
2801 | 2801 | |
2802 | - if ( ! $donation_obj instanceof WP_Post ) { |
|
2803 | - Give()->payment_meta->delete_all_meta( $donation ); |
|
2802 | + if ( ! $donation_obj instanceof WP_Post) { |
|
2803 | + Give()->payment_meta->delete_all_meta($donation); |
|
2804 | 2804 | } |
2805 | 2805 | } |
2806 | 2806 | } else { |
2807 | 2807 | |
2808 | 2808 | // The Update Ran. |
2809 | - give_set_upgrade_complete( 'v213_delete_donation_meta' ); |
|
2809 | + give_set_upgrade_complete('v213_delete_donation_meta'); |
|
2810 | 2810 | } |
2811 | 2811 | } |
2812 | 2812 | |
@@ -2817,19 +2817,19 @@ discard block |
||
2817 | 2817 | * |
2818 | 2818 | * @since 2.2.0 |
2819 | 2819 | */ |
2820 | -function give_v220_rename_donation_meta_type_callback(){ |
|
2820 | +function give_v220_rename_donation_meta_type_callback() { |
|
2821 | 2821 | global $wpdb; |
2822 | 2822 | |
2823 | 2823 | // Check upgrade before running. |
2824 | - if( |
|
2825 | - give_has_upgrade_completed( 'v220_rename_donation_meta_type' ) |
|
2826 | - || ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) |
|
2824 | + if ( |
|
2825 | + give_has_upgrade_completed('v220_rename_donation_meta_type') |
|
2826 | + || ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta")) |
|
2827 | 2827 | ) { |
2828 | 2828 | return; |
2829 | 2829 | } |
2830 | 2830 | |
2831 | - $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)" ); |
|
2832 | - $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta" ); |
|
2831 | + $wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta CHANGE COLUMN payment_id donation_id bigint(20)"); |
|
2832 | + $wpdb->query("ALTER TABLE {$wpdb->prefix}give_paymentmeta RENAME TO {$wpdb->prefix}give_donationmeta"); |
|
2833 | 2833 | |
2834 | 2834 | give_set_upgrade_complete('v220_rename_donation_meta_type'); |
2835 | 2835 | } |
@@ -2841,10 +2841,10 @@ discard block |
||
2841 | 2841 | */ |
2842 | 2842 | function give_v215_update_donor_user_roles_callback() { |
2843 | 2843 | |
2844 | - $role = get_role( 'give_manager' ); |
|
2845 | - $role->add_cap( 'view_give_payments' ); |
|
2844 | + $role = get_role('give_manager'); |
|
2845 | + $role->add_cap('view_give_payments'); |
|
2846 | 2846 | |
2847 | - give_set_upgrade_complete( 'v215_update_donor_user_roles' ); |
|
2847 | + give_set_upgrade_complete('v215_update_donor_user_roles'); |
|
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | |
@@ -2856,8 +2856,8 @@ discard block |
||
2856 | 2856 | * |
2857 | 2857 | * @global wpdb $wpdb |
2858 | 2858 | */ |
2859 | -function give_v220_delete_wp_session_data(){ |
|
2859 | +function give_v220_delete_wp_session_data() { |
|
2860 | 2860 | global $wpdb; |
2861 | 2861 | |
2862 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'" ); |
|
2862 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_wp_session_%'"); |
|
2863 | 2863 | } |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_Offline_Donation_Instruction_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_Offline_Donation_Instruction_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_Offline_Donation_Instruction_Email |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'offline-donation-instruction', |
43 | - 'label' => __( 'Offline Donation Instructions', 'give' ), |
|
44 | - 'description' => __( 'Sent to the donor when they submit an offline donation.', 'give' ), |
|
45 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
43 | + 'label' => __('Offline Donation Instructions', 'give'), |
|
44 | + 'description' => __('Sent to the donor when they submit an offline donation.', 'give'), |
|
45 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
46 | 46 | 'form_metabox_setting' => true, |
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tag_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | - 'default_email_subject' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
51 | + 'default_email_subject' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
52 | 52 | 'default_email_message' => give_get_default_offline_donation_email_content(), |
53 | - 'default_email_header' => __( 'Offline Donation Instructions', 'give' ), |
|
53 | + 'default_email_header' => __('Offline Donation Instructions', 'give'), |
|
54 | 54 | 'notices' => array( |
55 | 55 | 'non-notification-status-editable' => sprintf( |
56 | 56 | '%1$s <a href="%2$s">%3$s »</a>', |
57 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
58 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
59 | - __( 'Edit Setting', 'give' ) |
|
57 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
58 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
59 | + __('Edit Setting', 'give') |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
65 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
64 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
65 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function get_email_message( $form_id = null ) { |
|
77 | + public function get_email_message($form_id = null) { |
|
78 | 78 | $message = Give_Email_Notification_Util::get_value( |
79 | 79 | $this, |
80 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
80 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
81 | 81 | $form_id, |
82 | 82 | $this->config['default_email_message'] |
83 | 83 | ); |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function get_email_subject( $form_id = null ) { |
|
109 | + public function get_email_subject($form_id = null) { |
|
110 | 110 | $subject = wp_strip_all_tags( |
111 | 111 | Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_subject'] |
116 | 116 | ) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param int $form_id |
140 | 140 | * @return array |
141 | 141 | */ |
142 | - public function get_email_attachments( $form_id = null ) { |
|
142 | + public function get_email_attachments($form_id = null) { |
|
143 | 143 | /** |
144 | 144 | * Filter the attachments. |
145 | 145 | * Note: This filter will deprecate soon. |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $this->payment->payment_meta |
203 | 203 | ); |
204 | 204 | |
205 | - Give()->emails->__set( 'from_name', $from_name ); |
|
206 | - Give()->emails->__set( 'from_email', $from_email ); |
|
207 | - Give()->emails->__set( 'headers', apply_filters( 'give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta ) ); |
|
205 | + Give()->emails->__set('from_name', $from_name); |
|
206 | + Give()->emails->__set('from_email', $from_email); |
|
207 | + Give()->emails->__set('headers', apply_filters('give_receipt_headers', Give()->emails->get_headers(), $this->payment->ID, $this->payment->payment_meta)); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @param int $payment_id |
217 | 217 | */ |
218 | - public function setup_email_notification( $payment_id ) { |
|
219 | - $this->payment = new Give_Payment( $payment_id ); |
|
218 | + public function setup_email_notification($payment_id) { |
|
219 | + $this->payment = new Give_Payment($payment_id); |
|
220 | 220 | |
221 | 221 | // Exit if not donation was not with offline donation. |
222 | - if ( 'offline' !== $this->payment->gateway ) { |
|
222 | + if ('offline' !== $this->payment->gateway) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | $this->setup_email_data(); |
228 | 228 | |
229 | 229 | // Send email. |
230 | - $this->send_email_notification( array( |
|
230 | + $this->send_email_notification(array( |
|
231 | 231 | 'payment_id' => $this->payment->ID, |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | * @param $update_options |
242 | 242 | * @param $option_name |
243 | 243 | */ |
244 | - public function set_notification_status( $update_options, $option_name ) { |
|
244 | + public function set_notification_status($update_options, $option_name) { |
|
245 | 245 | // Get updated settings. |
246 | 246 | $update_options = give_get_settings(); |
247 | 247 | |
248 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
248 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
249 | 249 | |
250 | 250 | if ( |
251 | - empty( $update_options["{$this->config['id']}_notification"] ) |
|
251 | + empty($update_options["{$this->config['id']}_notification"]) |
|
252 | 252 | || $notification_status !== $update_options["{$this->config['id']}_notification"] |
253 | 253 | ) { |
254 | 254 | $update_options["{$this->config['id']}_notification"] = $notification_status; |
255 | - update_option( $option_name, $update_options, false ); |
|
255 | + update_option($option_name, $update_options, false); |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return array |
270 | 270 | */ |
271 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
272 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
271 | + public function add_metabox_setting_field($settings, $form_id) { |
|
272 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
273 | 273 | $settings[] = array( |
274 | 274 | 'id' => $this->config['id'], |
275 | 275 | 'title' => $this->config['label'], |
276 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
276 | + 'fields' => $this->get_setting_fields($form_id), |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if access directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_New_Donor_Register_Email' ) ) : |
|
17 | +if ( ! class_exists('Give_New_Donor_Register_Email')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_New_Donor_Register_Email |
@@ -31,35 +31,35 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'new-donor-register', |
36 | - 'label' => __( 'New User Registration', 'give' ), |
|
37 | - 'description' => __( 'Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give' ), |
|
36 | + 'label' => __('New User Registration', 'give'), |
|
37 | + 'description' => __('Sent to designated recipient(s) when a new user registers on the site via a donation form.', 'give'), |
|
38 | 38 | 'has_recipient_field' => true, |
39 | 39 | 'notification_status' => 'enabled', |
40 | 40 | 'has_preview_header' => true, |
41 | - 'email_tag_context' => array( 'donor', 'general' ), |
|
41 | + 'email_tag_context' => array('donor', 'general'), |
|
42 | 42 | 'form_metabox_setting' => false, |
43 | 43 | 'default_email_subject' => sprintf( |
44 | 44 | /* translators: %s: site name */ |
45 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
46 | - get_bloginfo( 'name' ) |
|
45 | + esc_attr__('[%s] New User Registration', 'give'), |
|
46 | + get_bloginfo('name') |
|
47 | 47 | ), |
48 | 48 | 'default_email_message' => $this->get_default_email_message(), |
49 | - 'default_email_header' => __( 'New User Registration', 'give' ), |
|
50 | - ) ); |
|
49 | + 'default_email_header' => __('New User Registration', 'give'), |
|
50 | + )); |
|
51 | 51 | |
52 | 52 | // Setup action hook. |
53 | 53 | add_action( |
54 | 54 | "give_{$this->config['id']}_email_notification", |
55 | - array( $this, 'setup_email_notification' ), |
|
55 | + array($this, 'setup_email_notification'), |
|
56 | 56 | 10, |
57 | 57 | 2 |
58 | 58 | ); |
59 | 59 | |
60 | 60 | add_filter( |
61 | 61 | 'give_email_preview_header', |
62 | - array( $this, 'email_preview_header' ), |
|
62 | + array($this, 'email_preview_header'), |
|
63 | 63 | 10, |
64 | 64 | 2 |
65 | 65 | ); |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @return string |
75 | 75 | */ |
76 | 76 | function get_default_email_message() { |
77 | - $message = esc_attr__( 'New user registration on your site {sitename}:', 'give' ) . "\r\n\r\n"; |
|
78 | - $message .= esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n"; |
|
79 | - $message .= esc_attr__( 'Email: {user_email}', 'give' ) . "\r\n"; |
|
77 | + $message = esc_attr__('New user registration on your site {sitename}:', 'give')."\r\n\r\n"; |
|
78 | + $message .= esc_attr__('Username: {username}', 'give')."\r\n\r\n"; |
|
79 | + $message .= esc_attr__('Email: {user_email}', 'give')."\r\n"; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Filter the default email message |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function setup_email_notification( $user_id, $user_data ) { |
|
104 | + public function setup_email_notification($user_id, $user_data) { |
|
105 | 105 | $this->setup_email_data(); |
106 | 106 | |
107 | - $this->send_email_notification( array( |
|
107 | + $this->send_email_notification(array( |
|
108 | 108 | 'user_id' => $user_id, |
109 | - ) ); |
|
109 | + )); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -120,42 +120,42 @@ discard block |
||
120 | 120 | * @param Give_New_Donor_Register_Email $email |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - public function email_preview_header( $email_preview_header, $email ) { |
|
123 | + public function email_preview_header($email_preview_header, $email) { |
|
124 | 124 | // Bailout. |
125 | - if ( $this->config['id'] !== $email->config['id'] ) { |
|
125 | + if ($this->config['id'] !== $email->config['id']) { |
|
126 | 126 | return $email_preview_header; |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Payment receipt switcher |
130 | - $user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ); |
|
130 | + $user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id'); |
|
131 | 131 | |
132 | 132 | // Get payments. |
133 | 133 | $donors = new Give_API(); |
134 | - $donors = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' ); |
|
134 | + $donors = give_check_variable($donors->get_donors(), 'empty', array(), 'donors'); |
|
135 | 135 | $options = array(); |
136 | 136 | |
137 | 137 | // Default option. |
138 | - $options[0] = esc_html__( 'No donor(s) found.', 'give' ); |
|
138 | + $options[0] = esc_html__('No donor(s) found.', 'give'); |
|
139 | 139 | |
140 | 140 | // Provide nice human readable options. |
141 | - if ( $donors ) { |
|
142 | - $options[0] = esc_html__( '- Select a donor -', 'give' ); |
|
143 | - foreach ( $donors as $donor ) { |
|
141 | + if ($donors) { |
|
142 | + $options[0] = esc_html__('- Select a donor -', 'give'); |
|
143 | + foreach ($donors as $donor) { |
|
144 | 144 | // Exclude customers for which wp user not exist. |
145 | - if ( ! $donor['info']['user_id'] ) { |
|
145 | + if ( ! $donor['info']['user_id']) { |
|
146 | 146 | continue; |
147 | 147 | } |
148 | - $options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] ); |
|
148 | + $options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
152 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
153 | 153 | $query = $request_url_data['query']; |
154 | 154 | |
155 | 155 | // Remove user id query param if set from request url. |
156 | - $query = remove_query_arg( array( 'user_id' ), $query ); |
|
156 | + $query = remove_query_arg(array('user_id'), $query); |
|
157 | 157 | |
158 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
158 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
159 | 159 | ?> |
160 | 160 | <script type="text/javascript"> |
161 | 161 | function change_preview() { |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | <div class="give_preview_email_user_id_main"> |
190 | 190 | |
191 | 191 | <label for="give_preview_email_user_id" class="give_preview_email_user_id_label"> |
192 | - <?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?> |
|
192 | + <?php echo esc_html__('Preview email with a donor:', 'give'); ?> |
|
193 | 193 | </label> |
194 | 194 | |
195 | 195 | <?php |
196 | 196 | // The select field with 100 latest transactions |
197 | - echo Give()->html->select( array( |
|
197 | + echo Give()->html->select(array( |
|
198 | 198 | 'name' => 'preview_email_user_id', |
199 | 199 | 'selected' => $user_id, |
200 | 200 | 'id' => 'give_preview_email_user_id', |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'select_atts' => 'onchange="change_preview()"', |
205 | 205 | 'show_option_all' => false, |
206 | 206 | 'show_option_none' => false, |
207 | - ) ); |
|
207 | + )); |
|
208 | 208 | ?> |
209 | 209 | <!-- Closing tag--> |
210 | 210 | </div> |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) : |
|
19 | +if ( ! class_exists('Give_New_Offline_Donation_Email')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_New_Offline_Donation_Email |
@@ -36,33 +36,33 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function init() { |
38 | 38 | // Initialize empty payment. |
39 | - $this->payment = new Give_Payment( 0 ); |
|
39 | + $this->payment = new Give_Payment(0); |
|
40 | 40 | |
41 | - $this->load( array( |
|
41 | + $this->load(array( |
|
42 | 42 | 'id' => 'new-offline-donation', |
43 | - 'label' => __( 'New Offline Donation', 'give' ), |
|
44 | - 'description' => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ), |
|
43 | + 'label' => __('New Offline Donation', 'give'), |
|
44 | + 'description' => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'), |
|
45 | 45 | 'has_recipient_field' => true, |
46 | - 'notification_status' => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled', |
|
46 | + 'notification_status' => give_is_gateway_active('offline') ? 'enabled' : 'disabled', |
|
47 | 47 | 'notification_status_editable' => false, |
48 | 48 | 'preview_email_tags_values' => array( |
49 | - 'payment_method' => esc_html__( 'Offline', 'give' ), |
|
49 | + 'payment_method' => esc_html__('Offline', 'give'), |
|
50 | 50 | ), |
51 | 51 | 'default_email_subject' => $this->get_default_email_subject(), |
52 | 52 | 'default_email_message' => $this->get_default_email_message(), |
53 | - 'default_email_header' => __( 'New Offline Donation!', 'give' ), |
|
53 | + 'default_email_header' => __('New Offline Donation!', 'give'), |
|
54 | 54 | 'notices' => array( |
55 | 55 | 'non-notification-status-editable' => sprintf( |
56 | 56 | '%1$s <a href="%2$s">%3$s »</a>', |
57 | - __( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ), |
|
58 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations') ), |
|
59 | - __( 'Edit Setting', 'give' ) |
|
57 | + __('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'), |
|
58 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=offline-donations')), |
|
59 | + __('Edit Setting', 'give') |
|
60 | 60 | ) |
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | - add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) ); |
|
65 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
64 | + add_action('give_insert_payment', array($this, 'setup_email_notification')); |
|
65 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | $subject = apply_filters( |
83 | 83 | 'give_offline_admin_donation_notification_subject', |
84 | - __( 'New Pending Donation', 'give' ) |
|
84 | + __('New Pending Donation', 'give') |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | /** |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | * @return string |
107 | 107 | */ |
108 | 108 | public function get_default_email_message() { |
109 | - $message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
110 | - $message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
111 | - $message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
109 | + $message = __('Dear Admin,', 'give')."\n\n"; |
|
110 | + $message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
111 | + $message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
112 | 112 | |
113 | - $message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
114 | - $message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
113 | + $message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
114 | + $message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
115 | 115 | |
116 | 116 | $message .= sprintf( |
117 | 117 | '<a href="%1$s">%2$s</a>', |
118 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ), |
|
119 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
120 | - ) . "\n\n"; |
|
118 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID), |
|
119 | + __('Click Here to View and/or Update Donation Details', 'give') |
|
120 | + )."\n\n"; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Filter the donation receipt email message |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - public function get_email_message( $form_id = null ) { |
|
158 | + public function get_email_message($form_id = null) { |
|
159 | 159 | $message = Give_Email_Notification_Util::get_value( |
160 | 160 | $this, |
161 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
161 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
162 | 162 | $form_id, |
163 | 163 | $this->config['default_email_message'] |
164 | 164 | ); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return array |
200 | 200 | */ |
201 | - public function get_email_attachments( $form_id = null ) { |
|
201 | + public function get_email_attachments($form_id = null) { |
|
202 | 202 | /** |
203 | 203 | * Filter the attachments. |
204 | 204 | * Note: This filter will deprecate soon. |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param int $payment_id |
251 | 251 | */ |
252 | - public function setup_email_notification( $payment_id ) { |
|
253 | - $this->payment = new Give_Payment( $payment_id ); |
|
252 | + public function setup_email_notification($payment_id) { |
|
253 | + $this->payment = new Give_Payment($payment_id); |
|
254 | 254 | |
255 | 255 | // Exit if not donation was not with offline donation. |
256 | - if ( 'offline' !== $this->payment->gateway ) { |
|
256 | + if ('offline' !== $this->payment->gateway) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | $this->setup_email_data(); |
262 | 262 | |
263 | 263 | // Send email. |
264 | - $this->send_email_notification( array( |
|
264 | + $this->send_email_notification(array( |
|
265 | 265 | 'payment_id' => $this->payment->ID, |
266 | - ) ); |
|
266 | + )); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -275,18 +275,18 @@ discard block |
||
275 | 275 | * @param $update_options |
276 | 276 | * @param $option_name |
277 | 277 | */ |
278 | - public function set_notification_status( $update_options, $option_name ) { |
|
278 | + public function set_notification_status($update_options, $option_name) { |
|
279 | 279 | // Get updated settings. |
280 | 280 | $update_options = give_get_settings(); |
281 | 281 | |
282 | - $notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled'; |
|
282 | + $notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled'; |
|
283 | 283 | |
284 | 284 | if ( |
285 | - empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
286 | - || $notification_status !== $update_options[ "{$this->config['id']}_notification" ] |
|
285 | + empty($update_options["{$this->config['id']}_notification"]) |
|
286 | + || $notification_status !== $update_options["{$this->config['id']}_notification"] |
|
287 | 287 | ) { |
288 | - $update_options[ "{$this->config['id']}_notification" ] = $notification_status; |
|
289 | - update_option( $option_name, $update_options, false ); |
|
288 | + $update_options["{$this->config['id']}_notification"] = $notification_status; |
|
289 | + update_option($option_name, $update_options, false); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @return array |
303 | 303 | */ |
304 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
304 | + public function add_metabox_setting_field($settings, $form_id) { |
|
305 | 305 | |
306 | - if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) { |
|
306 | + if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) { |
|
307 | 307 | $settings[] = array( |
308 | 308 | 'id' => $this->config['id'], |
309 | 309 | 'title' => $this->config['label'], |
310 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
310 | + 'fields' => $this->get_setting_fields($form_id), |
|
311 | 311 | ); |
312 | 312 | } |
313 | 313 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if access directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) : |
|
18 | +if ( ! class_exists('Give_Donation_Receipt_Email')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Donation_Receipt_Email |
@@ -35,22 +35,22 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function init() { |
37 | 37 | // Initialize empty payment. |
38 | - $this->payment = new Give_Payment( 0 ); |
|
38 | + $this->payment = new Give_Payment(0); |
|
39 | 39 | |
40 | - $this->load( array( |
|
40 | + $this->load(array( |
|
41 | 41 | 'id' => 'donation-receipt', |
42 | - 'label' => __( 'Donation Receipt', 'give' ), |
|
43 | - 'description' => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ), |
|
42 | + 'label' => __('Donation Receipt', 'give'), |
|
43 | + 'description' => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'), |
|
44 | 44 | 'notification_status' => 'enabled', |
45 | 45 | 'form_metabox_setting' => true, |
46 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
47 | - 'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ), |
|
46 | + 'recipient_group_name' => __('Donor', 'give'), |
|
47 | + 'default_email_subject' => esc_attr__('Donation Receipt', 'give'), |
|
48 | 48 | 'default_email_message' => give_get_default_donation_receipt_email(), |
49 | - 'default_email_header' => __( 'Donation Receipt', 'give' ), |
|
50 | - ) ); |
|
49 | + 'default_email_header' => __('Donation Receipt', 'give'), |
|
50 | + )); |
|
51 | 51 | |
52 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) ); |
|
53 | - add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) ); |
|
52 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt')); |
|
53 | + add_action('give_email_links', array($this, 'resend_donation_receipt')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | * @param int $form_id |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public function get_email_subject( $form_id = null ) { |
|
65 | + public function get_email_subject($form_id = null) { |
|
66 | 66 | $subject = wp_strip_all_tags( |
67 | 67 | Give_Email_Notification_Util::get_value( |
68 | 68 | $this, |
69 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
69 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
70 | 70 | $form_id, |
71 | 71 | $this->config['default_email_subject'] |
72 | 72 | ) |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * @param int $form_id |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function get_email_message( $form_id = null ) { |
|
112 | + public function get_email_message($form_id = null) { |
|
113 | 113 | $message = Give_Email_Notification_Util::get_value( |
114 | 114 | $this, |
115 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
115 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
116 | 116 | $form_id, |
117 | 117 | $this->config['default_email_message'] |
118 | 118 | ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @since 1.0 |
125 | 125 | */ |
126 | 126 | $message = apply_filters( |
127 | - 'give_donation_receipt_' . Give()->emails->get_template(), |
|
127 | + 'give_donation_receipt_'.Give()->emails->get_template(), |
|
128 | 128 | $message, |
129 | 129 | $this->payment->ID, |
130 | 130 | $this->payment->payment_meta |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param int $form_id |
168 | 168 | * @return array |
169 | 169 | */ |
170 | - public function get_email_attachments( $form_id = null) { |
|
170 | + public function get_email_attachments($form_id = null) { |
|
171 | 171 | /** |
172 | 172 | * Filter the attachments. |
173 | 173 | * Note: this filter will deprecate soon. |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | $this->payment->payment_meta |
237 | 237 | ); |
238 | 238 | |
239 | - Give()->emails->__set( 'from_name', $from_name ); |
|
240 | - Give()->emails->__set( 'from_email', $from_email ); |
|
239 | + Give()->emails->__set('from_name', $from_name); |
|
240 | + Give()->emails->__set('from_email', $from_email); |
|
241 | 241 | |
242 | 242 | /** |
243 | 243 | * Filters the donation receipt's email headers. |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $this->payment->payment_meta |
255 | 255 | ); |
256 | 256 | |
257 | - Give()->emails->__set( 'headers', $headers ); |
|
257 | + Give()->emails->__set('headers', $headers); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -265,16 +265,16 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @param $payment_id |
267 | 267 | */ |
268 | - public function send_donation_receipt( $payment_id ) { |
|
269 | - $this->payment = new Give_Payment( $payment_id ); |
|
268 | + public function send_donation_receipt($payment_id) { |
|
269 | + $this->payment = new Give_Payment($payment_id); |
|
270 | 270 | |
271 | 271 | // Setup email data. |
272 | 272 | $this->setup_email_data(); |
273 | 273 | |
274 | 274 | // Send email. |
275 | - $this->send_email_notification( array( |
|
275 | + $this->send_email_notification(array( |
|
276 | 276 | 'payment_id' => $this->payment->ID, |
277 | - ) ); |
|
277 | + )); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -285,35 +285,35 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @param array $data Donation details. |
287 | 287 | */ |
288 | - public function resend_donation_receipt( $data ) { |
|
289 | - $purchase_id = absint( $data['purchase_id'] ); |
|
288 | + public function resend_donation_receipt($data) { |
|
289 | + $purchase_id = absint($data['purchase_id']); |
|
290 | 290 | |
291 | - if ( empty( $purchase_id ) ) { |
|
291 | + if (empty($purchase_id)) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | 295 | // Get donation payment information. |
296 | - $this->payment = new Give_Payment( $purchase_id ); |
|
296 | + $this->payment = new Give_Payment($purchase_id); |
|
297 | 297 | |
298 | - if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) { |
|
299 | - wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
298 | + if ( ! current_user_can('edit_give_payments', $this->payment->ID)) { |
|
299 | + wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array( |
|
300 | 300 | 'response' => 403, |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | // Setup email data. |
305 | 305 | $this->setup_email_data(); |
306 | 306 | |
307 | 307 | // Send email. |
308 | - $this->send_email_notification( array( |
|
308 | + $this->send_email_notification(array( |
|
309 | 309 | 'payment_id' => $this->payment->ID, |
310 | - ) ); |
|
310 | + )); |
|
311 | 311 | |
312 | - wp_redirect( add_query_arg( array( |
|
312 | + wp_redirect(add_query_arg(array( |
|
313 | 313 | 'give-messages[]' => 'email-sent', |
314 | 314 | 'give-action' => false, |
315 | 315 | 'purchase_id' => false, |
316 | - ) ) ); |
|
316 | + ))); |
|
317 | 317 | exit; |
318 | 318 | } |
319 | 319 | } |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if access directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
20 | -if ( ! class_exists( 'Give_New_Donation_Email' ) ) : |
|
20 | +if ( ! class_exists('Give_New_Donation_Email')) : |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Give_New_Donation_Email |
@@ -37,21 +37,21 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function init() { |
39 | 39 | // Initialize empty payment. |
40 | - $this->payment = new Give_Payment( 0 ); |
|
40 | + $this->payment = new Give_Payment(0); |
|
41 | 41 | |
42 | - $this->load( array( |
|
42 | + $this->load(array( |
|
43 | 43 | 'id' => 'new-donation', |
44 | - 'label' => __( 'New Donation', 'give' ), |
|
45 | - 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ), |
|
44 | + 'label' => __('New Donation', 'give'), |
|
45 | + 'description' => __('Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give'), |
|
46 | 46 | 'has_recipient_field' => true, |
47 | 47 | 'notification_status' => 'enabled', |
48 | 48 | 'form_metabox_setting' => true, |
49 | - 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
49 | + 'default_email_subject' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
50 | 50 | 'default_email_message' => give_get_default_donation_notification_email(), |
51 | - 'default_email_header' => __( 'New Donation!', 'give' ), |
|
52 | - ) ); |
|
51 | + 'default_email_header' => __('New Donation!', 'give'), |
|
52 | + )); |
|
53 | 53 | |
54 | - add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) ); |
|
54 | + add_action("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function get_email_subject( $form_id = null ) { |
|
67 | + public function get_email_subject($form_id = null) { |
|
68 | 68 | $subject = wp_strip_all_tags( |
69 | 69 | Give_Email_Notification_Util::get_value( |
70 | 70 | $this, |
71 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
71 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
72 | 72 | $form_id, |
73 | 73 | $this->config['default_email_subject'] |
74 | 74 | ) |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - $subject = apply_filters( 'give_admin_donation_notification_subject', $subject, $this->payment->ID ); |
|
83 | + $subject = apply_filters('give_admin_donation_notification_subject', $subject, $this->payment->ID); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Filters the donation notification subject. |
87 | 87 | * |
88 | 88 | * @since 2.0 |
89 | 89 | */ |
90 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
90 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
91 | 91 | |
92 | 92 | return $subject; |
93 | 93 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function get_email_message( $form_id = null ) { |
|
106 | + public function get_email_message($form_id = null) { |
|
107 | 107 | $message = Give_Email_Notification_Util::get_value( |
108 | 108 | $this, |
109 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
109 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
110 | 110 | $form_id, |
111 | 111 | $this->config['default_email_message'] |
112 | 112 | ); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @param int $form_id |
150 | 150 | * @return array |
151 | 151 | */ |
152 | - public function get_email_attachments( $form_id = null ) { |
|
152 | + public function get_email_attachments($form_id = null) { |
|
153 | 153 | /** |
154 | 154 | * Filters the donation notification email attachments. |
155 | 155 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | $this->payment->payment_meta |
213 | 213 | ); |
214 | 214 | |
215 | - Give()->emails->__set( 'from_name', $from_name ); |
|
216 | - Give()->emails->__set( 'from_email', $from_email ); |
|
215 | + Give()->emails->__set('from_name', $from_name); |
|
216 | + Give()->emails->__set('from_email', $from_email); |
|
217 | 217 | |
218 | 218 | /** |
219 | 219 | * Filters the donation notification email headers. |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $this->payment->payment_meta |
228 | 228 | ); |
229 | 229 | |
230 | - Give()->emails->__set( 'headers', $headers ); |
|
230 | + Give()->emails->__set('headers', $headers); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param int $payment_id |
240 | 240 | */ |
241 | - public function setup_email_notification( $payment_id ) { |
|
242 | - $this->payment = new Give_Payment( $payment_id ); |
|
241 | + public function setup_email_notification($payment_id) { |
|
242 | + $this->payment = new Give_Payment($payment_id); |
|
243 | 243 | |
244 | 244 | // Set email data. |
245 | 245 | $this->setup_email_data(); |
246 | 246 | |
247 | 247 | // Send email. |
248 | - $this->send_email_notification( array( |
|
248 | + $this->send_email_notification(array( |
|
249 | 249 | 'payment_id' => $payment_id, |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if access directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Email_Access_Email' ) ) : |
|
18 | +if ( ! class_exists('Give_Email_Access_Email')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Email_Access_Email |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'email-access', |
36 | - 'label' => __( 'Email access', 'give' ), |
|
37 | - 'description' => __( 'Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give' ), |
|
38 | - 'notification_status' => give_get_option( 'email_access', 'disabled' ), |
|
36 | + 'label' => __('Email access', 'give'), |
|
37 | + 'description' => __('Sent when donors request access to their donation history using only their email as verification. (See Settings > General > Access Control)', 'give'), |
|
38 | + 'notification_status' => give_get_option('email_access', 'disabled'), |
|
39 | 39 | 'form_metabox_setting' => false, |
40 | 40 | 'notification_status_editable' => false, |
41 | 41 | 'email_tag_context' => 'donor', |
42 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
43 | - 'default_email_subject' => sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ), |
|
42 | + 'recipient_group_name' => __('Donor', 'give'), |
|
43 | + 'default_email_subject' => sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')), |
|
44 | 44 | 'default_email_message' => $this->get_default_email_message(), |
45 | - 'default_email_header' => __( 'Confirm Email', 'give' ), |
|
45 | + 'default_email_header' => __('Confirm Email', 'give'), |
|
46 | 46 | 'notices' => array( |
47 | 47 | 'non-notification-status-editable' => sprintf( |
48 | 48 | '%1$s <a href="%2$s">%3$s »</a>', |
49 | - __( 'This notification is automatically toggled based on whether the email access is enabled or not.', 'give' ), |
|
50 | - esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control') ), |
|
51 | - __( 'Edit Setting', 'give' ) |
|
49 | + __('This notification is automatically toggled based on whether the email access is enabled or not.', 'give'), |
|
50 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=general§ion=access-control')), |
|
51 | + __('Edit Setting', 'give') |
|
52 | 52 | ) |
53 | 53 | ), |
54 | - ) ); |
|
54 | + )); |
|
55 | 55 | |
56 | - add_filter( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ), 10, 2 ); |
|
57 | - add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 ); |
|
58 | - add_filter( 'give_email_preview_header', array( $this, 'email_preview_header' ), 10, 2 ); |
|
56 | + add_filter("give_{$this->config['id']}_email_notification", array($this, 'setup_email_notification'), 10, 2); |
|
57 | + add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2); |
|
58 | + add_filter('give_email_preview_header', array($this, 'email_preview_header'), 10, 2); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function get_email_subject( $form_id = null ) { |
|
71 | + public function get_email_subject($form_id = null) { |
|
72 | 72 | $subject = wp_strip_all_tags( |
73 | 73 | Give_Email_Notification_Util::get_value( |
74 | 74 | $this, |
75 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
75 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
76 | 76 | $form_id, |
77 | 77 | $this->config['default_email_subject'] |
78 | 78 | ) |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @since 1.0 |
86 | 86 | */ |
87 | - $subject = apply_filters( 'give_email_access_token_subject', $subject ); |
|
87 | + $subject = apply_filters('give_email_access_token_subject', $subject); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Filters the donation notification subject. |
91 | 91 | * |
92 | 92 | * @since 2.0 |
93 | 93 | */ |
94 | - $subject = apply_filters( "give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id ); |
|
94 | + $subject = apply_filters("give_{$this->config['id']}_get_email_subject", $subject, $this, $form_id); |
|
95 | 95 | |
96 | 96 | return $subject; |
97 | 97 | } |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function get_email_message( $form_id = null ) { |
|
110 | + public function get_email_message($form_id = null) { |
|
111 | 111 | $message = Give_Email_Notification_Util::get_value( |
112 | 112 | $this, |
113 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
113 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
114 | 114 | $form_id, |
115 | 115 | $this->config['default_email_message'] |
116 | 116 | ); |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @since 1.0 |
123 | 123 | */ |
124 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
124 | + $message = apply_filters('give_email_access_token_message', $message); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Filter the email message |
128 | 128 | * |
129 | 129 | * @since 2.0 |
130 | 130 | */ |
131 | - $message = apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id ); |
|
131 | + $message = apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this, $form_id); |
|
132 | 132 | |
133 | 133 | return $message; |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param int $form_id |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function get_email_attachments( $form_id = null ) { |
|
146 | + public function get_email_attachments($form_id = null) { |
|
147 | 147 | /** |
148 | 148 | * Filters the donation notification email attachments. |
149 | 149 | * By default, there is no attachment but plugins can hook in to provide one more multiple. |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array() ); |
|
154 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array()); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Filters the donation notification email attachments. |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 2.0 |
161 | 161 | */ |
162 | - $attachments = apply_filters( "give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id ); |
|
162 | + $attachments = apply_filters("give_{$this->config['id']}_get_email_attachments", $attachments, $this, $form_id); |
|
163 | 163 | |
164 | 164 | return $attachments; |
165 | 165 | } |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | * @return string |
175 | 175 | */ |
176 | 176 | public function get_default_email_message() { |
177 | - $message = __( 'Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give' ) . "\n\n"; |
|
178 | - $message .= '{email_access_link}' . "\n\n"; |
|
177 | + $message = __('Please click the link to access your donation history on {site_url}. If you did not request this email, please contact {admin_email}.', 'give')."\n\n"; |
|
178 | + $message .= '{email_access_link}'."\n\n"; |
|
179 | 179 | $message .= "\n\n"; |
180 | - $message .= __( 'Sincerely,', 'give' ) . "\n"; |
|
181 | - $message .= get_bloginfo( 'name' ) . "\n"; |
|
180 | + $message .= __('Sincerely,', 'give')."\n"; |
|
181 | + $message .= get_bloginfo('name')."\n"; |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Filter the new donation email message |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @param string $message |
189 | 189 | */ |
190 | - return apply_filters( "give_{$this->config['id']}_get_default_email_message", $message, $this ); |
|
190 | + return apply_filters("give_{$this->config['id']}_get_default_email_message", $message, $this); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function get_email_header( $form_id = null ) { |
|
205 | - $subject = parent::get_email_header( $form_id ); |
|
204 | + public function get_email_header($form_id = null) { |
|
205 | + $subject = parent::get_email_header($form_id); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Filter the email header |
209 | 209 | * |
210 | 210 | * @since 1.0 |
211 | 211 | */ |
212 | - $subject = apply_filters( 'give_email_access_token_heading', $subject ); |
|
212 | + $subject = apply_filters('give_email_access_token_heading', $subject); |
|
213 | 213 | |
214 | 214 | return $subject; |
215 | 215 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @since 1.0 |
229 | 229 | */ |
230 | - $from_name = apply_filters( 'give_donation_from_name', Give()->emails->get_from_name() ); |
|
230 | + $from_name = apply_filters('give_donation_from_name', Give()->emails->get_from_name()); |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Filters the from email. |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @since 1.0 |
237 | 237 | */ |
238 | - $from_email = apply_filters( 'give_donation_from_address', Give()->emails->get_from_address() ); |
|
238 | + $from_email = apply_filters('give_donation_from_address', Give()->emails->get_from_address()); |
|
239 | 239 | |
240 | - Give()->emails->__set( 'from_name', $from_name ); |
|
241 | - Give()->emails->__set( 'from_email', $from_email ); |
|
240 | + Give()->emails->__set('from_name', $from_name); |
|
241 | + Give()->emails->__set('from_email', $from_email); |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * Filters the donation notification email headers. |
245 | 245 | * |
246 | 246 | * @since 1.0 |
247 | 247 | */ |
248 | - $headers = apply_filters( 'give_admin_donation_notification_headers', Give()->emails->get_headers() ); |
|
248 | + $headers = apply_filters('give_admin_donation_notification_headers', Give()->emails->get_headers()); |
|
249 | 249 | |
250 | - Give()->emails->__set( 'headers', $headers ); |
|
250 | + Give()->emails->__set('headers', $headers); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return bool |
263 | 263 | */ |
264 | - public function setup_email_notification( $donor_id, $email ) { |
|
265 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
264 | + public function setup_email_notification($donor_id, $email) { |
|
265 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
266 | 266 | $this->recipient_email = $email; |
267 | 267 | |
268 | 268 | // Set email data. |
@@ -287,17 +287,17 @@ discard block |
||
287 | 287 | * @param $update_options |
288 | 288 | * @param $option_name |
289 | 289 | */ |
290 | - public function set_notification_status( $update_options, $option_name ) { |
|
290 | + public function set_notification_status($update_options, $option_name) { |
|
291 | 291 | // Get updated settings. |
292 | 292 | $update_options = give_get_settings(); |
293 | 293 | |
294 | 294 | if ( |
295 | - ! empty( $update_options['email_access'] ) |
|
296 | - && ! empty( $update_options[ "{$this->config['id']}_notification" ] ) |
|
297 | - && $update_options['email_access'] !== $update_options[ "{$this->config['id']}_notification" ] |
|
295 | + ! empty($update_options['email_access']) |
|
296 | + && ! empty($update_options["{$this->config['id']}_notification"]) |
|
297 | + && $update_options['email_access'] !== $update_options["{$this->config['id']}_notification"] |
|
298 | 298 | ) { |
299 | - $update_options[ "{$this->config['id']}_notification" ] = $update_options['email_access']; |
|
300 | - update_option( $option_name, $update_options, false ); |
|
299 | + $update_options["{$this->config['id']}_notification"] = $update_options['email_access']; |
|
300 | + update_option($option_name, $update_options, false); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @param Give_Email_Access_Email $email |
313 | 313 | * @return string |
314 | 314 | */ |
315 | - public function email_preview_header( $email_preview_header, $email ) { |
|
316 | - if( $this->config['id'] === $email->config['id'] ) { |
|
315 | + public function email_preview_header($email_preview_header, $email) { |
|
316 | + if ($this->config['id'] === $email->config['id']) { |
|
317 | 317 | $email_preview_header = ''; |
318 | 318 | } |
319 | 319 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @return Give_Donor_Stats |
39 | 39 | */ |
40 | 40 | public static function get_instance() { |
41 | - if ( null === static::$instance ) { |
|
41 | + if (null === static::$instance) { |
|
42 | 42 | self::$instance = new static(); |
43 | 43 | } |
44 | 44 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @return string |
58 | 58 | * |
59 | 59 | */ |
60 | - public static function donated( $args = array() ) { |
|
60 | + public static function donated($args = array()) { |
|
61 | 61 | global $wpdb; |
62 | - $donation_id_col = Give()->payment_meta->get_meta_type() . '_id'; |
|
62 | + $donation_id_col = Give()->payment_meta->get_meta_type().'_id'; |
|
63 | 63 | |
64 | 64 | $donated_amount = ''; |
65 | 65 | |
66 | - if ( empty( $args['donor'] ) ) { |
|
66 | + if (empty($args['donor'])) { |
|
67 | 67 | return $donated_amount; |
68 | 68 | } |
69 | 69 | |
@@ -72,25 +72,25 @@ discard block |
||
72 | 72 | $args['fields'] = 'ids'; |
73 | 73 | $args['number'] = - 1; |
74 | 74 | |
75 | - $donation_query = new Give_Payments_Query( $args ); |
|
75 | + $donation_query = new Give_Payments_Query($args); |
|
76 | 76 | $donations = $donation_query->get_payments(); |
77 | - $donation_id_str = implode( '\',\'', $donations ); |
|
77 | + $donation_id_str = implode('\',\'', $donations); |
|
78 | 78 | |
79 | 79 | $query = "SELECT {$donation_id_col} as id, meta_value as total |
80 | 80 | FROM {$wpdb->donationmeta} |
81 | 81 | WHERE meta_key='_give_payment_total' |
82 | 82 | AND {$donation_id_col} IN ('{$donation_id_str}')"; |
83 | 83 | |
84 | - $donated_amounts = $wpdb->get_results( $query, ARRAY_A ); |
|
84 | + $donated_amounts = $wpdb->get_results($query, ARRAY_A); |
|
85 | 85 | |
86 | - if ( ! empty( $donated_amounts ) ) { |
|
87 | - foreach ( $donated_amounts as $donation ) { |
|
86 | + if ( ! empty($donated_amounts)) { |
|
87 | + foreach ($donated_amounts as $donation) { |
|
88 | 88 | // Do not include anonymous donation in calculation. |
89 | - if( give_is_anonymous_donation( $donation['id']) ){ |
|
89 | + if (give_is_anonymous_donation($donation['id'])) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
93 | - $currency_code = give_get_payment_currency_code( $donation['id'] ); |
|
93 | + $currency_code = give_get_payment_currency_code($donation['id']); |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Filter the donation amount |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | $formatted_amount = apply_filters( |
102 | 102 | 'give_donation_amount', |
103 | - give_format_amount( $donation['total'], array( 'currency' => $currency_code ) ), |
|
103 | + give_format_amount($donation['total'], array('currency' => $currency_code)), |
|
104 | 104 | $donation['total'], |
105 | 105 | $donation['id'], |
106 | - array( 'type' => 'stats', 'currency' => false, 'amount' => false ) |
|
106 | + array('type' => 'stats', 'currency' => false, 'amount' => false) |
|
107 | 107 | ); |
108 | 108 | |
109 | - $donated_amount += (float) give_maybe_sanitize_amount( $formatted_amount, array( 'currency' => $currency_code ) ); |
|
109 | + $donated_amount += (float) give_maybe_sanitize_amount($formatted_amount, array('currency' => $currency_code)); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 |