@@ -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 || 'login' === $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 || 'login' === $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,37 +230,37 @@ 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_get_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_get_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" |
253 | 253 | value="<?php echo $default_amount; ?>" required> |
254 | 254 | <p class="set-price give-donation-amount form-row-wide"> |
255 | - <?php if ( $currency_position == 'before' ) { |
|
255 | + <?php if ($currency_position == 'before') { |
|
256 | 256 | echo $currency_output; |
257 | 257 | } ?> |
258 | 258 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
259 | - <?php if ( $currency_position == 'after' ) { |
|
259 | + <?php if ($currency_position == 'after') { |
|
260 | 260 | echo $currency_output; |
261 | 261 | } ?> |
262 | 262 | <span class="give-loading-text give-updating-price-loader"> |
263 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
263 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
264 | 264 | </span> |
265 | 265 | </p> |
266 | 266 | <?php |
@@ -269,37 +269,37 @@ discard block |
||
269 | 269 | ?> |
270 | 270 | <div class="give-total-wrap"> |
271 | 271 | <div class="give-donation-amount form-row-wide"> |
272 | - <?php if ( $currency_position == 'before' ) { |
|
272 | + <?php if ($currency_position == 'before') { |
|
273 | 273 | echo $currency_output; |
274 | 274 | } ?> |
275 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
275 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
276 | 276 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
277 | - <?php if ( $currency_position == 'after' ) { |
|
277 | + <?php if ($currency_position == 'after') { |
|
278 | 278 | echo $currency_output; |
279 | 279 | } ?> |
280 | 280 | <span class="give-loading-text give-updating-price-loader"> |
281 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
281 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
282 | 282 | </span> |
283 | 283 | </div> |
284 | 284 | </div> |
285 | 285 | <?php } |
286 | 286 | |
287 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
287 | + do_action('give_after_donation_amount', $form_id, $args); |
|
288 | 288 | |
289 | 289 | //Custom Amount Text |
290 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
290 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
291 | 291 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
292 | 292 | <?php } |
293 | 293 | |
294 | 294 | //Output Variable Pricing Levels |
295 | - if ( $variable_pricing ) { |
|
296 | - give_output_levels( $form_id ); |
|
295 | + if ($variable_pricing) { |
|
296 | + give_output_levels($form_id); |
|
297 | 297 | } |
298 | 298 | |
299 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
299 | + do_action('give_after_donation_levels', $form_id, $args); |
|
300 | 300 | } |
301 | 301 | |
302 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
302 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
303 | 303 | |
304 | 304 | |
305 | 305 | /** |
@@ -311,32 +311,32 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return string |
313 | 313 | */ |
314 | -function give_output_levels( $form_id ) { |
|
314 | +function give_output_levels($form_id) { |
|
315 | 315 | |
316 | 316 | //Get variable pricing |
317 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
318 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
319 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
320 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
321 | - if ( empty( $custom_amount_text ) ) { |
|
322 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
317 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
318 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
319 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
320 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
321 | + if (empty($custom_amount_text)) { |
|
322 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | $output = ''; |
326 | 326 | $counter = 0; |
327 | 327 | |
328 | - switch ( $display_style ) { |
|
328 | + switch ($display_style) { |
|
329 | 329 | case 'buttons': |
330 | 330 | |
331 | 331 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
332 | 332 | |
333 | - foreach ( $prices as $price ) { |
|
334 | - $counter ++; |
|
335 | - $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 ); |
|
336 | - $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 ); |
|
333 | + foreach ($prices as $price) { |
|
334 | + $counter++; |
|
335 | + $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); |
|
336 | + $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); |
|
337 | 337 | |
338 | 338 | $output .= '<li>'; |
339 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
339 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
340 | 340 | $output .= $level_text; |
341 | 341 | $output .= '</button>'; |
342 | 342 | $output .= '</li>'; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | //Custom Amount |
347 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
347 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
348 | 348 | $output .= '<li>'; |
349 | 349 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
350 | 350 | $output .= $custom_amount_text; |
@@ -360,23 +360,23 @@ discard block |
||
360 | 360 | |
361 | 361 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
362 | 362 | |
363 | - foreach ( $prices as $price ) { |
|
364 | - $counter ++; |
|
365 | - $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 ); |
|
366 | - $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 ); |
|
363 | + foreach ($prices as $price) { |
|
364 | + $counter++; |
|
365 | + $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); |
|
366 | + $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); |
|
367 | 367 | |
368 | 368 | $output .= '<li>'; |
369 | - $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'] ) . '">'; |
|
370 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
369 | + $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']).'">'; |
|
370 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
371 | 371 | $output .= '</li>'; |
372 | 372 | |
373 | 373 | } |
374 | 374 | |
375 | 375 | //Custom Amount |
376 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
376 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
377 | 377 | $output .= '<li>'; |
378 | 378 | $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">'; |
379 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
379 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
380 | 380 | $output .= '</li>'; |
381 | 381 | } |
382 | 382 | |
@@ -386,23 +386,23 @@ discard block |
||
386 | 386 | |
387 | 387 | case 'dropdown': |
388 | 388 | |
389 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
390 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
389 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
390 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
391 | 391 | |
392 | 392 | //first loop through prices |
393 | - foreach ( $prices as $price ) { |
|
394 | - $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 ); |
|
395 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id, $form_id, $price ); |
|
393 | + foreach ($prices as $price) { |
|
394 | + $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); |
|
395 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id, $form_id, $price); |
|
396 | 396 | |
397 | - $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'] ) . '">'; |
|
397 | + $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']).'">'; |
|
398 | 398 | $output .= $level_text; |
399 | 399 | $output .= '</option>'; |
400 | 400 | |
401 | 401 | } |
402 | 402 | |
403 | 403 | //Custom Amount |
404 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
405 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
404 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
405 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | $output .= '</select>'; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | break; |
411 | 411 | } |
412 | 412 | |
413 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
413 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -422,26 +422,26 @@ discard block |
||
422 | 422 | * @param array $args |
423 | 423 | * |
424 | 424 | */ |
425 | -function give_display_checkout_button( $form_id, $args ) { |
|
425 | +function give_display_checkout_button($form_id, $args) { |
|
426 | 426 | |
427 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
427 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
428 | 428 | ? $args['display_style'] |
429 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
429 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
430 | 430 | |
431 | 431 | //no btn for onpage |
432 | - if ( $display_option === 'onpage' ) { |
|
432 | + if ($display_option === 'onpage') { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
437 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
436 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
437 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
438 | 438 | |
439 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
439 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
440 | 440 | |
441 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
441 | + echo apply_filters('give_display_checkout_button', $output); |
|
442 | 442 | } |
443 | 443 | |
444 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
444 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -452,71 +452,71 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return void |
454 | 454 | */ |
455 | -function give_user_info_fields( $form_id ) { |
|
455 | +function give_user_info_fields($form_id) { |
|
456 | 456 | |
457 | - if ( is_user_logged_in() ) : |
|
458 | - $user_data = get_userdata( get_current_user_id() ); |
|
457 | + if (is_user_logged_in()) : |
|
458 | + $user_data = get_userdata(get_current_user_id()); |
|
459 | 459 | endif; |
460 | 460 | |
461 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
461 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
462 | 462 | ?> |
463 | 463 | <fieldset id="give_checkout_user_info"> |
464 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
464 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
465 | 465 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
466 | 466 | <label class="give-label" for="give-first"> |
467 | - <?php _e( 'First Name', 'give' ); ?> |
|
468 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
467 | + <?php _e('First Name', 'give'); ?> |
|
468 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
469 | 469 | <span class="give-required-indicator">*</span> |
470 | 470 | <?php } ?> |
471 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
471 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
472 | 472 | </label> |
473 | - <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 ) ) { |
|
473 | + <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)) { |
|
474 | 474 | echo ' required '; |
475 | 475 | } ?>/> |
476 | 476 | </p> |
477 | 477 | |
478 | 478 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
479 | 479 | <label class="give-label" for="give-last"> |
480 | - <?php _e( 'Last Name', 'give' ); ?> |
|
481 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
480 | + <?php _e('Last Name', 'give'); ?> |
|
481 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
482 | 482 | <span class="give-required-indicator">*</span> |
483 | 483 | <?php } ?> |
484 | - <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> |
|
484 | + <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> |
|
485 | 485 | </label> |
486 | 486 | |
487 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
487 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
488 | 488 | echo ' required'; |
489 | - } ?>" 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 ) ) { |
|
489 | + } ?>" 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)) { |
|
490 | 490 | echo ' required '; |
491 | 491 | } ?> /> |
492 | 492 | </p> |
493 | 493 | |
494 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
494 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
495 | 495 | <p id="give-email-wrap" class="form-row form-row-wide"> |
496 | 496 | <label class="give-label" for="give-email"> |
497 | - <?php _e( 'Email Address', 'give' ); ?> |
|
498 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
497 | + <?php _e('Email Address', 'give'); ?> |
|
498 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
499 | 499 | <span class="give-required-indicator">*</span> |
500 | 500 | <?php } ?> |
501 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
501 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
502 | 502 | </label> |
503 | 503 | |
504 | - <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 ) ) { |
|
504 | + <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)) { |
|
505 | 505 | echo ' required '; |
506 | 506 | } ?>/> |
507 | 507 | |
508 | 508 | </p> |
509 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
509 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
510 | 510 | |
511 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
511 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
512 | 512 | </fieldset> |
513 | 513 | <?php |
514 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
514 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
515 | 515 | |
516 | 516 | } |
517 | 517 | |
518 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
519 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
518 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
519 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
520 | 520 | |
521 | 521 | /** |
522 | 522 | * Renders the credit card info form. |
@@ -527,73 +527,73 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return void |
529 | 529 | */ |
530 | -function give_get_cc_form( $form_id ) { |
|
530 | +function give_get_cc_form($form_id) { |
|
531 | 531 | |
532 | 532 | ob_start(); |
533 | 533 | |
534 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
534 | + do_action('give_before_cc_fields', $form_id); ?> |
|
535 | 535 | |
536 | 536 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
537 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
538 | - <?php if ( is_ssl() ) : ?> |
|
537 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
538 | + <?php if (is_ssl()) : ?> |
|
539 | 539 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
540 | 540 | <span class="give-icon padlock"></span> |
541 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
541 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
542 | 542 | </div> |
543 | 543 | <?php endif; ?> |
544 | 544 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
545 | 545 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
546 | - <?php _e( 'Card Number', 'give' ); ?> |
|
546 | + <?php _e('Card Number', 'give'); ?> |
|
547 | 547 | <span class="give-required-indicator">*</span> |
548 | - <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> |
|
548 | + <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> |
|
549 | 549 | <span class="card-type"></span> |
550 | 550 | </label> |
551 | 551 | |
552 | - <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/> |
|
552 | + <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/> |
|
553 | 553 | </p> |
554 | 554 | |
555 | 555 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
556 | 556 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
557 | - <?php _e( 'CVC', 'give' ); ?> |
|
557 | + <?php _e('CVC', 'give'); ?> |
|
558 | 558 | <span class="give-required-indicator">*</span> |
559 | - <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> |
|
559 | + <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> |
|
560 | 560 | </label> |
561 | 561 | |
562 | - <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/> |
|
562 | + <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/> |
|
563 | 563 | </p> |
564 | 564 | |
565 | 565 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
566 | 566 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
567 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
567 | + <?php _e('Name on the Card', 'give'); ?> |
|
568 | 568 | <span class="give-required-indicator">*</span> |
569 | - <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> |
|
569 | + <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> |
|
570 | 570 | </label> |
571 | 571 | |
572 | - <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/> |
|
572 | + <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/> |
|
573 | 573 | </p> |
574 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
574 | + <?php do_action('give_before_cc_expiration'); ?> |
|
575 | 575 | <p class="card-expiration form-row form-row-one-third"> |
576 | 576 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
577 | - <?php _e( 'Expiration', 'give' ); ?> |
|
577 | + <?php _e('Expiration', 'give'); ?> |
|
578 | 578 | <span class="give-required-indicator">*</span> |
579 | - <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> |
|
579 | + <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> |
|
580 | 580 | </label> |
581 | 581 | |
582 | 582 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
583 | 583 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
584 | 584 | |
585 | - <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/> |
|
585 | + <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/> |
|
586 | 586 | </p> |
587 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
587 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
588 | 588 | |
589 | 589 | </fieldset> |
590 | 590 | <?php |
591 | - do_action( 'give_after_cc_fields', $form_id ); |
|
591 | + do_action('give_after_cc_fields', $form_id); |
|
592 | 592 | |
593 | 593 | echo ob_get_clean(); |
594 | 594 | } |
595 | 595 | |
596 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
596 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
597 | 597 | |
598 | 598 | /** |
599 | 599 | * Outputs the default credit card address fields |
@@ -604,110 +604,110 @@ discard block |
||
604 | 604 | * |
605 | 605 | * @return void |
606 | 606 | */ |
607 | -function give_default_cc_address_fields( $form_id ) { |
|
607 | +function give_default_cc_address_fields($form_id) { |
|
608 | 608 | |
609 | 609 | $logged_in = is_user_logged_in(); |
610 | 610 | |
611 | - if ( $logged_in ) { |
|
612 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
611 | + if ($logged_in) { |
|
612 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
613 | 613 | } |
614 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
615 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
616 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
617 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
614 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
615 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
616 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
617 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
618 | 618 | ob_start(); ?> |
619 | 619 | <fieldset id="give_cc_address" class="cc-address"> |
620 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
621 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
620 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
621 | + <?php do_action('give_cc_billing_top'); ?> |
|
622 | 622 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
623 | 623 | <label for="card_address" class="give-label"> |
624 | - <?php _e( 'Address', 'give' ); ?> |
|
624 | + <?php _e('Address', 'give'); ?> |
|
625 | 625 | <?php |
626 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
626 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
627 | 627 | <span class="give-required-indicator">*</span> |
628 | 628 | <?php } ?> |
629 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
629 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
630 | 630 | </label> |
631 | 631 | |
632 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
632 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
633 | 633 | echo ' required'; |
634 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
634 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
635 | 635 | echo ' required '; |
636 | 636 | } ?>/> |
637 | 637 | </p> |
638 | 638 | |
639 | 639 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
640 | 640 | <label for="card_address_2" class="give-label"> |
641 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
642 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
641 | + <?php _e('Address Line 2', 'give'); ?> |
|
642 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
643 | 643 | <span class="give-required-indicator">*</span> |
644 | 644 | <?php } ?> |
645 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
645 | + <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> |
|
646 | 646 | </label> |
647 | 647 | |
648 | - <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 ) ) { |
|
648 | + <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)) { |
|
649 | 649 | echo ' required'; |
650 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
650 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
651 | 651 | echo ' required '; |
652 | 652 | } ?>/> |
653 | 653 | </p> |
654 | 654 | |
655 | 655 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
656 | 656 | <label for="card_city" class="give-label"> |
657 | - <?php _e( 'City', 'give' ); ?> |
|
658 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
657 | + <?php _e('City', 'give'); ?> |
|
658 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
659 | 659 | <span class="give-required-indicator">*</span> |
660 | 660 | <?php } ?> |
661 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
661 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
662 | 662 | </label> |
663 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
663 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
664 | 664 | echo ' required'; |
665 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
665 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
666 | 666 | echo ' required '; |
667 | 667 | } ?>/> |
668 | 668 | </p> |
669 | 669 | |
670 | 670 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
671 | 671 | <label for="card_zip" class="give-label"> |
672 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
673 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
672 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
673 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
674 | 674 | <span class="give-required-indicator">*</span> |
675 | 675 | <?php } ?> |
676 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
676 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
677 | 677 | </label> |
678 | 678 | |
679 | - <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 ) ) { |
|
679 | + <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)) { |
|
680 | 680 | echo ' required'; |
681 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
681 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
682 | 682 | echo ' required '; |
683 | 683 | } ?>/> |
684 | 684 | </p> |
685 | 685 | |
686 | 686 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
687 | 687 | <label for="billing_country" class="give-label"> |
688 | - <?php _e( 'Country', 'give' ); ?> |
|
689 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
688 | + <?php _e('Country', 'give'); ?> |
|
689 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
690 | 690 | <span class="give-required-indicator">*</span> |
691 | 691 | <?php } ?> |
692 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
692 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
693 | 693 | </label> |
694 | 694 | |
695 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
695 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
696 | 696 | echo ' required'; |
697 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
697 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
698 | 698 | echo ' required '; |
699 | 699 | } ?>> |
700 | 700 | <?php |
701 | 701 | |
702 | 702 | $selected_country = give_get_country(); |
703 | 703 | |
704 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
704 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
705 | 705 | $selected_country = $user_address['country']; |
706 | 706 | } |
707 | 707 | |
708 | 708 | $countries = give_get_country_list(); |
709 | - foreach ( $countries as $country_code => $country ) { |
|
710 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
709 | + foreach ($countries as $country_code => $country) { |
|
710 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
711 | 711 | } |
712 | 712 | ?> |
713 | 713 | </select> |
@@ -715,44 +715,44 @@ discard block |
||
715 | 715 | |
716 | 716 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
717 | 717 | <label for="card_state" class="give-label"> |
718 | - <?php _e( 'State / Province', 'give' ); ?> |
|
719 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
718 | + <?php _e('State / Province', 'give'); ?> |
|
719 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
720 | 720 | <span class="give-required-indicator">*</span> |
721 | 721 | <?php } ?> |
722 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
722 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
723 | 723 | </label> |
724 | 724 | |
725 | 725 | <?php |
726 | 726 | $selected_state = give_get_state(); |
727 | - $states = give_get_states( $selected_country ); |
|
727 | + $states = give_get_states($selected_country); |
|
728 | 728 | |
729 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
729 | + if ($logged_in && ! empty($user_address['state'])) { |
|
730 | 730 | $selected_state = $user_address['state']; |
731 | 731 | } |
732 | 732 | |
733 | - if ( ! empty( $states ) ) : ?> |
|
734 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
733 | + if ( ! empty($states)) : ?> |
|
734 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
735 | 735 | echo ' required'; |
736 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
736 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
737 | 737 | echo ' required '; |
738 | 738 | } ?>> |
739 | 739 | <?php |
740 | - foreach ( $states as $state_code => $state ) { |
|
741 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
740 | + foreach ($states as $state_code => $state) { |
|
741 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
742 | 742 | } |
743 | 743 | ?> |
744 | 744 | </select> |
745 | 745 | <?php else : ?> |
746 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
746 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
747 | 747 | <?php endif; ?> |
748 | 748 | </p> |
749 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
749 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
750 | 750 | </fieldset> |
751 | 751 | <?php |
752 | 752 | echo ob_get_clean(); |
753 | 753 | } |
754 | 754 | |
755 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
755 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
756 | 756 | |
757 | 757 | |
758 | 758 | /** |
@@ -764,94 +764,94 @@ discard block |
||
764 | 764 | * |
765 | 765 | * @return string |
766 | 766 | */ |
767 | -function give_get_register_fields( $form_id ) { |
|
767 | +function give_get_register_fields($form_id) { |
|
768 | 768 | |
769 | 769 | global $give_options; |
770 | 770 | global $user_ID; |
771 | 771 | |
772 | - if ( is_user_logged_in() ) { |
|
773 | - $user_data = get_userdata( $user_ID ); |
|
772 | + if (is_user_logged_in()) { |
|
773 | + $user_data = get_userdata($user_ID); |
|
774 | 774 | } |
775 | 775 | |
776 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
776 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
777 | 777 | |
778 | 778 | ob_start(); ?> |
779 | 779 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
780 | 780 | |
781 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
781 | + <?php if ($show_register_form == 'both') { ?> |
|
782 | 782 | <div class="give-login-account-wrap"> |
783 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
784 | - <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> |
|
783 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
784 | + <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> |
|
785 | 785 | </p> |
786 | 786 | <p class="give-loading-text"> |
787 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
787 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
788 | 788 | </div> |
789 | 789 | <?php } ?> |
790 | 790 | |
791 | - <?php do_action( 'give_register_fields_before' ); ?> |
|
791 | + <?php do_action('give_register_fields_before'); ?> |
|
792 | 792 | |
793 | 793 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
794 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
795 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
796 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
794 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
795 | + if ( ! give_no_guest_checkout($form_id)) { |
|
796 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
797 | 797 | } ?></legend> |
798 | - <?php do_action( 'give_register_account_fields_before' ); ?> |
|
798 | + <?php do_action('give_register_account_fields_before'); ?> |
|
799 | 799 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
800 | 800 | <label for="give-user-login-<?php echo $form_id; ?>"> |
801 | - <?php _e( 'Username', 'give' ); ?> |
|
802 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
801 | + <?php _e('Username', 'give'); ?> |
|
802 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
803 | 803 | <span class="give-required-indicator">*</span> |
804 | 804 | <?php } ?> |
805 | - <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> |
|
805 | + <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> |
|
806 | 806 | </label> |
807 | 807 | |
808 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
808 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
809 | 809 | echo 'required '; |
810 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
810 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
811 | 811 | </p> |
812 | 812 | |
813 | 813 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
814 | 814 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
815 | - <?php _e( 'Password', 'give' ); ?> |
|
816 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
815 | + <?php _e('Password', 'give'); ?> |
|
816 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
817 | 817 | <span class="give-required-indicator">*</span> |
818 | 818 | <?php } ?> |
819 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
819 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
820 | 820 | </label> |
821 | 821 | |
822 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
822 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
823 | 823 | echo 'required '; |
824 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
824 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
825 | 825 | </p> |
826 | 826 | |
827 | 827 | <p id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
828 | 828 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
829 | - <?php _e( 'Confirm PW', 'give' ); ?> |
|
830 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
829 | + <?php _e('Confirm PW', 'give'); ?> |
|
830 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
831 | 831 | <span class="give-required-indicator">*</span> |
832 | 832 | <?php } ?> |
833 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
833 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
834 | 834 | </label> |
835 | 835 | |
836 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
836 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_no_guest_checkout($form_id)) { |
|
837 | 837 | echo 'required '; |
838 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
838 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
839 | 839 | </p> |
840 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
840 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
841 | 841 | </fieldset> |
842 | 842 | |
843 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
843 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
844 | 844 | |
845 | 845 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
846 | 846 | |
847 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
847 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
848 | 848 | |
849 | 849 | </fieldset> |
850 | 850 | <?php |
851 | 851 | echo ob_get_clean(); |
852 | 852 | } |
853 | 853 | |
854 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
854 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
855 | 855 | |
856 | 856 | /** |
857 | 857 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -864,76 +864,76 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string |
866 | 866 | */ |
867 | -function give_get_login_fields( $form_id ) { |
|
867 | +function give_get_login_fields($form_id) { |
|
868 | 868 | |
869 | 869 | global $give_options; |
870 | 870 | |
871 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
872 | - $show_register_form = apply_filters( 'give_show_register_form', get_post_meta( $form_id, '_give_show_register_form', true ) ); |
|
871 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
872 | + $show_register_form = apply_filters('give_show_register_form', get_post_meta($form_id, '_give_show_register_form', true)); |
|
873 | 873 | |
874 | 874 | ob_start(); |
875 | 875 | ?> |
876 | 876 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
877 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
878 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
879 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
877 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
878 | + if ( ! give_no_guest_checkout($form_id)) { |
|
879 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
880 | 880 | } ?> |
881 | 881 | </legend> |
882 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
882 | + <?php if ($show_register_form == 'both') { ?> |
|
883 | 883 | <p class="give-new-account-link"> |
884 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
885 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-login" |
|
884 | + <?php _e('Need to create an account?', 'give'); ?> |
|
885 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-login" |
|
886 | 886 | data-action="give_checkout_register"> |
887 | - <?php _e( 'Register', 'give' ); |
|
888 | - if ( ! give_no_guest_checkout( $form_id ) ) { |
|
889 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
887 | + <?php _e('Register', 'give'); |
|
888 | + if ( ! give_no_guest_checkout($form_id)) { |
|
889 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
890 | 890 | } ?> |
891 | 891 | </a> |
892 | 892 | </p> |
893 | 893 | <p class="give-loading-text"> |
894 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
894 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
895 | 895 | <?php } ?> |
896 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
896 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
897 | 897 | <p id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
898 | 898 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
899 | - <?php _e( 'Username', 'give' ); ?> |
|
900 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
899 | + <?php _e('Username', 'give'); ?> |
|
900 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
901 | 901 | <span class="give-required-indicator">*</span> |
902 | 902 | <?php } ?> |
903 | 903 | </label> |
904 | 904 | |
905 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
905 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
906 | 906 | echo 'required '; |
907 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
907 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
908 | 908 | </p> |
909 | 909 | |
910 | 910 | <p id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
911 | 911 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
912 | - <?php _e( 'Password', 'give' ); ?> |
|
913 | - <?php if ( give_no_guest_checkout( $form_id ) ) { ?> |
|
912 | + <?php _e('Password', 'give'); ?> |
|
913 | + <?php if (give_no_guest_checkout($form_id)) { ?> |
|
914 | 914 | <span class="give-required-indicator">*</span> |
915 | 915 | <?php } ?> |
916 | 916 | </label> |
917 | - <input class="<?php if ( give_no_guest_checkout( $form_id ) ) { |
|
917 | + <input class="<?php if (give_no_guest_checkout($form_id)) { |
|
918 | 918 | echo 'required '; |
919 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
919 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
920 | 920 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
921 | 921 | </p> |
922 | 922 | |
923 | 923 | <p id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
924 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
925 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
926 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
924 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
925 | + <?php if ($show_register_form !== 'login') { ?> |
|
926 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
927 | 927 | <?php } ?> |
928 | 928 | <span class="give-loading-animation"></span> |
929 | 929 | </p> |
930 | - <?php do_action( 'give_checkout_login_fields_after' ); ?> |
|
930 | + <?php do_action('give_checkout_login_fields_after'); ?> |
|
931 | 931 | </fieldset><!--end #give-login-fields--> |
932 | 932 | <?php |
933 | 933 | echo ob_get_clean(); |
934 | 934 | } |
935 | 935 | |
936 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
936 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
937 | 937 | |
938 | 938 | /** |
939 | 939 | * Payment Mode Select |
@@ -949,49 +949,49 @@ discard block |
||
949 | 949 | * |
950 | 950 | * @return void |
951 | 951 | */ |
952 | -function give_payment_mode_select( $form_id ) { |
|
952 | +function give_payment_mode_select($form_id) { |
|
953 | 953 | |
954 | 954 | $gateways = give_get_enabled_payment_gateways(); |
955 | 955 | |
956 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
956 | + do_action('give_payment_mode_top', $form_id); ?> |
|
957 | 957 | |
958 | 958 | <fieldset id="give-payment-mode-select"> |
959 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
959 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
960 | 960 | <div id="give-payment-mode-wrap"> |
961 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
962 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
961 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
962 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
963 | 963 | </legend> |
964 | 964 | <?php |
965 | 965 | |
966 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
966 | + do_action('give_payment_mode_before_gateways') ?> |
|
967 | 967 | |
968 | 968 | <ul id="give-gateway-radio-list"> |
969 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
970 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
969 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
970 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
971 | 971 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
972 | - 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 ) . '">'; |
|
973 | - 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'] ); |
|
972 | + 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).'">'; |
|
973 | + 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']); |
|
974 | 974 | echo '</label></li>'; |
975 | 975 | endforeach; ?> |
976 | 976 | </ul> |
977 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
977 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
978 | 978 | </div> |
979 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
979 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
980 | 980 | </fieldset> |
981 | 981 | |
982 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
982 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
983 | 983 | |
984 | 984 | <div id="give_purchase_form_wrap"> |
985 | 985 | |
986 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
986 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
987 | 987 | |
988 | 988 | </div><!-- the checkout fields are loaded into this--> |
989 | 989 | |
990 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
990 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
991 | 991 | |
992 | 992 | } |
993 | 993 | |
994 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
994 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
995 | 995 | |
996 | 996 | |
997 | 997 | /** |
@@ -1006,35 +1006,35 @@ discard block |
||
1006 | 1006 | * |
1007 | 1007 | * @return void |
1008 | 1008 | */ |
1009 | -function give_terms_agreement( $form_id ) { |
|
1009 | +function give_terms_agreement($form_id) { |
|
1010 | 1010 | |
1011 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1012 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1013 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1011 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1012 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1013 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1014 | 1014 | |
1015 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1015 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1016 | 1016 | <fieldset id="give_terms_agreement"> |
1017 | 1017 | <div id="give_terms" style="display:none;"> |
1018 | 1018 | <?php |
1019 | - do_action( 'give_before_terms' ); |
|
1020 | - echo wpautop( stripslashes( $terms ) ); |
|
1021 | - do_action( 'give_after_terms' ); |
|
1019 | + do_action('give_before_terms'); |
|
1020 | + echo wpautop(stripslashes($terms)); |
|
1021 | + do_action('give_after_terms'); |
|
1022 | 1022 | ?> |
1023 | 1023 | </div> |
1024 | 1024 | <div id="give_show_terms"> |
1025 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1026 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1025 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1026 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1027 | 1027 | </div> |
1028 | 1028 | |
1029 | 1029 | <label |
1030 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1030 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1031 | 1031 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1032 | 1032 | </fieldset> |
1033 | 1033 | <?php |
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | |
1037 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1037 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1038 | 1038 | |
1039 | 1039 | /** |
1040 | 1040 | * Checkout Final Total |
@@ -1046,27 +1046,27 @@ discard block |
||
1046 | 1046 | * @since 1.0 |
1047 | 1047 | * @return void |
1048 | 1048 | */ |
1049 | -function give_checkout_final_total( $form_id ) { |
|
1049 | +function give_checkout_final_total($form_id) { |
|
1050 | 1050 | |
1051 | - if ( isset( $_POST['give_total'] ) ) { |
|
1052 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1051 | + if (isset($_POST['give_total'])) { |
|
1052 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1053 | 1053 | } else { |
1054 | 1054 | //default total |
1055 | - $total = give_get_default_form_amount( $form_id ); |
|
1055 | + $total = give_get_default_form_amount($form_id); |
|
1056 | 1056 | } |
1057 | 1057 | //Only proceed if give_total available |
1058 | - if ( empty( $total ) ) { |
|
1058 | + if (empty($total)) { |
|
1059 | 1059 | return; |
1060 | 1060 | } |
1061 | 1061 | ?> |
1062 | 1062 | <p id="give-final-total-wrap" class="form-wrap "> |
1063 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1064 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1063 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1064 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1065 | 1065 | </p> |
1066 | 1066 | <?php |
1067 | 1067 | } |
1068 | 1068 | |
1069 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1069 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1070 | 1070 | |
1071 | 1071 | |
1072 | 1072 | /** |
@@ -1078,22 +1078,22 @@ discard block |
||
1078 | 1078 | * |
1079 | 1079 | * @return void |
1080 | 1080 | */ |
1081 | -function give_checkout_submit( $form_id ) { |
|
1081 | +function give_checkout_submit($form_id) { |
|
1082 | 1082 | ?> |
1083 | 1083 | <fieldset id="give_purchase_submit"> |
1084 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1084 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1085 | 1085 | |
1086 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1086 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1087 | 1087 | |
1088 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1088 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1089 | 1089 | |
1090 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1090 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1091 | 1091 | |
1092 | 1092 | </fieldset> |
1093 | 1093 | <?php |
1094 | 1094 | } |
1095 | 1095 | |
1096 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1096 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | /** |
@@ -1106,10 +1106,10 @@ discard block |
||
1106 | 1106 | * |
1107 | 1107 | * @return string |
1108 | 1108 | */ |
1109 | -function give_checkout_button_purchase( $form_id ) { |
|
1109 | +function give_checkout_button_purchase($form_id) { |
|
1110 | 1110 | |
1111 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1112 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1111 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1112 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1113 | 1113 | |
1114 | 1114 | ob_start(); |
1115 | 1115 | |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | <span class="give-loading-animation"></span> |
1121 | 1121 | </div> |
1122 | 1122 | <?php |
1123 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1123 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | /** |
@@ -1134,11 +1134,11 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @return void |
1136 | 1136 | */ |
1137 | -function give_agree_to_terms_js( $form_id ) { |
|
1137 | +function give_agree_to_terms_js($form_id) { |
|
1138 | 1138 | |
1139 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1139 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1140 | 1140 | |
1141 | - if ( $form_option === 'yes' ) { |
|
1141 | + if ($form_option === 'yes') { |
|
1142 | 1142 | ?> |
1143 | 1143 | <script type="text/javascript"> |
1144 | 1144 | jQuery(document).ready(function ($) { |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | } |
1155 | 1155 | } |
1156 | 1156 | |
1157 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1157 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | /** |
@@ -1167,19 +1167,19 @@ discard block |
||
1167 | 1167 | * |
1168 | 1168 | * @return void |
1169 | 1169 | */ |
1170 | -function give_form_content( $form_id, $args ) { |
|
1170 | +function give_form_content($form_id, $args) { |
|
1171 | 1171 | |
1172 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1172 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1173 | 1173 | ? $args['show_content'] |
1174 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1174 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1175 | 1175 | |
1176 | - if ( $show_content !== 'none' ) { |
|
1176 | + if ($show_content !== 'none') { |
|
1177 | 1177 | //add action according to value |
1178 | - add_action( $show_content, 'give_form_display_content' ); |
|
1178 | + add_action($show_content, 'give_form_display_content'); |
|
1179 | 1179 | } |
1180 | 1180 | } |
1181 | 1181 | |
1182 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1182 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1183 | 1183 | |
1184 | 1184 | /** |
1185 | 1185 | * Show Give Goals |
@@ -1192,25 +1192,25 @@ discard block |
||
1192 | 1192 | * @return mixed |
1193 | 1193 | */ |
1194 | 1194 | |
1195 | -function give_show_goal_progress( $form_id, $args ) { |
|
1195 | +function give_show_goal_progress($form_id, $args) { |
|
1196 | 1196 | |
1197 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1198 | - $form = new Give_Donate_Form( $form_id ); |
|
1197 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1198 | + $form = new Give_Donate_Form($form_id); |
|
1199 | 1199 | $goal = $form->goal; |
1200 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
1200 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
1201 | 1201 | $income = $form->get_earnings(); |
1202 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1203 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1204 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1202 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1203 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1204 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1205 | 1205 | |
1206 | 1206 | //Sanity check - respect shortcode args |
1207 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1207 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1208 | 1208 | return false; |
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | //Sanity check - ensure form has goal set to output |
1212 | - if ( empty( $form->ID ) |
|
1213 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1212 | + if (empty($form->ID) |
|
1213 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1214 | 1214 | || $goal_option !== 'yes' |
1215 | 1215 | || $goal == 0 |
1216 | 1216 | ) { |
@@ -1218,26 +1218,26 @@ discard block |
||
1218 | 1218 | return false; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1221 | + $progress = round(($income / $goal) * 100, 2); |
|
1222 | 1222 | |
1223 | - if ( $income > $goal ) { |
|
1223 | + if ($income > $goal) { |
|
1224 | 1224 | $progress = 100; |
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | $output = '<div class="give-goal-progress">'; |
1228 | 1228 | |
1229 | 1229 | //Goal Progress Text |
1230 | - if ( ! empty( $show_text ) ) { |
|
1230 | + if ( ! empty($show_text)) { |
|
1231 | 1231 | |
1232 | 1232 | $output .= '<div class="raised">'; |
1233 | 1233 | |
1234 | - if ( $goal_format !== 'percentage' ) { |
|
1234 | + if ($goal_format !== 'percentage') { |
|
1235 | 1235 | |
1236 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
1236 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
1237 | 1237 | |
1238 | - } elseif ( $goal_format == 'percentage' ) { |
|
1238 | + } elseif ($goal_format == 'percentage') { |
|
1239 | 1239 | |
1240 | - $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
1240 | + $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
1241 | 1241 | |
1242 | 1242 | } |
1243 | 1243 | |
@@ -1246,11 +1246,11 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | //Goal Progress Bar |
1249 | - if ( ! empty( $show_bar ) ) { |
|
1249 | + if ( ! empty($show_bar)) { |
|
1250 | 1250 | $output .= '<div class="give-progress-bar">'; |
1251 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1252 | - if ( ! empty( $color ) ) { |
|
1253 | - $output .= 'background-color:' . $color; |
|
1251 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1252 | + if ( ! empty($color)) { |
|
1253 | + $output .= 'background-color:'.$color; |
|
1254 | 1254 | } |
1255 | 1255 | $output .= '"></span>'; |
1256 | 1256 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1258,13 +1258,13 @@ discard block |
||
1258 | 1258 | |
1259 | 1259 | $output .= '</div><!-- /.goal-progress -->'; |
1260 | 1260 | |
1261 | - echo apply_filters( 'give_goal_output', $output ); |
|
1261 | + echo apply_filters('give_goal_output', $output); |
|
1262 | 1262 | |
1263 | 1263 | return false; |
1264 | 1264 | |
1265 | 1265 | } |
1266 | 1266 | |
1267 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1267 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1268 | 1268 | |
1269 | 1269 | /** |
1270 | 1270 | * Renders Post Form Content |
@@ -1276,17 +1276,17 @@ discard block |
||
1276 | 1276 | * @return void |
1277 | 1277 | * @since 1.0 |
1278 | 1278 | */ |
1279 | -function give_form_display_content( $form_id ) { |
|
1279 | +function give_form_display_content($form_id) { |
|
1280 | 1280 | |
1281 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1281 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1282 | 1282 | |
1283 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1284 | - $content = apply_filters( 'the_content', $content ); |
|
1283 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1284 | + $content = apply_filters('the_content', $content); |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1287 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1288 | 1288 | |
1289 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1289 | + echo apply_filters('give_form_content_output', $output); |
|
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | |
@@ -1299,16 +1299,16 @@ discard block |
||
1299 | 1299 | * |
1300 | 1300 | * @return void |
1301 | 1301 | */ |
1302 | -function give_checkout_hidden_fields( $form_id ) { |
|
1302 | +function give_checkout_hidden_fields($form_id) { |
|
1303 | 1303 | |
1304 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1305 | - if ( is_user_logged_in() ) { ?> |
|
1304 | + do_action('give_hidden_fields_before', $form_id); |
|
1305 | + if (is_user_logged_in()) { ?> |
|
1306 | 1306 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1307 | 1307 | <?php } ?> |
1308 | 1308 | <input type="hidden" name="give_action" value="purchase"/> |
1309 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1309 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1310 | 1310 | <?php |
1311 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1311 | + do_action('give_hidden_fields_after', $form_id); |
|
1312 | 1312 | |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1323,20 +1323,20 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @return string $content Filtered content |
1325 | 1325 | */ |
1326 | -function give_filter_success_page_content( $content ) { |
|
1326 | +function give_filter_success_page_content($content) { |
|
1327 | 1327 | |
1328 | 1328 | global $give_options; |
1329 | 1329 | |
1330 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1331 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1332 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1330 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1331 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1332 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1333 | 1333 | } |
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | return $content; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1339 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1340 | 1340 | |
1341 | 1341 | |
1342 | 1342 | /** |
@@ -1348,11 +1348,11 @@ discard block |
||
1348 | 1348 | |
1349 | 1349 | function give_test_mode_frontend_warning() { |
1350 | 1350 | |
1351 | - $test_mode = give_get_option( 'test_mode' ); |
|
1351 | + $test_mode = give_get_option('test_mode'); |
|
1352 | 1352 | |
1353 | - if ( $test_mode == 'on' ) { |
|
1354 | - 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>'; |
|
1353 | + if ($test_mode == 'on') { |
|
1354 | + 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>'; |
|
1355 | 1355 | } |
1356 | 1356 | } |
1357 | 1357 | |
1358 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1358 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |