@@ -259,8 +259,11 @@ discard block |
||
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | 260 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | - <?php else : ?> |
|
263 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
262 | + <?php else { |
|
263 | + : ?> |
|
264 | + <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); |
|
265 | +} |
|
266 | +?></span> |
|
264 | 267 | <?php endif; ?> |
265 | 268 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
266 | 269 | <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
@@ -329,8 +332,11 @@ discard block |
||
329 | 332 | } |
330 | 333 | ?> |
331 | 334 | </select> |
332 | - <?php else : ?> |
|
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
335 | + <?php else { |
|
336 | + : ?> |
|
337 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
338 | +} |
|
339 | +?>" /> |
|
334 | 340 | <?php endif; ?> |
335 | 341 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
336 | 342 | </span> |
@@ -420,9 +426,12 @@ discard block |
||
420 | 426 | </td> |
421 | 427 | </tr> |
422 | 428 | <?php endforeach; ?> |
423 | - <?php else: ?> |
|
429 | + <?php else { |
|
430 | + : ?> |
|
424 | 431 | <tr> |
425 | - <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); ?></td> |
|
432 | + <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); |
|
433 | +} |
|
434 | +?></td> |
|
426 | 435 | </tr> |
427 | 436 | <?php endif; ?> |
428 | 437 | </tbody> |
@@ -463,9 +472,12 @@ discard block |
||
463 | 472 | </td> |
464 | 473 | </tr> |
465 | 474 | <?php endforeach; ?> |
466 | - <?php else: ?> |
|
475 | + <?php else { |
|
476 | + : ?> |
|
467 | 477 | <tr> |
468 | - <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td> |
|
478 | + <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); |
|
479 | +} |
|
480 | +?></td> |
|
469 | 481 | </tr> |
470 | 482 | <?php endif; ?> |
471 | 483 | </tbody> |
@@ -539,9 +551,12 @@ discard block |
||
539 | 551 | </span> |
540 | 552 | </div> |
541 | 553 | <?php endforeach; ?> |
542 | - <?php else: ?> |
|
554 | + <?php else { |
|
555 | + : ?> |
|
543 | 556 | <div class="give-no-customer-notes"> |
544 | - <?php esc_html_e( 'No Donor Notes', 'give' ); ?> |
|
557 | + <?php esc_html_e( 'No Donor Notes', 'give' ); |
|
558 | +} |
|
559 | +?> |
|
545 | 560 | </div> |
546 | 561 | <?php endif; ?> |
547 | 562 | </div> |
@@ -10,7 +10,7 @@ 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 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_customers_page() { |
26 | 26 | $default_views = give_customer_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_customer_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_customer_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_customers_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_customer_views', $views ); |
|
45 | + return apply_filters('give_customer_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
59 | + return apply_filters('give_customer_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_customers_list() { |
70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
71 | 71 | |
72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
73 | 73 | $customers_table->prepare_items(); |
74 | 74 | ?> |
75 | 75 | <div class="wrap"> |
76 | - <h1><?php esc_html_e( 'Donors', 'give' ); ?></h1> |
|
76 | + <h1><?php esc_html_e('Donors', 'give'); ?></h1> |
|
77 | 77 | <?php |
78 | 78 | /** |
79 | 79 | * Fires in donors screen, above the table. |
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
86 | 86 | <?php |
87 | - $customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
87 | + $customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
88 | 88 | $customers_table->display(); |
89 | 89 | ?> |
90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_donors_table_bottom' ); |
|
100 | + do_action('give_donors_table_bottom'); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | -function give_render_customer_view( $view, $callbacks ) { |
|
116 | +function give_render_customer_view($view, $callbacks) { |
|
117 | 117 | |
118 | 118 | $render = true; |
119 | 119 | |
120 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
120 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
121 | 121 | |
122 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
123 | - give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
122 | + if ( ! current_user_can($customer_view_role)) { |
|
123 | + give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give')); |
|
124 | 124 | $render = false; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
128 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID Provided.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $customer_id = (int) $_GET['id']; |
133 | - $customer = new Give_Customer( $customer_id ); |
|
133 | + $customer = new Give_Customer($customer_id); |
|
134 | 134 | |
135 | - if ( empty( $customer->id ) ) { |
|
136 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
135 | + if (empty($customer->id)) { |
|
136 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID Provided.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class='wrap'> |
144 | 144 | |
145 | - <?php if ( give_get_errors() ) : ?> |
|
145 | + <?php if (give_get_errors()) : ?> |
|
146 | 146 | <div class="error settings-error"> |
147 | - <?php give_print_errors( 0 ); ?> |
|
147 | + <?php give_print_errors(0); ?> |
|
148 | 148 | </div> |
149 | 149 | <?php endif; ?> |
150 | 150 | |
151 | - <?php if ( $customer && $render ) : ?> |
|
151 | + <?php if ($customer && $render) : ?> |
|
152 | 152 | |
153 | 153 | <div id="customer-tab-wrapper"> |
154 | 154 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
155 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
155 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
156 | 156 | <?php $active = $key === $view ? true : false; ?> |
157 | 157 | <?php $class = $active ? 'active' : 'inactive'; ?> |
158 | 158 | |
159 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
160 | - <?php if ( ! $active ) : ?> |
|
161 | - <a title="<?php esc_attr_e( $tab['title'] ); ?>" aria-label="<?php esc_attr_e( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
159 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
160 | + <?php if ( ! $active) : ?> |
|
161 | + <a title="<?php esc_attr_e($tab['title']); ?>" aria-label="<?php esc_attr_e($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
162 | 162 | <?php endif; ?> |
163 | 163 | |
164 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php esc_html_e( $tab['title'] ); ?> |
|
165 | - <?php if ( ! $active ) : ?> |
|
164 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($tab['title']); ?> |
|
165 | + <?php if ( ! $active) : ?> |
|
166 | 166 | </a> |
167 | 167 | <?php endif; ?> |
168 | 168 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div id="give-customer-card-wrapper"> |
177 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
177 | + <?php $callbacks[$view]($customer) ?> |
|
178 | 178 | </div> |
179 | 179 | |
180 | 180 | <?php endif; ?> |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return void |
196 | 196 | */ |
197 | -function give_customers_view( $customer ) { |
|
197 | +function give_customers_view($customer) { |
|
198 | 198 | |
199 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
199 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Fires in donor profile screen, above the donor card. |
@@ -205,32 +205,32 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @param object $customer The customer object being displayed. |
207 | 207 | */ |
208 | - do_action( 'give_donor_card_top', $customer ); |
|
208 | + do_action('give_donor_card_top', $customer); |
|
209 | 209 | ?> |
210 | 210 | |
211 | 211 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
212 | 212 | |
213 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
213 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
214 | 214 | |
215 | 215 | <div class="customer-info"> |
216 | 216 | |
217 | 217 | <div class="donor-bio-header clearfix"> |
218 | 218 | |
219 | 219 | <div class="avatar-wrap left" id="customer-avatar"> |
220 | - <?php echo get_avatar( $customer->email ); ?> |
|
220 | + <?php echo get_avatar($customer->email); ?> |
|
221 | 221 | </div> |
222 | 222 | |
223 | 223 | <div id="customer-name-wrap" class="left"> |
224 | 224 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
225 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
225 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
226 | 226 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
227 | 227 | </div> |
228 | 228 | <p class="customer-since info-item"> |
229 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
230 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
229 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
230 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
231 | 231 | </p> |
232 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
233 | - <a title="<?php esc_attr_e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
232 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
233 | + <a title="<?php esc_attr_e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
234 | 234 | <?php endif; ?> |
235 | 235 | </div> |
236 | 236 | <!-- /donor-bio-header --> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <table class="widefat"> |
241 | 241 | <tbody> |
242 | 242 | <tr> |
243 | - <td><label for="tablecell"><?php esc_html_e( 'Email', 'give' ); ?></label>:</td> |
|
243 | + <td><label for="tablecell"><?php esc_html_e('Email', 'give'); ?></label>:</td> |
|
244 | 244 | <td class="row-title"> |
245 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e( 'Donor Email', 'give' ); ?>" /></span> |
|
245 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e('Donor Email', 'give'); ?>" /></span> |
|
246 | 246 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
247 | 247 | </td> |
248 | 248 | </tr> |
249 | 249 | <tr class="alternate"> |
250 | - <td><label for="tablecell"><?php esc_html_e( 'User ID', 'give' ); ?></label>:</td> |
|
250 | + <td><label for="tablecell"><?php esc_html_e('User ID', 'give'); ?></label>:</td> |
|
251 | 251 | <td class="row-title"> |
252 | 252 | <span class="customer-user-id info-item edit-item"> |
253 | 253 | <?php |
@@ -263,38 +263,38 @@ discard block |
||
263 | 263 | 'data' => $data_atts, |
264 | 264 | ); |
265 | 265 | |
266 | - if ( ! empty( $user_id ) ) { |
|
267 | - $userdata = get_userdata( $user_id ); |
|
266 | + if ( ! empty($user_id)) { |
|
267 | + $userdata = get_userdata($user_id); |
|
268 | 268 | $user_args['value'] = $userdata->user_login; |
269 | 269 | } |
270 | 270 | |
271 | - echo Give()->html->ajax_user_search( $user_args ); |
|
271 | + echo Give()->html->ajax_user_search($user_args); |
|
272 | 272 | ?> |
273 | 273 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
274 | 274 | </span> |
275 | 275 | |
276 | 276 | <span class="customer-user-id info-item editable"> |
277 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
277 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
278 | 278 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
279 | 279 | <?php else : ?> |
280 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
280 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
281 | 281 | <?php endif; ?> |
282 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
283 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
282 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
283 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
284 | 284 | <?php endif; ?> |
285 | 285 | </span> |
286 | 286 | </td> |
287 | 287 | </tr> |
288 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
288 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
289 | 289 | |
290 | 290 | <tr> |
291 | - <td><?php esc_html_e( 'Address', 'give' ); ?>:</td> |
|
291 | + <td><?php esc_html_e('Address', 'give'); ?>:</td> |
|
292 | 292 | <td class="row-title"> |
293 | 293 | |
294 | 294 | <div class="customer-address-wrapper"> |
295 | 295 | |
296 | 296 | <?php |
297 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
297 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
298 | 298 | $defaults = array( |
299 | 299 | 'line1' => '', |
300 | 300 | 'line2' => '', |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | 'zip' => '' |
305 | 305 | ); |
306 | 306 | |
307 | - $address = wp_parse_args( $address, $defaults ); |
|
307 | + $address = wp_parse_args($address, $defaults); |
|
308 | 308 | ?> |
309 | 309 | |
310 | - <?php if ( ! empty( $address ) ) { ?> |
|
310 | + <?php if ( ! empty($address)) { ?> |
|
311 | 311 | <span class="customer-address info-item editable"> |
312 | 312 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
313 | 313 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -318,38 +318,38 @@ discard block |
||
318 | 318 | </span> |
319 | 319 | <?php } ?> |
320 | 320 | <span class="customer-address info-item edit-item"> |
321 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
322 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
323 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
321 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
322 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
323 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
324 | 324 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
325 | 325 | <?php |
326 | 326 | |
327 | 327 | $selected_country = $address['country']; |
328 | 328 | |
329 | 329 | $countries = give_get_country_list(); |
330 | - foreach ( $countries as $country_code => $country ) { |
|
331 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
330 | + foreach ($countries as $country_code => $country) { |
|
331 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
332 | 332 | } |
333 | 333 | ?> |
334 | 334 | </select> |
335 | 335 | <?php |
336 | 336 | $selected_state = give_get_state(); |
337 | - $states = give_get_states( $selected_country ); |
|
337 | + $states = give_get_states($selected_country); |
|
338 | 338 | |
339 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
339 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
340 | 340 | |
341 | - if ( ! empty( $states ) ) : ?> |
|
341 | + if ( ! empty($states)) : ?> |
|
342 | 342 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
343 | 343 | <?php |
344 | - foreach ( $states as $state_code => $state ) { |
|
345 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
344 | + foreach ($states as $state_code => $state) { |
|
345 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
346 | 346 | } |
347 | 347 | ?> |
348 | 348 | </select> |
349 | 349 | <?php else : ?> |
350 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
350 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
351 | 351 | <?php endif; ?> |
352 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
352 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
353 | 353 | </span> |
354 | 354 | |
355 | 355 | </div> |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | |
367 | 367 | <span id="customer-edit-actions" class="edit-item"> |
368 | 368 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
369 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
369 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
370 | 370 | <input type="hidden" name="give_action" value="edit-customer" /> |
371 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
372 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
371 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
372 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
373 | 373 | </span> |
374 | 374 | |
375 | 375 | </form> |
@@ -384,24 +384,24 @@ discard block |
||
384 | 384 | * |
385 | 385 | * @param object $customer The customer object being displayed. |
386 | 386 | */ |
387 | - do_action( 'give_donor_before_stats', $customer ); |
|
387 | + do_action('give_donor_before_stats', $customer); |
|
388 | 388 | ?> |
389 | 389 | |
390 | 390 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
391 | 391 | <ul> |
392 | 392 | <li> |
393 | - <a title="<?php esc_attr_e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
393 | + <a title="<?php esc_attr_e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
394 | 394 | <span class="dashicons dashicons-heart"></span> |
395 | 395 | <?php |
396 | 396 | //Completed Donations |
397 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
398 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
397 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
398 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
399 | 399 | ?> |
400 | 400 | </a> |
401 | 401 | </li> |
402 | 402 | <li> |
403 | 403 | <span class="dashicons dashicons-chart-area"></span> |
404 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
404 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
405 | 405 | </li> |
406 | 406 | <?php |
407 | 407 | /** |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @param object $customer The customer object being displayed. |
415 | 415 | */ |
416 | - do_action( 'give_donor_stats_list', $customer ); |
|
416 | + do_action('give_donor_stats_list', $customer); |
|
417 | 417 | ?> |
418 | 418 | </ul> |
419 | 419 | </div> |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @param object $customer The customer object being displayed. |
428 | 428 | */ |
429 | - do_action( 'give_donor_before_tables_wrapper', $customer ); |
|
429 | + do_action('give_donor_before_tables_wrapper', $customer); |
|
430 | 430 | ?> |
431 | 431 | |
432 | 432 | <div id="customer-tables-wrapper" class="customer-section"> |
@@ -439,37 +439,37 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param object $customer The customer object being displayed. |
441 | 441 | */ |
442 | - do_action( 'give_donor_before_tables', $customer ); |
|
442 | + do_action('give_donor_before_tables', $customer); |
|
443 | 443 | ?> |
444 | 444 | |
445 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
445 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
446 | 446 | <?php |
447 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
448 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
449 | - $payments = array_slice( $payments, 0, 10 ); |
|
447 | + $payment_ids = explode(',', $customer->payment_ids); |
|
448 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
449 | + $payments = array_slice($payments, 0, 10); |
|
450 | 450 | ?> |
451 | 451 | <table class="wp-list-table widefat striped payments"> |
452 | 452 | <thead> |
453 | 453 | <tr> |
454 | - <th><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
455 | - <th><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
456 | - <th><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
457 | - <th><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
458 | - <th><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
454 | + <th><?php esc_html_e('ID', 'give'); ?></th> |
|
455 | + <th><?php esc_html_e('Amount', 'give'); ?></th> |
|
456 | + <th><?php esc_html_e('Date', 'give'); ?></th> |
|
457 | + <th><?php esc_html_e('Status', 'give'); ?></th> |
|
458 | + <th><?php esc_html_e('Actions', 'give'); ?></th> |
|
459 | 459 | </tr> |
460 | 460 | </thead> |
461 | 461 | <tbody> |
462 | - <?php if ( ! empty( $payments ) ) : ?> |
|
463 | - <?php foreach ( $payments as $payment ) : ?> |
|
462 | + <?php if ( ! empty($payments)) : ?> |
|
463 | + <?php foreach ($payments as $payment) : ?> |
|
464 | 464 | <tr> |
465 | 465 | <td><?php echo $payment->ID; ?></td> |
466 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
467 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
468 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
466 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
467 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
468 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
469 | 469 | <td> |
470 | - <a title="<?php esc_attr_e( 'View Details for Donation', 'give' ); |
|
471 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
472 | - <?php esc_html_e( 'View Details', 'give' ); ?> |
|
470 | + <a title="<?php esc_attr_e('View Details for Donation', 'give'); |
|
471 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
472 | + <?php esc_html_e('View Details', 'give'); ?> |
|
473 | 473 | </a> |
474 | 474 | <?php |
475 | 475 | /** |
@@ -482,47 +482,47 @@ discard block |
||
482 | 482 | * @param object $customer The customer object being displayed. |
483 | 483 | * @param object $payment The payment object being displayed. |
484 | 484 | */ |
485 | - do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); |
|
485 | + do_action('give_donor_recent_purchases_actions', $customer, $payment); |
|
486 | 486 | ?> |
487 | 487 | </td> |
488 | 488 | </tr> |
489 | 489 | <?php endforeach; ?> |
490 | 490 | <?php else: ?> |
491 | 491 | <tr> |
492 | - <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); ?></td> |
|
492 | + <td colspan="5"><?php esc_html_e('No Donations Found', 'give'); ?></td> |
|
493 | 493 | </tr> |
494 | 494 | <?php endif; ?> |
495 | 495 | </tbody> |
496 | 496 | </table> |
497 | 497 | |
498 | - <h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3> |
|
498 | + <h3><?php esc_html_e('Completed Donations', 'give'); ?></h3> |
|
499 | 499 | <?php |
500 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
500 | + $donations = give_get_users_completed_donations($customer->email); |
|
501 | 501 | ?> |
502 | 502 | <table class="wp-list-table widefat striped donations"> |
503 | 503 | <thead> |
504 | 504 | <tr> |
505 | 505 | <th><?php echo give_get_forms_label_singular(); ?></th> |
506 | - <th width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
506 | + <th width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
507 | 507 | </tr> |
508 | 508 | </thead> |
509 | 509 | <tbody> |
510 | - <?php if ( ! empty( $donations ) ) : ?> |
|
511 | - <?php foreach ( $donations as $donation ) : ?> |
|
510 | + <?php if ( ! empty($donations)) : ?> |
|
511 | + <?php foreach ($donations as $donation) : ?> |
|
512 | 512 | <tr> |
513 | 513 | <td><?php echo $donation->post_title; ?></td> |
514 | 514 | <td> |
515 | 515 | <a title="<?php |
516 | 516 | printf( |
517 | 517 | /* translators: %s: post title */ |
518 | - esc_attr__( 'View %s', 'give' ), |
|
518 | + esc_attr__('View %s', 'give'), |
|
519 | 519 | $donation->post_title |
520 | - ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); |
|
520 | + ); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); |
|
521 | 521 | ?>"> |
522 | 522 | <?php |
523 | 523 | printf( |
524 | 524 | /* translators: %s: forms singular label */ |
525 | - esc_html__( 'View %s', 'give' ), |
|
525 | + esc_html__('View %s', 'give'), |
|
526 | 526 | give_get_forms_label_singular() |
527 | 527 | ); |
528 | 528 | ?> |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | <?php endforeach; ?> |
533 | 533 | <?php else: ?> |
534 | 534 | <tr> |
535 | - <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td> |
|
535 | + <td colspan="2"><?php esc_html_e('No Completed Donations Found', 'give'); ?></td> |
|
536 | 536 | </tr> |
537 | 537 | <?php endif; ?> |
538 | 538 | </tbody> |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * |
547 | 547 | * @param object $customer The customer object being displayed. |
548 | 548 | */ |
549 | - do_action( 'give_donor_after_tables', $customer ); |
|
549 | + do_action('give_donor_after_tables', $customer); |
|
550 | 550 | ?> |
551 | 551 | |
552 | 552 | </div> |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @param object $customer The customer object being displayed. |
561 | 561 | */ |
562 | - do_action( 'give_donor_card_bottom', $customer ); |
|
562 | + do_action('give_donor_card_bottom', $customer); |
|
563 | 563 | |
564 | 564 | } |
565 | 565 | |
@@ -572,30 +572,30 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return void |
574 | 574 | */ |
575 | -function give_customer_notes_view( $customer ) { |
|
575 | +function give_customer_notes_view($customer) { |
|
576 | 576 | |
577 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
578 | - $paged = absint( $paged ); |
|
577 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
578 | + $paged = absint($paged); |
|
579 | 579 | $note_count = $customer->get_notes_count(); |
580 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
581 | - $total_pages = ceil( $note_count / $per_page ); |
|
582 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
580 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
581 | + $total_pages = ceil($note_count / $per_page); |
|
582 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
583 | 583 | ?> |
584 | 584 | |
585 | 585 | <div id="customer-notes-wrapper"> |
586 | 586 | <div class="customer-notes-header"> |
587 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
587 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
588 | 588 | </div> |
589 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
589 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
590 | 590 | |
591 | - <?php if ( 1 == $paged ) : ?> |
|
591 | + <?php if (1 == $paged) : ?> |
|
592 | 592 | <div style="display: block; margin-bottom: 55px;"> |
593 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
593 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
594 | 594 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
595 | 595 | <br /> |
596 | 596 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
597 | 597 | <input type="hidden" name="give_action" value="add-customer-note" /> |
598 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
598 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
599 | 599 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
600 | 600 | </form> |
601 | 601 | </div> |
@@ -610,26 +610,26 @@ discard block |
||
610 | 610 | 'show_all' => true |
611 | 611 | ); |
612 | 612 | |
613 | - echo paginate_links( $pagination_args ); |
|
613 | + echo paginate_links($pagination_args); |
|
614 | 614 | ?> |
615 | 615 | |
616 | 616 | <div id="give-customer-notes" class="postbox"> |
617 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
618 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
617 | + <?php if (count($customer_notes) > 0) : ?> |
|
618 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
619 | 619 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
620 | 620 | <span class="note-content-wrap"> |
621 | - <?php echo stripslashes( $note ); ?> |
|
621 | + <?php echo stripslashes($note); ?> |
|
622 | 622 | </span> |
623 | 623 | </div> |
624 | 624 | <?php endforeach; ?> |
625 | 625 | <?php else: ?> |
626 | 626 | <div class="give-no-customer-notes"> |
627 | - <?php esc_html_e( 'No Donor Notes', 'give' ); ?> |
|
627 | + <?php esc_html_e('No Donor Notes', 'give'); ?> |
|
628 | 628 | </div> |
629 | 629 | <?php endif; ?> |
630 | 630 | </div> |
631 | 631 | |
632 | - <?php echo paginate_links( $pagination_args ); ?> |
|
632 | + <?php echo paginate_links($pagination_args); ?> |
|
633 | 633 | |
634 | 634 | </div> |
635 | 635 | |
@@ -645,9 +645,9 @@ discard block |
||
645 | 645 | * |
646 | 646 | * @return void |
647 | 647 | */ |
648 | -function give_customers_delete_view( $customer ) { |
|
648 | +function give_customers_delete_view($customer) { |
|
649 | 649 | |
650 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
650 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
651 | 651 | |
652 | 652 | /** |
653 | 653 | * Fires in donor delete screen, above the content. |
@@ -656,15 +656,15 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param object $customer The customer object being displayed. |
658 | 658 | */ |
659 | - do_action( 'give_customer_delete_top', $customer ); |
|
659 | + do_action('give_customer_delete_top', $customer); |
|
660 | 660 | ?> |
661 | 661 | |
662 | 662 | <div class="info-wrapper customer-section"> |
663 | 663 | |
664 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
664 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
665 | 665 | |
666 | 666 | <div class="customer-notes-header"> |
667 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
667 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
668 | 668 | </div> |
669 | 669 | |
670 | 670 | |
@@ -672,16 +672,16 @@ discard block |
||
672 | 672 | |
673 | 673 | <span class="delete-customer-options"> |
674 | 674 | <p> |
675 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
676 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
675 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
676 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
677 | 677 | </p> |
678 | 678 | |
679 | 679 | <p> |
680 | - <?php echo Give()->html->checkbox( array( |
|
680 | + <?php echo Give()->html->checkbox(array( |
|
681 | 681 | 'name' => 'give-customer-delete-records', |
682 | - 'options' => array( 'disabled' => true ) |
|
683 | - ) ); ?> |
|
684 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
682 | + 'options' => array('disabled' => true) |
|
683 | + )); ?> |
|
684 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label> |
|
685 | 685 | </p> |
686 | 686 | |
687 | 687 | <?php |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @param object $customer The customer object being displayed. |
696 | 696 | */ |
697 | - do_action( 'give_customer_delete_inputs', $customer ); |
|
697 | + do_action('give_customer_delete_inputs', $customer); |
|
698 | 698 | ?> |
699 | 699 | </span> |
700 | 700 | |
701 | 701 | <span id="customer-edit-actions"> |
702 | 702 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
703 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
703 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
704 | 704 | <input type="hidden" name="give_action" value="delete-customer" /> |
705 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
706 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
705 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
706 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
707 | 707 | </span> |
708 | 708 | |
709 | 709 | </div> |
@@ -719,5 +719,5 @@ discard block |
||
719 | 719 | * |
720 | 720 | * @param object $customer The customer object being displayed. |
721 | 721 | */ |
722 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
722 | + do_action('give_customer_delete_bottom', $customer); |
|
723 | 723 | } |
@@ -64,11 +64,14 @@ |
||
64 | 64 | }, 250 ); |
65 | 65 | </script> |
66 | 66 | |
67 | - <?php else : ?> |
|
67 | + <?php else { |
|
68 | + : ?> |
|
68 | 69 | |
69 | 70 | <div id="give-upgrade-status"> |
70 | 71 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | + <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); |
|
73 | +} |
|
74 | +?> |
|
72 | 75 | <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
73 | 76 | </p> |
74 | 77 | </div> |
@@ -10,7 +10,7 @@ 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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h1><?php esc_html_e( 'Give - Upgrades', 'give' ); ?></h1> |
|
46 | + <h1><?php esc_html_e('Give - Upgrades', 'give'); ?></h1> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( esc_html__( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(esc_html__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @access private |
22 | 22 | * @since 1.0 |
23 | 23 | */ |
24 | -add_action( 'give_paypal_cc_form', '__return_false' ); |
|
24 | +add_action('give_paypal_cc_form', '__return_false'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Process PayPal Purchase |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_process_paypal_purchase( $purchase_data ) { |
|
35 | +function give_process_paypal_purchase($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | - $form_id = intval( $purchase_data['post_data']['give-form-id'] ); |
|
41 | + $form_id = intval($purchase_data['post_data']['give-form-id']); |
|
42 | 42 | $price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : ''; |
43 | 43 | |
44 | 44 | // Collect payment data |
@@ -57,67 +57,67 @@ discard block |
||
57 | 57 | ); |
58 | 58 | |
59 | 59 | // Record the pending payment |
60 | - $payment = give_insert_payment( $payment_data ); |
|
60 | + $payment = give_insert_payment($payment_data); |
|
61 | 61 | |
62 | 62 | // Check payment |
63 | - if ( ! $payment ) { |
|
63 | + if ( ! $payment) { |
|
64 | 64 | // Record the error |
65 | 65 | give_record_gateway_error( |
66 | - esc_html__( 'Payment Error', 'give' ), |
|
66 | + esc_html__('Payment Error', 'give'), |
|
67 | 67 | sprintf( |
68 | 68 | /* translators: %s: payment data */ |
69 | - esc_html__( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ), |
|
70 | - json_encode( $payment_data ) |
|
69 | + esc_html__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'), |
|
70 | + json_encode($payment_data) |
|
71 | 71 | ), |
72 | 72 | $payment |
73 | 73 | ); |
74 | 74 | // Problems? send back |
75 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
75 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
76 | 76 | } else { |
77 | 77 | // Only send to PayPal if the pending payment is created successfully |
78 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
78 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
79 | 79 | |
80 | 80 | // Get the success url |
81 | - $return_url = add_query_arg( array( |
|
81 | + $return_url = add_query_arg(array( |
|
82 | 82 | 'payment-confirmation' => 'paypal', |
83 | 83 | 'payment-id' => $payment |
84 | 84 | |
85 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
85 | + ), get_permalink(give_get_option('success_page'))); |
|
86 | 86 | |
87 | 87 | // Get the PayPal redirect uri |
88 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
88 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
89 | 89 | |
90 | 90 | //Item name - pass level name if variable priced |
91 | 91 | $item_name = $purchase_data['post_data']['give-form-title']; |
92 | 92 | |
93 | 93 | //Verify has variable prices |
94 | - if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) { |
|
94 | + if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) { |
|
95 | 95 | |
96 | - $item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
96 | + $item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']); |
|
97 | 97 | |
98 | - $price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] ); |
|
98 | + $price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']); |
|
99 | 99 | |
100 | 100 | //Donation given doesn't match selected level (must be a custom amount) |
101 | - if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) { |
|
102 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
101 | + if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) { |
|
102 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
103 | 103 | //user custom amount text if any, fallback to default if not |
104 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
104 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
105 | 105 | |
106 | 106 | } //Is there any donation level text? |
107 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
108 | - $item_name .= ' - ' . $item_price_level_text; |
|
107 | + elseif ( ! empty($item_price_level_text)) { |
|
108 | + $item_name .= ' - '.$item_price_level_text; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | } //Single donation: Custom Amount |
112 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) { |
|
113 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
112 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) { |
|
113 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
114 | 114 | //user custom amount text if any, fallback to default if not |
115 | - $item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) ); |
|
115 | + $item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give')); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | // Setup PayPal arguments |
119 | 119 | $paypal_args = array( |
120 | - 'business' => give_get_option( 'paypal_email', false ), |
|
120 | + 'business' => give_get_option('paypal_email', false), |
|
121 | 121 | 'email' => $purchase_data['user_email'], |
122 | 122 | 'invoice' => $purchase_data['purchase_key'], |
123 | 123 | 'amount' => $purchase_data['price'], |
@@ -128,25 +128,25 @@ discard block |
||
128 | 128 | 'shipping' => '0', |
129 | 129 | 'no_note' => '1', |
130 | 130 | 'currency_code' => give_get_currency(), |
131 | - 'charset' => get_bloginfo( 'charset' ), |
|
131 | + 'charset' => get_bloginfo('charset'), |
|
132 | 132 | 'custom' => $payment, |
133 | 133 | 'rm' => '2', |
134 | 134 | 'return' => $return_url, |
135 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ), |
|
135 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment), |
|
136 | 136 | 'notify_url' => $listener_url, |
137 | 137 | 'page_style' => give_get_paypal_page_style(), |
138 | - 'cbt' => get_bloginfo( 'name' ), |
|
138 | + 'cbt' => get_bloginfo('name'), |
|
139 | 139 | 'bn' => 'givewp_SP' |
140 | 140 | ); |
141 | 141 | |
142 | - if ( ! empty( $purchase_data['user_info']['address'] ) ) { |
|
142 | + if ( ! empty($purchase_data['user_info']['address'])) { |
|
143 | 143 | $paypal_args['address1'] = $purchase_data['user_info']['address']['line1']; |
144 | 144 | $paypal_args['address2'] = $purchase_data['user_info']['address']['line2']; |
145 | 145 | $paypal_args['city'] = $purchase_data['user_info']['address']['city']; |
146 | 146 | $paypal_args['country'] = $purchase_data['user_info']['address']['country']; |
147 | 147 | } |
148 | 148 | |
149 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
149 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
150 | 150 | $paypal_extra_args = array( |
151 | 151 | 'cmd' => '_xclick', |
152 | 152 | ); |
@@ -156,23 +156,23 @@ discard block |
||
156 | 156 | ); |
157 | 157 | } |
158 | 158 | |
159 | - $paypal_args = array_merge( $paypal_extra_args, $paypal_args ); |
|
160 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data ); |
|
159 | + $paypal_args = array_merge($paypal_extra_args, $paypal_args); |
|
160 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data); |
|
161 | 161 | |
162 | 162 | // Build query |
163 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
163 | + $paypal_redirect .= http_build_query($paypal_args); |
|
164 | 164 | |
165 | 165 | // Fix for some sites that encode the entities |
166 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
166 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
167 | 167 | |
168 | 168 | // Redirect to PayPal |
169 | - wp_redirect( $paypal_redirect ); |
|
169 | + wp_redirect($paypal_redirect); |
|
170 | 170 | exit; |
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
174 | 174 | |
175 | -add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' ); |
|
175 | +add_action('give_gateway_paypal', 'give_process_paypal_purchase'); |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | */ |
183 | 183 | function give_listen_for_paypal_ipn() { |
184 | 184 | // Regular PayPal IPN |
185 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
186 | - do_action( 'give_verify_paypal_ipn' ); |
|
185 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
186 | + do_action('give_verify_paypal_ipn'); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
190 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
191 | 191 | |
192 | 192 | /** |
193 | 193 | * Process PayPal IPN |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | function give_process_paypal_ipn() { |
199 | 199 | |
200 | 200 | // Check the request method is POST |
201 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
201 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | $post_data = ''; |
207 | 207 | |
208 | 208 | // Fallback just in case post_max_size is lower than needed |
209 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
210 | - $post_data = file_get_contents( 'php://input' ); |
|
209 | + if (ini_get('allow_url_fopen')) { |
|
210 | + $post_data = file_get_contents('php://input'); |
|
211 | 211 | } else { |
212 | 212 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
213 | - ini_set( 'post_max_size', '12M' ); |
|
213 | + ini_set('post_max_size', '12M'); |
|
214 | 214 | } |
215 | 215 | // Start the encoded data collection with notification command |
216 | 216 | $encoded_data = 'cmd=_notify-validate'; |
@@ -219,40 +219,40 @@ discard block |
||
219 | 219 | $arg_separator = give_get_php_arg_separator_output(); |
220 | 220 | |
221 | 221 | // Verify there is a post_data |
222 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
222 | + if ($post_data || strlen($post_data) > 0) { |
|
223 | 223 | // Append the data |
224 | - $encoded_data .= $arg_separator . $post_data; |
|
224 | + $encoded_data .= $arg_separator.$post_data; |
|
225 | 225 | } else { |
226 | 226 | // Check if POST is empty |
227 | - if ( empty( $_POST ) ) { |
|
227 | + if (empty($_POST)) { |
|
228 | 228 | // Nothing to do |
229 | 229 | return; |
230 | 230 | } else { |
231 | 231 | // Loop through each POST |
232 | - foreach ( $_POST as $key => $value ) { |
|
232 | + foreach ($_POST as $key => $value) { |
|
233 | 233 | // Encode the value and append the data |
234 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
234 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | 239 | // Convert collected post data to an array |
240 | - parse_str( $encoded_data, $encoded_data_array ); |
|
240 | + parse_str($encoded_data, $encoded_data_array); |
|
241 | 241 | |
242 | - foreach ( $encoded_data_array as $key => $value ) { |
|
242 | + foreach ($encoded_data_array as $key => $value) { |
|
243 | 243 | |
244 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
245 | - $new_key = str_replace( '&', '&', $key ); |
|
246 | - $new_key = str_replace( 'amp;', '&' , $new_key ); |
|
244 | + if (false !== strpos($key, 'amp;')) { |
|
245 | + $new_key = str_replace('&', '&', $key); |
|
246 | + $new_key = str_replace('amp;', '&', $new_key); |
|
247 | 247 | |
248 | - unset( $encoded_data_array[ $key ] ); |
|
249 | - $encoded_data_array[ $new_key ] = $value; |
|
248 | + unset($encoded_data_array[$key]); |
|
249 | + $encoded_data_array[$new_key] = $value; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | } |
253 | 253 | |
254 | 254 | //Validate IPN request w/ PayPal if user hasn't disabled this security measure |
255 | - if ( ! give_get_option( 'disable_paypal_verification' ) ) { |
|
255 | + if ( ! give_get_option('disable_paypal_verification')) { |
|
256 | 256 | |
257 | 257 | $remote_post_vars = array( |
258 | 258 | 'method' => 'POST', |
@@ -272,27 +272,27 @@ discard block |
||
272 | 272 | ); |
273 | 273 | |
274 | 274 | // Validate the IPN |
275 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
275 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
276 | 276 | |
277 | - if ( is_wp_error( $api_response ) ) { |
|
277 | + if (is_wp_error($api_response)) { |
|
278 | 278 | give_record_gateway_error( |
279 | - esc_html__( 'IPN Error', 'give' ), |
|
279 | + esc_html__('IPN Error', 'give'), |
|
280 | 280 | sprintf( |
281 | 281 | /* translators: %s: Paypal IPN response */ |
282 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
283 | - json_encode( $api_response ) |
|
282 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
283 | + json_encode($api_response) |
|
284 | 284 | ) |
285 | 285 | ); |
286 | 286 | return; // Something went wrong |
287 | 287 | } |
288 | 288 | |
289 | - if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) { |
|
289 | + if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) { |
|
290 | 290 | give_record_gateway_error( |
291 | - esc_html__( 'IPN Error', 'give' ), |
|
291 | + esc_html__('IPN Error', 'give'), |
|
292 | 292 | sprintf( |
293 | 293 | /* translators: %s: Paypal IPN response */ |
294 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
295 | - json_encode( $api_response ) |
|
294 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
295 | + json_encode($api_response) |
|
296 | 296 | ) |
297 | 297 | ); |
298 | 298 | return; // Response not okay |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | // Check if $post_data_array has been populated |
304 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
304 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
@@ -310,21 +310,21 @@ discard block |
||
310 | 310 | 'payment_status' => '' |
311 | 311 | ); |
312 | 312 | |
313 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
313 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
314 | 314 | |
315 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
315 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
316 | 316 | |
317 | - if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) { |
|
317 | + if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) { |
|
318 | 318 | // Allow PayPal IPN types to be processed separately |
319 | - do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id ); |
|
319 | + do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id); |
|
320 | 320 | } else { |
321 | 321 | // Fallback to web accept just in case the txn_type isn't present |
322 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
322 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
323 | 323 | } |
324 | 324 | exit; |
325 | 325 | } |
326 | 326 | |
327 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
327 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Process web accept (one time) payment IPNs |
@@ -335,224 +335,224 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return void |
337 | 337 | */ |
338 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
338 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
339 | 339 | |
340 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) { |
|
340 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') { |
|
341 | 341 | return; |
342 | 342 | } |
343 | 343 | |
344 | - if ( empty( $payment_id ) ) { |
|
344 | + if (empty($payment_id)) { |
|
345 | 345 | return; |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Collect payment details |
349 | - $purchase_key = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number']; |
|
349 | + $purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number']; |
|
350 | 350 | $paypal_amount = $data['mc_gross']; |
351 | - $payment_status = strtolower( $data['payment_status'] ); |
|
352 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
353 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
354 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
351 | + $payment_status = strtolower($data['payment_status']); |
|
352 | + $currency_code = strtolower($data['mc_currency']); |
|
353 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
354 | + $payment_meta = give_get_payment_meta($payment_id); |
|
355 | 355 | |
356 | 356 | |
357 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
357 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
358 | 358 | return; // this isn't a PayPal standard IPN |
359 | 359 | } |
360 | 360 | |
361 | 361 | // Verify payment recipient |
362 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
362 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
363 | 363 | |
364 | 364 | give_record_gateway_error( |
365 | - esc_html__( 'IPN Error', 'give' ), |
|
365 | + esc_html__('IPN Error', 'give'), |
|
366 | 366 | sprintf( |
367 | 367 | /* translators: %s: Paypal IPN response */ |
368 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
369 | - json_encode( $data ) |
|
368 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
369 | + json_encode($data) |
|
370 | 370 | ), |
371 | 371 | $payment_id |
372 | 372 | ); |
373 | - give_update_payment_status( $payment_id, 'failed' ); |
|
374 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
373 | + give_update_payment_status($payment_id, 'failed'); |
|
374 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
375 | 375 | |
376 | 376 | return; |
377 | 377 | } |
378 | 378 | |
379 | 379 | // Verify payment currency |
380 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
380 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
381 | 381 | |
382 | 382 | give_record_gateway_error( |
383 | - esc_html__( 'IPN Error', 'give' ), |
|
383 | + esc_html__('IPN Error', 'give'), |
|
384 | 384 | sprintf( |
385 | 385 | /* translators: %s: Paypal IPN response */ |
386 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
387 | - json_encode( $data ) |
|
386 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
387 | + json_encode($data) |
|
388 | 388 | ), |
389 | 389 | $payment_id |
390 | 390 | ); |
391 | - give_update_payment_status( $payment_id, 'failed' ); |
|
392 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
391 | + give_update_payment_status($payment_id, 'failed'); |
|
392 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
393 | 393 | |
394 | 394 | return; |
395 | 395 | } |
396 | 396 | |
397 | - if ( ! give_get_payment_user_email( $payment_id ) ) { |
|
397 | + if ( ! give_get_payment_user_email($payment_id)) { |
|
398 | 398 | |
399 | 399 | // No email associated with purchase, so store from PayPal |
400 | - give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] ); |
|
400 | + give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']); |
|
401 | 401 | |
402 | 402 | // Setup and store the donors's details |
403 | 403 | $address = array(); |
404 | - $address['line1'] = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false; |
|
405 | - $address['city'] = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false; |
|
406 | - $address['state'] = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false; |
|
407 | - $address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false; |
|
408 | - $address['zip'] = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false; |
|
404 | + $address['line1'] = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false; |
|
405 | + $address['city'] = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false; |
|
406 | + $address['state'] = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false; |
|
407 | + $address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false; |
|
408 | + $address['zip'] = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false; |
|
409 | 409 | |
410 | 410 | $user_info = array( |
411 | 411 | 'id' => '-1', |
412 | - 'email' => sanitize_text_field( $data['payer_email'] ), |
|
413 | - 'first_name' => sanitize_text_field( $data['first_name'] ), |
|
414 | - 'last_name' => sanitize_text_field( $data['last_name'] ), |
|
412 | + 'email' => sanitize_text_field($data['payer_email']), |
|
413 | + 'first_name' => sanitize_text_field($data['first_name']), |
|
414 | + 'last_name' => sanitize_text_field($data['last_name']), |
|
415 | 415 | 'discount' => '', |
416 | 416 | 'address' => $address |
417 | 417 | ); |
418 | 418 | |
419 | 419 | $payment_meta['user_info'] = $user_info; |
420 | - give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta ); |
|
420 | + give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta); |
|
421 | 421 | } |
422 | 422 | |
423 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
423 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
424 | 424 | |
425 | 425 | // Process a refund |
426 | - give_process_paypal_refund( $data, $payment_id ); |
|
426 | + give_process_paypal_refund($data, $payment_id); |
|
427 | 427 | |
428 | 428 | } else { |
429 | 429 | |
430 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
430 | + if (get_post_status($payment_id) == 'publish') { |
|
431 | 431 | return; // Only complete payments once |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Retrieve the total purchase amount (before PayPal) |
435 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
435 | + $payment_amount = give_get_payment_amount($payment_id); |
|
436 | 436 | |
437 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
437 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
438 | 438 | // The prices don't match |
439 | 439 | give_record_gateway_error( |
440 | - esc_html__( 'IPN Error', 'give' ), |
|
440 | + esc_html__('IPN Error', 'give'), |
|
441 | 441 | sprintf( |
442 | 442 | /* translators: %s: Paypal IPN response */ |
443 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
444 | - json_encode( $data ) |
|
443 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
444 | + json_encode($data) |
|
445 | 445 | ), |
446 | 446 | $payment_id |
447 | 447 | ); |
448 | - give_update_payment_status( $payment_id, 'failed' ); |
|
449 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
448 | + give_update_payment_status($payment_id, 'failed'); |
|
449 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
450 | 450 | |
451 | 451 | return; |
452 | 452 | } |
453 | - if ( $purchase_key != give_get_payment_key( $payment_id ) ) { |
|
453 | + if ($purchase_key != give_get_payment_key($payment_id)) { |
|
454 | 454 | // Purchase keys don't match |
455 | 455 | give_record_gateway_error( |
456 | - esc_html__( 'IPN Error', 'give' ), |
|
456 | + esc_html__('IPN Error', 'give'), |
|
457 | 457 | sprintf( |
458 | 458 | /* translators: %s: Paypal IPN response */ |
459 | - esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ), |
|
460 | - json_encode( $data ) |
|
459 | + esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'), |
|
460 | + json_encode($data) |
|
461 | 461 | ), |
462 | 462 | $payment_id |
463 | 463 | ); |
464 | - give_update_payment_status( $payment_id, 'failed' ); |
|
465 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) ); |
|
464 | + give_update_payment_status($payment_id, 'failed'); |
|
465 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give')); |
|
466 | 466 | |
467 | 467 | return; |
468 | 468 | } |
469 | 469 | |
470 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
470 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
471 | 471 | give_insert_payment_note( |
472 | 472 | $payment_id, |
473 | 473 | sprintf( |
474 | 474 | /* translators: %s: Paypal transaction ID */ |
475 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
475 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
476 | 476 | $data['txn_id'] |
477 | 477 | ) |
478 | 478 | ); |
479 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
480 | - give_update_payment_status( $payment_id, 'publish' ); |
|
481 | - } else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
479 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
480 | + give_update_payment_status($payment_id, 'publish'); |
|
481 | + } else if ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
482 | 482 | |
483 | 483 | // Look for possible pending reasons, such as an echeck |
484 | 484 | |
485 | 485 | $note = ''; |
486 | 486 | |
487 | - switch ( strtolower( $data['pending_reason'] ) ) { |
|
487 | + switch (strtolower($data['pending_reason'])) { |
|
488 | 488 | |
489 | 489 | case 'echeck' : |
490 | 490 | |
491 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
491 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
492 | 492 | |
493 | 493 | break; |
494 | 494 | |
495 | 495 | case 'address' : |
496 | 496 | |
497 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
497 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
498 | 498 | |
499 | 499 | break; |
500 | 500 | |
501 | 501 | case 'intl' : |
502 | 502 | |
503 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
503 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
504 | 504 | |
505 | 505 | break; |
506 | 506 | |
507 | 507 | case 'multi-currency' : |
508 | 508 | |
509 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
509 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
510 | 510 | |
511 | 511 | break; |
512 | 512 | |
513 | 513 | case 'paymentreview' : |
514 | 514 | case 'regulatory_review' : |
515 | 515 | |
516 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
516 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
517 | 517 | |
518 | 518 | break; |
519 | 519 | |
520 | 520 | case 'unilateral' : |
521 | 521 | |
522 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
522 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
523 | 523 | |
524 | 524 | break; |
525 | 525 | |
526 | 526 | case 'upgrade' : |
527 | 527 | |
528 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
528 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
529 | 529 | |
530 | 530 | break; |
531 | 531 | |
532 | 532 | case 'verify' : |
533 | 533 | |
534 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' ); |
|
534 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give'); |
|
535 | 535 | |
536 | 536 | break; |
537 | 537 | |
538 | 538 | case 'other' : |
539 | 539 | |
540 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
540 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
541 | 541 | |
542 | 542 | break; |
543 | 543 | |
544 | 544 | } |
545 | 545 | |
546 | - if ( ! empty( $note ) ) { |
|
546 | + if ( ! empty($note)) { |
|
547 | 547 | |
548 | - give_insert_payment_note( $payment_id, $note ); |
|
548 | + give_insert_payment_note($payment_id, $note); |
|
549 | 549 | |
550 | 550 | } |
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
555 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
556 | 556 | |
557 | 557 | /** |
558 | 558 | * Process PayPal IPN Refunds |
@@ -563,28 +563,28 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @return void |
565 | 565 | */ |
566 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
566 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
567 | 567 | |
568 | 568 | // Collect payment details |
569 | 569 | |
570 | - if ( empty( $payment_id ) ) { |
|
570 | + if (empty($payment_id)) { |
|
571 | 571 | return; |
572 | 572 | } |
573 | 573 | |
574 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
574 | + if (get_post_status($payment_id) == 'refunded') { |
|
575 | 575 | return; // Only refund payments once |
576 | 576 | } |
577 | 577 | |
578 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
578 | + $payment_amount = give_get_payment_amount($payment_id); |
|
579 | 579 | $refund_amount = $data['payment_gross'] * - 1; |
580 | 580 | |
581 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
581 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
582 | 582 | |
583 | 583 | give_insert_payment_note( |
584 | 584 | $payment_id, |
585 | 585 | sprintf( |
586 | 586 | /* translators: %s: Paypal parent transaction ID */ |
587 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
587 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
588 | 588 | $data['parent_txn_id'] |
589 | 589 | ) |
590 | 590 | ); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $payment_id, |
598 | 598 | sprintf( |
599 | 599 | /* translators: %s: Paypal parent transaction ID */ |
600 | - esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ), |
|
600 | + esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'), |
|
601 | 601 | $data['parent_txn_id'], $data['reason_code'] |
602 | 602 | ) |
603 | 603 | ); |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | $payment_id, |
606 | 606 | sprintf( |
607 | 607 | /* translators: %s: Paypal transaction ID */ |
608 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
608 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
609 | 609 | $data['txn_id'] |
610 | 610 | ) |
611 | 611 | ); |
612 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
612 | + give_update_payment_status($payment_id, 'refunded'); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | /** |
@@ -621,24 +621,24 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @return string |
623 | 623 | */ |
624 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
624 | +function give_get_paypal_redirect($ssl_check = false) { |
|
625 | 625 | |
626 | - if ( is_ssl() || ! $ssl_check ) { |
|
626 | + if (is_ssl() || ! $ssl_check) { |
|
627 | 627 | $protocal = 'https://'; |
628 | 628 | } else { |
629 | 629 | $protocal = 'http://'; |
630 | 630 | } |
631 | 631 | |
632 | 632 | // Check the current payment mode |
633 | - if ( give_is_test_mode() ) { |
|
633 | + if (give_is_test_mode()) { |
|
634 | 634 | // Test mode |
635 | - $paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
635 | + $paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
636 | 636 | } else { |
637 | 637 | // Live mode |
638 | - $paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr'; |
|
638 | + $paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr'; |
|
639 | 639 | } |
640 | 640 | |
641 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
641 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
@@ -648,8 +648,8 @@ discard block |
||
648 | 648 | * @return string |
649 | 649 | */ |
650 | 650 | function give_get_paypal_page_style() { |
651 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
652 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
651 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
652 | + return apply_filters('give_paypal_page_style', $page_style); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
@@ -664,27 +664,27 @@ discard block |
||
664 | 664 | * @return string |
665 | 665 | * |
666 | 666 | */ |
667 | -function give_paypal_success_page_content( $content ) { |
|
667 | +function give_paypal_success_page_content($content) { |
|
668 | 668 | |
669 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
669 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
670 | 670 | return $content; |
671 | 671 | } |
672 | 672 | |
673 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
673 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
674 | 674 | |
675 | - if ( ! $payment_id ) { |
|
675 | + if ( ! $payment_id) { |
|
676 | 676 | $session = give_get_purchase_session(); |
677 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
677 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
678 | 678 | } |
679 | 679 | |
680 | - $payment = get_post( $payment_id ); |
|
680 | + $payment = get_post($payment_id); |
|
681 | 681 | |
682 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
682 | + if ($payment && 'pending' == $payment->post_status) { |
|
683 | 683 | |
684 | 684 | // Payment is still pending so show processing indicator to fix the Race Condition |
685 | 685 | ob_start(); |
686 | 686 | |
687 | - give_get_template_part( 'payment', 'processing' ); |
|
687 | + give_get_template_part('payment', 'processing'); |
|
688 | 688 | |
689 | 689 | $content = ob_get_clean(); |
690 | 690 | |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | |
695 | 695 | } |
696 | 696 | |
697 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
697 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
698 | 698 | |
699 | 699 | /** |
700 | 700 | * Given a Payment ID, extract the transaction ID |
@@ -705,22 +705,22 @@ discard block |
||
705 | 705 | * |
706 | 706 | * @return string Transaction ID |
707 | 707 | */ |
708 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
708 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
709 | 709 | |
710 | 710 | $transaction_id = ''; |
711 | - $notes = give_get_payment_notes( $payment_id ); |
|
711 | + $notes = give_get_payment_notes($payment_id); |
|
712 | 712 | |
713 | - foreach ( $notes as $note ) { |
|
714 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
713 | + foreach ($notes as $note) { |
|
714 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
715 | 715 | $transaction_id = $match[1]; |
716 | 716 | continue; |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
720 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
720 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
721 | 721 | } |
722 | 722 | |
723 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
723 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
724 | 724 | |
725 | 725 | /** |
726 | 726 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -732,13 +732,13 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @return string A link to the PayPal transaction details |
734 | 734 | */ |
735 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
735 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
736 | 736 | |
737 | 737 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
738 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
738 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
739 | 739 | |
740 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
740 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
741 | 741 | |
742 | 742 | } |
743 | 743 | |
744 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
744 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
@@ -10,7 +10,7 @@ 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 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
23 | +add_action('give_manual_cc_form', '__return_false'); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Processes the purchase data and uses the Manual Payment gateway to record |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_manual_payment( $purchase_data ) { |
|
35 | +function give_manual_payment($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification has failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification has failed', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //Create payment_data array |
42 | 42 | $payment_data = array( |
43 | 43 | 'price' => $purchase_data['price'], |
44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
47 | 47 | 'date' => $purchase_data['date'], |
48 | 48 | 'user_email' => $purchase_data['user_email'], |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | 'status' => 'pending' |
53 | 53 | ); |
54 | 54 | // Record the pending payment |
55 | - $payment = give_insert_payment( $payment_data ); |
|
55 | + $payment = give_insert_payment($payment_data); |
|
56 | 56 | |
57 | - if ( $payment ) { |
|
58 | - give_update_payment_status( $payment, 'publish' ); |
|
57 | + if ($payment) { |
|
58 | + give_update_payment_status($payment, 'publish'); |
|
59 | 59 | give_send_to_success_page(); |
60 | 60 | } else { |
61 | 61 | give_record_gateway_error( |
62 | - esc_html__( 'Payment Error', 'give' ), |
|
62 | + esc_html__('Payment Error', 'give'), |
|
63 | 63 | sprintf( |
64 | 64 | /* translators: %s: payment data */ |
65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
66 | - json_encode( $payment_data ) |
|
65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
66 | + json_encode($payment_data) |
|
67 | 67 | ), |
68 | 68 | $payment |
69 | 69 | ); |
70 | 70 | // If errors are present, send the user back to the purchase page so they can be corrected |
71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
42 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => esc_html__( 'Show', 'give' ), |
|
45 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
44 | + 'true' => esc_html__('Show', 'give'), |
|
45 | + 'false' => esc_html__('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'donor', |
51 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
51 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => esc_html__( 'Show', 'give' ), |
|
54 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
53 | + 'true' => esc_html__('Show', 'give'), |
|
54 | + 'false' => esc_html__('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'date', |
60 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
60 | + 'label' => esc_html__('Show Date:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => esc_html__( 'Show', 'give' ), |
|
63 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
62 | + 'true' => esc_html__('Show', 'give'), |
|
63 | + 'false' => esc_html__('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_key', |
69 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
69 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => esc_html__( 'Show', 'give' ), |
|
72 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
71 | + 'true' => esc_html__('Show', 'give'), |
|
72 | + 'false' => esc_html__('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_method', |
78 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
78 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'payment_id', |
87 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
87 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
88 | 88 | 'options' => array( |
89 | - 'true' => esc_html__( 'Show', 'give' ), |
|
90 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
89 | + 'true' => esc_html__('Show', 'give'), |
|
90 | + 'false' => esc_html__('Hide', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'donation_history' ); |
|
23 | + parent::__construct('donation_history'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Register extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_register' ); |
|
24 | + parent::__construct('give_register'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
43 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php'; |
|
19 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-actions.php'; |
|
18 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php'; |
|
19 | +require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-actions.php'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Process batch exports via ajax |
@@ -26,79 +26,79 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_do_ajax_export() { |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - parse_str( $_POST['form'], $form ); |
|
31 | + parse_str($_POST['form'], $form); |
|
32 | 32 | |
33 | 33 | $_REQUEST = $form = (array) $form; |
34 | 34 | |
35 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
36 | - die( '-2' ); |
|
35 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
36 | + die('-2'); |
|
37 | 37 | } |
38 | 38 | |
39 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
39 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
40 | 40 | |
41 | - $step = absint( $_POST['step'] ); |
|
42 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
41 | + $step = absint($_POST['step']); |
|
42 | + $class = sanitize_text_field($form['give-export-class']); |
|
43 | 43 | |
44 | - $export = new $class( $step ); |
|
44 | + $export = new $class($step); |
|
45 | 45 | |
46 | - if ( ! $export->can_export() ) { |
|
47 | - die( '-1' ); |
|
46 | + if ( ! $export->can_export()) { |
|
47 | + die('-1'); |
|
48 | 48 | } |
49 | 49 | |
50 | - if ( ! $export->is_writable ) { |
|
50 | + if ( ! $export->is_writable) { |
|
51 | 51 | $json_args = array( |
52 | 52 | 'error' => true, |
53 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
53 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
54 | 54 | ); |
55 | 55 | echo json_encode($json_args); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | - $export->set_properties( $_REQUEST ); |
|
59 | + $export->set_properties($_REQUEST); |
|
60 | 60 | |
61 | 61 | $export->pre_fetch(); |
62 | 62 | |
63 | - $ret = $export->process_step( $step ); |
|
63 | + $ret = $export->process_step($step); |
|
64 | 64 | |
65 | 65 | $percentage = $export->get_percentage_complete(); |
66 | 66 | |
67 | - if ( $ret ) { |
|
67 | + if ($ret) { |
|
68 | 68 | |
69 | 69 | $step += 1; |
70 | - echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) ); |
|
70 | + echo json_encode(array('step' => $step, 'percentage' => $percentage)); |
|
71 | 71 | exit; |
72 | 72 | |
73 | - } elseif ( true === $export->is_empty ) { |
|
73 | + } elseif (true === $export->is_empty) { |
|
74 | 74 | |
75 | - echo json_encode( array( |
|
75 | + echo json_encode(array( |
|
76 | 76 | 'error' => true, |
77 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
78 | - ) ); |
|
77 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
78 | + )); |
|
79 | 79 | exit; |
80 | 80 | |
81 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
81 | + } elseif (true === $export->done && true === $export->is_void) { |
|
82 | 82 | |
83 | - $message = ! empty( $export->message ) ? $export->message : esc_html__( 'Batch Processing Complete', 'give' ); |
|
84 | - echo json_encode( array( 'success' => true, 'message' => $message ) ); |
|
83 | + $message = ! empty($export->message) ? $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
84 | + echo json_encode(array('success' => true, 'message' => $message)); |
|
85 | 85 | exit; |
86 | 86 | |
87 | 87 | } else { |
88 | 88 | |
89 | - $args = array_merge( $_REQUEST, array( |
|
89 | + $args = array_merge($_REQUEST, array( |
|
90 | 90 | 'step' => $step, |
91 | 91 | 'class' => $class, |
92 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
92 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
93 | 93 | 'give_action' => 'form_batch_export', |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | - $download_url = add_query_arg( $args, admin_url() ); |
|
96 | + $download_url = add_query_arg($args, admin_url()); |
|
97 | 97 | |
98 | - echo json_encode( array( 'step' => 'done', 'url' => $download_url ) ); |
|
98 | + echo json_encode(array('step' => 'done', 'url' => $download_url)); |
|
99 | 99 | exit; |
100 | 100 | |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
104 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |