@@ -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,64 +23,64 @@ 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 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
62 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
63 | 63 | ? $args['display_style'] |
64 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
64 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
65 | 65 | |
66 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
66 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
67 | 67 | ? ' float-labels-enabled' |
68 | 68 | : ''; |
69 | 69 | |
70 | 70 | //Form Wrap Classes |
71 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
71 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
72 | 72 | 'give-form-wrap', |
73 | - 'give-display-' . $display_option |
|
74 | - ), $form->ID, $args ); |
|
75 | - $form_wrap_classes = implode( ' ', $form_wrap_classes_array ); |
|
73 | + 'give-display-'.$display_option |
|
74 | + ), $form->ID, $args); |
|
75 | + $form_wrap_classes = implode(' ', $form_wrap_classes_array); |
|
76 | 76 | |
77 | 77 | //Form Classes |
78 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
78 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
79 | 79 | 'give-form', |
80 | - 'give-form-' . $form->ID, |
|
80 | + 'give-form-'.$form->ID, |
|
81 | 81 | $float_labels_option |
82 | - ), $form->ID, $args ); |
|
83 | - $form_classes = implode( ' ', $form_classes_array ); |
|
82 | + ), $form->ID, $args); |
|
83 | + $form_classes = implode(' ', $form_classes_array); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | ob_start(); |
@@ -93,35 +93,35 @@ discard block |
||
93 | 93 | * @param int $form ->ID The current form ID |
94 | 94 | * @param array $args An array of form args |
95 | 95 | */ |
96 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
96 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
97 | 97 | |
98 | 98 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
99 | 99 | |
100 | 100 | <?php |
101 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
101 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
102 | 102 | |
103 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
103 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
104 | 104 | |
105 | 105 | } ?> |
106 | 106 | |
107 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
107 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
108 | 108 | |
109 | 109 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
110 | 110 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
111 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
112 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
113 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
114 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
111 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
112 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
113 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
114 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
115 | 115 | <?php |
116 | 116 | |
117 | 117 | //Price ID hidden field for variable (mult-level) donation forms |
118 | - if ( give_has_variable_prices( $form_id ) ) { |
|
118 | + if (give_has_variable_prices($form_id)) { |
|
119 | 119 | //get default selected price ID |
120 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
120 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
121 | 121 | $price_id = 0; |
122 | 122 | //loop through prices |
123 | - foreach ( $prices as $price ) { |
|
124 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
123 | + foreach ($prices as $price) { |
|
124 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
125 | 125 | $price_id = $price['_give_id']['level_id']; |
126 | 126 | }; |
127 | 127 | } |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
130 | 130 | <?php } |
131 | 131 | |
132 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
132 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
133 | 133 | |
134 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
134 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
135 | 135 | |
136 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
136 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
137 | 137 | |
138 | 138 | ?> |
139 | 139 | |
140 | 140 | </form> |
141 | 141 | |
142 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
142 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
143 | 143 | |
144 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
144 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
145 | 145 | <?php |
146 | 146 | |
147 | 147 | /** |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | * @param int $form ->ID The current form ID |
153 | 153 | * @param array $args An array of form args |
154 | 154 | */ |
155 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
155 | + do_action('give_post_form_output', $form->ID, $args); |
|
156 | 156 | |
157 | 157 | $final_output = ob_get_clean(); |
158 | 158 | |
159 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
159 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -176,43 +176,43 @@ discard block |
||
176 | 176 | * @global $give_options Array of all the Give options |
177 | 177 | * @return string |
178 | 178 | */ |
179 | -function give_show_purchase_form( $form_id ) { |
|
179 | +function give_show_purchase_form($form_id) { |
|
180 | 180 | |
181 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
181 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
182 | 182 | |
183 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
183 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
184 | 184 | $form_id = $_POST['give_form_id']; |
185 | 185 | } |
186 | 186 | |
187 | - do_action( 'give_purchase_form_top', $form_id ); |
|
187 | + do_action('give_purchase_form_top', $form_id); |
|
188 | 188 | |
189 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
189 | + if (give_can_checkout() && isset($form_id)) { |
|
190 | 190 | |
191 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
191 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
192 | 192 | |
193 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
193 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
194 | 194 | |
195 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
195 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
196 | 196 | |
197 | 197 | // Load the credit card form and allow gateways to load their own if they wish |
198 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
199 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
198 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
199 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
200 | 200 | } else { |
201 | - do_action( 'give_cc_form', $form_id ); |
|
201 | + do_action('give_cc_form', $form_id); |
|
202 | 202 | } |
203 | 203 | |
204 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
204 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
205 | 205 | |
206 | 206 | } else { |
207 | 207 | // Can't checkout |
208 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
208 | + do_action('give_purchase_form_no_access', $form_id); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
212 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
212 | + do_action('give_purchase_form_bottom', $form_id); |
|
213 | 213 | } |
214 | 214 | |
215 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
215 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * |
@@ -224,26 +224,26 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return void |
226 | 226 | */ |
227 | -function give_show_register_login_fields( $form_id ) { |
|
227 | +function give_show_register_login_fields($form_id) { |
|
228 | 228 | |
229 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
229 | + $show_register_form = give_show_login_register_option($form_id); |
|
230 | 230 | |
231 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
231 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
232 | 232 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
233 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
233 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
234 | 234 | </div> |
235 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
235 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
236 | 236 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
237 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
237 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
238 | 238 | </div> |
239 | 239 | <?php endif; ?> |
240 | 240 | |
241 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
242 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
241 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
242 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
246 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Donation Amount Field |
@@ -257,37 +257,37 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return void |
259 | 259 | */ |
260 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
260 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
261 | 261 | |
262 | 262 | global $give_options; |
263 | 263 | |
264 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
265 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
266 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
267 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
268 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
269 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
270 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
264 | + $variable_pricing = give_has_variable_prices($form_id); |
|
265 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
266 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
267 | + $symbol = give_currency_symbol(give_get_currency()); |
|
268 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
269 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
270 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
271 | 271 | |
272 | - do_action( 'give_before_donation_levels', $form_id ); |
|
272 | + do_action('give_before_donation_levels', $form_id); |
|
273 | 273 | |
274 | 274 | //Set Price, No Custom Amount Allowed means hidden price field |
275 | - if ( $allow_custom_amount == 'no' ) { |
|
275 | + if ($allow_custom_amount == 'no') { |
|
276 | 276 | ?> |
277 | 277 | |
278 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
278 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
279 | 279 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
280 | 280 | value="<?php echo $default_amount; ?>" required> |
281 | 281 | <p class="set-price give-donation-amount form-row-wide"> |
282 | - <?php if ( $currency_position == 'before' ) { |
|
282 | + <?php if ($currency_position == 'before') { |
|
283 | 283 | echo $currency_output; |
284 | 284 | } ?> |
285 | 285 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
286 | - <?php if ( $currency_position == 'after' ) { |
|
286 | + <?php if ($currency_position == 'after') { |
|
287 | 287 | echo $currency_output; |
288 | 288 | } ?> |
289 | 289 | <span class="give-loading-text give-updating-price-loader"> |
290 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
290 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
291 | 291 | </span> |
292 | 292 | </p> |
293 | 293 | <?php |
@@ -296,37 +296,37 @@ discard block |
||
296 | 296 | ?> |
297 | 297 | <div class="give-total-wrap"> |
298 | 298 | <div class="give-donation-amount form-row-wide"> |
299 | - <?php if ( $currency_position == 'before' ) { |
|
299 | + <?php if ($currency_position == 'before') { |
|
300 | 300 | echo $currency_output; |
301 | 301 | } ?> |
302 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
302 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
303 | 303 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
304 | - <?php if ( $currency_position == 'after' ) { |
|
304 | + <?php if ($currency_position == 'after') { |
|
305 | 305 | echo $currency_output; |
306 | 306 | } ?> |
307 | 307 | <span class="give-loading-text give-updating-price-loader"> |
308 | - <span class="give-loading-animation"></span> <?php _e( 'Updating Amount...', 'give' ); ?> |
|
308 | + <span class="give-loading-animation"></span> <?php _e('Updating Amount...', 'give'); ?> |
|
309 | 309 | </span> |
310 | 310 | </div> |
311 | 311 | </div> |
312 | 312 | <?php } |
313 | 313 | |
314 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
314 | + do_action('give_after_donation_amount', $form_id, $args); |
|
315 | 315 | |
316 | 316 | //Custom Amount Text |
317 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
317 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
318 | 318 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
319 | 319 | <?php } |
320 | 320 | |
321 | 321 | //Output Variable Pricing Levels |
322 | - if ( $variable_pricing ) { |
|
323 | - give_output_levels( $form_id ); |
|
322 | + if ($variable_pricing) { |
|
323 | + give_output_levels($form_id); |
|
324 | 324 | } |
325 | 325 | |
326 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
326 | + do_action('give_after_donation_levels', $form_id, $args); |
|
327 | 327 | } |
328 | 328 | |
329 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
329 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
330 | 330 | |
331 | 331 | |
332 | 332 | /** |
@@ -338,32 +338,32 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @return string |
340 | 340 | */ |
341 | -function give_output_levels( $form_id ) { |
|
341 | +function give_output_levels($form_id) { |
|
342 | 342 | |
343 | 343 | //Get variable pricing |
344 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
345 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
346 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
347 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
348 | - if ( empty( $custom_amount_text ) ) { |
|
349 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
344 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
345 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
346 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
347 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
348 | + if (empty($custom_amount_text)) { |
|
349 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | $output = ''; |
353 | 353 | $counter = 0; |
354 | 354 | |
355 | - switch ( $display_style ) { |
|
355 | + switch ($display_style) { |
|
356 | 356 | case 'buttons': |
357 | 357 | |
358 | 358 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
359 | 359 | |
360 | - foreach ( $prices as $price ) { |
|
361 | - $counter ++; |
|
362 | - $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 ); |
|
363 | - $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 ); |
|
360 | + foreach ($prices as $price) { |
|
361 | + $counter++; |
|
362 | + $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); |
|
363 | + $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); |
|
364 | 364 | |
365 | 365 | $output .= '<li>'; |
366 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
366 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
367 | 367 | $output .= $level_text; |
368 | 368 | $output .= '</button>'; |
369 | 369 | $output .= '</li>'; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | //Custom Amount |
374 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
374 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
375 | 375 | $output .= '<li>'; |
376 | 376 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
377 | 377 | $output .= $custom_amount_text; |
@@ -387,23 +387,23 @@ discard block |
||
387 | 387 | |
388 | 388 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
389 | 389 | |
390 | - foreach ( $prices as $price ) { |
|
391 | - $counter ++; |
|
392 | - $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 ); |
|
393 | - $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 ); |
|
390 | + foreach ($prices as $price) { |
|
391 | + $counter++; |
|
392 | + $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); |
|
393 | + $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); |
|
394 | 394 | |
395 | 395 | $output .= '<li>'; |
396 | - $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'] ) . '">'; |
|
397 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
396 | + $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']).'">'; |
|
397 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
398 | 398 | $output .= '</li>'; |
399 | 399 | |
400 | 400 | } |
401 | 401 | |
402 | 402 | //Custom Amount |
403 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
403 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
404 | 404 | $output .= '<li>'; |
405 | 405 | $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">'; |
406 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
406 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
407 | 407 | $output .= '</li>'; |
408 | 408 | } |
409 | 409 | |
@@ -413,23 +413,23 @@ discard block |
||
413 | 413 | |
414 | 414 | case 'dropdown': |
415 | 415 | |
416 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
417 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
416 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
417 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
418 | 418 | |
419 | 419 | //first loop through prices |
420 | - foreach ( $prices as $price ) { |
|
421 | - $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 ); |
|
422 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
420 | + foreach ($prices as $price) { |
|
421 | + $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); |
|
422 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
423 | 423 | |
424 | - $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'] ) . '">'; |
|
424 | + $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']).'">'; |
|
425 | 425 | $output .= $level_text; |
426 | 426 | $output .= '</option>'; |
427 | 427 | |
428 | 428 | } |
429 | 429 | |
430 | 430 | //Custom Amount |
431 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
432 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
431 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
432 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | $output .= '</select>'; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | break; |
438 | 438 | } |
439 | 439 | |
440 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
440 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
@@ -449,26 +449,26 @@ discard block |
||
449 | 449 | * @param array $args |
450 | 450 | * |
451 | 451 | */ |
452 | -function give_display_checkout_button( $form_id, $args ) { |
|
452 | +function give_display_checkout_button($form_id, $args) { |
|
453 | 453 | |
454 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
454 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
455 | 455 | ? $args['display_style'] |
456 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
456 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
457 | 457 | |
458 | 458 | //no btn for onpage |
459 | - if ( $display_option === 'onpage' ) { |
|
459 | + if ($display_option === 'onpage') { |
|
460 | 460 | return; |
461 | 461 | } |
462 | 462 | |
463 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
464 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
463 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
464 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
465 | 465 | |
466 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
466 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
467 | 467 | |
468 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
468 | + echo apply_filters('give_display_checkout_button', $output); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
471 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -479,71 +479,71 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return void |
481 | 481 | */ |
482 | -function give_user_info_fields( $form_id ) { |
|
482 | +function give_user_info_fields($form_id) { |
|
483 | 483 | |
484 | - if ( is_user_logged_in() ) : |
|
485 | - $user_data = get_userdata( get_current_user_id() ); |
|
484 | + if (is_user_logged_in()) : |
|
485 | + $user_data = get_userdata(get_current_user_id()); |
|
486 | 486 | endif; |
487 | 487 | |
488 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
488 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
489 | 489 | ?> |
490 | 490 | <fieldset id="give_checkout_user_info"> |
491 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
491 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
492 | 492 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
493 | 493 | <label class="give-label" for="give-first"> |
494 | - <?php _e( 'First Name', 'give' ); ?> |
|
495 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
494 | + <?php _e('First Name', 'give'); ?> |
|
495 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
496 | 496 | <span class="give-required-indicator">*</span> |
497 | 497 | <?php } ?> |
498 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
498 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
499 | 499 | </label> |
500 | - <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 ) ) { |
|
500 | + <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)) { |
|
501 | 501 | echo ' required '; |
502 | 502 | } ?>/> |
503 | 503 | </p> |
504 | 504 | |
505 | 505 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
506 | 506 | <label class="give-label" for="give-last"> |
507 | - <?php _e( 'Last Name', 'give' ); ?> |
|
508 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
507 | + <?php _e('Last Name', 'give'); ?> |
|
508 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
509 | 509 | <span class="give-required-indicator">*</span> |
510 | 510 | <?php } ?> |
511 | - <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> |
|
511 | + <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> |
|
512 | 512 | </label> |
513 | 513 | |
514 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
514 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
515 | 515 | echo ' required'; |
516 | - } ?>" 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 ) ) { |
|
516 | + } ?>" 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)) { |
|
517 | 517 | echo ' required '; |
518 | 518 | } ?> /> |
519 | 519 | </p> |
520 | 520 | |
521 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
521 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
522 | 522 | <p id="give-email-wrap" class="form-row form-row-wide"> |
523 | 523 | <label class="give-label" for="give-email"> |
524 | - <?php _e( 'Email Address', 'give' ); ?> |
|
525 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
524 | + <?php _e('Email Address', 'give'); ?> |
|
525 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
526 | 526 | <span class="give-required-indicator">*</span> |
527 | 527 | <?php } ?> |
528 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
528 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
529 | 529 | </label> |
530 | 530 | |
531 | - <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 ) ) { |
|
531 | + <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)) { |
|
532 | 532 | echo ' required '; |
533 | 533 | } ?>/> |
534 | 534 | |
535 | 535 | </p> |
536 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
536 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
537 | 537 | |
538 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
538 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
539 | 539 | </fieldset> |
540 | 540 | <?php |
541 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
541 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
542 | 542 | |
543 | 543 | } |
544 | 544 | |
545 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
546 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
545 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
546 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
547 | 547 | |
548 | 548 | /** |
549 | 549 | * Renders the credit card info form. |
@@ -554,73 +554,73 @@ discard block |
||
554 | 554 | * |
555 | 555 | * @return void |
556 | 556 | */ |
557 | -function give_get_cc_form( $form_id ) { |
|
557 | +function give_get_cc_form($form_id) { |
|
558 | 558 | |
559 | 559 | ob_start(); |
560 | 560 | |
561 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
561 | + do_action('give_before_cc_fields', $form_id); ?> |
|
562 | 562 | |
563 | 563 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
564 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
565 | - <?php if ( is_ssl() ) : ?> |
|
564 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
565 | + <?php if (is_ssl()) : ?> |
|
566 | 566 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
567 | 567 | <span class="give-icon padlock"></span> |
568 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
568 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
569 | 569 | </div> |
570 | 570 | <?php endif; ?> |
571 | 571 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
572 | 572 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
573 | - <?php _e( 'Card Number', 'give' ); ?> |
|
573 | + <?php _e('Card Number', 'give'); ?> |
|
574 | 574 | <span class="give-required-indicator">*</span> |
575 | - <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> |
|
575 | + <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> |
|
576 | 576 | <span class="card-type"></span> |
577 | 577 | </label> |
578 | 578 | |
579 | - <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/> |
|
579 | + <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/> |
|
580 | 580 | </p> |
581 | 581 | |
582 | 582 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
583 | 583 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
584 | - <?php _e( 'CVC', 'give' ); ?> |
|
584 | + <?php _e('CVC', 'give'); ?> |
|
585 | 585 | <span class="give-required-indicator">*</span> |
586 | - <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> |
|
586 | + <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> |
|
587 | 587 | </label> |
588 | 588 | |
589 | - <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/> |
|
589 | + <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/> |
|
590 | 590 | </p> |
591 | 591 | |
592 | 592 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
593 | 593 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
594 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
594 | + <?php _e('Name on the Card', 'give'); ?> |
|
595 | 595 | <span class="give-required-indicator">*</span> |
596 | - <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> |
|
596 | + <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> |
|
597 | 597 | </label> |
598 | 598 | |
599 | - <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/> |
|
599 | + <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/> |
|
600 | 600 | </p> |
601 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
601 | + <?php do_action('give_before_cc_expiration'); ?> |
|
602 | 602 | <p class="card-expiration form-row form-row-one-third"> |
603 | 603 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
604 | - <?php _e( 'Expiration', 'give' ); ?> |
|
604 | + <?php _e('Expiration', 'give'); ?> |
|
605 | 605 | <span class="give-required-indicator">*</span> |
606 | - <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> |
|
606 | + <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> |
|
607 | 607 | </label> |
608 | 608 | |
609 | 609 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
610 | 610 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
611 | 611 | |
612 | - <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/> |
|
612 | + <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/> |
|
613 | 613 | </p> |
614 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
614 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
615 | 615 | |
616 | 616 | </fieldset> |
617 | 617 | <?php |
618 | - do_action( 'give_after_cc_fields', $form_id ); |
|
618 | + do_action('give_after_cc_fields', $form_id); |
|
619 | 619 | |
620 | 620 | echo ob_get_clean(); |
621 | 621 | } |
622 | 622 | |
623 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
623 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
624 | 624 | |
625 | 625 | /** |
626 | 626 | * Outputs the default credit card address fields |
@@ -631,110 +631,110 @@ discard block |
||
631 | 631 | * |
632 | 632 | * @return void |
633 | 633 | */ |
634 | -function give_default_cc_address_fields( $form_id ) { |
|
634 | +function give_default_cc_address_fields($form_id) { |
|
635 | 635 | |
636 | 636 | $logged_in = is_user_logged_in(); |
637 | 637 | |
638 | - if ( $logged_in ) { |
|
639 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
638 | + if ($logged_in) { |
|
639 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
640 | 640 | } |
641 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
642 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
643 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
644 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
641 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
642 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
643 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
644 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
645 | 645 | ob_start(); ?> |
646 | 646 | <fieldset id="give_cc_address" class="cc-address"> |
647 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
648 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
647 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
648 | + <?php do_action('give_cc_billing_top'); ?> |
|
649 | 649 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
650 | 650 | <label for="card_address" class="give-label"> |
651 | - <?php _e( 'Address', 'give' ); ?> |
|
651 | + <?php _e('Address', 'give'); ?> |
|
652 | 652 | <?php |
653 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
653 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
654 | 654 | <span class="give-required-indicator">*</span> |
655 | 655 | <?php } ?> |
656 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
656 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
657 | 657 | </label> |
658 | 658 | |
659 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
659 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
660 | 660 | echo ' required'; |
661 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
661 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
662 | 662 | echo ' required '; |
663 | 663 | } ?>/> |
664 | 664 | </p> |
665 | 665 | |
666 | 666 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
667 | 667 | <label for="card_address_2" class="give-label"> |
668 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
669 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
668 | + <?php _e('Address Line 2', 'give'); ?> |
|
669 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
670 | 670 | <span class="give-required-indicator">*</span> |
671 | 671 | <?php } ?> |
672 | - <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> |
|
672 | + <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> |
|
673 | 673 | </label> |
674 | 674 | |
675 | - <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 ) ) { |
|
675 | + <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)) { |
|
676 | 676 | echo ' required'; |
677 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
677 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
678 | 678 | echo ' required '; |
679 | 679 | } ?>/> |
680 | 680 | </p> |
681 | 681 | |
682 | 682 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
683 | 683 | <label for="card_city" class="give-label"> |
684 | - <?php _e( 'City', 'give' ); ?> |
|
685 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
684 | + <?php _e('City', 'give'); ?> |
|
685 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
686 | 686 | <span class="give-required-indicator">*</span> |
687 | 687 | <?php } ?> |
688 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
688 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
689 | 689 | </label> |
690 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
690 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
691 | 691 | echo ' required'; |
692 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
692 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
693 | 693 | echo ' required '; |
694 | 694 | } ?>/> |
695 | 695 | </p> |
696 | 696 | |
697 | 697 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
698 | 698 | <label for="card_zip" class="give-label"> |
699 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
700 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
699 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
700 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
701 | 701 | <span class="give-required-indicator">*</span> |
702 | 702 | <?php } ?> |
703 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
703 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
704 | 704 | </label> |
705 | 705 | |
706 | - <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 ) ) { |
|
706 | + <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)) { |
|
707 | 707 | echo ' required'; |
708 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
708 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
709 | 709 | echo ' required '; |
710 | 710 | } ?>/> |
711 | 711 | </p> |
712 | 712 | |
713 | 713 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
714 | 714 | <label for="billing_country" class="give-label"> |
715 | - <?php _e( 'Country', 'give' ); ?> |
|
716 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
715 | + <?php _e('Country', 'give'); ?> |
|
716 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
717 | 717 | <span class="give-required-indicator">*</span> |
718 | 718 | <?php } ?> |
719 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
719 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
720 | 720 | </label> |
721 | 721 | |
722 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
722 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
723 | 723 | echo ' required'; |
724 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
724 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
725 | 725 | echo ' required '; |
726 | 726 | } ?>> |
727 | 727 | <?php |
728 | 728 | |
729 | 729 | $selected_country = give_get_country(); |
730 | 730 | |
731 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
731 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
732 | 732 | $selected_country = $user_address['country']; |
733 | 733 | } |
734 | 734 | |
735 | 735 | $countries = give_get_country_list(); |
736 | - foreach ( $countries as $country_code => $country ) { |
|
737 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
736 | + foreach ($countries as $country_code => $country) { |
|
737 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
738 | 738 | } |
739 | 739 | ?> |
740 | 740 | </select> |
@@ -742,44 +742,44 @@ discard block |
||
742 | 742 | |
743 | 743 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
744 | 744 | <label for="card_state" class="give-label"> |
745 | - <?php _e( 'State / Province', 'give' ); ?> |
|
746 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
745 | + <?php _e('State / Province', 'give'); ?> |
|
746 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
747 | 747 | <span class="give-required-indicator">*</span> |
748 | 748 | <?php } ?> |
749 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
749 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
750 | 750 | </label> |
751 | 751 | |
752 | 752 | <?php |
753 | 753 | $selected_state = give_get_state(); |
754 | - $states = give_get_states( $selected_country ); |
|
754 | + $states = give_get_states($selected_country); |
|
755 | 755 | |
756 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
756 | + if ($logged_in && ! empty($user_address['state'])) { |
|
757 | 757 | $selected_state = $user_address['state']; |
758 | 758 | } |
759 | 759 | |
760 | - if ( ! empty( $states ) ) : ?> |
|
761 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
760 | + if ( ! empty($states)) : ?> |
|
761 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
762 | 762 | echo ' required'; |
763 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
763 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
764 | 764 | echo ' required '; |
765 | 765 | } ?>> |
766 | 766 | <?php |
767 | - foreach ( $states as $state_code => $state ) { |
|
768 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
767 | + foreach ($states as $state_code => $state) { |
|
768 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
769 | 769 | } |
770 | 770 | ?> |
771 | 771 | </select> |
772 | 772 | <?php else : ?> |
773 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
773 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
774 | 774 | <?php endif; ?> |
775 | 775 | </p> |
776 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
776 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
777 | 777 | </fieldset> |
778 | 778 | <?php |
779 | 779 | echo ob_get_clean(); |
780 | 780 | } |
781 | 781 | |
782 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
782 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
783 | 783 | |
784 | 784 | |
785 | 785 | /** |
@@ -791,93 +791,93 @@ discard block |
||
791 | 791 | * |
792 | 792 | * @return string |
793 | 793 | */ |
794 | -function give_get_register_fields( $form_id ) { |
|
794 | +function give_get_register_fields($form_id) { |
|
795 | 795 | |
796 | 796 | global $user_ID; |
797 | 797 | |
798 | - if ( is_user_logged_in() ) { |
|
799 | - $user_data = get_userdata( $user_ID ); |
|
798 | + if (is_user_logged_in()) { |
|
799 | + $user_data = get_userdata($user_ID); |
|
800 | 800 | } |
801 | 801 | |
802 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
802 | + $show_register_form = give_show_login_register_option($form_id); |
|
803 | 803 | |
804 | 804 | ob_start(); ?> |
805 | 805 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
806 | 806 | |
807 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
807 | + <?php if ($show_register_form == 'both') { ?> |
|
808 | 808 | <div class="give-login-account-wrap"> |
809 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
810 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
809 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
810 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
811 | 811 | </p> |
812 | 812 | <p class="give-loading-text"> |
813 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
813 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
814 | 814 | </div> |
815 | 815 | <?php } ?> |
816 | 816 | |
817 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
817 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
818 | 818 | |
819 | 819 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
820 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
821 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
822 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
820 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
821 | + if ( ! give_logged_in_only($form_id)) { |
|
822 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
823 | 823 | } ?></legend> |
824 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
824 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
825 | 825 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
826 | 826 | <label for="give-user-login-<?php echo $form_id; ?>"> |
827 | - <?php _e( 'Username', 'give' ); ?> |
|
828 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
827 | + <?php _e('Username', 'give'); ?> |
|
828 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
829 | 829 | <span class="give-required-indicator">*</span> |
830 | 830 | <?php } ?> |
831 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
831 | + <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> |
|
832 | 832 | </label> |
833 | 833 | |
834 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
834 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
835 | 835 | echo 'required '; |
836 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
836 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
837 | 837 | </div> |
838 | 838 | |
839 | 839 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
840 | 840 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
841 | - <?php _e( 'Password', 'give' ); ?> |
|
842 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
841 | + <?php _e('Password', 'give'); ?> |
|
842 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
843 | 843 | <span class="give-required-indicator">*</span> |
844 | 844 | <?php } ?> |
845 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
845 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
846 | 846 | </label> |
847 | 847 | |
848 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
848 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
849 | 849 | echo 'required '; |
850 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
850 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
851 | 851 | </div> |
852 | 852 | |
853 | 853 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
854 | 854 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
855 | - <?php _e( 'Confirm PW', 'give' ); ?> |
|
856 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
855 | + <?php _e('Confirm PW', 'give'); ?> |
|
856 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
857 | 857 | <span class="give-required-indicator">*</span> |
858 | 858 | <?php } ?> |
859 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
859 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
860 | 860 | </label> |
861 | 861 | |
862 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
862 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
863 | 863 | echo 'required '; |
864 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
864 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
865 | 865 | </div> |
866 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
866 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
867 | 867 | </fieldset> |
868 | 868 | |
869 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
869 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
870 | 870 | |
871 | 871 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
872 | 872 | |
873 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
873 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
874 | 874 | |
875 | 875 | </fieldset> |
876 | 876 | <?php |
877 | 877 | echo ob_get_clean(); |
878 | 878 | } |
879 | 879 | |
880 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
880 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
881 | 881 | |
882 | 882 | /** |
883 | 883 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -890,73 +890,73 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @return string |
892 | 892 | */ |
893 | -function give_get_login_fields( $form_id ) { |
|
893 | +function give_get_login_fields($form_id) { |
|
894 | 894 | |
895 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
896 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
895 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
896 | + $show_register_form = give_show_login_register_option($form_id); |
|
897 | 897 | |
898 | 898 | ob_start(); |
899 | 899 | ?> |
900 | 900 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
901 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
902 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
903 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
901 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
902 | + if ( ! give_logged_in_only($form_id)) { |
|
903 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
904 | 904 | } ?> |
905 | 905 | </legend> |
906 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
906 | + <?php if ($show_register_form == 'both') { ?> |
|
907 | 907 | <p class="give-new-account-link"> |
908 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
909 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
910 | - <?php _e( 'Register', 'give' ); |
|
911 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
912 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
908 | + <?php _e('Need to create an account?', 'give'); ?> |
|
909 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
910 | + <?php _e('Register', 'give'); |
|
911 | + if ( ! give_logged_in_only($form_id)) { |
|
912 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
913 | 913 | } ?> |
914 | 914 | </a> |
915 | 915 | </p> |
916 | 916 | <p class="give-loading-text"> |
917 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
917 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
918 | 918 | <?php } ?> |
919 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
919 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
920 | 920 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
921 | 921 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
922 | - <?php _e( 'Username', 'give' ); ?> |
|
923 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
922 | + <?php _e('Username', 'give'); ?> |
|
923 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
924 | 924 | <span class="give-required-indicator">*</span> |
925 | 925 | <?php } ?> |
926 | 926 | </label> |
927 | 927 | |
928 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
928 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
929 | 929 | echo 'required '; |
930 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
930 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
931 | 931 | </div> |
932 | 932 | |
933 | 933 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
934 | 934 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
935 | - <?php _e( 'Password', 'give' ); ?> |
|
936 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
935 | + <?php _e('Password', 'give'); ?> |
|
936 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
937 | 937 | <span class="give-required-indicator">*</span> |
938 | 938 | <?php } ?> |
939 | 939 | </label> |
940 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
940 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
941 | 941 | echo 'required '; |
942 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
942 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
943 | 943 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
944 | 944 | </div> |
945 | 945 | |
946 | 946 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
947 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
948 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
949 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
947 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
948 | + <?php if ($show_register_form !== 'login') { ?> |
|
949 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
950 | 950 | <?php } ?> |
951 | 951 | <span class="give-loading-animation"></span> |
952 | 952 | </div> |
953 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
953 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
954 | 954 | </fieldset><!--end #give-login-fields--> |
955 | 955 | <?php |
956 | 956 | echo ob_get_clean(); |
957 | 957 | } |
958 | 958 | |
959 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
959 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
960 | 960 | |
961 | 961 | /** |
962 | 962 | * Payment Mode Select |
@@ -972,49 +972,49 @@ discard block |
||
972 | 972 | * |
973 | 973 | * @return void |
974 | 974 | */ |
975 | -function give_payment_mode_select( $form_id ) { |
|
975 | +function give_payment_mode_select($form_id) { |
|
976 | 976 | |
977 | 977 | $gateways = give_get_enabled_payment_gateways(); |
978 | 978 | |
979 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
979 | + do_action('give_payment_mode_top', $form_id); ?> |
|
980 | 980 | |
981 | 981 | <fieldset id="give-payment-mode-select"> |
982 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
982 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
983 | 983 | <div id="give-payment-mode-wrap"> |
984 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
985 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
984 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
985 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
986 | 986 | </legend> |
987 | 987 | <?php |
988 | 988 | |
989 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
989 | + do_action('give_payment_mode_before_gateways') ?> |
|
990 | 990 | |
991 | 991 | <ul id="give-gateway-radio-list"> |
992 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
993 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
992 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
993 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
994 | 994 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
995 | - 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 ) . '">'; |
|
996 | - 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'] ); |
|
995 | + 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).'">'; |
|
996 | + 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']); |
|
997 | 997 | echo '</label></li>'; |
998 | 998 | endforeach; ?> |
999 | 999 | </ul> |
1000 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
1000 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
1001 | 1001 | </div> |
1002 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
1002 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
1003 | 1003 | </fieldset> |
1004 | 1004 | |
1005 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
1005 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
1006 | 1006 | |
1007 | 1007 | <div id="give_purchase_form_wrap"> |
1008 | 1008 | |
1009 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
1009 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
1010 | 1010 | |
1011 | 1011 | </div><!-- the checkout fields are loaded into this--> |
1012 | 1012 | |
1013 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
1013 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1014 | 1014 | |
1015 | 1015 | } |
1016 | 1016 | |
1017 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1017 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1018 | 1018 | |
1019 | 1019 | |
1020 | 1020 | /** |
@@ -1029,35 +1029,35 @@ discard block |
||
1029 | 1029 | * |
1030 | 1030 | * @return void |
1031 | 1031 | */ |
1032 | -function give_terms_agreement( $form_id ) { |
|
1032 | +function give_terms_agreement($form_id) { |
|
1033 | 1033 | |
1034 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1035 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1036 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1034 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1035 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1036 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1037 | 1037 | |
1038 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1038 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1039 | 1039 | <fieldset id="give_terms_agreement"> |
1040 | 1040 | <div id="give_terms" style="display:none;"> |
1041 | 1041 | <?php |
1042 | - do_action( 'give_before_terms' ); |
|
1043 | - echo wpautop( stripslashes( $terms ) ); |
|
1044 | - do_action( 'give_after_terms' ); |
|
1042 | + do_action('give_before_terms'); |
|
1043 | + echo wpautop(stripslashes($terms)); |
|
1044 | + do_action('give_after_terms'); |
|
1045 | 1045 | ?> |
1046 | 1046 | </div> |
1047 | 1047 | <div id="give_show_terms"> |
1048 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1049 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1048 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1049 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1050 | 1050 | </div> |
1051 | 1051 | |
1052 | 1052 | <label |
1053 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1053 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1054 | 1054 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1055 | 1055 | </fieldset> |
1056 | 1056 | <?php |
1057 | 1057 | } |
1058 | 1058 | } |
1059 | 1059 | |
1060 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1060 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1061 | 1061 | |
1062 | 1062 | /** |
1063 | 1063 | * Checkout Final Total |
@@ -1069,27 +1069,27 @@ discard block |
||
1069 | 1069 | * @since 1.0 |
1070 | 1070 | * @return void |
1071 | 1071 | */ |
1072 | -function give_checkout_final_total( $form_id ) { |
|
1072 | +function give_checkout_final_total($form_id) { |
|
1073 | 1073 | |
1074 | - if ( isset( $_POST['give_total'] ) ) { |
|
1075 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1074 | + if (isset($_POST['give_total'])) { |
|
1075 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1076 | 1076 | } else { |
1077 | 1077 | //default total |
1078 | - $total = give_get_default_form_amount( $form_id ); |
|
1078 | + $total = give_get_default_form_amount($form_id); |
|
1079 | 1079 | } |
1080 | 1080 | //Only proceed if give_total available |
1081 | - if ( empty( $total ) ) { |
|
1081 | + if (empty($total)) { |
|
1082 | 1082 | return; |
1083 | 1083 | } |
1084 | 1084 | ?> |
1085 | 1085 | <p id="give-final-total-wrap" class="form-wrap "> |
1086 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1087 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1086 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1087 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1088 | 1088 | </p> |
1089 | 1089 | <?php |
1090 | 1090 | } |
1091 | 1091 | |
1092 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1092 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | /** |
@@ -1101,22 +1101,22 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @return void |
1103 | 1103 | */ |
1104 | -function give_checkout_submit( $form_id ) { |
|
1104 | +function give_checkout_submit($form_id) { |
|
1105 | 1105 | ?> |
1106 | 1106 | <fieldset id="give_purchase_submit"> |
1107 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1107 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1108 | 1108 | |
1109 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1109 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1110 | 1110 | |
1111 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1111 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1112 | 1112 | |
1113 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1113 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1114 | 1114 | |
1115 | 1115 | </fieldset> |
1116 | 1116 | <?php |
1117 | 1117 | } |
1118 | 1118 | |
1119 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1119 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | /** |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | * |
1130 | 1130 | * @return string |
1131 | 1131 | */ |
1132 | -function give_checkout_button_purchase( $form_id ) { |
|
1132 | +function give_checkout_button_purchase($form_id) { |
|
1133 | 1133 | |
1134 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1135 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1134 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1135 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1136 | 1136 | |
1137 | 1137 | ob_start(); |
1138 | 1138 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | <span class="give-loading-animation"></span> |
1144 | 1144 | </div> |
1145 | 1145 | <?php |
1146 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1146 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | /** |
@@ -1156,11 +1156,11 @@ discard block |
||
1156 | 1156 | * |
1157 | 1157 | * @return void |
1158 | 1158 | */ |
1159 | -function give_agree_to_terms_js( $form_id ) { |
|
1159 | +function give_agree_to_terms_js($form_id) { |
|
1160 | 1160 | |
1161 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1161 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1162 | 1162 | |
1163 | - if ( $form_option === 'yes' ) { |
|
1163 | + if ($form_option === 'yes') { |
|
1164 | 1164 | ?> |
1165 | 1165 | <script type="text/javascript"> |
1166 | 1166 | jQuery(document).ready(function ($) { |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | } |
1177 | 1177 | } |
1178 | 1178 | |
1179 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1179 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1180 | 1180 | |
1181 | 1181 | |
1182 | 1182 | /** |
@@ -1189,19 +1189,19 @@ discard block |
||
1189 | 1189 | * |
1190 | 1190 | * @return void |
1191 | 1191 | */ |
1192 | -function give_form_content( $form_id, $args ) { |
|
1192 | +function give_form_content($form_id, $args) { |
|
1193 | 1193 | |
1194 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1194 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1195 | 1195 | ? $args['show_content'] |
1196 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1196 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1197 | 1197 | |
1198 | - if ( $show_content !== 'none' ) { |
|
1198 | + if ($show_content !== 'none') { |
|
1199 | 1199 | //add action according to value |
1200 | - add_action( $show_content, 'give_form_display_content' ); |
|
1200 | + add_action($show_content, 'give_form_display_content'); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1204 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1205 | 1205 | |
1206 | 1206 | /** |
1207 | 1207 | * Show Give Goals |
@@ -1214,25 +1214,25 @@ discard block |
||
1214 | 1214 | * @return mixed |
1215 | 1215 | */ |
1216 | 1216 | |
1217 | -function give_show_goal_progress( $form_id, $args ) { |
|
1217 | +function give_show_goal_progress($form_id, $args) { |
|
1218 | 1218 | |
1219 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1220 | - $form = new Give_Donate_Form( $form_id ); |
|
1219 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1220 | + $form = new Give_Donate_Form($form_id); |
|
1221 | 1221 | $goal = $form->goal; |
1222 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
1222 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
1223 | 1223 | $income = $form->get_earnings(); |
1224 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1225 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1226 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1224 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1225 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1226 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1227 | 1227 | |
1228 | 1228 | //Sanity check - respect shortcode args |
1229 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1229 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1230 | 1230 | return false; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | //Sanity check - ensure form has goal set to output |
1234 | - if ( empty( $form->ID ) |
|
1235 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1234 | + if (empty($form->ID) |
|
1235 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1236 | 1236 | || $goal_option !== 'yes' |
1237 | 1237 | || $goal == 0 |
1238 | 1238 | ) { |
@@ -1240,26 +1240,26 @@ discard block |
||
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1243 | + $progress = round(($income / $goal) * 100, 2); |
|
1244 | 1244 | |
1245 | - if ( $income > $goal ) { |
|
1245 | + if ($income > $goal) { |
|
1246 | 1246 | $progress = 100; |
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | $output = '<div class="give-goal-progress">'; |
1250 | 1250 | |
1251 | 1251 | //Goal Progress Text |
1252 | - if ( ! empty( $show_text ) ) { |
|
1252 | + if ( ! empty($show_text)) { |
|
1253 | 1253 | |
1254 | 1254 | $output .= '<div class="raised">'; |
1255 | 1255 | |
1256 | - if ( $goal_format !== 'percentage' ) { |
|
1256 | + if ($goal_format !== 'percentage') { |
|
1257 | 1257 | |
1258 | - $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>'; |
|
1258 | + $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>'; |
|
1259 | 1259 | |
1260 | - } elseif ( $goal_format == 'percentage' ) { |
|
1260 | + } elseif ($goal_format == 'percentage') { |
|
1261 | 1261 | |
1262 | - $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>'; |
|
1262 | + $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>'; |
|
1263 | 1263 | |
1264 | 1264 | } |
1265 | 1265 | |
@@ -1268,11 +1268,11 @@ discard block |
||
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | //Goal Progress Bar |
1271 | - if ( ! empty( $show_bar ) ) { |
|
1271 | + if ( ! empty($show_bar)) { |
|
1272 | 1272 | $output .= '<div class="give-progress-bar">'; |
1273 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1274 | - if ( ! empty( $color ) ) { |
|
1275 | - $output .= 'background-color:' . $color; |
|
1273 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1274 | + if ( ! empty($color)) { |
|
1275 | + $output .= 'background-color:'.$color; |
|
1276 | 1276 | } |
1277 | 1277 | $output .= '"></span>'; |
1278 | 1278 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1280,13 +1280,13 @@ discard block |
||
1280 | 1280 | |
1281 | 1281 | $output .= '</div><!-- /.goal-progress -->'; |
1282 | 1282 | |
1283 | - echo apply_filters( 'give_goal_output', $output ); |
|
1283 | + echo apply_filters('give_goal_output', $output); |
|
1284 | 1284 | |
1285 | 1285 | return false; |
1286 | 1286 | |
1287 | 1287 | } |
1288 | 1288 | |
1289 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1289 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1290 | 1290 | |
1291 | 1291 | /** |
1292 | 1292 | * Renders Post Form Content |
@@ -1298,17 +1298,17 @@ discard block |
||
1298 | 1298 | * @return void |
1299 | 1299 | * @since 1.0 |
1300 | 1300 | */ |
1301 | -function give_form_display_content( $form_id ) { |
|
1301 | +function give_form_display_content($form_id) { |
|
1302 | 1302 | |
1303 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1303 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1304 | 1304 | |
1305 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1306 | - $content = apply_filters( 'the_content', $content ); |
|
1305 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1306 | + $content = apply_filters('the_content', $content); |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1309 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1310 | 1310 | |
1311 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1311 | + echo apply_filters('give_form_content_output', $output); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | |
@@ -1321,16 +1321,16 @@ discard block |
||
1321 | 1321 | * |
1322 | 1322 | * @return void |
1323 | 1323 | */ |
1324 | -function give_checkout_hidden_fields( $form_id ) { |
|
1324 | +function give_checkout_hidden_fields($form_id) { |
|
1325 | 1325 | |
1326 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1327 | - if ( is_user_logged_in() ) { ?> |
|
1326 | + do_action('give_hidden_fields_before', $form_id); |
|
1327 | + if (is_user_logged_in()) { ?> |
|
1328 | 1328 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1329 | 1329 | <?php } ?> |
1330 | 1330 | <input type="hidden" name="give_action" value="purchase"/> |
1331 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1331 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1332 | 1332 | <?php |
1333 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1333 | + do_action('give_hidden_fields_after', $form_id); |
|
1334 | 1334 | |
1335 | 1335 | } |
1336 | 1336 | |
@@ -1345,20 +1345,20 @@ discard block |
||
1345 | 1345 | * |
1346 | 1346 | * @return string $content Filtered content |
1347 | 1347 | */ |
1348 | -function give_filter_success_page_content( $content ) { |
|
1348 | +function give_filter_success_page_content($content) { |
|
1349 | 1349 | |
1350 | 1350 | global $give_options; |
1351 | 1351 | |
1352 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1353 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1354 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1352 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1353 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1354 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1355 | 1355 | } |
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | return $content; |
1359 | 1359 | } |
1360 | 1360 | |
1361 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1361 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1362 | 1362 | |
1363 | 1363 | |
1364 | 1364 | /** |
@@ -1370,14 +1370,14 @@ discard block |
||
1370 | 1370 | |
1371 | 1371 | function give_test_mode_frontend_warning() { |
1372 | 1372 | |
1373 | - $test_mode = give_get_option( 'test_mode' ); |
|
1373 | + $test_mode = give_get_option('test_mode'); |
|
1374 | 1374 | |
1375 | - if ( $test_mode == 'on' ) { |
|
1376 | - 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>'; |
|
1375 | + if ($test_mode == 'on') { |
|
1376 | + 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>'; |
|
1377 | 1377 | } |
1378 | 1378 | } |
1379 | 1379 | |
1380 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1380 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1381 | 1381 | |
1382 | 1382 | |
1383 | 1383 | /** |
@@ -1387,21 +1387,21 @@ discard block |
||
1387 | 1387 | * @since 1.4.1 |
1388 | 1388 | */ |
1389 | 1389 | |
1390 | -function give_members_only_form( $final_output, $args ) { |
|
1390 | +function give_members_only_form($final_output, $args) { |
|
1391 | 1391 | |
1392 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1392 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1393 | 1393 | |
1394 | 1394 | //Sanity Check: Must have form_id & not be logged in |
1395 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1395 | + if (empty($form_id) || is_user_logged_in()) { |
|
1396 | 1396 | return $final_output; |
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | //Logged in only and Register / Login set to none |
1400 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1400 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1401 | 1401 | |
1402 | - $final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false ); |
|
1402 | + $final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false); |
|
1403 | 1403 | |
1404 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1404 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1405 | 1405 | |
1406 | 1406 | } |
1407 | 1407 | |
@@ -1409,4 +1409,4 @@ discard block |
||
1409 | 1409 | |
1410 | 1410 | } |
1411 | 1411 | |
1412 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1413 | 1412 | \ No newline at end of file |
1413 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
1414 | 1414 | \ No newline at end of file |