@@ -781,8 +781,11 @@ |
||
781 | 781 | } |
782 | 782 | ?> |
783 | 783 | </select> |
784 | - <?php else : ?> |
|
785 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
784 | + <?php else { |
|
785 | + : ?> |
|
786 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
787 | +} |
|
788 | +?>"/> |
|
786 | 789 | <?php endif; ?> |
787 | 790 | </p> |
788 | 791 | <?php do_action( 'give_cc_billing_bottom' ); ?> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $args An array of form arguments. |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | * @param int $form_id The form ID. |
1578 | 1578 | * @param array $args An array of form arguments. |
1579 | 1579 | * |
1580 | - * @return mixed |
|
1580 | + * @return boolean |
|
1581 | 1581 | */ |
1582 | 1582 | function give_show_goal_progress( $form_id, $args ) { |
1583 | 1583 |
@@ -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 | |
@@ -23,47 +23,47 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | 62 | //Get the form wrap CSS classes. |
63 | - $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
63 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
64 | 64 | |
65 | 65 | //Get the <form> tag wrap CSS classes. |
66 | - $form_classes = $form->get_form_classes($args); |
|
66 | + $form_classes = $form->get_form_classes($args); |
|
67 | 67 | |
68 | 68 | ob_start(); |
69 | 69 | |
@@ -75,25 +75,25 @@ discard block |
||
75 | 75 | * @param int $form_id The form ID. |
76 | 76 | * @param array $args An array of form arguments. |
77 | 77 | */ |
78 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
78 | + do_action('give_pre_form_output', $form->ID, $args); |
|
79 | 79 | |
80 | 80 | ?> |
81 | 81 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
82 | 82 | |
83 | - <?php if ( $form->is_close_donation_form() ) { |
|
83 | + <?php if ($form->is_close_donation_form()) { |
|
84 | 84 | |
85 | 85 | //Get Goal thank you message. |
86 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
87 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
86 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
87 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
88 | 88 | |
89 | 89 | //Print thank you message. |
90 | - apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) ); |
|
90 | + apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success')); |
|
91 | 91 | |
92 | 92 | } else { |
93 | 93 | |
94 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
94 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
95 | 95 | |
96 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
96 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | * @param int $form_id The form ID. |
106 | 106 | * @param array $args An array of form arguments. |
107 | 107 | */ |
108 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
108 | + do_action('give_pre_form', $form->ID, $args); |
|
109 | 109 | ?> |
110 | 110 | |
111 | 111 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
112 | 112 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
113 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
114 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
115 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
116 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
113 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
114 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
115 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
116 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
117 | 117 | |
118 | 118 | <!-- The following field is for robots only, invisible to humans: --> |
119 | 119 | <span class="give-hidden" style="display: none !important;"> |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | <?php |
125 | 125 | |
126 | 126 | //Price ID hidden field for variable (mult-level) donation forms |
127 | - if ( give_has_variable_prices( $form_id ) ) { |
|
127 | + if (give_has_variable_prices($form_id)) { |
|
128 | 128 | //get default selected price ID |
129 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
129 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
130 | 130 | $price_id = 0; |
131 | 131 | //loop through prices |
132 | - foreach ( $prices as $price ) { |
|
133 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
132 | + foreach ($prices as $price) { |
|
133 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
134 | 134 | $price_id = $price['_give_id']['level_id']; |
135 | 135 | }; |
136 | 136 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $form_id The form ID. |
147 | 147 | * @param array $args An array of form arguments. |
148 | 148 | */ |
149 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
149 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Fires while outputing donation form, for payment gatways fields. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param int $form_id The form ID. |
157 | 157 | * @param array $args An array of form arguments. |
158 | 158 | */ |
159 | - do_action( 'give_donation_mode_select', $form->ID, $args ); |
|
159 | + do_action('give_donation_mode_select', $form->ID, $args); |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Fires while outputing donation form, after all other fields. |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param int $form_id The form ID. |
167 | 167 | * @param array $args An array of form arguments. |
168 | 168 | */ |
169 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
169 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
170 | 170 | |
171 | 171 | ?> |
172 | 172 | </form> |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | * @param int $form_id The form ID. |
181 | 181 | * @param array $args An array of form arguments. |
182 | 182 | */ |
183 | - do_action( 'give_post_form', $form->ID, $args ); |
|
183 | + do_action('give_post_form', $form->ID, $args); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | ?> |
187 | 187 | |
188 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
188 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
189 | 189 | <?php |
190 | 190 | |
191 | 191 | /** |
@@ -196,11 +196,11 @@ discard block |
||
196 | 196 | * @param int $form_id The form ID. |
197 | 197 | * @param array $args An array of form arguments. |
198 | 198 | */ |
199 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
199 | + do_action('give_post_form_output', $form->ID, $args); |
|
200 | 200 | |
201 | 201 | $final_output = ob_get_clean(); |
202 | 202 | |
203 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
203 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | -function give_show_purchase_form( $form_id ) { |
|
220 | +function give_show_purchase_form($form_id) { |
|
221 | 221 | |
222 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
222 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
223 | 223 | |
224 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
224 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
225 | 225 | $form_id = $_POST['give_form_id']; |
226 | 226 | } |
227 | 227 | |
@@ -230,33 +230,33 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @since 1.7 |
232 | 232 | */ |
233 | - do_action( 'give_donation_form_top', $form_id ); |
|
233 | + do_action('give_donation_form_top', $form_id); |
|
234 | 234 | |
235 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
235 | + if (give_can_checkout() && isset($form_id)) { |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires while displaying donation form, before registration login. |
239 | 239 | * |
240 | 240 | * @since 1.7 |
241 | 241 | */ |
242 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
242 | + do_action('give_donation_form_before_register_login', $form_id); |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Fire when register/login form fields render. |
246 | 246 | * |
247 | 247 | * @since 1.7 |
248 | 248 | */ |
249 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
249 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fire when credit card form fields render. |
253 | 253 | * |
254 | 254 | * @since 1.7 |
255 | 255 | */ |
256 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
256 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
257 | 257 | |
258 | 258 | // Load the credit card form and allow gateways to load their own if they wish |
259 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
259 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
260 | 260 | /** |
261 | 261 | * Fires while displaying donation form, credit card form fields for a given gateway. |
262 | 262 | * |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @param int $form_id The form ID. |
266 | 266 | */ |
267 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
267 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
268 | 268 | } else { |
269 | 269 | /** |
270 | 270 | * Fires while displaying donation form, credit card form fields. |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @param int $form_id The form ID. |
275 | 275 | */ |
276 | - do_action( 'give_cc_form', $form_id ); |
|
276 | + do_action('give_cc_form', $form_id); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @since 1.7 |
283 | 283 | */ |
284 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
284 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
285 | 285 | |
286 | 286 | } else { |
287 | 287 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @since 1.7 |
291 | 291 | */ |
292 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
292 | + do_action('give_donation_form_no_access', $form_id); |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.7 |
300 | 300 | */ |
301 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
301 | + do_action('give_donation_form_bottom', $form_id); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
304 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * Give Show Login/Register Form Fields. |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return void |
314 | 314 | */ |
315 | -function give_show_register_login_fields( $form_id ) { |
|
315 | +function give_show_register_login_fields($form_id) { |
|
316 | 316 | |
317 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
317 | + $show_register_form = give_show_login_register_option($form_id); |
|
318 | 318 | |
319 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
319 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
320 | 320 | ?> |
321 | 321 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
322 | 322 | <?php |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @since 1.7 |
327 | 327 | */ |
328 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
328 | + do_action('give_donation_form_register_fields', $form_id); |
|
329 | 329 | ?> |
330 | 330 | </div> |
331 | 331 | <?php |
332 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
332 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
333 | 333 | ?> |
334 | 334 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
335 | 335 | <?php |
@@ -338,23 +338,23 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @since 1.7 |
340 | 340 | */ |
341 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
341 | + do_action('give_donation_form_login_fields', $form_id); |
|
342 | 342 | ?> |
343 | 343 | </div> |
344 | 344 | <?php |
345 | 345 | endif; |
346 | 346 | |
347 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
347 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
348 | 348 | /** |
349 | 349 | * Fire when user info render. |
350 | 350 | * |
351 | 351 | * @since 1.7 |
352 | 352 | */ |
353 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
353 | + do_action('give_donation_form_after_user_info', $form_id); |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
357 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
358 | 358 | |
359 | 359 | /** |
360 | 360 | * Donation Amount Field. |
@@ -368,17 +368,17 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return void |
370 | 370 | */ |
371 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
371 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
372 | 372 | |
373 | 373 | global $give_options; |
374 | 374 | |
375 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
376 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
377 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
378 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
379 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
380 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
381 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
375 | + $variable_pricing = give_has_variable_prices($form_id); |
|
376 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
377 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
378 | + $symbol = give_currency_symbol(give_get_currency()); |
|
379 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
380 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
381 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
382 | 382 | |
383 | 383 | /** |
384 | 384 | * Fires while displaying donation form, before donation level fields. |
@@ -388,19 +388,19 @@ discard block |
||
388 | 388 | * @param int $form_id The form ID. |
389 | 389 | * @param array $args An array of form arguments. |
390 | 390 | */ |
391 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
391 | + do_action('give_before_donation_levels', $form_id, $args); |
|
392 | 392 | |
393 | 393 | //Set Price, No Custom Amount Allowed means hidden price field |
394 | - if ( $allow_custom_amount == 'no' ) { |
|
394 | + if ($allow_custom_amount == 'no') { |
|
395 | 395 | ?> |
396 | - <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
396 | + <label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
397 | 397 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required> |
398 | 398 | <div class="set-price give-donation-amount form-row-wide"> |
399 | - <?php if ( $currency_position == 'before' ) { |
|
399 | + <?php if ($currency_position == 'before') { |
|
400 | 400 | echo $currency_output; |
401 | 401 | } ?> |
402 | 402 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
403 | - <?php if ( $currency_position == 'after' ) { |
|
403 | + <?php if ($currency_position == 'after') { |
|
404 | 404 | echo $currency_output; |
405 | 405 | } ?> |
406 | 406 | </div> |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | ?> |
411 | 411 | <div class="give-total-wrap"> |
412 | 412 | <div class="give-donation-amount form-row-wide"> |
413 | - <?php if ( $currency_position == 'before' ) { |
|
413 | + <?php if ($currency_position == 'before') { |
|
414 | 414 | echo $currency_output; |
415 | 415 | } ?> |
416 | - <label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label> |
|
416 | + <label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label> |
|
417 | 417 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
418 | - <?php if ( $currency_position == 'after' ) { |
|
418 | + <?php if ($currency_position == 'after') { |
|
419 | 419 | echo $currency_output; |
420 | 420 | } ?> |
421 | 421 | </div> |
@@ -430,16 +430,16 @@ discard block |
||
430 | 430 | * @param int $form_id The form ID. |
431 | 431 | * @param array $args An array of form arguments. |
432 | 432 | */ |
433 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
433 | + do_action('give_after_donation_amount', $form_id, $args); |
|
434 | 434 | |
435 | 435 | //Custom Amount Text |
436 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
436 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
437 | 437 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
438 | 438 | <?php } |
439 | 439 | |
440 | 440 | //Output Variable Pricing Levels |
441 | - if ( $variable_pricing ) { |
|
442 | - give_output_levels( $form_id ); |
|
441 | + if ($variable_pricing) { |
|
442 | + give_output_levels($form_id); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -450,10 +450,10 @@ discard block |
||
450 | 450 | * @param int $form_id The form ID. |
451 | 451 | * @param array $args An array of form arguments. |
452 | 452 | */ |
453 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
453 | + do_action('give_after_donation_levels', $form_id, $args); |
|
454 | 454 | } |
455 | 455 | |
456 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
456 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -464,32 +464,32 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @return string Donation levels. |
466 | 466 | */ |
467 | -function give_output_levels( $form_id ) { |
|
467 | +function give_output_levels($form_id) { |
|
468 | 468 | |
469 | 469 | //Get variable pricing |
470 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
471 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
472 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
473 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
474 | - if ( empty( $custom_amount_text ) ) { |
|
475 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
470 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
471 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
472 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
473 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
474 | + if (empty($custom_amount_text)) { |
|
475 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | $output = ''; |
479 | 479 | $counter = 0; |
480 | 480 | |
481 | - switch ( $display_style ) { |
|
481 | + switch ($display_style) { |
|
482 | 482 | case 'buttons': |
483 | 483 | |
484 | 484 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
485 | 485 | |
486 | - foreach ( $prices as $price ) { |
|
487 | - $counter ++; |
|
488 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
489 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
486 | + foreach ($prices as $price) { |
|
487 | + $counter++; |
|
488 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
489 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
490 | 490 | |
491 | 491 | $output .= '<li>'; |
492 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
492 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
493 | 493 | $output .= $level_text; |
494 | 494 | $output .= '</button>'; |
495 | 495 | $output .= '</li>'; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | //Custom Amount |
500 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
500 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
501 | 501 | $output .= '<li>'; |
502 | 502 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
503 | 503 | $output .= $custom_amount_text; |
@@ -513,23 +513,23 @@ discard block |
||
513 | 513 | |
514 | 514 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
515 | 515 | |
516 | - foreach ( $prices as $price ) { |
|
517 | - $counter ++; |
|
518 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
519 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
516 | + foreach ($prices as $price) { |
|
517 | + $counter++; |
|
518 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
519 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
520 | 520 | |
521 | 521 | $output .= '<li>'; |
522 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
523 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
522 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
523 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
524 | 524 | $output .= '</li>'; |
525 | 525 | |
526 | 526 | } |
527 | 527 | |
528 | 528 | //Custom Amount |
529 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
529 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
530 | 530 | $output .= '<li>'; |
531 | 531 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
532 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
532 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
533 | 533 | $output .= '</li>'; |
534 | 534 | } |
535 | 535 | |
@@ -539,23 +539,23 @@ discard block |
||
539 | 539 | |
540 | 540 | case 'dropdown': |
541 | 541 | |
542 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
543 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
542 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
543 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
544 | 544 | |
545 | 545 | //first loop through prices |
546 | - foreach ( $prices as $price ) { |
|
547 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
548 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
546 | + foreach ($prices as $price) { |
|
547 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
548 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
549 | 549 | |
550 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
550 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
551 | 551 | $output .= $level_text; |
552 | 552 | $output .= '</option>'; |
553 | 553 | |
554 | 554 | } |
555 | 555 | |
556 | 556 | //Custom Amount |
557 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
558 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
557 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
558 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | $output .= '</select>'; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | break; |
564 | 564 | } |
565 | 565 | |
566 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
566 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
@@ -578,26 +578,26 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return string Checkout button. |
580 | 580 | */ |
581 | -function give_display_checkout_button( $form_id, $args ) { |
|
581 | +function give_display_checkout_button($form_id, $args) { |
|
582 | 582 | |
583 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
583 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
584 | 584 | ? $args['display_style'] |
585 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
585 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
586 | 586 | |
587 | 587 | //no btn for onpage |
588 | - if ( $display_option === 'onpage' ) { |
|
588 | + if ($display_option === 'onpage') { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
592 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
593 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
592 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
593 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
594 | 594 | |
595 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
595 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
596 | 596 | |
597 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
597 | + echo apply_filters('give_display_checkout_button', $output); |
|
598 | 598 | } |
599 | 599 | |
600 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
600 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
601 | 601 | |
602 | 602 | /** |
603 | 603 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | * |
609 | 609 | * @return void |
610 | 610 | */ |
611 | -function give_user_info_fields( $form_id ) { |
|
611 | +function give_user_info_fields($form_id) { |
|
612 | 612 | |
613 | - if ( is_user_logged_in() ) : |
|
614 | - $user_data = get_userdata( get_current_user_id() ); |
|
613 | + if (is_user_logged_in()) : |
|
614 | + $user_data = get_userdata(get_current_user_id()); |
|
615 | 615 | endif; |
616 | 616 | |
617 | 617 | /** |
@@ -619,35 +619,35 @@ discard block |
||
619 | 619 | * |
620 | 620 | * @since 1.7 |
621 | 621 | */ |
622 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
622 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
623 | 623 | ?> |
624 | 624 | <fieldset id="give_checkout_user_info"> |
625 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
625 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
626 | 626 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
627 | 627 | <label class="give-label" for="give-first"> |
628 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
629 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
628 | + <?php esc_html_e('First Name', 'give'); ?> |
|
629 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
630 | 630 | <span class="give-required-indicator">*</span> |
631 | 631 | <?php } ?> |
632 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
632 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
633 | 633 | </label> |
634 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
634 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
635 | 635 | echo ' required '; |
636 | 636 | } ?>/> |
637 | 637 | </p> |
638 | 638 | |
639 | 639 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
640 | 640 | <label class="give-label" for="give-last"> |
641 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
642 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
641 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
642 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
643 | 643 | <span class="give-required-indicator">*</span> |
644 | 644 | <?php } ?> |
645 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
645 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
646 | 646 | </label> |
647 | 647 | |
648 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
648 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
649 | 649 | echo ' required'; |
650 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
650 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
651 | 651 | echo ' required '; |
652 | 652 | } ?> /> |
653 | 653 | </p> |
@@ -658,18 +658,18 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @since 1.7 |
660 | 660 | */ |
661 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
661 | + do_action('give_donation_form_before_email', $form_id); |
|
662 | 662 | ?> |
663 | 663 | <p id="give-email-wrap" class="form-row form-row-wide"> |
664 | 664 | <label class="give-label" for="give-email"> |
665 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
666 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
665 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
666 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
667 | 667 | <span class="give-required-indicator">*</span> |
668 | 668 | <?php } ?> |
669 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
669 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
670 | 670 | </label> |
671 | 671 | |
672 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
672 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
673 | 673 | echo ' required '; |
674 | 674 | } ?>/> |
675 | 675 | |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | * |
681 | 681 | * @since 1.7 |
682 | 682 | */ |
683 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
683 | + do_action('give_donation_form_after_email', $form_id); |
|
684 | 684 | |
685 | 685 | /** |
686 | 686 | * Fire after personal email field |
687 | 687 | * |
688 | 688 | * @since 1.7 |
689 | 689 | */ |
690 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
690 | + do_action('give_donation_form_user_info', $form_id); |
|
691 | 691 | ?> |
692 | 692 | </fieldset> |
693 | 693 | <?php |
@@ -696,11 +696,11 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @since 1.7 |
698 | 698 | */ |
699 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
699 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
700 | 700 | } |
701 | 701 | |
702 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
703 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
702 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
703 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
704 | 704 | |
705 | 705 | /** |
706 | 706 | * Renders the credit card info form. |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * |
712 | 712 | * @return void |
713 | 713 | */ |
714 | -function give_get_cc_form( $form_id ) { |
|
714 | +function give_get_cc_form($form_id) { |
|
715 | 715 | |
716 | 716 | ob_start(); |
717 | 717 | |
@@ -722,45 +722,45 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @param int $form_id The form ID. |
724 | 724 | */ |
725 | - do_action( 'give_before_cc_fields', $form_id ); |
|
725 | + do_action('give_before_cc_fields', $form_id); |
|
726 | 726 | ?> |
727 | 727 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
728 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
729 | - <?php if ( is_ssl() ) : ?> |
|
728 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
729 | + <?php if (is_ssl()) : ?> |
|
730 | 730 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
731 | 731 | <span class="give-icon padlock"></span> |
732 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
732 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
733 | 733 | </div> |
734 | 734 | <?php endif; ?> |
735 | 735 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
736 | 736 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
737 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
737 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
738 | 738 | <span class="give-required-indicator">*</span> |
739 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
739 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
740 | 740 | <span class="card-type"></span> |
741 | 741 | </label> |
742 | 742 | |
743 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/> |
|
743 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/> |
|
744 | 744 | </p> |
745 | 745 | |
746 | 746 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
747 | 747 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
748 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
748 | + <?php esc_html_e('CVC', 'give'); ?> |
|
749 | 749 | <span class="give-required-indicator">*</span> |
750 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
750 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
751 | 751 | </label> |
752 | 752 | |
753 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/> |
|
753 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/> |
|
754 | 754 | </p> |
755 | 755 | |
756 | 756 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
757 | 757 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
758 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
758 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
759 | 759 | <span class="give-required-indicator">*</span> |
760 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
760 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
761 | 761 | </label> |
762 | 762 | |
763 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/> |
|
763 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/> |
|
764 | 764 | </p> |
765 | 765 | <?php |
766 | 766 | /** |
@@ -770,19 +770,19 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @param int $form_id The form ID. |
772 | 772 | */ |
773 | - do_action( 'give_before_cc_expiration' ); |
|
773 | + do_action('give_before_cc_expiration'); |
|
774 | 774 | ?> |
775 | 775 | <p class="card-expiration form-row form-row-one-third"> |
776 | 776 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
777 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
777 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
778 | 778 | <span class="give-required-indicator">*</span> |
779 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
779 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
780 | 780 | </label> |
781 | 781 | |
782 | 782 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
783 | 783 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
784 | 784 | |
785 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/> |
|
785 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/> |
|
786 | 786 | </p> |
787 | 787 | <?php |
788 | 788 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * |
793 | 793 | * @param int $form_id The form ID. |
794 | 794 | */ |
795 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
795 | + do_action('give_after_cc_expiration', $form_id); |
|
796 | 796 | ?> |
797 | 797 | </fieldset> |
798 | 798 | <?php |
@@ -803,12 +803,12 @@ discard block |
||
803 | 803 | * |
804 | 804 | * @param int $form_id The form ID. |
805 | 805 | */ |
806 | - do_action( 'give_after_cc_fields', $form_id ); |
|
806 | + do_action('give_after_cc_fields', $form_id); |
|
807 | 807 | |
808 | 808 | echo ob_get_clean(); |
809 | 809 | } |
810 | 810 | |
811 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
811 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * Outputs the default credit card address fields. |
@@ -819,22 +819,22 @@ discard block |
||
819 | 819 | * |
820 | 820 | * @return void |
821 | 821 | */ |
822 | -function give_default_cc_address_fields( $form_id ) { |
|
822 | +function give_default_cc_address_fields($form_id) { |
|
823 | 823 | |
824 | 824 | $logged_in = is_user_logged_in(); |
825 | 825 | |
826 | - if ( $logged_in ) { |
|
827 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
826 | + if ($logged_in) { |
|
827 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
828 | 828 | } |
829 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
830 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
831 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
832 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
829 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
830 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
831 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
832 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
833 | 833 | |
834 | 834 | ob_start(); |
835 | 835 | ?> |
836 | 836 | <fieldset id="give_cc_address" class="cc-address"> |
837 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
837 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
838 | 838 | <?php |
839 | 839 | /** |
840 | 840 | * Fires while rendering credit card billing form, before address fields. |
@@ -843,97 +843,97 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @param int $form_id The form ID. |
845 | 845 | */ |
846 | - do_action( 'give_cc_billing_top' ); |
|
846 | + do_action('give_cc_billing_top'); |
|
847 | 847 | ?> |
848 | 848 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
849 | 849 | <label for="card_address" class="give-label"> |
850 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
850 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
851 | 851 | <?php |
852 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
852 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
853 | 853 | <span class="give-required-indicator">*</span> |
854 | 854 | <?php } ?> |
855 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
855 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
856 | 856 | </label> |
857 | 857 | |
858 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
858 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
859 | 859 | echo ' required'; |
860 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
860 | + } ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
861 | 861 | echo ' required '; |
862 | 862 | } ?>/> |
863 | 863 | </p> |
864 | 864 | |
865 | 865 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
866 | 866 | <label for="card_address_2" class="give-label"> |
867 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
868 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
867 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
868 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
869 | 869 | <span class="give-required-indicator">*</span> |
870 | 870 | <?php } ?> |
871 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
871 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
872 | 872 | </label> |
873 | 873 | |
874 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
874 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
875 | 875 | echo ' required'; |
876 | - } ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
876 | + } ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
877 | 877 | echo ' required '; |
878 | 878 | } ?>/> |
879 | 879 | </p> |
880 | 880 | |
881 | 881 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
882 | 882 | <label for="card_city" class="give-label"> |
883 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
884 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
883 | + <?php esc_html_e('City', 'give'); ?> |
|
884 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
885 | 885 | <span class="give-required-indicator">*</span> |
886 | 886 | <?php } ?> |
887 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
887 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
888 | 888 | </label> |
889 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
889 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
890 | 890 | echo ' required'; |
891 | - } ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
891 | + } ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
892 | 892 | echo ' required '; |
893 | 893 | } ?>/> |
894 | 894 | </p> |
895 | 895 | |
896 | 896 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
897 | 897 | <label for="card_zip" class="give-label"> |
898 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
899 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
898 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
899 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
900 | 900 | <span class="give-required-indicator">*</span> |
901 | 901 | <?php } ?> |
902 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
902 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
903 | 903 | </label> |
904 | 904 | |
905 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
905 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
906 | 906 | echo ' required'; |
907 | - } ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
907 | + } ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
908 | 908 | echo ' required '; |
909 | 909 | } ?>/> |
910 | 910 | </p> |
911 | 911 | |
912 | 912 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
913 | 913 | <label for="billing_country" class="give-label"> |
914 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
915 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
914 | + <?php esc_html_e('Country', 'give'); ?> |
|
915 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
916 | 916 | <span class="give-required-indicator">*</span> |
917 | 917 | <?php } ?> |
918 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
918 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
919 | 919 | </label> |
920 | 920 | |
921 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
921 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
922 | 922 | echo ' required'; |
923 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
923 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
924 | 924 | echo ' required '; |
925 | 925 | } ?>> |
926 | 926 | <?php |
927 | 927 | |
928 | 928 | $selected_country = give_get_country(); |
929 | 929 | |
930 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
930 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
931 | 931 | $selected_country = $user_address['country']; |
932 | 932 | } |
933 | 933 | |
934 | 934 | $countries = give_get_country_list(); |
935 | - foreach ( $countries as $country_code => $country ) { |
|
936 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
935 | + foreach ($countries as $country_code => $country) { |
|
936 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
937 | 937 | } |
938 | 938 | ?> |
939 | 939 | </select> |
@@ -941,35 +941,35 @@ discard block |
||
941 | 941 | |
942 | 942 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
943 | 943 | <label for="card_state" class="give-label"> |
944 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
945 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
944 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
945 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
946 | 946 | <span class="give-required-indicator">*</span> |
947 | 947 | <?php } ?> |
948 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
948 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
949 | 949 | </label> |
950 | 950 | |
951 | 951 | <?php |
952 | 952 | $selected_state = give_get_state(); |
953 | - $states = give_get_states( $selected_country ); |
|
953 | + $states = give_get_states($selected_country); |
|
954 | 954 | |
955 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
955 | + if ($logged_in && ! empty($user_address['state'])) { |
|
956 | 956 | $selected_state = $user_address['state']; |
957 | 957 | } |
958 | 958 | |
959 | - if ( ! empty( $states ) ) : ?> |
|
960 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
959 | + if ( ! empty($states)) : ?> |
|
960 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
961 | 961 | echo ' required'; |
962 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
962 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
963 | 963 | echo ' required '; |
964 | 964 | } ?>> |
965 | 965 | <?php |
966 | - foreach ( $states as $state_code => $state ) { |
|
967 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
966 | + foreach ($states as $state_code => $state) { |
|
967 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
968 | 968 | } |
969 | 969 | ?> |
970 | 970 | </select> |
971 | 971 | <?php else : ?> |
972 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
972 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
973 | 973 | <?php endif; ?> |
974 | 974 | </p> |
975 | 975 | <?php |
@@ -980,14 +980,14 @@ discard block |
||
980 | 980 | * |
981 | 981 | * @param int $form_id The form ID. |
982 | 982 | */ |
983 | - do_action( 'give_cc_billing_bottom' ); |
|
983 | + do_action('give_cc_billing_bottom'); |
|
984 | 984 | ?> |
985 | 985 | </fieldset> |
986 | 986 | <?php |
987 | 987 | echo ob_get_clean(); |
988 | 988 | } |
989 | 989 | |
990 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
990 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
991 | 991 | |
992 | 992 | |
993 | 993 | /** |
@@ -999,26 +999,26 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return string |
1001 | 1001 | */ |
1002 | -function give_get_register_fields( $form_id ) { |
|
1002 | +function give_get_register_fields($form_id) { |
|
1003 | 1003 | |
1004 | 1004 | global $user_ID; |
1005 | 1005 | |
1006 | - if ( is_user_logged_in() ) { |
|
1007 | - $user_data = get_userdata( $user_ID ); |
|
1006 | + if (is_user_logged_in()) { |
|
1007 | + $user_data = get_userdata($user_ID); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1010 | + $show_register_form = give_show_login_register_option($form_id); |
|
1011 | 1011 | |
1012 | 1012 | ob_start(); ?> |
1013 | 1013 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1014 | 1014 | |
1015 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1015 | + <?php if ($show_register_form == 'both') { ?> |
|
1016 | 1016 | <div class="give-login-account-wrap"> |
1017 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1018 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1017 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1018 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1019 | 1019 | </p> |
1020 | 1020 | <p class="give-loading-text"> |
1021 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
1021 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
1022 | 1022 | </div> |
1023 | 1023 | <?php } ?> |
1024 | 1024 | |
@@ -1030,15 +1030,15 @@ discard block |
||
1030 | 1030 | * |
1031 | 1031 | * @param int $form_id The form ID. |
1032 | 1032 | */ |
1033 | - do_action( 'give_register_fields_before', $form_id ); |
|
1033 | + do_action('give_register_fields_before', $form_id); |
|
1034 | 1034 | ?> |
1035 | 1035 | |
1036 | 1036 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1037 | 1037 | <legend> |
1038 | 1038 | <?php |
1039 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1040 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1041 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1039 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1040 | + if ( ! give_logged_in_only($form_id)) { |
|
1041 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1042 | 1042 | } |
1043 | 1043 | ?> |
1044 | 1044 | </legend> |
@@ -1050,42 +1050,42 @@ discard block |
||
1050 | 1050 | * |
1051 | 1051 | * @param int $form_id The form ID. |
1052 | 1052 | */ |
1053 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1053 | + do_action('give_register_account_fields_before', $form_id); |
|
1054 | 1054 | ?> |
1055 | 1055 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
1056 | 1056 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1057 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1058 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1057 | + <?php esc_html_e('Username', 'give'); ?> |
|
1058 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1059 | 1059 | <span class="give-required-indicator">*</span> |
1060 | 1060 | <?php } ?> |
1061 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1061 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1062 | 1062 | </label> |
1063 | 1063 | |
1064 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1064 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1065 | 1065 | </div> |
1066 | 1066 | |
1067 | 1067 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
1068 | 1068 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1069 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1070 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1069 | + <?php esc_html_e('Password', 'give'); ?> |
|
1070 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1071 | 1071 | <span class="give-required-indicator">*</span> |
1072 | 1072 | <?php } ?> |
1073 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1073 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1074 | 1074 | </label> |
1075 | 1075 | |
1076 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1076 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1077 | 1077 | </div> |
1078 | 1078 | |
1079 | 1079 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
1080 | 1080 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1081 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1082 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1081 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1082 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1083 | 1083 | <span class="give-required-indicator">*</span> |
1084 | 1084 | <?php } ?> |
1085 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1085 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1086 | 1086 | </label> |
1087 | 1087 | |
1088 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required ' : ''; ?>/> |
|
1088 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"<?php echo (give_logged_in_only($form_id)) ? ' required ' : ''; ?>/> |
|
1089 | 1089 | </div> |
1090 | 1090 | <?php |
1091 | 1091 | /** |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @param int $form_id The form ID. |
1097 | 1097 | */ |
1098 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1098 | + do_action('give_register_account_fields_after', $form_id); |
|
1099 | 1099 | ?> |
1100 | 1100 | </fieldset> |
1101 | 1101 | |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * |
1108 | 1108 | * @param int $form_id The form ID. |
1109 | 1109 | */ |
1110 | - do_action( 'give_register_fields_after', $form_id ); |
|
1110 | + do_action('give_register_fields_after', $form_id); |
|
1111 | 1111 | ?> |
1112 | 1112 | |
1113 | 1113 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * |
1119 | 1119 | * @since 1.7 |
1120 | 1120 | */ |
1121 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1121 | + do_action('give_donation_form_user_info', $form_id); |
|
1122 | 1122 | ?> |
1123 | 1123 | |
1124 | 1124 | </fieldset> |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | echo ob_get_clean(); |
1127 | 1127 | } |
1128 | 1128 | |
1129 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
1129 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
1130 | 1130 | |
1131 | 1131 | /** |
1132 | 1132 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1139,31 +1139,31 @@ discard block |
||
1139 | 1139 | * |
1140 | 1140 | * @return string |
1141 | 1141 | */ |
1142 | -function give_get_login_fields( $form_id ) { |
|
1142 | +function give_get_login_fields($form_id) { |
|
1143 | 1143 | |
1144 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1145 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1144 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1145 | + $show_register_form = give_show_login_register_option($form_id); |
|
1146 | 1146 | |
1147 | 1147 | ob_start(); |
1148 | 1148 | ?> |
1149 | 1149 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1150 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1151 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1152 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1150 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1151 | + if ( ! give_logged_in_only($form_id)) { |
|
1152 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1153 | 1153 | } ?> |
1154 | 1154 | </legend> |
1155 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1155 | + <?php if ($show_register_form == 'both') { ?> |
|
1156 | 1156 | <p class="give-new-account-link"> |
1157 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1158 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
1159 | - <?php esc_html_e( 'Register', 'give' ); |
|
1160 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1161 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1157 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1158 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
1159 | + <?php esc_html_e('Register', 'give'); |
|
1160 | + if ( ! give_logged_in_only($form_id)) { |
|
1161 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1162 | 1162 | } ?> |
1163 | 1163 | </a> |
1164 | 1164 | </p> |
1165 | 1165 | <p class="give-loading-text"> |
1166 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
1166 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
1167 | 1167 | <?php } ?> |
1168 | 1168 | <?php |
1169 | 1169 | /** |
@@ -1173,44 +1173,44 @@ discard block |
||
1173 | 1173 | * |
1174 | 1174 | * @param int $form_id The form ID. |
1175 | 1175 | */ |
1176 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1176 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1177 | 1177 | ?> |
1178 | 1178 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
1179 | 1179 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1180 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1181 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1180 | + <?php esc_html_e('Username', 'give'); ?> |
|
1181 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1182 | 1182 | <span class="give-required-indicator">*</span> |
1183 | 1183 | <?php } ?> |
1184 | 1184 | </label> |
1185 | 1185 | |
1186 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
1186 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
1187 | 1187 | echo 'required '; |
1188 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/> |
|
1188 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/> |
|
1189 | 1189 | </div> |
1190 | 1190 | |
1191 | 1191 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
1192 | 1192 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1193 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1194 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1193 | + <?php esc_html_e('Password', 'give'); ?> |
|
1194 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1195 | 1195 | <span class="give-required-indicator">*</span> |
1196 | 1196 | <?php } ?> |
1197 | 1197 | </label> |
1198 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
1198 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
1199 | 1199 | echo 'required '; |
1200 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/> |
|
1200 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/> |
|
1201 | 1201 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1202 | 1202 | </div> |
1203 | 1203 | |
1204 | 1204 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1205 | 1205 | <span class="give-forgot-password "> |
1206 | - <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1206 | + <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1207 | 1207 | </span> |
1208 | 1208 | </div> |
1209 | 1209 | |
1210 | 1210 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1211 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1212 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1213 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1211 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1212 | + <?php if ($show_register_form !== 'login') { ?> |
|
1213 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1214 | 1214 | <?php } ?> |
1215 | 1215 | <span class="give-loading-animation"></span> |
1216 | 1216 | </div> |
@@ -1222,14 +1222,14 @@ discard block |
||
1222 | 1222 | * |
1223 | 1223 | * @param int $form_id The form ID. |
1224 | 1224 | */ |
1225 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1225 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1226 | 1226 | ?> |
1227 | 1227 | </fieldset><!--end #give-login-fields--> |
1228 | 1228 | <?php |
1229 | 1229 | echo ob_get_clean(); |
1230 | 1230 | } |
1231 | 1231 | |
1232 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1232 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1233 | 1233 | |
1234 | 1234 | /** |
1235 | 1235 | * Payment Mode Select. |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | * |
1246 | 1246 | * @return void |
1247 | 1247 | */ |
1248 | -function give_payment_mode_select( $form_id ) { |
|
1248 | +function give_payment_mode_select($form_id) { |
|
1249 | 1249 | |
1250 | 1250 | $gateways = give_get_enabled_payment_gateways(); |
1251 | 1251 | |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | * |
1257 | 1257 | * @param int $form_id The form ID. |
1258 | 1258 | */ |
1259 | - do_action( 'give_donation_mode_top', $form_id ); ?> |
|
1259 | + do_action('give_donation_mode_top', $form_id); ?> |
|
1260 | 1260 | |
1261 | 1261 | <fieldset id="give-payment-mode-select"> |
1262 | 1262 | <?php |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | * |
1268 | 1268 | * @param int $form_id The form ID. |
1269 | 1269 | */ |
1270 | - do_action( 'give_donation_mode_before_gateways_wrap' ); |
|
1270 | + do_action('give_donation_mode_before_gateways_wrap'); |
|
1271 | 1271 | ?> |
1272 | 1272 | <div id="give-payment-mode-wrap"> |
1273 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
1274 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
1273 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
1274 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
1275 | 1275 | </legend> |
1276 | 1276 | <?php |
1277 | 1277 | /** |
@@ -1279,14 +1279,14 @@ discard block |
||
1279 | 1279 | * |
1280 | 1280 | * @since 1.7 |
1281 | 1281 | */ |
1282 | - do_action( 'give_donation_mode_before_gateways' ) |
|
1282 | + do_action('give_donation_mode_before_gateways') |
|
1283 | 1283 | ?> |
1284 | 1284 | <ul id="give-gateway-radio-list"> |
1285 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
1286 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
1285 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
1286 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
1287 | 1287 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
1288 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
1289 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
1288 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
1289 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
1290 | 1290 | echo '</label></li>'; |
1291 | 1291 | endforeach; ?> |
1292 | 1292 | </ul> |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | * |
1297 | 1297 | * @since 1.7 |
1298 | 1298 | */ |
1299 | - do_action( 'give_donation_mode_after_gateways' ); |
|
1299 | + do_action('give_donation_mode_after_gateways'); |
|
1300 | 1300 | ?> |
1301 | 1301 | </div> |
1302 | 1302 | <?php |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | * |
1308 | 1308 | * @param int $form_id The form ID. |
1309 | 1309 | */ |
1310 | - do_action( 'give_donation_mode_after_gateways_wrap' ); |
|
1310 | + do_action('give_donation_mode_after_gateways_wrap'); |
|
1311 | 1311 | ?> |
1312 | 1312 | </fieldset> |
1313 | 1313 | |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | * |
1320 | 1320 | * @param int $form_id The form ID. |
1321 | 1321 | */ |
1322 | - do_action( 'give_donation_mode_bottom', $form_id ); |
|
1322 | + do_action('give_donation_mode_bottom', $form_id); |
|
1323 | 1323 | ?> |
1324 | 1324 | |
1325 | 1325 | <div id="give_purchase_form_wrap"> |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | * |
1331 | 1331 | * @since 1.7 |
1332 | 1332 | */ |
1333 | - do_action( 'give_donation_form', $form_id ); |
|
1333 | + do_action('give_donation_form', $form_id); |
|
1334 | 1334 | ?> |
1335 | 1335 | |
1336 | 1336 | </div> |
@@ -1341,10 +1341,10 @@ discard block |
||
1341 | 1341 | * |
1342 | 1342 | * @since 1.7 |
1343 | 1343 | */ |
1344 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1344 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1347 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1348 | 1348 | |
1349 | 1349 | /** |
1350 | 1350 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1357,46 +1357,46 @@ discard block |
||
1357 | 1357 | * |
1358 | 1358 | * @return void |
1359 | 1359 | */ |
1360 | -function give_terms_agreement( $form_id ) { |
|
1360 | +function give_terms_agreement($form_id) { |
|
1361 | 1361 | |
1362 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1363 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1364 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1362 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1363 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1364 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1365 | 1365 | |
1366 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1366 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1367 | 1367 | <fieldset id="give_terms_agreement"> |
1368 | - <div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;"> |
|
1368 | + <div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;"> |
|
1369 | 1369 | <?php |
1370 | 1370 | /** |
1371 | 1371 | * Fires while rendering terms of agreement, before the fields. |
1372 | 1372 | * |
1373 | 1373 | * @since 1.0 |
1374 | 1374 | */ |
1375 | - do_action( 'give_before_terms' ); |
|
1375 | + do_action('give_before_terms'); |
|
1376 | 1376 | |
1377 | - echo wpautop( stripslashes( $terms ) ); |
|
1377 | + echo wpautop(stripslashes($terms)); |
|
1378 | 1378 | /** |
1379 | 1379 | * Fires while rendering terms of agreement, after the fields. |
1380 | 1380 | * |
1381 | 1381 | * @since 1.0 |
1382 | 1382 | */ |
1383 | - do_action( 'give_after_terms' ); |
|
1383 | + do_action('give_after_terms'); |
|
1384 | 1384 | ?> |
1385 | 1385 | </div> |
1386 | 1386 | <div id="give_show_terms"> |
1387 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1388 | - <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1387 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1388 | + <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1389 | 1389 | </div> |
1390 | 1390 | |
1391 | 1391 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1392 | - <label for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label> |
|
1392 | + <label for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label> |
|
1393 | 1393 | |
1394 | 1394 | </fieldset> |
1395 | 1395 | <?php |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | |
1399 | -add_action( 'give_donation_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1399 | +add_action('give_donation_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1400 | 1400 | |
1401 | 1401 | /** |
1402 | 1402 | * Checkout Final Total. |
@@ -1409,27 +1409,27 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @return void |
1411 | 1411 | */ |
1412 | -function give_checkout_final_total( $form_id ) { |
|
1412 | +function give_checkout_final_total($form_id) { |
|
1413 | 1413 | |
1414 | - if ( isset( $_POST['give_total'] ) ) { |
|
1415 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1414 | + if (isset($_POST['give_total'])) { |
|
1415 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1416 | 1416 | } else { |
1417 | 1417 | //default total |
1418 | - $total = give_get_default_form_amount( $form_id ); |
|
1418 | + $total = give_get_default_form_amount($form_id); |
|
1419 | 1419 | } |
1420 | 1420 | //Only proceed if give_total available |
1421 | - if ( empty( $total ) ) { |
|
1421 | + if (empty($total)) { |
|
1422 | 1422 | return; |
1423 | 1423 | } |
1424 | 1424 | ?> |
1425 | 1425 | <p id="give-final-total-wrap" class="form-wrap "> |
1426 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1427 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1426 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1427 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1428 | 1428 | </p> |
1429 | 1429 | <?php |
1430 | 1430 | } |
1431 | 1431 | |
1432 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1432 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1433 | 1433 | |
1434 | 1434 | /** |
1435 | 1435 | * Renders the Checkout Submit section. |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | * |
1441 | 1441 | * @return void |
1442 | 1442 | */ |
1443 | -function give_checkout_submit( $form_id ) { |
|
1443 | +function give_checkout_submit($form_id) { |
|
1444 | 1444 | ?> |
1445 | 1445 | <fieldset id="give_purchase_submit"> |
1446 | 1446 | <?php |
@@ -1449,24 +1449,24 @@ discard block |
||
1449 | 1449 | * |
1450 | 1450 | * @since 1.7 |
1451 | 1451 | */ |
1452 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1452 | + do_action('give_donation_form_before_submit', $form_id); |
|
1453 | 1453 | |
1454 | - give_checkout_hidden_fields( $form_id ); |
|
1454 | + give_checkout_hidden_fields($form_id); |
|
1455 | 1455 | |
1456 | - echo give_checkout_button_purchase( $form_id ); |
|
1456 | + echo give_checkout_button_purchase($form_id); |
|
1457 | 1457 | |
1458 | 1458 | /** |
1459 | 1459 | * Fire after donation form submit. |
1460 | 1460 | * |
1461 | 1461 | * @since 1.7 |
1462 | 1462 | */ |
1463 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1463 | + do_action('give_donation_form_after_submit', $form_id); |
|
1464 | 1464 | ?> |
1465 | 1465 | </fieldset> |
1466 | 1466 | <?php |
1467 | 1467 | } |
1468 | 1468 | |
1469 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1469 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1470 | 1470 | |
1471 | 1471 | /** |
1472 | 1472 | * Give Checkout Button. |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * |
1480 | 1480 | * @return string |
1481 | 1481 | */ |
1482 | -function give_checkout_button_purchase( $form_id ) { |
|
1482 | +function give_checkout_button_purchase($form_id) { |
|
1483 | 1483 | |
1484 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1485 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1484 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1485 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1486 | 1486 | ob_start(); ?> |
1487 | 1487 | <div class="give-submit-button-wrap give-clearfix"> |
1488 | 1488 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
1489 | 1489 | <span class="give-loading-animation"></span> |
1490 | 1490 | </div> |
1491 | 1491 | <?php |
1492 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1492 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | /** |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | * |
1504 | 1504 | * @return void |
1505 | 1505 | */ |
1506 | -function give_agree_to_terms_js( $form_id ) { |
|
1506 | +function give_agree_to_terms_js($form_id) { |
|
1507 | 1507 | |
1508 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1508 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1509 | 1509 | |
1510 | - if ( $form_option === 'yes' ) { |
|
1510 | + if ($form_option === 'yes') { |
|
1511 | 1511 | ?> |
1512 | 1512 | <script type="text/javascript"> |
1513 | 1513 | jQuery(document).ready(function ($) { |
1514 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1514 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1515 | 1515 | e.preventDefault(); |
1516 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1517 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1516 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1517 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1518 | 1518 | return false; |
1519 | 1519 | }); |
1520 | 1520 | }); |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | } |
1524 | 1524 | } |
1525 | 1525 | |
1526 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1526 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1527 | 1527 | |
1528 | 1528 | /** |
1529 | 1529 | * Show Give Goals. |
@@ -1537,17 +1537,17 @@ discard block |
||
1537 | 1537 | * |
1538 | 1538 | * @return mixed |
1539 | 1539 | */ |
1540 | -function give_show_goal_progress( $form_id, $args ) { |
|
1540 | +function give_show_goal_progress($form_id, $args) { |
|
1541 | 1541 | |
1542 | 1542 | ob_start(); |
1543 | - give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1543 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1544 | 1544 | |
1545 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1545 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1546 | 1546 | |
1547 | 1547 | return true; |
1548 | 1548 | } |
1549 | 1549 | |
1550 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1550 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1551 | 1551 | |
1552 | 1552 | /** |
1553 | 1553 | * Adds Actions to Render Form Content. |
@@ -1559,19 +1559,19 @@ discard block |
||
1559 | 1559 | * |
1560 | 1560 | * @return void |
1561 | 1561 | */ |
1562 | -function give_form_content( $form_id, $args ) { |
|
1562 | +function give_form_content($form_id, $args) { |
|
1563 | 1563 | |
1564 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1564 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1565 | 1565 | ? $args['show_content'] |
1566 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1566 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1567 | 1567 | |
1568 | - if ( $show_content !== 'none' ) { |
|
1568 | + if ($show_content !== 'none') { |
|
1569 | 1569 | //add action according to value |
1570 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1570 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1571 | 1571 | } |
1572 | 1572 | } |
1573 | 1573 | |
1574 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1574 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1575 | 1575 | |
1576 | 1576 | /** |
1577 | 1577 | * Renders Post Form Content. |
@@ -1585,24 +1585,24 @@ discard block |
||
1585 | 1585 | * |
1586 | 1586 | * @return void |
1587 | 1587 | */ |
1588 | -function give_form_display_content( $form_id, $args ) { |
|
1588 | +function give_form_display_content($form_id, $args) { |
|
1589 | 1589 | |
1590 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1591 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1590 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1591 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1592 | 1592 | ? $args['show_content'] |
1593 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1593 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1594 | 1594 | |
1595 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1596 | - $content = apply_filters( 'the_content', $content ); |
|
1595 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1596 | + $content = apply_filters('the_content', $content); |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1599 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1600 | 1600 | |
1601 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1601 | + echo apply_filters('give_form_content_output', $output); |
|
1602 | 1602 | |
1603 | 1603 | //remove action to prevent content output on addition forms on page |
1604 | 1604 | //@see: https://github.com/WordImpress/Give/issues/634 |
1605 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1605 | + remove_action($show_content, 'give_form_display_content'); |
|
1606 | 1606 | } |
1607 | 1607 | |
1608 | 1608 | /** |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * |
1615 | 1615 | * @return void |
1616 | 1616 | */ |
1617 | -function give_checkout_hidden_fields( $form_id ) { |
|
1617 | +function give_checkout_hidden_fields($form_id) { |
|
1618 | 1618 | |
1619 | 1619 | /** |
1620 | 1620 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1623,13 +1623,13 @@ discard block |
||
1623 | 1623 | * |
1624 | 1624 | * @param int $form_id The form ID. |
1625 | 1625 | */ |
1626 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1626 | + do_action('give_hidden_fields_before', $form_id); |
|
1627 | 1627 | |
1628 | - if ( is_user_logged_in() ) { ?> |
|
1628 | + if (is_user_logged_in()) { ?> |
|
1629 | 1629 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1630 | 1630 | <?php } ?> |
1631 | 1631 | <input type="hidden" name="give_action" value="purchase"/> |
1632 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1632 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1633 | 1633 | <?php |
1634 | 1634 | /** |
1635 | 1635 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | * |
1639 | 1639 | * @param int $form_id The form ID. |
1640 | 1640 | */ |
1641 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1641 | + do_action('give_hidden_fields_after', $form_id); |
|
1642 | 1642 | |
1643 | 1643 | } |
1644 | 1644 | |
@@ -1653,20 +1653,20 @@ discard block |
||
1653 | 1653 | * |
1654 | 1654 | * @return string $content Filtered content. |
1655 | 1655 | */ |
1656 | -function give_filter_success_page_content( $content ) { |
|
1656 | +function give_filter_success_page_content($content) { |
|
1657 | 1657 | |
1658 | 1658 | global $give_options; |
1659 | 1659 | |
1660 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1661 | - if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1662 | - $content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1660 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1661 | + if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) { |
|
1662 | + $content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | return $content; |
1667 | 1667 | } |
1668 | 1668 | |
1669 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1669 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1670 | 1670 | |
1671 | 1671 | /** |
1672 | 1672 | * Test Mode Frontend Warning. |
@@ -1677,14 +1677,14 @@ discard block |
||
1677 | 1677 | */ |
1678 | 1678 | function give_test_mode_frontend_warning() { |
1679 | 1679 | |
1680 | - $test_mode = give_get_option( 'test_mode' ); |
|
1680 | + $test_mode = give_get_option('test_mode'); |
|
1681 | 1681 | |
1682 | - if ( $test_mode == 'on' ) { |
|
1683 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1682 | + if ($test_mode == 'on') { |
|
1683 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | |
1687 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1687 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1688 | 1688 | |
1689 | 1689 | /** |
1690 | 1690 | * Members-only Form. |
@@ -1698,21 +1698,21 @@ discard block |
||
1698 | 1698 | * |
1699 | 1699 | * @return string |
1700 | 1700 | */ |
1701 | -function give_members_only_form( $final_output, $args ) { |
|
1701 | +function give_members_only_form($final_output, $args) { |
|
1702 | 1702 | |
1703 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1703 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1704 | 1704 | |
1705 | 1705 | //Sanity Check: Must have form_id & not be logged in |
1706 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1706 | + if (empty($form_id) || is_user_logged_in()) { |
|
1707 | 1707 | return $final_output; |
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | //Logged in only and Register / Login set to none |
1711 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1711 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1712 | 1712 | |
1713 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1713 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1714 | 1714 | |
1715 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1715 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1716 | 1716 | |
1717 | 1717 | } |
1718 | 1718 | |
@@ -1720,4 +1720,4 @@ discard block |
||
1720 | 1720 | |
1721 | 1721 | } |
1722 | 1722 | |
1723 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1723 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -713,7 +713,7 @@ |
||
713 | 713 | * @param bool $colon Check if add colon between heading and message. |
714 | 714 | * @param string $color Heading color. |
715 | 715 | * |
716 | - * @return mixed |
|
716 | + * @return string |
|
717 | 717 | */ |
718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
719 | 719 | // Add colon. |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @subcommand donors |
327 | 327 | */ |
328 | 328 | public function donors( $args, $assoc_args ) { |
329 | - global $wp_query; |
|
329 | + global $wp_query; |
|
330 | 330 | $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
331 | 331 | $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
332 | 332 | $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * @subcommand donations |
493 | 493 | */ |
494 | 494 | public function donations( $args, $assoc_args ) { |
495 | - global $wp_query; |
|
495 | + global $wp_query; |
|
496 | 496 | $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
497 | 497 | |
498 | 498 | // Cache previous number query var. |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | * @return mixed |
717 | 717 | */ |
718 | 718 | private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
719 | - // Add colon. |
|
720 | - if ( $colon ) { |
|
721 | - $heading = $heading . ': '; |
|
719 | + // Add colon. |
|
720 | + if ( $colon ) { |
|
721 | + $heading = $heading . ': '; |
|
722 | 722 | } |
723 | 723 | return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
724 | 724 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
10 | +if ( ! defined('ABSPATH')) { exit; } |
|
11 | 11 | |
12 | 12 | // Add give command. |
13 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
13 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -66,54 +66,54 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @subcommand details |
68 | 68 | */ |
69 | - public function details( $args, $assoc_args ) { |
|
69 | + public function details($args, $assoc_args) { |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Plugin Information |
73 | 73 | */ |
74 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
74 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * General Information. |
78 | 78 | */ |
79 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
79 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
80 | 80 | |
81 | - $success_page = give_get_option( 'success_page' ); |
|
82 | - $failure_page = give_get_option( 'failure_page' ); |
|
83 | - $history_page = give_get_option( 'history_page' ); |
|
81 | + $success_page = give_get_option('success_page'); |
|
82 | + $failure_page = give_get_option('failure_page'); |
|
83 | + $history_page = give_get_option('history_page'); |
|
84 | 84 | |
85 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
86 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
87 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
88 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
85 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
86 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
87 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
88 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Currency Information. |
92 | 92 | */ |
93 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
93 | + $default_gateway = give_get_option('default_gateway'); |
|
94 | 94 | |
95 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
95 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
96 | 96 | |
97 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
98 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
99 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
100 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
101 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
102 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
103 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
97 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
98 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
99 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
100 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
101 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
102 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
103 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
104 | 104 | |
105 | 105 | // Payment gateways Information. |
106 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
107 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
106 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
107 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
108 | 108 | |
109 | - if ( ! empty( $gateways ) ) { |
|
109 | + if ( ! empty($gateways)) { |
|
110 | 110 | self::$counter = 1; |
111 | - foreach ( $gateways as $gateway ) { |
|
112 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
111 | + foreach ($gateways as $gateway) { |
|
112 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
113 | 113 | self::$counter++; |
114 | 114 | } |
115 | 115 | } else { |
116 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
116 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @subcommand forms |
147 | 147 | */ |
148 | - public function forms( $args, $assoc_args ) { |
|
148 | + public function forms($args, $assoc_args) { |
|
149 | 149 | global $wp_query; |
150 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
151 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
150 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
151 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
152 | 152 | $start = time(); |
153 | 153 | |
154 | 154 | // Cache previous number query var. |
155 | 155 | $is_set_number = $cache_per_page = false; |
156 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
156 | + if (isset($wp_query->query_vars['number'])) { |
|
157 | 157 | $cache_per_page = $wp_query->query_vars['number']; |
158 | 158 | $is_set_number = true; |
159 | 159 | } |
@@ -162,46 +162,46 @@ discard block |
||
162 | 162 | $wp_query->query_vars['number'] = $number; |
163 | 163 | |
164 | 164 | // Get forms. |
165 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
165 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
166 | 166 | |
167 | 167 | // Reset number query var. |
168 | - if ( $is_set_number ) { |
|
168 | + if ($is_set_number) { |
|
169 | 169 | $wp_query->query_vars['number'] = $cache_per_page; |
170 | 170 | } |
171 | 171 | |
172 | 172 | // Bailout. |
173 | - if ( array_key_exists( 'error', $forms ) ) { |
|
173 | + if (array_key_exists('error', $forms)) { |
|
174 | 174 | |
175 | - WP_CLI::warning( $forms['error'] ); |
|
175 | + WP_CLI::warning($forms['error']); |
|
176 | 176 | return; |
177 | - } elseif ( empty( $forms['forms'] ) ) { |
|
177 | + } elseif (empty($forms['forms'])) { |
|
178 | 178 | |
179 | - WP_CLI::error( __( 'No form found.', 'give' ) ); |
|
179 | + WP_CLI::error(__('No form found.', 'give')); |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Param to check if form typeis already showed or not. |
184 | 184 | $is_show_form_type = false; |
185 | 185 | |
186 | - if ( 1 === count( $forms ) && $form_id ) { |
|
186 | + if (1 === count($forms) && $form_id) { |
|
187 | 187 | // Show single form. |
188 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
189 | - switch ( $key ) { |
|
188 | + foreach ($forms['forms'][0] as $key => $info) { |
|
189 | + switch ($key) { |
|
190 | 190 | case 'stats': |
191 | - $this->color_main_heading( ucfirst( $key ) ); |
|
191 | + $this->color_main_heading(ucfirst($key)); |
|
192 | 192 | |
193 | - foreach ( $info as $heading => $data ) { |
|
194 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
195 | - switch ( $heading ) { |
|
193 | + foreach ($info as $heading => $data) { |
|
194 | + $this->color_sub_heading(ucfirst($heading)); |
|
195 | + switch ($heading) { |
|
196 | 196 | default: |
197 | - foreach ( $data as $subheading => $subdata ) { |
|
197 | + foreach ($data as $subheading => $subdata) { |
|
198 | 198 | |
199 | - switch ( $subheading ) { |
|
199 | + switch ($subheading) { |
|
200 | 200 | case 'earnings': |
201 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
201 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
202 | 202 | break; |
203 | 203 | default: |
204 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
204 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | } |
@@ -211,26 +211,26 @@ discard block |
||
211 | 211 | case 'pricing': |
212 | 212 | case 'info': |
213 | 213 | default: |
214 | - $this->color_main_heading( ucfirst( $key ) ); |
|
214 | + $this->color_main_heading(ucfirst($key)); |
|
215 | 215 | |
216 | 216 | // Show form type. |
217 | - if ( ! $is_show_form_type ) { |
|
218 | - $form = new Give_Donate_Form( $form_id ); |
|
217 | + if ( ! $is_show_form_type) { |
|
218 | + $form = new Give_Donate_Form($form_id); |
|
219 | 219 | $is_show_form_type = true; |
220 | 220 | |
221 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
221 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
222 | 222 | } |
223 | 223 | |
224 | - foreach ( $info as $heading => $data ) { |
|
224 | + foreach ($info as $heading => $data) { |
|
225 | 225 | |
226 | - switch ( $heading ) { |
|
226 | + switch ($heading) { |
|
227 | 227 | case 'id': |
228 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
228 | + WP_CLI::log($this->color_message($heading, $data)); |
|
229 | 229 | break; |
230 | 230 | |
231 | 231 | default: |
232 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
233 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
232 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
233 | + WP_CLI::log($this->color_message($heading, $data)); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | } |
@@ -241,37 +241,37 @@ discard block |
||
241 | 241 | $is_table_first_row_set = false; |
242 | 242 | $table_column_count = 0; |
243 | 243 | |
244 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
244 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
245 | 245 | |
246 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
246 | + foreach ($forms['forms'] as $index => $form_data) { |
|
247 | 247 | |
248 | 248 | // Default table data. |
249 | 249 | $table_first_row = array(); |
250 | 250 | $table_row = array(); |
251 | 251 | |
252 | - foreach ( $form_data['info'] as $key => $form ) { |
|
252 | + foreach ($form_data['info'] as $key => $form) { |
|
253 | 253 | |
254 | 254 | // Do not show thumbnail, content and link in table. |
255 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
255 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | - if ( ! $is_table_first_row_set ) { |
|
259 | + if ( ! $is_table_first_row_set) { |
|
260 | 260 | $table_first_row[] = $key; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $table_row[] = $form; |
264 | 264 | |
265 | - if ( 'status' === $key ) { |
|
265 | + if ('status' === $key) { |
|
266 | 266 | // First array item will be an form id in our case. |
267 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
267 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
268 | 268 | |
269 | 269 | $table_row[] = $form->get_type(); |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | 273 | // Set table first row. |
274 | - if ( ! $is_table_first_row_set ) { |
|
274 | + if ( ! $is_table_first_row_set) { |
|
275 | 275 | |
276 | 276 | // Add extra column to table. |
277 | 277 | $table_first_row[] = 'type'; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $table_data[] = $table_row; |
285 | 285 | } |
286 | 286 | |
287 | - $this->display_table( $table_data ); |
|
287 | + $this->display_table($table_data); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
@@ -325,29 +325,29 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @subcommand donors |
327 | 327 | */ |
328 | - public function donors( $args, $assoc_args ) { |
|
328 | + public function donors($args, $assoc_args) { |
|
329 | 329 | global $wp_query; |
330 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
331 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
332 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
333 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
334 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
330 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
331 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
332 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
333 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
334 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
335 | 335 | $start = time(); |
336 | 336 | |
337 | - if ( $create ) { |
|
337 | + if ($create) { |
|
338 | 338 | $number = 1; |
339 | 339 | |
340 | 340 | // Create one or more donors. |
341 | - if ( ! $email ) { |
|
341 | + if ( ! $email) { |
|
342 | 342 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
343 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
343 | + $number = is_numeric($create) ? absint($create) : 1; |
|
344 | 344 | } |
345 | 345 | |
346 | - for ( $i = 0; $i < $number; $i++ ) { |
|
347 | - if ( ! $email ) { |
|
346 | + for ($i = 0; $i < $number; $i++) { |
|
347 | + if ( ! $email) { |
|
348 | 348 | |
349 | 349 | // Generate fake email. |
350 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
350 | + $email = 'customer-'.uniqid().'@test.com'; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $args = array( |
@@ -355,33 +355,33 @@ discard block |
||
355 | 355 | 'name' => $name, |
356 | 356 | ); |
357 | 357 | |
358 | - $customer_id = Give()->customers->add( $args ); |
|
358 | + $customer_id = Give()->customers->add($args); |
|
359 | 359 | |
360 | - if ( $customer_id ) { |
|
361 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor %d created successfully', 'give' ), $customer_id ) ) ); |
|
360 | + if ($customer_id) { |
|
361 | + WP_CLI::line($this->color_message(sprintf(__('Donor %d created successfully', 'give'), $customer_id))); |
|
362 | 362 | } else { |
363 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
363 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // Reset email to false so it is generated on the next loop (if creating donors). |
367 | 367 | $email = false; |
368 | 368 | } |
369 | 369 | |
370 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
370 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
371 | 371 | |
372 | 372 | } else { |
373 | 373 | // Counter. |
374 | 374 | self::$counter = 1; |
375 | 375 | |
376 | 376 | // Search for customers. |
377 | - $search = $donor_id ? $donor_id : $email; |
|
377 | + $search = $donor_id ? $donor_id : $email; |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Get donors. |
381 | 381 | */ |
382 | 382 | // Cache previous number query var. |
383 | 383 | $is_set_number = $cache_per_page = false; |
384 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
384 | + if (isset($wp_query->query_vars['number'])) { |
|
385 | 385 | $cache_per_page = $wp_query->query_vars['number']; |
386 | 386 | $is_set_number = true; |
387 | 387 | } |
@@ -390,43 +390,43 @@ discard block |
||
390 | 390 | $wp_query->query_vars['number'] = $number; |
391 | 391 | |
392 | 392 | // Get donors. |
393 | - $donors = $this->api->get_customers( $search ); |
|
393 | + $donors = $this->api->get_customers($search); |
|
394 | 394 | |
395 | 395 | // Reset number query var. |
396 | - if ( $is_set_number ) { |
|
396 | + if ($is_set_number) { |
|
397 | 397 | $wp_query->query_vars['number'] = $cache_per_page; |
398 | 398 | } |
399 | 399 | |
400 | - if ( isset( $donors['error'] ) ) { |
|
401 | - WP_CLI::error( $donors['error'] ); |
|
400 | + if (isset($donors['error'])) { |
|
401 | + WP_CLI::error($donors['error']); |
|
402 | 402 | } |
403 | 403 | |
404 | - if ( empty( $donors ) ) { |
|
405 | - WP_CLI::error( __( 'No donors found', 'give' ) ); |
|
404 | + if (empty($donors)) { |
|
405 | + WP_CLI::error(__('No donors found', 'give')); |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
409 | 409 | $table_data = array(); |
410 | 410 | $is_table_first_row_set = false; |
411 | 411 | |
412 | - foreach ( $donors['donors'] as $donor_data ) { |
|
412 | + foreach ($donors['donors'] as $donor_data) { |
|
413 | 413 | // Set default table row data. |
414 | - $table_first_row = array( __( 'S. No.', 'give' ) ); |
|
415 | - $table_row = array( self::$counter ); |
|
414 | + $table_first_row = array(__('S. No.', 'give')); |
|
415 | + $table_row = array(self::$counter); |
|
416 | 416 | |
417 | - foreach ( $donor_data as $key => $donor ) { |
|
418 | - switch ( $key ) { |
|
417 | + foreach ($donor_data as $key => $donor) { |
|
418 | + switch ($key) { |
|
419 | 419 | case 'stats': |
420 | - foreach ( $donor as $heading => $data ) { |
|
420 | + foreach ($donor as $heading => $data) { |
|
421 | 421 | |
422 | 422 | // Get first row. |
423 | - if ( ! $is_table_first_row_set ) { |
|
423 | + if ( ! $is_table_first_row_set) { |
|
424 | 424 | $table_first_row[] = $heading; |
425 | 425 | } |
426 | 426 | |
427 | - switch ( $heading ) { |
|
427 | + switch ($heading) { |
|
428 | 428 | case 'total_spent': |
429 | - $table_row[] = give_currency_filter( $data ); |
|
429 | + $table_row[] = give_currency_filter($data); |
|
430 | 430 | break; |
431 | 431 | |
432 | 432 | default: |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | |
438 | 438 | case 'info': |
439 | 439 | default: |
440 | - foreach ( $donor as $heading => $data ) { |
|
440 | + foreach ($donor as $heading => $data) { |
|
441 | 441 | |
442 | 442 | // Get first row. |
443 | - if ( ! $is_table_first_row_set ) { |
|
443 | + if ( ! $is_table_first_row_set) { |
|
444 | 444 | $table_first_row[] = $heading; |
445 | 445 | } |
446 | 446 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | // Add first row data to table data. |
453 | - if ( ! $is_table_first_row_set ) { |
|
453 | + if ( ! $is_table_first_row_set) { |
|
454 | 454 | $table_data[] = $table_first_row; |
455 | 455 | $is_table_first_row_set = true; |
456 | 456 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | self::$counter++; |
463 | 463 | } |
464 | 464 | |
465 | - $this->display_table( $table_data ); |
|
465 | + $this->display_table($table_data); |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | * |
492 | 492 | * @subcommand donations |
493 | 493 | */ |
494 | - public function donations( $args, $assoc_args ) { |
|
494 | + public function donations($args, $assoc_args) { |
|
495 | 495 | global $wp_query; |
496 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
496 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
497 | 497 | |
498 | 498 | // Cache previous number query var. |
499 | 499 | $is_set_number = $cache_per_page = false; |
500 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
500 | + if (isset($wp_query->query_vars['number'])) { |
|
501 | 501 | $cache_per_page = $wp_query->query_vars['number']; |
502 | 502 | $is_set_number = true; |
503 | 503 | } |
@@ -509,45 +509,45 @@ discard block |
||
509 | 509 | $donations = $this->api->get_recent_donations(); |
510 | 510 | |
511 | 511 | // Reset number query var. |
512 | - if ( $is_set_number ) { |
|
512 | + if ($is_set_number) { |
|
513 | 513 | $wp_query->query_vars['number'] = $cache_per_page; |
514 | 514 | } |
515 | 515 | |
516 | - if ( empty( $donations ) ) { |
|
517 | - WP_CLI::error( __( 'No sales found', 'give' ) ); |
|
516 | + if (empty($donations)) { |
|
517 | + WP_CLI::error(__('No sales found', 'give')); |
|
518 | 518 | return; |
519 | 519 | } |
520 | 520 | |
521 | 521 | self::$counter = 1; |
522 | 522 | |
523 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
524 | - $this->color_main_heading( sprintf( __( '%1$s. Payment #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
523 | + foreach ($donations['donations'] as $key => $donation) { |
|
524 | + $this->color_main_heading(sprintf(__('%1$s. Payment #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
525 | 525 | self::$counter++; |
526 | 526 | |
527 | - foreach ( $donation as $column => $data ) { |
|
527 | + foreach ($donation as $column => $data) { |
|
528 | 528 | |
529 | - if ( is_array( $data ) ) { |
|
530 | - $this->color_sub_heading( $column ); |
|
531 | - foreach ( $data as $subcolumn => $subdata ) { |
|
529 | + if (is_array($data)) { |
|
530 | + $this->color_sub_heading($column); |
|
531 | + foreach ($data as $subcolumn => $subdata) { |
|
532 | 532 | |
533 | 533 | // Decode html codes. |
534 | - switch ( $subcolumn ) { |
|
534 | + switch ($subcolumn) { |
|
535 | 535 | case 'name': |
536 | - $subdata = html_entity_decode( $subdata ); |
|
536 | + $subdata = html_entity_decode($subdata); |
|
537 | 537 | break; |
538 | 538 | } |
539 | 539 | |
540 | 540 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
541 | - if ( is_array( $subdata ) ) { |
|
541 | + if (is_array($subdata)) { |
|
542 | 542 | continue; |
543 | 543 | } |
544 | 544 | |
545 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
545 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
546 | 546 | } |
547 | 547 | continue; |
548 | 548 | } |
549 | 549 | |
550 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
550 | + WP_CLI::log($this->color_message($column, $data)); |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
@@ -586,27 +586,27 @@ discard block |
||
586 | 586 | * |
587 | 587 | * @return void |
588 | 588 | */ |
589 | - public function report( $args, $assoc_args ) { |
|
589 | + public function report($args, $assoc_args) { |
|
590 | 590 | $stats = new Give_Payment_Stats(); |
591 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
592 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
593 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
594 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
591 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
592 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
593 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
594 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
595 | 595 | |
596 | - if ( ! empty( $date ) ) { |
|
596 | + if ( ! empty($date)) { |
|
597 | 597 | $start_date = $date; |
598 | 598 | $end_date = false; |
599 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
599 | + } elseif (empty($date) && empty($start_date)) { |
|
600 | 600 | $start_date = 'this_month'; |
601 | 601 | $end_date = false; |
602 | 602 | } |
603 | 603 | |
604 | 604 | // Get stats. |
605 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
606 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
605 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
606 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
607 | 607 | |
608 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
609 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
608 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
609 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -633,26 +633,26 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @subcommand cache |
635 | 635 | */ |
636 | - public function cache( $args, $assoc_args ) { |
|
637 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
636 | + public function cache($args, $assoc_args) { |
|
637 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
638 | 638 | |
639 | 639 | // Bailout. |
640 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
641 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
640 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
641 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
642 | 642 | return; |
643 | 643 | } |
644 | 644 | |
645 | - switch ( $action ) { |
|
645 | + switch ($action) { |
|
646 | 646 | case 'delete' : |
647 | 647 | // Reset counter. |
648 | 648 | self::$counter = 1; |
649 | 649 | |
650 | - if ( $this->delete_stats_transients() ) { |
|
650 | + if ($this->delete_stats_transients()) { |
|
651 | 651 | // Report .eading. |
652 | - WP_CLI::success( 'All form stat transient cache deleted.' ); |
|
652 | + WP_CLI::success('All form stat transient cache deleted.'); |
|
653 | 653 | } else { |
654 | 654 | // Report .eading. |
655 | - WP_CLI::warning( 'We did not find any transient to delete :)' ); |
|
655 | + WP_CLI::warning('We did not find any transient to delete :)'); |
|
656 | 656 | } |
657 | 657 | break; |
658 | 658 | } |
@@ -678,23 +678,23 @@ discard block |
||
678 | 678 | ARRAY_A |
679 | 679 | ); |
680 | 680 | |
681 | - if ( ! empty( $stat_option_names ) ) { |
|
681 | + if ( ! empty($stat_option_names)) { |
|
682 | 682 | |
683 | 683 | // Convert transient option name to transient name. |
684 | 684 | $stat_option_names = array_map( |
685 | - function( $option ) { |
|
686 | - return str_replace( '_transient_', '', $option['option_name'] ); |
|
685 | + function($option) { |
|
686 | + return str_replace('_transient_', '', $option['option_name']); |
|
687 | 687 | }, |
688 | 688 | $stat_option_names |
689 | 689 | ); |
690 | 690 | |
691 | - foreach ( $stat_option_names as $option_name ) { |
|
692 | - if ( delete_transient( $option_name ) ) { |
|
691 | + foreach ($stat_option_names as $option_name) { |
|
692 | + if (delete_transient($option_name)) { |
|
693 | 693 | |
694 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
694 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
695 | 695 | self::$counter++; |
696 | 696 | } else { |
697 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
697 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
@@ -715,12 +715,12 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @return mixed |
717 | 717 | */ |
718 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
718 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
719 | 719 | // Add colon. |
720 | - if ( $colon ) { |
|
721 | - $heading = $heading . ': '; |
|
720 | + if ($colon) { |
|
721 | + $heading = $heading.': '; |
|
722 | 722 | } |
723 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
723 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
739 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
738 | + private function color_main_heading($heading, $color = 'g') { |
|
739 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return void |
751 | 751 | */ |
752 | - private function color_sub_heading( $subheading ) { |
|
753 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
752 | + private function color_sub_heading($subheading) { |
|
753 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | * |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - private function display_table( $data ) { |
|
767 | + private function display_table($data) { |
|
768 | 768 | $table = new \cli\Table(); |
769 | 769 | |
770 | 770 | // Set table header. |
771 | - $table->setHeaders( $data[0] ); |
|
771 | + $table->setHeaders($data[0]); |
|
772 | 772 | |
773 | 773 | // Remove table header. |
774 | - unset( $data[0] ); |
|
774 | + unset($data[0]); |
|
775 | 775 | |
776 | 776 | // Set table data. |
777 | - $table->setRows( $data ); |
|
777 | + $table->setRows($data); |
|
778 | 778 | |
779 | 779 | // Display table. |
780 | 780 | $table->display(); |
@@ -358,9 +358,9 @@ |
||
358 | 358 | require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
359 | 359 | require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
360 | 360 | |
361 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
363 | - } |
|
361 | + if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
362 | + require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
363 | + } |
|
364 | 364 | |
365 | 365 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
366 | 366 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly. |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function __clone() { |
234 | 234 | // Cloning instances of the class is forbidden |
235 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
235 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function __wakeup() { |
247 | 247 | // Unserializing instances of the class is forbidden. |
248 | - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ uh?', 'give' ), '1.0' ); |
|
248 | + _doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ uh?', 'give'), '1.0'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | private function setup_constants() { |
260 | 260 | |
261 | 261 | // Plugin version |
262 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
263 | - define( 'GIVE_VERSION', '1.7' ); |
|
262 | + if ( ! defined('GIVE_VERSION')) { |
|
263 | + define('GIVE_VERSION', '1.7'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // Plugin Folder Path |
267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
267 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | // Plugin Folder URL |
272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
272 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | // Plugin Basename aka: "give/give.php" |
277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | // Plugin Root File |
282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
282 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
283 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | // Make sure CAL_GREGORIAN is defined |
287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
288 | - define( 'CAL_GREGORIAN', 1 ); |
|
287 | + if ( ! defined('CAL_GREGORIAN')) { |
|
288 | + define('CAL_GREGORIAN', 1); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,116 +300,116 @@ discard block |
||
300 | 300 | private function includes() { |
301 | 301 | global $give_options; |
302 | 302 | |
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
304 | 304 | $give_options = give_get_settings(); |
305 | 305 | |
306 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
311 | - |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
326 | - |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
344 | - |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
350 | - |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
356 | - |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
362 | - |
|
363 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
311 | + |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
326 | + |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
344 | + |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
350 | + |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
356 | + |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
362 | + |
|
363 | + if (defined('WP_CLI') && WP_CLI) { |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
365 | 365 | } |
366 | 366 | |
367 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
368 | - |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
379 | - |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
382 | - |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
388 | - |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
396 | - |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
402 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
406 | - |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
367 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
368 | + |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
379 | + |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
382 | + |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
388 | + |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
396 | + |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
402 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
406 | + |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
409 | 409 | |
410 | 410 | } |
411 | 411 | |
412 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
@@ -423,26 +423,26 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function load_textdomain() { |
425 | 425 | // Set filter for Give's languages directory |
426 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
427 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
426 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
427 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
428 | 428 | |
429 | 429 | // Traditional WordPress plugin locale filter |
430 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
431 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
430 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
431 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
432 | 432 | |
433 | 433 | // Setup paths to current locale file |
434 | - $mofile_local = $give_lang_dir . $mofile; |
|
435 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
434 | + $mofile_local = $give_lang_dir.$mofile; |
|
435 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
436 | 436 | |
437 | - if ( file_exists( $mofile_global ) ) { |
|
437 | + if (file_exists($mofile_global)) { |
|
438 | 438 | // Look in global /wp-content/languages/give folder |
439 | - load_textdomain( 'give', $mofile_global ); |
|
440 | - } elseif ( file_exists( $mofile_local ) ) { |
|
439 | + load_textdomain('give', $mofile_global); |
|
440 | + } elseif (file_exists($mofile_local)) { |
|
441 | 441 | // Look in local location from filter `give_languages_directory` |
442 | - load_textdomain( 'give', $mofile_local ); |
|
442 | + load_textdomain('give', $mofile_local); |
|
443 | 443 | } else { |
444 | 444 | // Load the default language files packaged up w/ Give |
445 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
445 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 |
@@ -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 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | function give_add_ons_page() { |
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | - <h1><?php esc_html_e( 'Give Add-ons', 'give' ); ?> |
|
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
28 | + <h1><?php esc_html_e('Give Add-ons', 'give'); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = get_transient( 'give_add_ons_feed' ); |
|
51 | + $cache = get_transient('give_add_ons_feed'); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - set_transient( 'give_add_ons_feed', $cache, 3600 ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + set_transient('give_add_ons_feed', $cache, 3600); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | - $cache = '<div class="error"><p>' . esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) . '</div>'; |
|
62 | + $cache = '<div class="error"><p>'.esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give').'</div>'; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 1.3.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) or exit; |
|
11 | +defined('ABSPATH') or exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Class Give_Shortcode_Donation_Form_Goal |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | 22 | |
23 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
24 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
23 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_goal' ); |
|
26 | + parent::__construct('give_goal'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | $create_form_link = sprintf( |
37 | 37 | /* translators: %s: create new form URL */ |
38 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
39 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
38 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
39 | + admin_url('post-new.php?post_type=give_forms') |
|
40 | 40 | ); |
41 | 41 | |
42 | 42 | return array( |
@@ -46,35 +46,35 @@ discard block |
||
46 | 46 | 'post_type' => 'give_forms', |
47 | 47 | ), |
48 | 48 | 'name' => 'id', |
49 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
50 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
49 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
50 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
51 | 51 | 'required' => array( |
52 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
53 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ), |
|
52 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
53 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link), |
|
54 | 54 | ), |
55 | 55 | ), |
56 | 56 | array( |
57 | 57 | 'type' => 'container', |
58 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
58 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'listbox', |
62 | 62 | 'name' => 'show_text', |
63 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
64 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
63 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
64 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
65 | 65 | 'options' => array( |
66 | - 'true' => esc_html__( 'Show', 'give' ), |
|
67 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
66 | + 'true' => esc_html__('Show', 'give'), |
|
67 | + 'false' => esc_html__('Hide', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | 71 | 'type' => 'listbox', |
72 | 72 | 'name' => 'show_bar', |
73 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
74 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
73 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
74 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
75 | 75 | 'options' => array( |
76 | - 'true' => esc_html__( 'Show', 'give' ), |
|
77 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
76 | + 'true' => esc_html__('Show', 'give'), |
|
77 | + 'false' => esc_html__('Hide', 'give'), |
|
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | ); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
94 | - 'details' => esc_html__( 'Request Details', 'give' ), |
|
95 | - 'ip' => esc_html__( 'Request IP', 'give' ), |
|
96 | - 'date' => esc_html__( 'Date', 'give' ) |
|
93 | + 'ID' => esc_html__('Log ID', 'give'), |
|
94 | + 'details' => esc_html__('Request Details', 'give'), |
|
95 | + 'ip' => esc_html__('Request IP', 'give'), |
|
96 | + 'date' => esc_html__('Date', 'give') |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $which |
178 | 178 | */ |
179 | - protected function display_tablenav( $which ) { |
|
180 | - if ( 'top' === $which ) { |
|
181 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
179 | + protected function display_tablenav($which) { |
|
180 | + if ('top' === $which) { |
|
181 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
182 | 182 | } |
183 | 183 | ?> |
184 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
184 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
185 | 185 | |
186 | 186 | <div class="alignleft actions bulkactions"> |
187 | - <?php $this->bulk_actions( $which ); ?> |
|
187 | + <?php $this->bulk_actions($which); ?> |
|
188 | 188 | </div> |
189 | 189 | <?php |
190 | - $this->extra_tablenav( $which ); |
|
191 | - $this->pagination( $which ); |
|
190 | + $this->extra_tablenav($which); |
|
191 | + $this->pagination($which); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <br class="clear"/> |
@@ -210,31 +210,31 @@ discard block |
||
210 | 210 | |
211 | 211 | $search = $this->get_search(); |
212 | 212 | |
213 | - if ( $search ) { |
|
214 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
213 | + if ($search) { |
|
214 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
215 | 215 | // This is an IP address search |
216 | 216 | $key = '_give_log_request_ip'; |
217 | - } else if ( is_email( $search ) ) { |
|
217 | + } else if (is_email($search)) { |
|
218 | 218 | // This is an email search |
219 | - $userdata = get_user_by( 'email', $search ); |
|
219 | + $userdata = get_user_by('email', $search); |
|
220 | 220 | |
221 | - if ( $userdata ) { |
|
221 | + if ($userdata) { |
|
222 | 222 | $search = $userdata->ID; |
223 | 223 | } |
224 | 224 | |
225 | 225 | $key = '_give_log_user'; |
226 | - } elseif ( strlen( $search ) == 32 ) { |
|
226 | + } elseif (strlen($search) == 32) { |
|
227 | 227 | // Look for an API key |
228 | 228 | $key = '_give_log_key'; |
229 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
229 | + } elseif (stristr($search, 'token:')) { |
|
230 | 230 | // Look for an API token |
231 | - $search = str_ireplace( 'token:', '', $search ); |
|
231 | + $search = str_ireplace('token:', '', $search); |
|
232 | 232 | $key = '_give_log_token'; |
233 | 233 | } else { |
234 | 234 | // This is (probably) a user ID search |
235 | - $userdata = get_userdata( $search ); |
|
235 | + $userdata = get_userdata($search); |
|
236 | 236 | |
237 | - if ( $userdata ) { |
|
237 | + if ($userdata) { |
|
238 | 238 | $search = $userdata->ID; |
239 | 239 | } |
240 | 240 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @return int Current page number |
261 | 261 | */ |
262 | 262 | public function get_paged() { |
263 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
263 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 1.0 |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - function bulk_actions( $which = '' ) { |
|
273 | + function bulk_actions($which = '') { |
|
274 | 274 | give_log_views(); |
275 | 275 | } |
276 | 276 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | 'meta_query' => $this->get_meta_query() |
294 | 294 | ); |
295 | 295 | |
296 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
296 | + $logs = $give_logs->get_connected_logs($log_query); |
|
297 | 297 | |
298 | - if ( $logs ) { |
|
299 | - foreach ( $logs as $log ) { |
|
298 | + if ($logs) { |
|
299 | + foreach ($logs as $log) { |
|
300 | 300 | |
301 | 301 | $logs_data[] = array( |
302 | 302 | 'ID' => $log->ID, |
303 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
303 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
304 | 304 | 'date' => $log->post_date |
305 | 305 | ); |
306 | 306 | } |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | $columns = $this->get_columns(); |
329 | 329 | $hidden = array(); // No hidden columns |
330 | 330 | $sortable = $this->get_sortable_columns(); |
331 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
331 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
332 | 332 | $this->items = $this->get_logs(); |
333 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
333 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
334 | 334 | |
335 | - $this->set_pagination_args( array( |
|
335 | + $this->set_pagination_args(array( |
|
336 | 336 | 'total_items' => $total_items, |
337 | 337 | 'per_page' => $this->per_page, |
338 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
338 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
@@ -11,7 +11,7 @@ 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 | |
@@ -54,50 +54,50 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | 56 | |
57 | - if ( $this->step == 1 ) { |
|
58 | - $this->delete_data( 'give_temp_recount_income' ); |
|
57 | + if ($this->step == 1) { |
|
58 | + $this->delete_data('give_temp_recount_income'); |
|
59 | 59 | } |
60 | 60 | |
61 | - $total = get_option( 'give_temp_recount_income', false ); |
|
61 | + $total = get_option('give_temp_recount_income', false); |
|
62 | 62 | |
63 | - if ( false === $total ) { |
|
63 | + if (false === $total) { |
|
64 | 64 | $total = (float) 0; |
65 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
65 | + $this->store_data('give_temp_recount_income', $total); |
|
66 | 66 | } |
67 | 67 | |
68 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
68 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
69 | 69 | |
70 | - $args = apply_filters( 'give_recount_income_args', array( |
|
70 | + $args = apply_filters('give_recount_income_args', array( |
|
71 | 71 | 'number' => $this->per_step, |
72 | 72 | 'page' => $this->step, |
73 | 73 | 'status' => $accepted_statuses, |
74 | 74 | 'fields' => 'ids' |
75 | - ) ); |
|
75 | + )); |
|
76 | 76 | |
77 | - $payments = give_get_payments( $args ); |
|
77 | + $payments = give_get_payments($args); |
|
78 | 78 | |
79 | - if ( ! empty( $payments ) ) { |
|
79 | + if ( ! empty($payments)) { |
|
80 | 80 | |
81 | - foreach ( $payments as $payment ) { |
|
81 | + foreach ($payments as $payment) { |
|
82 | 82 | |
83 | - $total += give_get_payment_amount( $payment ); |
|
83 | + $total += give_get_payment_amount($payment); |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | - if ( $total < 0 ) { |
|
87 | + if ($total < 0) { |
|
88 | 88 | $totals = 0; |
89 | 89 | } |
90 | 90 | |
91 | - $total = round( $total, give_currency_decimal_filter() ); |
|
91 | + $total = round($total, give_currency_decimal_filter()); |
|
92 | 92 | |
93 | - $this->store_data( 'give_temp_recount_income', $total ); |
|
93 | + $this->store_data('give_temp_recount_income', $total); |
|
94 | 94 | |
95 | 95 | return true; |
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | - update_option( 'give_income_total', $total ); |
|
100 | - set_transient( 'give_income_total', $total, 86400 ); |
|
99 | + update_option('give_income_total', $total); |
|
100 | + set_transient('give_income_total', $total, 86400); |
|
101 | 101 | |
102 | 102 | return false; |
103 | 103 | |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function get_percentage_complete() { |
113 | 113 | |
114 | - $total = $this->get_stored_data( 'give_recount_income_total' ); |
|
114 | + $total = $this->get_stored_data('give_recount_income_total'); |
|
115 | 115 | |
116 | - if ( false === $total ) { |
|
117 | - $args = apply_filters( 'give_recount_income_total_args', array() ); |
|
116 | + if (false === $total) { |
|
117 | + $args = apply_filters('give_recount_income_total_args', array()); |
|
118 | 118 | |
119 | - $counts = give_count_payments( $args ); |
|
120 | - $total = absint( $counts->publish ); |
|
121 | - $total = apply_filters( 'give_recount_store_income_total', $total ); |
|
119 | + $counts = give_count_payments($args); |
|
120 | + $total = absint($counts->publish); |
|
121 | + $total = apply_filters('give_recount_store_income_total', $total); |
|
122 | 122 | |
123 | - $this->store_data( 'give_recount_income_total', $total ); |
|
123 | + $this->store_data('give_recount_income_total', $total); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | $percentage = 100; |
127 | 127 | |
128 | - if ( $total > 0 ) { |
|
129 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
128 | + if ($total > 0) { |
|
129 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
130 | 130 | } |
131 | 131 | |
132 | - if ( $percentage > 100 ) { |
|
132 | + if ($percentage > 100) { |
|
133 | 133 | $percentage = 100; |
134 | 134 | } |
135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @param array $request The Form Data passed into the batch processing |
145 | 145 | */ |
146 | - public function set_properties( $request ) { |
|
146 | + public function set_properties($request) { |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,31 +154,31 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function process_step() { |
156 | 156 | |
157 | - if ( ! $this->can_export() ) { |
|
158 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
157 | + if ( ! $this->can_export()) { |
|
158 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $had_data = $this->get_data(); |
162 | 162 | |
163 | - if ( $had_data ) { |
|
163 | + if ($had_data) { |
|
164 | 164 | $this->done = false; |
165 | 165 | |
166 | 166 | return true; |
167 | 167 | } else { |
168 | - $this->delete_data( 'give_recount_income_total' ); |
|
169 | - $this->delete_data( 'give_temp_recount_income' ); |
|
168 | + $this->delete_data('give_recount_income_total'); |
|
169 | + $this->delete_data('give_temp_recount_income'); |
|
170 | 170 | $this->done = true; |
171 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
171 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
172 | 172 | |
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | public function headers() { |
178 | - ignore_user_abort( true ); |
|
178 | + ignore_user_abort(true); |
|
179 | 179 | |
180 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
181 | - set_time_limit( 0 ); |
|
180 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
181 | + set_time_limit(0); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return mixed Returns the data from the database |
208 | 208 | */ |
209 | - private function get_stored_data( $key ) { |
|
209 | + private function get_stored_data($key) { |
|
210 | 210 | global $wpdb; |
211 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
211 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
212 | 212 | |
213 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
213 | + return empty($value) ? false : maybe_unserialize($value); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -223,10 +223,10 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void |
225 | 225 | */ |
226 | - private function store_data( $key, $value ) { |
|
226 | + private function store_data($key, $value) { |
|
227 | 227 | global $wpdb; |
228 | 228 | |
229 | - $value = maybe_serialize( $value ); |
|
229 | + $value = maybe_serialize($value); |
|
230 | 230 | |
231 | 231 | $data = array( |
232 | 232 | 'option_name' => $key, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | '%s', |
241 | 241 | ); |
242 | 242 | |
243 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
243 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return void |
254 | 254 | */ |
255 | - private function delete_data( $key ) { |
|
255 | + private function delete_data($key) { |
|
256 | 256 | global $wpdb; |
257 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
257 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | } |
@@ -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 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array $output Response messages |
25 | 25 | */ |
26 | -function give_edit_customer( $args ) { |
|
26 | +function give_edit_customer($args) { |
|
27 | 27 | |
28 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
28 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $args ) ) { |
|
34 | + if (empty($args)) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $customer_id = (int) $args['customerinfo']['id']; |
40 | 40 | $nonce = $args['_wpnonce']; |
41 | 41 | |
42 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
43 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
42 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
43 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
44 | 44 | } |
45 | 45 | |
46 | - $customer = new Give_Customer( $customer_id ); |
|
47 | - if ( empty( $customer->id ) ) { |
|
46 | + $customer = new Give_Customer($customer_id); |
|
47 | + if (empty($customer->id)) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | 'user_id' => 0 |
55 | 55 | ); |
56 | 56 | |
57 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
57 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
58 | 58 | |
59 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
60 | - give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) ); |
|
59 | + if ( ! is_email($customer_info['email'])) { |
|
60 | + give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give')); |
|
61 | 61 | } |
62 | 62 | |
63 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
63 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
64 | 64 | |
65 | 65 | // Make sure we don't already have this user attached to a customer |
66 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
67 | - give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
66 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
67 | + give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Make sure it's actually a user |
71 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
72 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
73 | - give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
71 | + $user = get_user_by('id', $customer_info['user_id']); |
|
72 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
73 | + give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | } |
@@ -78,53 +78,53 @@ discard block |
||
78 | 78 | // Record this for later |
79 | 79 | $previous_user_id = $customer->user_id; |
80 | 80 | |
81 | - if ( give_get_errors() ) { |
|
81 | + if (give_get_errors()) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Setup the customer address, if present |
86 | 86 | $address = array(); |
87 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
87 | + if (intval($customer_info['user_id']) > 0) { |
|
88 | 88 | |
89 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
89 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
90 | 90 | |
91 | - if ( false === $current_address ) { |
|
92 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
93 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
94 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
95 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
96 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
97 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
91 | + if (false === $current_address) { |
|
92 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
93 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
94 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
95 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
96 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
97 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
98 | 98 | } else { |
99 | - $current_address = wp_parse_args( $current_address, array( |
|
99 | + $current_address = wp_parse_args($current_address, array( |
|
100 | 100 | 'line1', |
101 | 101 | 'line2', |
102 | 102 | 'city', |
103 | 103 | 'zip', |
104 | 104 | 'state', |
105 | 105 | 'country' |
106 | - ) ); |
|
107 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
110 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
111 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
106 | + )); |
|
107 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
108 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
109 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
110 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
111 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
112 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Sanitize the inputs |
118 | 118 | $customer_data = array(); |
119 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
119 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
120 | 120 | $customer_data['email'] = $customer_info['email']; |
121 | 121 | $customer_data['user_id'] = $customer_info['user_id']; |
122 | 122 | |
123 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
124 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
123 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
124 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
125 | 125 | |
126 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
127 | - $address = array_map( 'sanitize_text_field', $address ); |
|
126 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
127 | + $address = array_map('sanitize_text_field', $address); |
|
128 | 128 | |
129 | 129 | |
130 | 130 | /** |
@@ -136,34 +136,34 @@ discard block |
||
136 | 136 | * @param array $customer_data The customer data. |
137 | 137 | * @param array $address The customer address. |
138 | 138 | */ |
139 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
139 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
140 | 140 | |
141 | 141 | $output = array(); |
142 | 142 | $previous_email = $customer->email; |
143 | 143 | |
144 | - if ( $customer->update( $customer_data ) ) { |
|
144 | + if ($customer->update($customer_data)) { |
|
145 | 145 | |
146 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
147 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
146 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
147 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // Update some payment meta if we need to |
151 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
151 | + $payments_array = explode(',', $customer->payment_ids); |
|
152 | 152 | |
153 | - if ( $customer->email != $previous_email ) { |
|
154 | - foreach ( $payments_array as $payment_id ) { |
|
155 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
153 | + if ($customer->email != $previous_email) { |
|
154 | + foreach ($payments_array as $payment_id) { |
|
155 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | |
159 | - if ( $customer->user_id != $previous_user_id ) { |
|
160 | - foreach ( $payments_array as $payment_id ) { |
|
161 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
159 | + if ($customer->user_id != $previous_user_id) { |
|
160 | + foreach ($payments_array as $payment_id) { |
|
161 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | $output['success'] = true; |
166 | - $customer_data = array_merge( $customer_data, $address ); |
|
166 | + $customer_data = array_merge($customer_data, $address); |
|
167 | 167 | $output['customer_info'] = $customer_data; |
168 | 168 | |
169 | 169 | } else { |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | * @param int $customer_id The ID of the customer. |
181 | 181 | * @param array $customer_data The customer data. |
182 | 182 | */ |
183 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
183 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
184 | 184 | |
185 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
186 | - header( 'Content-Type: application/json' ); |
|
187 | - echo json_encode( $output ); |
|
185 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
186 | + header('Content-Type: application/json'); |
|
187 | + echo json_encode($output); |
|
188 | 188 | wp_die(); |
189 | 189 | } |
190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
195 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
196 | 196 | |
197 | 197 | /** |
198 | 198 | * Save a customer note being added |
@@ -203,36 +203,36 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return int The Note ID that was saved, or 0 if nothing was saved |
205 | 205 | */ |
206 | -function give_customer_save_note( $args ) { |
|
206 | +function give_customer_save_note($args) { |
|
207 | 207 | |
208 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
208 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
209 | 209 | |
210 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
211 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
210 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
211 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
212 | 212 | } |
213 | 213 | |
214 | - if ( empty( $args ) ) { |
|
214 | + if (empty($args)) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
218 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
219 | 219 | $customer_id = (int) $args['customer_id']; |
220 | 220 | $nonce = $args['add_customer_note_nonce']; |
221 | 221 | |
222 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
223 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
222 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
223 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( empty( $customer_note ) ) { |
|
227 | - give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) ); |
|
226 | + if (empty($customer_note)) { |
|
227 | + give_set_error('empty-customer-note', esc_html__('A note is required.', 'give')); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( give_get_errors() ) { |
|
230 | + if (give_get_errors()) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | - $customer = new Give_Customer( $customer_id ); |
|
235 | - $new_note = $customer->add_note( $customer_note ); |
|
234 | + $customer = new Give_Customer($customer_id); |
|
235 | + $new_note = $customer->add_note($customer_note); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * Fires before inserting customer note. |
@@ -242,22 +242,22 @@ discard block |
||
242 | 242 | * @param int $customer_id The ID of the customer. |
243 | 243 | * @param string $new_note Note content. |
244 | 244 | */ |
245 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
245 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
246 | 246 | |
247 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
247 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
248 | 248 | |
249 | 249 | ob_start(); |
250 | 250 | ?> |
251 | 251 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
252 | 252 | <span class="note-content-wrap"> |
253 | - <?php echo stripslashes( $new_note ); ?> |
|
253 | + <?php echo stripslashes($new_note); ?> |
|
254 | 254 | </span> |
255 | 255 | </div> |
256 | 256 | <?php |
257 | 257 | $output = ob_get_contents(); |
258 | 258 | ob_end_clean(); |
259 | 259 | |
260 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
260 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
261 | 261 | echo $output; |
262 | 262 | exit; |
263 | 263 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | } |
272 | 272 | |
273 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
273 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Delete a customer |
@@ -281,37 +281,37 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return int Whether it was a successful deletion |
283 | 283 | */ |
284 | -function give_customer_delete( $args ) { |
|
284 | +function give_customer_delete($args) { |
|
285 | 285 | |
286 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
286 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
287 | 287 | |
288 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
289 | - wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
288 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
289 | + wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
290 | 290 | } |
291 | 291 | |
292 | - if ( empty( $args ) ) { |
|
292 | + if (empty($args)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
296 | 296 | $customer_id = (int) $args['customer_id']; |
297 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
298 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
297 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
298 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
299 | 299 | $nonce = $args['_wpnonce']; |
300 | 300 | |
301 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
302 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
301 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
302 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
303 | 303 | } |
304 | 304 | |
305 | - if ( ! $confirm ) { |
|
306 | - give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) ); |
|
305 | + if ( ! $confirm) { |
|
306 | + give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give')); |
|
307 | 307 | } |
308 | 308 | |
309 | - if ( give_get_errors() ) { |
|
310 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
309 | + if (give_get_errors()) { |
|
310 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
311 | 311 | exit; |
312 | 312 | } |
313 | 313 | |
314 | - $customer = new Give_Customer( $customer_id ); |
|
314 | + $customer = new Give_Customer($customer_id); |
|
315 | 315 | |
316 | 316 | /** |
317 | 317 | * Fires before deleting customer. |
@@ -322,55 +322,55 @@ discard block |
||
322 | 322 | * @param bool $confirm Delete confirmation. |
323 | 323 | * @param bool $remove_data Records delete confirmation. |
324 | 324 | */ |
325 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
325 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
326 | 326 | |
327 | 327 | $success = false; |
328 | 328 | |
329 | - if ( $customer->id > 0 ) { |
|
329 | + if ($customer->id > 0) { |
|
330 | 330 | |
331 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
332 | - $success = Give()->customers->delete( $customer->id ); |
|
331 | + $payments_array = explode(',', $customer->payment_ids); |
|
332 | + $success = Give()->customers->delete($customer->id); |
|
333 | 333 | |
334 | - if ( $success ) { |
|
334 | + if ($success) { |
|
335 | 335 | |
336 | - if ( $remove_data ) { |
|
336 | + if ($remove_data) { |
|
337 | 337 | |
338 | 338 | // Remove all payments, logs, etc |
339 | - foreach ( $payments_array as $payment_id ) { |
|
340 | - give_delete_purchase( $payment_id ); |
|
339 | + foreach ($payments_array as $payment_id) { |
|
340 | + give_delete_purchase($payment_id); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | } else { |
344 | 344 | |
345 | 345 | // Just set the payments to customer_id of 0 |
346 | - foreach ( $payments_array as $payment_id ) { |
|
347 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
346 | + foreach ($payments_array as $payment_id) { |
|
347 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
352 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
353 | 353 | |
354 | 354 | } else { |
355 | 355 | |
356 | - give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) ); |
|
357 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
356 | + give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give')); |
|
357 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
358 | 358 | |
359 | 359 | } |
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
363 | - give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
364 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
363 | + give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give')); |
|
364 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | - wp_redirect( $redirect ); |
|
368 | + wp_redirect($redirect); |
|
369 | 369 | exit; |
370 | 370 | |
371 | 371 | } |
372 | 372 | |
373 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
373 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Disconnect a user ID from a donor |
@@ -381,27 +381,27 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @return bool If the disconnect was successful |
383 | 383 | */ |
384 | -function give_disconnect_customer_user_id( $args ) { |
|
384 | +function give_disconnect_customer_user_id($args) { |
|
385 | 385 | |
386 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
386 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
387 | 387 | |
388 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
389 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
388 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
389 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( empty( $args ) ) { |
|
392 | + if (empty($args)) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
396 | 396 | $customer_id = (int) $args['customer_id']; |
397 | 397 | $nonce = $args['_wpnonce']; |
398 | 398 | |
399 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
400 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
399 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
400 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
401 | 401 | } |
402 | 402 | |
403 | - $customer = new Give_Customer( $customer_id ); |
|
404 | - if ( empty( $customer->id ) ) { |
|
403 | + $customer = new Give_Customer($customer_id); |
|
404 | + if (empty($customer->id)) { |
|
405 | 405 | return false; |
406 | 406 | } |
407 | 407 | |
@@ -415,15 +415,15 @@ discard block |
||
415 | 415 | * @param int $customer_id The ID of the customer. |
416 | 416 | * @param int $user_id The ID of the user. |
417 | 417 | */ |
418 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id ); |
|
418 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id); |
|
419 | 419 | |
420 | - $customer_args = array( 'user_id' => 0 ); |
|
420 | + $customer_args = array('user_id' => 0); |
|
421 | 421 | |
422 | - if ( $customer->update( $customer_args ) ) { |
|
422 | + if ($customer->update($customer_args)) { |
|
423 | 423 | global $wpdb; |
424 | 424 | |
425 | - if ( ! empty( $customer->payment_ids ) ) { |
|
426 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
425 | + if ( ! empty($customer->payment_ids)) { |
|
426 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | $output['success'] = true; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | } else { |
432 | 432 | |
433 | 433 | $output['success'] = false; |
434 | - give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) ); |
|
434 | + give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give')); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param int $customer_id The ID of the customer. |
443 | 443 | */ |
444 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
444 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
445 | 445 | |
446 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
447 | - header( 'Content-Type: application/json' ); |
|
448 | - echo json_encode( $output ); |
|
446 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
447 | + header('Content-Type: application/json'); |
|
448 | + echo json_encode($output); |
|
449 | 449 | wp_die(); |
450 | 450 | } |
451 | 451 | |
@@ -453,4 +453,4 @@ discard block |
||
453 | 453 | |
454 | 454 | } |
455 | 455 | |
456 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
456 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
@@ -276,8 +276,11 @@ discard block |
||
276 | 276 | <span class="customer-user-id info-item editable"> |
277 | 277 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
278 | 278 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
279 | - <?php else : ?> |
|
280 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
279 | + <?php else { |
|
280 | + : ?> |
|
281 | + <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); |
|
282 | +} |
|
283 | +?></span> |
|
281 | 284 | <?php endif; ?> |
282 | 285 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
283 | 286 | <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> |
@@ -346,8 +349,11 @@ discard block |
||
346 | 349 | } |
347 | 350 | ?> |
348 | 351 | </select> |
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' ); ?>" /> |
|
352 | + <?php else { |
|
353 | + : ?> |
|
354 | + <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' ); |
|
355 | +} |
|
356 | +?>" /> |
|
351 | 357 | <?php endif; ?> |
352 | 358 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
353 | 359 | </span> |
@@ -486,9 +492,12 @@ discard block |
||
486 | 492 | </td> |
487 | 493 | </tr> |
488 | 494 | <?php endforeach; ?> |
489 | - <?php else: ?> |
|
495 | + <?php else { |
|
496 | + : ?> |
|
490 | 497 | <tr> |
491 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
498 | + <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); |
|
499 | +} |
|
500 | +?></td> |
|
492 | 501 | </tr> |
493 | 502 | <?php endif; ?> |
494 | 503 | </tbody> |
@@ -529,9 +538,12 @@ discard block |
||
529 | 538 | </td> |
530 | 539 | </tr> |
531 | 540 | <?php endforeach; ?> |
532 | - <?php else: ?> |
|
541 | + <?php else { |
|
542 | + : ?> |
|
533 | 543 | <tr> |
534 | - <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td> |
|
544 | + <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); |
|
545 | +} |
|
546 | +?></td> |
|
535 | 547 | </tr> |
536 | 548 | <?php endif; ?> |
537 | 549 | </tbody> |
@@ -621,9 +633,12 @@ discard block |
||
621 | 633 | </span> |
622 | 634 | </div> |
623 | 635 | <?php endforeach; ?> |
624 | - <?php else: ?> |
|
636 | + <?php else { |
|
637 | + : ?> |
|
625 | 638 | <div class="give-no-customer-notes"> |
626 | - <?php esc_html_e( 'No donor notes found.', 'give' ); ?> |
|
639 | + <?php esc_html_e( 'No donor notes found.', 'give' ); |
|
640 | +} |
|
641 | +?> |
|
627 | 642 | </div> |
628 | 643 | <?php endif; ?> |
629 | 644 | </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.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', '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.', 'give' ) ); |
|
135 | + if (empty($customer->id)) { |
|
136 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,34 +142,34 @@ 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 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1> |
|
151 | + <h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1> |
|
152 | 152 | |
153 | - <?php if ( $customer && $render ) : ?> |
|
153 | + <?php if ($customer && $render) : ?> |
|
154 | 154 | |
155 | 155 | <h2 class="nav-tab-wrapper"> |
156 | 156 | <?php |
157 | - foreach ( $customer_tabs as $key => $tab ) : |
|
157 | + foreach ($customer_tabs as $key => $tab) : |
|
158 | 158 | $active = $key === $view ? true : false; |
159 | 159 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
160 | 160 | printf( |
161 | 161 | '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
162 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ), |
|
163 | - esc_attr( $class ), |
|
164 | - sanitize_html_class( $tab['dashicon'] ), |
|
165 | - esc_html( $tab['title'] ) |
|
162 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)), |
|
163 | + esc_attr($class), |
|
164 | + sanitize_html_class($tab['dashicon']), |
|
165 | + esc_html($tab['title']) |
|
166 | 166 | ); |
167 | 167 | endforeach; |
168 | 168 | ?> |
169 | 169 | </h2> |
170 | 170 | |
171 | 171 | <div id="give-customer-card-wrapper"> |
172 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
172 | + <?php $callbacks[$view]($customer) ?> |
|
173 | 173 | </div> |
174 | 174 | |
175 | 175 | <?php endif; ?> |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return void |
191 | 191 | */ |
192 | -function give_customers_view( $customer ) { |
|
192 | +function give_customers_view($customer) { |
|
193 | 193 | |
194 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
194 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Fires in donor profile screen, above the donor card. |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param object $customer The customer object being displayed. |
202 | 202 | */ |
203 | - do_action( 'give_donor_card_top', $customer ); |
|
203 | + do_action('give_donor_card_top', $customer); |
|
204 | 204 | ?> |
205 | 205 | |
206 | 206 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
207 | 207 | |
208 | - <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 ); ?>"> |
|
208 | + <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); ?>"> |
|
209 | 209 | |
210 | 210 | <div class="customer-info"> |
211 | 211 | |
212 | 212 | <div class="donor-bio-header clearfix"> |
213 | 213 | |
214 | 214 | <div class="avatar-wrap left" id="customer-avatar"> |
215 | - <?php echo get_avatar( $customer->email ); ?> |
|
215 | + <?php echo get_avatar($customer->email); ?> |
|
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <div id="customer-name-wrap" class="left"> |
219 | 219 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
220 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
220 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
221 | 221 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
222 | 222 | </div> |
223 | 223 | <p class="customer-since info-item"> |
224 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
225 | - <?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?> |
|
224 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
225 | + <?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?> |
|
226 | 226 | </p> |
227 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
228 | - <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
227 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
228 | + <a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
229 | 229 | <?php endif; ?> |
230 | 230 | </div> |
231 | 231 | <!-- /donor-bio-header --> |
@@ -235,14 +235,14 @@ discard block |
||
235 | 235 | <table class="widefat"> |
236 | 236 | <tbody> |
237 | 237 | <tr> |
238 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'Email:', 'give' ); ?></label></th> |
|
238 | + <th scope="col"><label for="tablecell"><?php esc_html_e('Email:', 'give'); ?></label></th> |
|
239 | 239 | <td class="row-title"> |
240 | - <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> |
|
240 | + <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> |
|
241 | 241 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
242 | 242 | </td> |
243 | 243 | </tr> |
244 | 244 | <tr class="alternate"> |
245 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label></th> |
|
245 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label></th> |
|
246 | 246 | <td class="row-title"> |
247 | 247 | <span class="customer-user-id info-item edit-item"> |
248 | 248 | <?php |
@@ -258,38 +258,38 @@ discard block |
||
258 | 258 | 'data' => $data_atts, |
259 | 259 | ); |
260 | 260 | |
261 | - if ( ! empty( $user_id ) ) { |
|
262 | - $userdata = get_userdata( $user_id ); |
|
261 | + if ( ! empty($user_id)) { |
|
262 | + $userdata = get_userdata($user_id); |
|
263 | 263 | $user_args['value'] = $userdata->user_login; |
264 | 264 | } |
265 | 265 | |
266 | - echo Give()->html->ajax_user_search( $user_args ); |
|
266 | + echo Give()->html->ajax_user_search($user_args); |
|
267 | 267 | ?> |
268 | 268 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
269 | 269 | </span> |
270 | 270 | |
271 | 271 | <span class="customer-user-id info-item editable"> |
272 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
272 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
273 | 273 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
274 | 274 | <?php else : ?> |
275 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
275 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
276 | 276 | <?php endif; ?> |
277 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
278 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
277 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
278 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
279 | 279 | <?php endif; ?> |
280 | 280 | </span> |
281 | 281 | </td> |
282 | 282 | </tr> |
283 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
283 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
284 | 284 | |
285 | 285 | <tr> |
286 | - <th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th> |
|
286 | + <th scope="col"><?php esc_html_e('Address:', 'give'); ?></th> |
|
287 | 287 | <td class="row-title"> |
288 | 288 | |
289 | 289 | <div class="customer-address-wrapper"> |
290 | 290 | |
291 | 291 | <?php |
292 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
292 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
293 | 293 | $defaults = array( |
294 | 294 | 'line1' => '', |
295 | 295 | 'line2' => '', |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | 'zip' => '' |
300 | 300 | ); |
301 | 301 | |
302 | - $address = wp_parse_args( $address, $defaults ); |
|
302 | + $address = wp_parse_args($address, $defaults); |
|
303 | 303 | ?> |
304 | 304 | |
305 | - <?php if ( ! empty( $address ) ) { ?> |
|
305 | + <?php if ( ! empty($address)) { ?> |
|
306 | 306 | <span class="customer-address info-item editable"> |
307 | 307 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
308 | 308 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -313,38 +313,38 @@ discard block |
||
313 | 313 | </span> |
314 | 314 | <?php } ?> |
315 | 315 | <span class="customer-address info-item edit-item"> |
316 | - <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']; ?>" /> |
|
317 | - <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']; ?>" /> |
|
318 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
316 | + <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']; ?>" /> |
|
317 | + <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']; ?>" /> |
|
318 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
319 | 319 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
320 | 320 | <?php |
321 | 321 | |
322 | 322 | $selected_country = $address['country']; |
323 | 323 | |
324 | 324 | $countries = give_get_country_list(); |
325 | - foreach ( $countries as $country_code => $country ) { |
|
326 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
325 | + foreach ($countries as $country_code => $country) { |
|
326 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
327 | 327 | } |
328 | 328 | ?> |
329 | 329 | </select> |
330 | 330 | <?php |
331 | 331 | $selected_state = give_get_state(); |
332 | - $states = give_get_states( $selected_country ); |
|
332 | + $states = give_get_states($selected_country); |
|
333 | 333 | |
334 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
334 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
335 | 335 | |
336 | - if ( ! empty( $states ) ) : ?> |
|
336 | + if ( ! empty($states)) : ?> |
|
337 | 337 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
338 | 338 | <?php |
339 | - foreach ( $states as $state_code => $state ) { |
|
340 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
339 | + foreach ($states as $state_code => $state) { |
|
340 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
341 | 341 | } |
342 | 342 | ?> |
343 | 343 | </select> |
344 | 344 | <?php else : ?> |
345 | - <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' ); ?>" /> |
|
345 | + <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'); ?>" /> |
|
346 | 346 | <?php endif; ?> |
347 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
347 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
348 | 348 | </span> |
349 | 349 | |
350 | 350 | </div> |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | |
361 | 361 | <span id="customer-edit-actions" class="edit-item"> |
362 | 362 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
363 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
363 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
364 | 364 | <input type="hidden" name="give_action" value="edit-customer" /> |
365 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
366 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
365 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
366 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
367 | 367 | </span> |
368 | 368 | |
369 | 369 | </form> |
@@ -378,24 +378,24 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @param object $customer The customer object being displayed. |
380 | 380 | */ |
381 | - do_action( 'give_donor_before_stats', $customer ); |
|
381 | + do_action('give_donor_before_stats', $customer); |
|
382 | 382 | ?> |
383 | 383 | |
384 | 384 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
385 | 385 | <ul> |
386 | 386 | <li> |
387 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
387 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
388 | 388 | <span class="dashicons dashicons-heart"></span> |
389 | 389 | <?php |
390 | 390 | //Completed Donations |
391 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
392 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
391 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
392 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
393 | 393 | ?> |
394 | 394 | </a> |
395 | 395 | </li> |
396 | 396 | <li> |
397 | 397 | <span class="dashicons dashicons-chart-area"></span> |
398 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
398 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
399 | 399 | </li> |
400 | 400 | <?php |
401 | 401 | /** |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * |
408 | 408 | * @param object $customer The customer object being displayed. |
409 | 409 | */ |
410 | - do_action( 'give_donor_stats_list', $customer ); |
|
410 | + do_action('give_donor_stats_list', $customer); |
|
411 | 411 | ?> |
412 | 412 | </ul> |
413 | 413 | </div> |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * |
421 | 421 | * @param object $customer The customer object being displayed. |
422 | 422 | */ |
423 | - do_action( 'give_donor_before_tables_wrapper', $customer ); |
|
423 | + do_action('give_donor_before_tables_wrapper', $customer); |
|
424 | 424 | ?> |
425 | 425 | |
426 | 426 | <div id="customer-tables-wrapper" class="customer-section"> |
@@ -433,44 +433,44 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @param object $customer The customer object being displayed. |
435 | 435 | */ |
436 | - do_action( 'give_donor_before_tables', $customer ); |
|
436 | + do_action('give_donor_before_tables', $customer); |
|
437 | 437 | ?> |
438 | 438 | |
439 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
439 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
440 | 440 | <?php |
441 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
442 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
443 | - $payments = array_slice( $payments, 0, 10 ); |
|
441 | + $payment_ids = explode(',', $customer->payment_ids); |
|
442 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
443 | + $payments = array_slice($payments, 0, 10); |
|
444 | 444 | ?> |
445 | 445 | <table class="wp-list-table widefat striped payments"> |
446 | 446 | <thead> |
447 | 447 | <tr> |
448 | - <th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
449 | - <th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
450 | - <th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
451 | - <th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
452 | - <th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
448 | + <th scope="col"><?php esc_html_e('ID', 'give'); ?></th> |
|
449 | + <th scope="col"><?php esc_html_e('Amount', 'give'); ?></th> |
|
450 | + <th scope="col"><?php esc_html_e('Date', 'give'); ?></th> |
|
451 | + <th scope="col"><?php esc_html_e('Status', 'give'); ?></th> |
|
452 | + <th scope="col"><?php esc_html_e('Actions', 'give'); ?></th> |
|
453 | 453 | </tr> |
454 | 454 | </thead> |
455 | 455 | <tbody> |
456 | - <?php if ( ! empty( $payments ) ) : ?> |
|
457 | - <?php foreach ( $payments as $payment ) : ?> |
|
456 | + <?php if ( ! empty($payments)) : ?> |
|
457 | + <?php foreach ($payments as $payment) : ?> |
|
458 | 458 | <tr> |
459 | 459 | <td><?php echo $payment->ID; ?></td> |
460 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
461 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
462 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
460 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
461 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
462 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
463 | 463 | <td> |
464 | 464 | <?php |
465 | 465 | printf( |
466 | 466 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
467 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ), |
|
467 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID), |
|
468 | 468 | sprintf( |
469 | 469 | /* translators: %s: Donation ID */ |
470 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
470 | + esc_attr__('View Donation %s.', 'give'), |
|
471 | 471 | $payment->ID |
472 | 472 | ), |
473 | - esc_html__( 'View Donation', 'give' ) |
|
473 | + esc_html__('View Donation', 'give') |
|
474 | 474 | ); |
475 | 475 | ?> |
476 | 476 | |
@@ -485,46 +485,46 @@ discard block |
||
485 | 485 | * @param object $customer The customer object being displayed. |
486 | 486 | * @param object $payment The payment object being displayed. |
487 | 487 | */ |
488 | - do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); |
|
488 | + do_action('give_donor_recent_purchases_actions', $customer, $payment); |
|
489 | 489 | ?> |
490 | 490 | </td> |
491 | 491 | </tr> |
492 | 492 | <?php endforeach; ?> |
493 | 493 | <?php else: ?> |
494 | 494 | <tr> |
495 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
495 | + <td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td> |
|
496 | 496 | </tr> |
497 | 497 | <?php endif; ?> |
498 | 498 | </tbody> |
499 | 499 | </table> |
500 | 500 | |
501 | - <h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3> |
|
501 | + <h3><?php esc_html_e('Completed Donations', 'give'); ?></h3> |
|
502 | 502 | <?php |
503 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
503 | + $donations = give_get_users_completed_donations($customer->email); |
|
504 | 504 | ?> |
505 | 505 | <table class="wp-list-table widefat striped donations"> |
506 | 506 | <thead> |
507 | 507 | <tr> |
508 | 508 | <th scope="col"><?php echo give_get_forms_label_singular(); ?></th> |
509 | - <th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
509 | + <th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
510 | 510 | </tr> |
511 | 511 | </thead> |
512 | 512 | <tbody> |
513 | - <?php if ( ! empty( $donations ) ) : ?> |
|
514 | - <?php foreach ( $donations as $donation ) : ?> |
|
513 | + <?php if ( ! empty($donations)) : ?> |
|
514 | + <?php foreach ($donations as $donation) : ?> |
|
515 | 515 | <tr> |
516 | 516 | <td><?php echo $donation->post_title; ?></td> |
517 | 517 | <td> |
518 | 518 | <?php |
519 | 519 | printf( |
520 | 520 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
521 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
521 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
522 | 522 | sprintf( |
523 | 523 | /* translators: %s: form name */ |
524 | - esc_attr__( 'View Form %s.', 'give' ), |
|
524 | + esc_attr__('View Form %s.', 'give'), |
|
525 | 525 | $donation->post_title |
526 | 526 | ), |
527 | - esc_html__( 'View Form', 'give' ) |
|
527 | + esc_html__('View Form', 'give') |
|
528 | 528 | ); |
529 | 529 | ?> |
530 | 530 | </td> |
@@ -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 found.', 'give' ); ?> |
|
627 | + <?php esc_html_e('No donor notes found.', '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 donations and records?', 'give' ); ?></label> |
|
682 | + 'options' => array('disabled' => true) |
|
683 | + )); ?> |
|
684 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations 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 | } |