@@ -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,56 +23,56 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string $purchase_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 | - $post_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $post_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $post_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' => $post_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 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_product', $form->ID ) ) { |
|
57 | + if ('publish' !== $form->post_status && ! current_user_can('edit_product', $form->ID)) { |
|
58 | 58 | return false; // Product not published or user doesn't have permission to view drafts |
59 | 59 | } |
60 | 60 | |
61 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
61 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
62 | 62 | ? $args['display_style'] |
63 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
63 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
64 | 64 | |
65 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
65 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
66 | 66 | ? ' float-labels-enabled' |
67 | 67 | : ''; |
68 | 68 | |
69 | 69 | |
70 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
70 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
71 | 71 | 'give-form-wrap', |
72 | - 'give-display-' . $display_option |
|
73 | - ), $form->ID, $args ); |
|
72 | + 'give-display-'.$display_option |
|
73 | + ), $form->ID, $args); |
|
74 | 74 | |
75 | - $form_classes = implode( ' ', $form_classes_array ); |
|
75 | + $form_classes = implode(' ', $form_classes_array); |
|
76 | 76 | |
77 | 77 | ob_start(); |
78 | 78 | |
@@ -84,34 +84,34 @@ discard block |
||
84 | 84 | * @param int $form ->ID The current form ID |
85 | 85 | * @param array $args An array of form args |
86 | 86 | */ |
87 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
87 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
88 | 88 | |
89 | 89 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_classes; ?>"> |
90 | 90 | |
91 | 91 | <?php |
92 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
92 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
93 | 93 | |
94 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $post_id ) . '</h2>' ); |
|
94 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($post_id).'</h2>'); |
|
95 | 95 | |
96 | 96 | } ?> |
97 | 97 | |
98 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
98 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
99 | 99 | |
100 | - <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint( $form->ID ); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
100 | + <form id="give-form-<?php echo $post_id; ?>" class="give-form give-form-<?php echo absint($form->ID); ?><?php echo $float_labels_option; ?>" action="<?php echo $form_action; ?>" method="post"> |
|
101 | 101 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>" /> |
102 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>" /> |
|
103 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>" /> |
|
104 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>" /> |
|
105 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price( $form->ID ); ?>" /> |
|
102 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>" /> |
|
103 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>" /> |
|
104 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>" /> |
|
105 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_get_form_minimum_price($form->ID); ?>" /> |
|
106 | 106 | <?php |
107 | 107 | //Price ID hidden field for variable (mult-level) donation forms |
108 | - if ( give_has_variable_prices( $post_id ) ) { |
|
108 | + if (give_has_variable_prices($post_id)) { |
|
109 | 109 | //get default selected price ID |
110 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $post_id ), $post_id ); |
|
110 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($post_id), $post_id); |
|
111 | 111 | $price_id = 0; |
112 | 112 | //loop through prices |
113 | - foreach ( $prices as $price ) { |
|
114 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
113 | + foreach ($prices as $price) { |
|
114 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
115 | 115 | $price_id = $price['_give_id']['level_id']; |
116 | 116 | }; |
117 | 117 | } |
@@ -119,19 +119,19 @@ discard block |
||
119 | 119 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>" /> |
120 | 120 | <?php } |
121 | 121 | |
122 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
122 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
123 | 123 | |
124 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
124 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
125 | 125 | |
126 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
126 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
127 | 127 | |
128 | 128 | ?> |
129 | 129 | |
130 | 130 | </form> |
131 | 131 | |
132 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
132 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
133 | 133 | |
134 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
134 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
135 | 135 | <?php |
136 | 136 | |
137 | 137 | /** |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param int $form ->ID The current form ID |
143 | 143 | * @param array $args An array of form args |
144 | 144 | */ |
145 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
145 | + do_action('give_post_form_output', $form->ID, $args); |
|
146 | 146 | |
147 | 147 | $final_output = ob_get_clean(); |
148 | 148 | |
149 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
149 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -166,57 +166,57 @@ discard block |
||
166 | 166 | * @global $give_options Array of all the Give options |
167 | 167 | * @return string |
168 | 168 | */ |
169 | -function give_show_purchase_form( $form_id ) { |
|
169 | +function give_show_purchase_form($form_id) { |
|
170 | 170 | |
171 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
171 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
172 | 172 | |
173 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
173 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
174 | 174 | $form_id = $_POST['give_form_id']; |
175 | 175 | } |
176 | 176 | |
177 | - do_action( 'give_purchase_form_top', $form_id ); |
|
177 | + do_action('give_purchase_form_top', $form_id); |
|
178 | 178 | |
179 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
179 | + if (give_can_checkout() && isset($form_id)) { |
|
180 | 180 | |
181 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
181 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
182 | 182 | |
183 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
183 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
184 | 184 | |
185 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
185 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
186 | 186 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
187 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
187 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
188 | 188 | </div> |
189 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
189 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
190 | 190 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
191 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
191 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
192 | 192 | </div> |
193 | 193 | <?php endif; ?> |
194 | 194 | |
195 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form ) { |
|
196 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
195 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form) { |
|
196 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
197 | 197 | } |
198 | 198 | |
199 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
199 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
200 | 200 | |
201 | 201 | // Load the credit card form and allow gateways to load their own if they wish |
202 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
203 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
202 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
203 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
204 | 204 | } else { |
205 | - do_action( 'give_cc_form', $form_id ); |
|
205 | + do_action('give_cc_form', $form_id); |
|
206 | 206 | } |
207 | 207 | |
208 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
208 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
209 | 209 | |
210 | 210 | } else { |
211 | 211 | // Can't checkout |
212 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
212 | + do_action('give_purchase_form_no_access', $form_id); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
216 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
216 | + do_action('give_purchase_form_bottom', $form_id); |
|
217 | 217 | } |
218 | 218 | |
219 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
219 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Donation Amount Field |
@@ -230,32 +230,32 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @return void |
232 | 232 | */ |
233 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
233 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
234 | 234 | |
235 | 235 | global $give_options; |
236 | 236 | |
237 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
238 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
239 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
240 | - $symbol = give_currency_symbol( $give_options['currency'] ); |
|
241 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
242 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
243 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
237 | + $variable_pricing = give_has_variable_prices($form_id); |
|
238 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
239 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
240 | + $symbol = give_currency_symbol($give_options['currency']); |
|
241 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
242 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
243 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
244 | 244 | |
245 | - do_action( 'give_before_donation_levels', $form_id ); |
|
245 | + do_action('give_before_donation_levels', $form_id); |
|
246 | 246 | |
247 | 247 | //Set Price, No Custom Amount Allowed means hidden price field |
248 | - if ( $allow_custom_amount == 'no' ) { |
|
248 | + if ($allow_custom_amount == 'no') { |
|
249 | 249 | ?> |
250 | 250 | |
251 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
251 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
252 | 252 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" value="<?php echo $default_amount; ?>" required> |
253 | 253 | <p class="set-price give-donation-amount form-row-wide"> |
254 | - <?php if ( $currency_position == 'before' ) { |
|
254 | + <?php if ($currency_position == 'before') { |
|
255 | 255 | echo $currency_output; |
256 | 256 | } ?> |
257 | 257 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
258 | - <?php if ( $currency_position == 'after' ) { |
|
258 | + <?php if ($currency_position == 'after') { |
|
259 | 259 | echo $currency_output; |
260 | 260 | } ?> |
261 | 261 | </p> |
@@ -265,34 +265,34 @@ discard block |
||
265 | 265 | ?> |
266 | 266 | <div class="give-total-wrap"> |
267 | 267 | <div class="give-donation-amount form-row-wide"> |
268 | - <?php if ( $currency_position == 'before' ) { |
|
268 | + <?php if ($currency_position == 'before') { |
|
269 | 269 | echo $currency_output; |
270 | 270 | } ?> |
271 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
271 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
272 | 272 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
273 | - <?php if ( $currency_position == 'after' ) { |
|
273 | + <?php if ($currency_position == 'after') { |
|
274 | 274 | echo $currency_output; |
275 | 275 | } ?> |
276 | 276 | <p class="give-loading-text give-updating-price-loader" style="display: none;"> |
277 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount', 'give' ); ?> |
|
277 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount', 'give'); ?> |
|
278 | 278 | <span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p> |
279 | 279 | </div> |
280 | 280 | </div> |
281 | 281 | <?php } |
282 | 282 | |
283 | 283 | //Custom Amount Text |
284 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' ) { ?> |
|
285 | - <p class="give-custom-amount-text"><?php echo ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Give a Custom Amount', 'give' ); ?></p> |
|
284 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes') { ?> |
|
285 | + <p class="give-custom-amount-text"><?php echo ! empty($custom_amount_text) ? $custom_amount_text : __('Give a Custom Amount', 'give'); ?></p> |
|
286 | 286 | <?php } |
287 | 287 | |
288 | 288 | //Output Variable Pricing Levels |
289 | - if ( $variable_pricing ) { |
|
290 | - give_output_levels( $form_id ); |
|
289 | + if ($variable_pricing) { |
|
290 | + give_output_levels($form_id); |
|
291 | 291 | } |
292 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
292 | + do_action('give_after_donation_levels', $form_id, $args); |
|
293 | 293 | } |
294 | 294 | |
295 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
295 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
296 | 296 | |
297 | 297 | |
298 | 298 | /** |
@@ -304,32 +304,32 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return string |
306 | 306 | */ |
307 | -function give_output_levels( $form_id ) { |
|
307 | +function give_output_levels($form_id) { |
|
308 | 308 | |
309 | 309 | //Get variable pricing |
310 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
311 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
312 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
313 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
314 | - if ( empty( $custom_amount_text ) ) { |
|
315 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
310 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
311 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
312 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
313 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
314 | + if (empty($custom_amount_text)) { |
|
315 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $output = ''; |
319 | 319 | $counter = 0; |
320 | 320 | |
321 | - switch ( $display_style ) { |
|
321 | + switch ($display_style) { |
|
322 | 322 | case 'buttons': |
323 | 323 | |
324 | 324 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
325 | 325 | |
326 | - foreach ( $prices as $price ) { |
|
327 | - $counter ++; |
|
328 | - $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 ); |
|
329 | - $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 ); |
|
326 | + foreach ($prices as $price) { |
|
327 | + $counter++; |
|
328 | + $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); |
|
329 | + $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); |
|
330 | 330 | |
331 | 331 | $output .= '<li>'; |
332 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
332 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
333 | 333 | $output .= $level_text; |
334 | 334 | $output .= '</button>'; |
335 | 335 | $output .= '</li>'; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | //Custom Amount |
340 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
340 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
341 | 341 | $output .= '<li>'; |
342 | 342 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
343 | 343 | $output .= $custom_amount_text; |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | |
354 | 354 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
355 | 355 | |
356 | - foreach ( $prices as $price ) { |
|
357 | - $counter ++; |
|
358 | - $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 ); |
|
359 | - $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 ); |
|
356 | + foreach ($prices as $price) { |
|
357 | + $counter++; |
|
358 | + $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); |
|
359 | + $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); |
|
360 | 360 | |
361 | 361 | $output .= '<li>'; |
362 | - $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'] ) . '">'; |
|
363 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
362 | + $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']).'">'; |
|
363 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
364 | 364 | $output .= '</li>'; |
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | 368 | //Custom Amount |
369 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
369 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
370 | 370 | $output .= '<li>'; |
371 | 371 | $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">'; |
372 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
372 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
373 | 373 | $output .= '</li>'; |
374 | 374 | } |
375 | 375 | |
@@ -379,23 +379,23 @@ discard block |
||
379 | 379 | |
380 | 380 | case 'dropdown': |
381 | 381 | |
382 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose your Donation Amount', 'give' ) . ':</label>'; |
|
383 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
382 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose your Donation Amount', 'give').':</label>'; |
|
383 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
384 | 384 | |
385 | 385 | //first loop through prices |
386 | - foreach ( $prices as $price ) { |
|
387 | - $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 ); |
|
388 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
386 | + foreach ($prices as $price) { |
|
387 | + $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); |
|
388 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
|
389 | 389 | |
390 | - $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'] ) . '">'; |
|
390 | + $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']).'">'; |
|
391 | 391 | $output .= $level_text; |
392 | 392 | $output .= '</option>'; |
393 | 393 | |
394 | 394 | } |
395 | 395 | |
396 | 396 | //Custom Amount |
397 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
398 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
397 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
398 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | $output .= '</select>'; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | break; |
404 | 404 | } |
405 | 405 | |
406 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
406 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -415,26 +415,26 @@ discard block |
||
415 | 415 | * @param array $args |
416 | 416 | * |
417 | 417 | */ |
418 | -function give_display_checkout_button( $form_id, $args ) { |
|
418 | +function give_display_checkout_button($form_id, $args) { |
|
419 | 419 | |
420 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
420 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
421 | 421 | ? $args['display_style'] |
422 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
422 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
423 | 423 | |
424 | 424 | //no btn for onpage |
425 | - if ( $display_option === 'onpage' ) { |
|
425 | + if ($display_option === 'onpage') { |
|
426 | 426 | return; |
427 | 427 | } |
428 | 428 | |
429 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
430 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
429 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
430 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
431 | 431 | |
432 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
432 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
433 | 433 | |
434 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
434 | + echo apply_filters('give_display_checkout_button', $output); |
|
435 | 435 | } |
436 | 436 | |
437 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
437 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
438 | 438 | |
439 | 439 | /** |
440 | 440 | * Shows the User Info fields in the Personal Info box, more fields can be added |
@@ -446,71 +446,71 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @return void |
448 | 448 | */ |
449 | -function give_user_info_fields( $form_id ) { |
|
449 | +function give_user_info_fields($form_id) { |
|
450 | 450 | |
451 | - if ( is_user_logged_in() ) : |
|
452 | - $user_data = get_userdata( get_current_user_id() ); |
|
451 | + if (is_user_logged_in()) : |
|
452 | + $user_data = get_userdata(get_current_user_id()); |
|
453 | 453 | endif; |
454 | 454 | |
455 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
455 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
456 | 456 | ?> |
457 | 457 | <fieldset id="give_checkout_user_info"> |
458 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
458 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
459 | 459 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
460 | 460 | <label class="give-label" for="give-first"> |
461 | - <?php _e( 'First Name', 'give' ); ?> |
|
462 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
461 | + <?php _e('First Name', 'give'); ?> |
|
462 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
463 | 463 | <span class="give-required-indicator">*</span> |
464 | 464 | <?php } ?> |
465 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
465 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
466 | 466 | </label> |
467 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php _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 ) ) { |
|
467 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php _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)) { |
|
468 | 468 | echo ' required '; |
469 | 469 | } ?>/> |
470 | 470 | </p> |
471 | 471 | |
472 | 472 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
473 | 473 | <label class="give-label" for="give-last"> |
474 | - <?php _e( 'Last Name', 'give' ); ?> |
|
475 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
474 | + <?php _e('Last Name', 'give'); ?> |
|
475 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
476 | 476 | <span class="give-required-indicator">*</span> |
477 | 477 | <?php } ?> |
478 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
478 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
479 | 479 | </label> |
480 | 480 | |
481 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
481 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
482 | 482 | echo ' required'; |
483 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _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 ) ) { |
|
483 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _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)) { |
|
484 | 484 | echo ' required '; |
485 | 485 | } ?> /> |
486 | 486 | </p> |
487 | 487 | |
488 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
488 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
489 | 489 | <p id="give-email-wrap" class="form-row form-row-wide"> |
490 | 490 | <label class="give-label" for="give-email"> |
491 | - <?php _e( 'Email Address', 'give' ); ?> |
|
492 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
491 | + <?php _e('Email Address', 'give'); ?> |
|
492 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
493 | 493 | <span class="give-required-indicator">*</span> |
494 | 494 | <?php } ?> |
495 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
495 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
496 | 496 | </label> |
497 | 497 | |
498 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php _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 ) ) { |
|
498 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php _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)) { |
|
499 | 499 | echo ' required '; |
500 | 500 | } ?>/> |
501 | 501 | |
502 | 502 | </p> |
503 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
503 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
504 | 504 | |
505 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
505 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
506 | 506 | </fieldset> |
507 | 507 | <?php |
508 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
508 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
509 | 509 | |
510 | 510 | } |
511 | 511 | |
512 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
513 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
512 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
513 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
514 | 514 | |
515 | 515 | /** |
516 | 516 | * Renders the credit card info form. |
@@ -521,73 +521,73 @@ discard block |
||
521 | 521 | * |
522 | 522 | * @return void |
523 | 523 | */ |
524 | -function give_get_cc_form( $form_id ) { |
|
524 | +function give_get_cc_form($form_id) { |
|
525 | 525 | |
526 | 526 | ob_start(); |
527 | 527 | |
528 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
528 | + do_action('give_before_cc_fields', $form_id); ?> |
|
529 | 529 | |
530 | 530 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
531 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' )); ?></legend> |
|
532 | - <?php if ( is_ssl() ) : ?> |
|
531 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
532 | + <?php if (is_ssl()) : ?> |
|
533 | 533 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
534 | 534 | <span class="give-icon padlock"></span> |
535 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
535 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
536 | 536 | </div> |
537 | 537 | <?php endif; ?> |
538 | 538 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
539 | 539 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
540 | - <?php _e( 'Card Number', 'give' ); ?> |
|
540 | + <?php _e('Card Number', 'give'); ?> |
|
541 | 541 | <span class="give-required-indicator">*</span> |
542 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
542 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
543 | 543 | <span class="card-type"></span> |
544 | 544 | </label> |
545 | 545 | |
546 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required /> |
|
546 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required /> |
|
547 | 547 | </p> |
548 | 548 | |
549 | 549 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
550 | 550 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
551 | - <?php _e( 'CVC', 'give' ); ?> |
|
551 | + <?php _e('CVC', 'give'); ?> |
|
552 | 552 | <span class="give-required-indicator">*</span> |
553 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
553 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
554 | 554 | </label> |
555 | 555 | |
556 | - <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 _e( 'Security code', 'give' ); ?>" required /> |
|
556 | + <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 _e('Security code', 'give'); ?>" required /> |
|
557 | 557 | </p> |
558 | 558 | |
559 | 559 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
560 | 560 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
561 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
561 | + <?php _e('Name on the Card', 'give'); ?> |
|
562 | 562 | <span class="give-required-indicator">*</span> |
563 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
563 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
564 | 564 | </label> |
565 | 565 | |
566 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required /> |
|
566 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required /> |
|
567 | 567 | </p> |
568 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
568 | + <?php do_action('give_before_cc_expiration'); ?> |
|
569 | 569 | <p class="card-expiration form-row form-row-one-third"> |
570 | 570 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
571 | - <?php _e( 'Expiration', 'give' ); ?> |
|
571 | + <?php _e('Expiration', 'give'); ?> |
|
572 | 572 | <span class="give-required-indicator">*</span> |
573 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
573 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
574 | 574 | </label> |
575 | 575 | |
576 | 576 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month" /> |
577 | 577 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year" /> |
578 | 578 | |
579 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required /> |
|
579 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required /> |
|
580 | 580 | </p> |
581 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
581 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
582 | 582 | |
583 | 583 | </fieldset> |
584 | 584 | <?php |
585 | - do_action( 'give_after_cc_fields', $form_id ); |
|
585 | + do_action('give_after_cc_fields', $form_id); |
|
586 | 586 | |
587 | 587 | echo ob_get_clean(); |
588 | 588 | } |
589 | 589 | |
590 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
590 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
591 | 591 | |
592 | 592 | /** |
593 | 593 | * Outputs the default credit card address fields |
@@ -598,110 +598,110 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return void |
600 | 600 | */ |
601 | -function give_default_cc_address_fields( $form_id ) { |
|
601 | +function give_default_cc_address_fields($form_id) { |
|
602 | 602 | |
603 | 603 | $logged_in = is_user_logged_in(); |
604 | 604 | |
605 | - if ( $logged_in ) { |
|
606 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
605 | + if ($logged_in) { |
|
606 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
607 | 607 | } |
608 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
609 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
610 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
611 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
608 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
609 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
610 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
611 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
612 | 612 | ob_start(); ?> |
613 | 613 | <fieldset id="give_cc_address" class="cc-address"> |
614 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' )); ?></legend> |
|
615 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
614 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
615 | + <?php do_action('give_cc_billing_top'); ?> |
|
616 | 616 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
617 | 617 | <label for="card_address" class="give-label"> |
618 | - <?php _e( 'Address', 'give' ); ?> |
|
618 | + <?php _e('Address', 'give'); ?> |
|
619 | 619 | <?php |
620 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
620 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
621 | 621 | <span class="give-required-indicator">*</span> |
622 | 622 | <?php } ?> |
623 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
623 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
624 | 624 | </label> |
625 | 625 | |
626 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
626 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
627 | 627 | echo ' required'; |
628 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
628 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
629 | 629 | echo ' required '; |
630 | 630 | } ?>/> |
631 | 631 | </p> |
632 | 632 | |
633 | 633 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
634 | 634 | <label for="card_address_2" class="give-label"> |
635 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
636 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
635 | + <?php _e('Address Line 2', 'give'); ?> |
|
636 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
637 | 637 | <span class="give-required-indicator">*</span> |
638 | 638 | <?php } ?> |
639 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
639 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
640 | 640 | </label> |
641 | 641 | |
642 | - <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 ) ) { |
|
642 | + <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)) { |
|
643 | 643 | echo ' required'; |
644 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
644 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
645 | 645 | echo ' required '; |
646 | 646 | } ?>/> |
647 | 647 | </p> |
648 | 648 | |
649 | 649 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
650 | 650 | <label for="card_city" class="give-label"> |
651 | - <?php _e( 'City', 'give' ); ?> |
|
652 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
651 | + <?php _e('City', 'give'); ?> |
|
652 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
653 | 653 | <span class="give-required-indicator">*</span> |
654 | 654 | <?php } ?> |
655 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
655 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
656 | 656 | </label> |
657 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
657 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
658 | 658 | echo ' required'; |
659 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
659 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
660 | 660 | echo ' required '; |
661 | 661 | } ?>/> |
662 | 662 | </p> |
663 | 663 | |
664 | 664 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
665 | 665 | <label for="card_zip" class="give-label"> |
666 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
667 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
666 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
667 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
668 | 668 | <span class="give-required-indicator">*</span> |
669 | 669 | <?php } ?> |
670 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
670 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
671 | 671 | </label> |
672 | 672 | |
673 | - <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 ) ) { |
|
673 | + <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)) { |
|
674 | 674 | echo ' required'; |
675 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
675 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
676 | 676 | echo ' required '; |
677 | 677 | } ?>/> |
678 | 678 | </p> |
679 | 679 | |
680 | 680 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
681 | 681 | <label for="billing_country" class="give-label"> |
682 | - <?php _e( 'Country', 'give' ); ?> |
|
683 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
682 | + <?php _e('Country', 'give'); ?> |
|
683 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
684 | 684 | <span class="give-required-indicator">*</span> |
685 | 685 | <?php } ?> |
686 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
686 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
687 | 687 | </label> |
688 | 688 | |
689 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
689 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
690 | 690 | echo ' required'; |
691 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
691 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
692 | 692 | echo ' required '; |
693 | 693 | } ?>> |
694 | 694 | <?php |
695 | 695 | |
696 | 696 | $selected_country = give_get_country(); |
697 | 697 | |
698 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
698 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
699 | 699 | $selected_country = $user_address['country']; |
700 | 700 | } |
701 | 701 | |
702 | 702 | $countries = give_get_country_list(); |
703 | - foreach ( $countries as $country_code => $country ) { |
|
704 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
703 | + foreach ($countries as $country_code => $country) { |
|
704 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
705 | 705 | } |
706 | 706 | ?> |
707 | 707 | </select> |
@@ -709,44 +709,44 @@ discard block |
||
709 | 709 | |
710 | 710 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
711 | 711 | <label for="card_state" class="give-label"> |
712 | - <?php _e( 'State / Province', 'give' ); ?> |
|
713 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
712 | + <?php _e('State / Province', 'give'); ?> |
|
713 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
714 | 714 | <span class="give-required-indicator">*</span> |
715 | 715 | <?php } ?> |
716 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
716 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
717 | 717 | </label> |
718 | 718 | |
719 | 719 | <?php |
720 | 720 | $selected_state = give_get_state(); |
721 | - $states = give_get_states( $selected_country ); |
|
721 | + $states = give_get_states($selected_country); |
|
722 | 722 | |
723 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
723 | + if ($logged_in && ! empty($user_address['state'])) { |
|
724 | 724 | $selected_state = $user_address['state']; |
725 | 725 | } |
726 | 726 | |
727 | - if ( ! empty( $states ) ) : ?> |
|
728 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
727 | + if ( ! empty($states)) : ?> |
|
728 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
729 | 729 | echo ' required'; |
730 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
730 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
731 | 731 | echo ' required '; |
732 | 732 | } ?>> |
733 | 733 | <?php |
734 | - foreach ( $states as $state_code => $state ) { |
|
735 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
734 | + foreach ($states as $state_code => $state) { |
|
735 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
736 | 736 | } |
737 | 737 | ?> |
738 | 738 | </select> |
739 | 739 | <?php else : ?> |
740 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>" /> |
|
740 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>" /> |
|
741 | 741 | <?php endif; ?> |
742 | 742 | </p> |
743 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
743 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
744 | 744 | </fieldset> |
745 | 745 | <?php |
746 | 746 | echo ob_get_clean(); |
747 | 747 | } |
748 | 748 | |
749 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
749 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
750 | 750 | |
751 | 751 | |
752 | 752 | /** |
@@ -760,96 +760,96 @@ discard block |
||
760 | 760 | * |
761 | 761 | * @return string |
762 | 762 | */ |
763 | -function give_get_register_fields( $form_id ) { |
|
763 | +function give_get_register_fields($form_id) { |
|
764 | 764 | |
765 | 765 | global $give_options; |
766 | 766 | global $user_ID; |
767 | 767 | |
768 | - if ( is_user_logged_in() ) { |
|
769 | - $user_data = get_userdata( $user_ID ); |
|
768 | + if (is_user_logged_in()) { |
|
769 | + $user_data = get_userdata($user_ID); |
|
770 | 770 | } |
771 | 771 | |
772 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
772 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
773 | 773 | |
774 | 774 | ob_start(); ?> |
775 | 775 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
776 | 776 | |
777 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
777 | + <?php if ($show_register_form == 'both') { ?> |
|
778 | 778 | <div class="give-login-account-wrap"> |
779 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
780 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
779 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
780 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-register-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
781 | 781 | </p> |
782 | 782 | |
783 | 783 | <p class="give-loading-text"> |
784 | - <span class="give-loading-animation"></span> <?php _e( 'Loading', 'give' ); ?> |
|
784 | + <span class="give-loading-animation"></span> <?php _e('Loading', 'give'); ?> |
|
785 | 785 | <span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p> |
786 | 786 | </div> |
787 | 787 | <?php } ?> |
788 | 788 | |
789 | - <?php do_action( 'give_register_fields_before' ); ?> |
|
789 | + <?php do_action('give_register_fields_before'); ?> |
|
790 | 790 | |
791 | 791 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
792 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __('Create an account', 'give' )); |
|
793 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
794 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
792 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
793 | + if ( ! give_no_guest_checkout($form_id)) { |
|
794 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
795 | 795 | } ?></legend> |
796 | - <?php do_action( 'give_register_account_fields_before' ); ?> |
|
796 | + <?php do_action('give_register_account_fields_before'); ?> |
|
797 | 797 | <p id="give-user-login-wrap" class="form-row form-row-one-third form-row-first"> |
798 | 798 | <label for="give_user_login"> |
799 | - <?php _e( 'Username', 'give' ); ?> |
|
800 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
799 | + <?php _e('Username', 'give'); ?> |
|
800 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
801 | 801 | <span class="give-required-indicator">*</span> |
802 | 802 | <?php } ?> |
803 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
803 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
804 | 804 | </label> |
805 | 805 | |
806 | - <input name="give_user_login" id="give_user_login" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
806 | + <input name="give_user_login" id="give_user_login" class="<?php if (give_no_guest_checkout($form_id)) { |
|
807 | 807 | echo 'required '; |
808 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>" /> |
|
808 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>" /> |
|
809 | 809 | </p> |
810 | 810 | |
811 | 811 | <p id="give-user-pass-wrap" class="form-row form-row-one-third"> |
812 | 812 | <label for="give_user_pass"> |
813 | - <?php _e( 'Password', 'give' ); ?> |
|
814 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
813 | + <?php _e('Password', 'give'); ?> |
|
814 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
815 | 815 | <span class="give-required-indicator">*</span> |
816 | 816 | <?php } ?> |
817 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
817 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
818 | 818 | </label> |
819 | 819 | |
820 | - <input name="give_user_pass" id="give_user_pass" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
820 | + <input name="give_user_pass" id="give_user_pass" class="<?php if (give_no_guest_checkout($form_id)) { |
|
821 | 821 | echo 'required '; |
822 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password" /> |
|
822 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password" /> |
|
823 | 823 | </p> |
824 | 824 | |
825 | 825 | <p id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
826 | 826 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
827 | - <?php _e( 'Confirm Password', 'give' ); ?> |
|
828 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
827 | + <?php _e('Confirm Password', 'give'); ?> |
|
828 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
829 | 829 | <span class="give-required-indicator">*</span> |
830 | 830 | <?php } ?> |
831 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
831 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
832 | 832 | </label> |
833 | 833 | |
834 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm--<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
834 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm--<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
835 | 835 | echo 'required '; |
836 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password" /> |
|
836 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password" /> |
|
837 | 837 | </p> |
838 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
838 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
839 | 839 | </fieldset> |
840 | 840 | |
841 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
841 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
842 | 842 | |
843 | 843 | <input type="hidden" name="give-purchase-var" value="needs-to-register" /> |
844 | 844 | |
845 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
845 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
846 | 846 | |
847 | 847 | </fieldset> |
848 | 848 | <?php |
849 | 849 | echo ob_get_clean(); |
850 | 850 | } |
851 | 851 | |
852 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
852 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
853 | 853 | |
854 | 854 | /** |
855 | 855 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -862,59 +862,59 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @return string |
864 | 864 | */ |
865 | -function give_get_login_fields( $form_id ) { |
|
865 | +function give_get_login_fields($form_id) { |
|
866 | 866 | |
867 | 867 | global $give_options; |
868 | 868 | |
869 | - $color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'gray'; |
|
870 | - $color = ( $color == 'inherit' ) ? '' : $color; |
|
871 | - $show_register_form = give_get_option( 'show_register_form', 'none' ); |
|
869 | + $color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'gray'; |
|
870 | + $color = ($color == 'inherit') ? '' : $color; |
|
871 | + $show_register_form = give_get_option('show_register_form', 'none'); |
|
872 | 872 | |
873 | 873 | ob_start(); |
874 | 874 | ?> |
875 | 875 | <fieldset id="give_login_fields"> |
876 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' )); |
|
877 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
878 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
876 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
877 | + if ( ! give_no_guest_checkout($form_id)) { |
|
878 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
879 | 879 | } ?></legend> |
880 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
880 | + <?php if ($show_register_form == 'both') { ?> |
|
881 | 881 | <p id="give-new-account-wrap"> |
882 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
883 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-login" data-action="checkout_register"> |
|
884 | - <?php _e( 'Register', 'give' ); |
|
885 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
886 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
882 | + <?php _e('Need to create an account?', 'give'); ?> |
|
883 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-login" data-action="checkout_register"> |
|
884 | + <?php _e('Register', 'give'); |
|
885 | + if ( ! give_no_guest_checkout($form_id)) { |
|
886 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
887 | 887 | } ?> |
888 | 888 | </a> |
889 | 889 | </p> |
890 | 890 | <?php } ?> |
891 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
891 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
892 | 892 | <p id="give-user-login-wrap" class="form-row form-row-first"> |
893 | - <label class="give-label" for="give-username"><?php _e( 'Username', 'give' ); ?></label> |
|
894 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
893 | + <label class="give-label" for="give-username"><?php _e('Username', 'give'); ?></label> |
|
894 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
895 | 895 | echo 'required '; |
896 | - } ?>give-input" type="text" name="give_user_login" id="give_user_login" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>" /> |
|
896 | + } ?>give-input" type="text" name="give_user_login" id="give_user_login" value="" placeholder="<?php _e('Your username', 'give'); ?>" /> |
|
897 | 897 | </p> |
898 | 898 | |
899 | 899 | <p id="give-user-pass-wrap" class="give_login_password form-row form-row-last"> |
900 | - <label class="give-label" for="give-password"><?php _e( 'Password', 'give' ); ?></label> |
|
901 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
900 | + <label class="give-label" for="give-password"><?php _e('Password', 'give'); ?></label> |
|
901 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
902 | 902 | echo 'required '; |
903 | - } ?>give-input" type="password" name="give_user_pass" id="give_user_pass" placeholder="<?php _e( 'Your password', 'give' ); ?>" /> |
|
903 | + } ?>give-input" type="password" name="give_user_pass" id="give_user_pass" placeholder="<?php _e('Your password', 'give'); ?>" /> |
|
904 | 904 | <input type="hidden" name="give-purchase-var" value="needs-to-login" /> |
905 | 905 | </p> |
906 | 906 | |
907 | 907 | <p id="give-user-login-submit" class="give-clearfix"> |
908 | - <input type="submit" class="give-submit give-btn button <?php echo $color; ?>" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>" /> |
|
908 | + <input type="submit" class="give-submit give-btn button <?php echo $color; ?>" name="give_login_submit" value="<?php _e('Login', 'give'); ?>" /> |
|
909 | 909 | <span class="give-loading-animation"></span> |
910 | 910 | </p> |
911 | - <?php do_action( 'give_checkout_login_fields_after' ); ?> |
|
911 | + <?php do_action('give_checkout_login_fields_after'); ?> |
|
912 | 912 | </fieldset><!--end #give_login_fields--> |
913 | 913 | <?php |
914 | 914 | echo ob_get_clean(); |
915 | 915 | } |
916 | 916 | |
917 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
917 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
918 | 918 | |
919 | 919 | /** |
920 | 920 | * Payment Mode Select |
@@ -930,49 +930,49 @@ discard block |
||
930 | 930 | * |
931 | 931 | * @return void |
932 | 932 | */ |
933 | -function give_payment_mode_select( $form_id ) { |
|
933 | +function give_payment_mode_select($form_id) { |
|
934 | 934 | |
935 | 935 | $gateways = give_get_enabled_payment_gateways(); |
936 | 936 | |
937 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
937 | + do_action('give_payment_mode_top', $form_id); ?> |
|
938 | 938 | |
939 | 939 | <fieldset id="give-payment-mode-select"> |
940 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
940 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
941 | 941 | <div id="give-payment-mode-wrap"> |
942 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?></legend> |
|
942 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?></legend> |
|
943 | 943 | <?php |
944 | 944 | |
945 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
945 | + do_action('give_payment_mode_before_gateways') ?> |
|
946 | 946 | |
947 | 947 | <ul id="give-gateway-radio-list"> |
948 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
949 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
948 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
949 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
950 | 950 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
951 | - 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 ) . '">'; |
|
952 | - 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'] ); |
|
951 | + 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).'">'; |
|
952 | + 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']); |
|
953 | 953 | echo '</label></li>'; |
954 | 954 | endforeach; ?> |
955 | 955 | </ul> |
956 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
957 | - <p class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading', 'give' ); ?> |
|
956 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
957 | + <p class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading', 'give'); ?> |
|
958 | 958 | <span class="elipsis">.</span><span class="elipsis">.</span><span class="elipsis">.</span></p> |
959 | 959 | </div> |
960 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
960 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
961 | 961 | </fieldset> |
962 | 962 | |
963 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
963 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
964 | 964 | |
965 | 965 | <div id="give_purchase_form_wrap"> |
966 | 966 | |
967 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
967 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
968 | 968 | |
969 | 969 | </div><!-- the checkout fields are loaded into this--> |
970 | 970 | |
971 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
971 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | |
975 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
975 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
976 | 976 | |
977 | 977 | |
978 | 978 | /** |
@@ -987,36 +987,36 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @return void |
989 | 989 | */ |
990 | -function give_terms_agreement( $form_id ) { |
|
990 | +function give_terms_agreement($form_id) { |
|
991 | 991 | |
992 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
993 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
994 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
992 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
993 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
994 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
995 | 995 | |
996 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { |
|
996 | + if ($form_option === 'yes' && ! empty($terms)) { |
|
997 | 997 | |
998 | 998 | ?> |
999 | 999 | <fieldset id="give_terms_agreement"> |
1000 | 1000 | <div id="give_terms" style="display:none;"> |
1001 | 1001 | <?php |
1002 | - do_action( 'give_before_terms' ); |
|
1003 | - echo wpautop( stripslashes( $terms ) ); |
|
1004 | - do_action( 'give_after_terms' ); |
|
1002 | + do_action('give_before_terms'); |
|
1003 | + echo wpautop(stripslashes($terms)); |
|
1004 | + do_action('give_after_terms'); |
|
1005 | 1005 | ?> |
1006 | 1006 | </div> |
1007 | 1007 | <div id="give_show_terms"> |
1008 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1009 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1008 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1009 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1010 | 1010 | </div> |
1011 | 1011 | |
1012 | - <label for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1012 | + <label for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1013 | 1013 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1" /> |
1014 | 1014 | </fieldset> |
1015 | 1015 | <?php |
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | |
1019 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1019 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1020 | 1020 | |
1021 | 1021 | /** |
1022 | 1022 | * Checkout Final Total |
@@ -1028,27 +1028,27 @@ discard block |
||
1028 | 1028 | * @since 1.0 |
1029 | 1029 | * @return void |
1030 | 1030 | */ |
1031 | -function give_checkout_final_total( $form_id ) { |
|
1031 | +function give_checkout_final_total($form_id) { |
|
1032 | 1032 | |
1033 | - if ( isset( $_POST['give_total'] ) ) { |
|
1034 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1033 | + if (isset($_POST['give_total'])) { |
|
1034 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1035 | 1035 | } else { |
1036 | 1036 | //default total |
1037 | - $total = give_get_default_form_amount( $form_id ); |
|
1037 | + $total = give_get_default_form_amount($form_id); |
|
1038 | 1038 | } |
1039 | 1039 | //Only proceed if give_total available |
1040 | - if ( empty( $total ) ) { |
|
1040 | + if (empty($total)) { |
|
1041 | 1041 | return; |
1042 | 1042 | } |
1043 | 1043 | ?> |
1044 | 1044 | <p id="give-final-total-wrap" class="form-wrap "> |
1045 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1046 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1045 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1046 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1047 | 1047 | </p> |
1048 | 1048 | <?php |
1049 | 1049 | } |
1050 | 1050 | |
1051 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1051 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1052 | 1052 | |
1053 | 1053 | |
1054 | 1054 | /** |
@@ -1060,22 +1060,22 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return void |
1062 | 1062 | */ |
1063 | -function give_checkout_submit( $form_id ) { |
|
1063 | +function give_checkout_submit($form_id) { |
|
1064 | 1064 | ?> |
1065 | 1065 | <fieldset id="give_purchase_submit"> |
1066 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1066 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1067 | 1067 | |
1068 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1068 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1069 | 1069 | |
1070 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1070 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1071 | 1071 | |
1072 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1072 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1073 | 1073 | |
1074 | 1074 | </fieldset> |
1075 | 1075 | <?php |
1076 | 1076 | } |
1077 | 1077 | |
1078 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1078 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1079 | 1079 | |
1080 | 1080 | |
1081 | 1081 | /** |
@@ -1088,10 +1088,10 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @return string |
1090 | 1090 | */ |
1091 | -function give_checkout_button_purchase( $form_id ) { |
|
1091 | +function give_checkout_button_purchase($form_id) { |
|
1092 | 1092 | |
1093 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1094 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1093 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1094 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1095 | 1095 | |
1096 | 1096 | ob_start(); |
1097 | 1097 | |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | <span class="give-loading-animation"></span> |
1103 | 1103 | </div> |
1104 | 1104 | <?php |
1105 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1105 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | /** |
@@ -1116,11 +1116,11 @@ discard block |
||
1116 | 1116 | * |
1117 | 1117 | * @return void |
1118 | 1118 | */ |
1119 | -function give_agree_to_terms_js( $form_id ) { |
|
1119 | +function give_agree_to_terms_js($form_id) { |
|
1120 | 1120 | |
1121 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1121 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1122 | 1122 | |
1123 | - if ( $form_option === 'yes' ) { |
|
1123 | + if ($form_option === 'yes') { |
|
1124 | 1124 | ?> |
1125 | 1125 | <script type="text/javascript"> |
1126 | 1126 | jQuery( document ).ready( function ( $ ) { |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | } |
1137 | 1137 | } |
1138 | 1138 | |
1139 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1139 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1140 | 1140 | |
1141 | 1141 | |
1142 | 1142 | /** |
@@ -1149,19 +1149,19 @@ discard block |
||
1149 | 1149 | * |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | -function give_form_content( $form_id, $args ) { |
|
1152 | +function give_form_content($form_id, $args) { |
|
1153 | 1153 | |
1154 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1154 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1155 | 1155 | ? $args['show_content'] |
1156 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1156 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1157 | 1157 | |
1158 | - if ( $show_content !== 'none' ) { |
|
1158 | + if ($show_content !== 'none') { |
|
1159 | 1159 | //add action according to value |
1160 | - add_action( $show_content, 'give_form_display_content' ); |
|
1160 | + add_action($show_content, 'give_form_display_content'); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | |
1164 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1164 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1165 | 1165 | |
1166 | 1166 | /** |
1167 | 1167 | * Show Give Goals |
@@ -1173,24 +1173,24 @@ discard block |
||
1173 | 1173 | * @return mixed |
1174 | 1174 | */ |
1175 | 1175 | |
1176 | -function give_show_goal_progress( $form_id, $args ) { |
|
1176 | +function give_show_goal_progress($form_id, $args) { |
|
1177 | 1177 | |
1178 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1179 | - $form = new Give_Donate_Form( $form_id ); |
|
1178 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1179 | + $form = new Give_Donate_Form($form_id); |
|
1180 | 1180 | $goal = $form->goal; |
1181 | 1181 | $income = $form->get_earnings(); |
1182 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1183 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1184 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1182 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1183 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1184 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1185 | 1185 | |
1186 | 1186 | //Sanity check - respect shortcode args |
1187 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1187 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1188 | 1188 | return false; |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | //Sanity check - ensure form has goal set to output |
1192 | - if ( empty( $form->ID ) |
|
1193 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1192 | + if (empty($form->ID) |
|
1193 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1194 | 1194 | || $goal_option !== 'yes' |
1195 | 1195 | || $goal == 0 |
1196 | 1196 | ) { |
@@ -1198,26 +1198,26 @@ discard block |
||
1198 | 1198 | return false; |
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1201 | + $progress = round(($income / $goal) * 100, 2); |
|
1202 | 1202 | |
1203 | - if ( $income > $goal ) { |
|
1203 | + if ($income > $goal) { |
|
1204 | 1204 | $progress = 100; |
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | $output = '<div class="give-goal-progress">'; |
1208 | 1208 | |
1209 | 1209 | //Goal Progress Text |
1210 | - if ( ! empty( $show_text ) ) { |
|
1210 | + if ( ! empty($show_text)) { |
|
1211 | 1211 | $output .= '<div class="raised">'; |
1212 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . give_currency_filter( give_format_amount( $income ) ) . '</span>', '<span class="goal-text">' . give_currency_filter( give_format_amount( $goal ) ) ) . '</span>'; |
|
1212 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.give_currency_filter(give_format_amount($income)).'</span>', '<span class="goal-text">'.give_currency_filter(give_format_amount($goal))).'</span>'; |
|
1213 | 1213 | $output .= '</div>'; |
1214 | 1214 | } |
1215 | 1215 | //Goal Progress Bar |
1216 | - if ( ! empty( $show_bar ) ) { |
|
1216 | + if ( ! empty($show_bar)) { |
|
1217 | 1217 | $output .= '<div class="give-progress-bar">'; |
1218 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1219 | - if ( ! empty( $color ) ) { |
|
1220 | - $output .= 'background-color:' . $color; |
|
1218 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1219 | + if ( ! empty($color)) { |
|
1220 | + $output .= 'background-color:'.$color; |
|
1221 | 1221 | } |
1222 | 1222 | $output .= '"></span>'; |
1223 | 1223 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1225,13 +1225,13 @@ discard block |
||
1225 | 1225 | |
1226 | 1226 | $output .= '</div><!-- /.goal-progress -->'; |
1227 | 1227 | |
1228 | - echo apply_filters( 'give_goal_output', $output ); |
|
1228 | + echo apply_filters('give_goal_output', $output); |
|
1229 | 1229 | |
1230 | 1230 | return false; |
1231 | 1231 | |
1232 | 1232 | } |
1233 | 1233 | |
1234 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1234 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1235 | 1235 | |
1236 | 1236 | /** |
1237 | 1237 | * Renders Post Form Content |
@@ -1243,17 +1243,17 @@ discard block |
||
1243 | 1243 | * @return void |
1244 | 1244 | * @since 1.0 |
1245 | 1245 | */ |
1246 | -function give_form_display_content( $form_id ) { |
|
1246 | +function give_form_display_content($form_id) { |
|
1247 | 1247 | |
1248 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1248 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1249 | 1249 | |
1250 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1251 | - $content = apply_filters( 'the_content', $content ); |
|
1250 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1251 | + $content = apply_filters('the_content', $content); |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1254 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1255 | 1255 | |
1256 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1256 | + echo apply_filters('give_form_content_output', $output); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | |
@@ -1266,16 +1266,16 @@ discard block |
||
1266 | 1266 | * |
1267 | 1267 | * @return void |
1268 | 1268 | */ |
1269 | -function give_checkout_hidden_fields( $form_id ) { |
|
1269 | +function give_checkout_hidden_fields($form_id) { |
|
1270 | 1270 | |
1271 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1272 | - if ( is_user_logged_in() ) { ?> |
|
1271 | + do_action('give_hidden_fields_before', $form_id); |
|
1272 | + if (is_user_logged_in()) { ?> |
|
1273 | 1273 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>" /> |
1274 | 1274 | <?php } ?> |
1275 | 1275 | <input type="hidden" name="give_action" value="purchase" /> |
1276 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>" /> |
|
1276 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>" /> |
|
1277 | 1277 | <?php |
1278 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1278 | + do_action('give_hidden_fields_after', $form_id); |
|
1279 | 1279 | |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1290,20 +1290,20 @@ discard block |
||
1290 | 1290 | * |
1291 | 1291 | * @return string $content Filtered content |
1292 | 1292 | */ |
1293 | -function give_filter_success_page_content( $content ) { |
|
1293 | +function give_filter_success_page_content($content) { |
|
1294 | 1294 | |
1295 | 1295 | global $give_options; |
1296 | 1296 | |
1297 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1298 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1299 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1297 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1298 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1299 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | return $content; |
1304 | 1304 | } |
1305 | 1305 | |
1306 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1306 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1307 | 1307 | |
1308 | 1308 | |
1309 | 1309 | /** |
@@ -1315,11 +1315,11 @@ discard block |
||
1315 | 1315 | |
1316 | 1316 | function give_test_mode_frontend_warning() { |
1317 | 1317 | |
1318 | - $test_mode = give_get_option( 'test_mode' ); |
|
1318 | + $test_mode = give_get_option('test_mode'); |
|
1319 | 1319 | |
1320 | - if ( $test_mode == 'on' ) { |
|
1321 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
1320 | + if ($test_mode == 'on') { |
|
1321 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
1325 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1325 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |