@@ -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,14 +23,14 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | static $count = 1; |
| 30 | 30 | |
| 31 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 31 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 32 | 32 | |
| 33 | - if ( isset( $args['id'] ) ) { |
|
| 33 | + if (isset($args['id'])) { |
|
| 34 | 34 | $form_id = $args['id']; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | ) |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - $args = wp_parse_args( $args, $defaults ); |
|
| 43 | + $args = wp_parse_args($args, $defaults); |
|
| 44 | 44 | |
| 45 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 45 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 46 | 46 | |
| 47 | 47 | // Bail out, if no form ID. |
| 48 | - if ( empty( $form->ID ) ) { |
|
| 48 | + if (empty($form->ID)) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $args['id_prefix'] = "{$form_id}-{$count}"; |
| 53 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 53 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 54 | 54 | |
| 55 | 55 | $form_action = add_query_arg( |
| 56 | 56 | apply_filters( |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | // Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 65 | 65 | if ( |
| 66 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 67 | - || ( 'trash' === $form->post_status ) |
|
| 66 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 67 | + || ('trash' === $form->post_status) |
|
| 68 | 68 | ) { |
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Get the form wrap CSS classes. |
| 73 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 73 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 74 | 74 | |
| 75 | 75 | // Get the <form> tag wrap CSS classes. |
| 76 | - $form_classes = $form->get_form_classes( $args ); |
|
| 76 | + $form_classes = $form->get_form_classes($args); |
|
| 77 | 77 | |
| 78 | 78 | ob_start(); |
| 79 | 79 | |
@@ -85,21 +85,21 @@ discard block |
||
| 85 | 85 | * @param int $form_id The form ID. |
| 86 | 86 | * @param array $args An array of form arguments. |
| 87 | 87 | */ |
| 88 | - do_action( 'give_pre_form_output', $form->ID, $args, $form ); |
|
| 88 | + do_action('give_pre_form_output', $form->ID, $args, $form); |
|
| 89 | 89 | |
| 90 | 90 | ?> |
| 91 | 91 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 92 | 92 | <?php |
| 93 | - if ( $form->is_close_donation_form() ) { |
|
| 93 | + if ($form->is_close_donation_form()) { |
|
| 94 | 94 | |
| 95 | - $form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : ''; |
|
| 95 | + $form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : ''; |
|
| 96 | 96 | |
| 97 | 97 | // Get Goal thank you message. |
| 98 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 99 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 98 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 99 | + $goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 100 | 100 | |
| 101 | 101 | // Print thank you message. |
| 102 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form ); |
|
| 102 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form); |
|
| 103 | 103 | |
| 104 | 104 | } else { |
| 105 | 105 | /** |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | * 1. if show_title params set to true |
| 108 | 108 | * 2. if admin set form display_style to button |
| 109 | 109 | */ |
| 110 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 110 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 111 | 111 | if ( |
| 112 | 112 | ( |
| 113 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 114 | - || ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) ) |
|
| 113 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 114 | + || ('button' === get_post_meta($form_id, '_give_payment_display', true)) |
|
| 115 | 115 | ) |
| 116 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 116 | + && ! doing_action('give_single_form_summary') |
|
| 117 | 117 | ) { |
| 118 | 118 | echo $form_title; |
| 119 | 119 | } |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | * @param array $args An array of form arguments. |
| 128 | 128 | * @param Give_Donate_Form $form Form object. |
| 129 | 129 | */ |
| 130 | - do_action( 'give_pre_form', $form->ID, $args, $form ); |
|
| 130 | + do_action('give_pre_form', $form->ID, $args, $form); |
|
| 131 | 131 | |
| 132 | 132 | // Set form html tags. |
| 133 | 133 | $form_html_tags = array( |
| 134 | 134 | 'id' => "give-form-{$args['id_prefix']}", |
| 135 | 135 | 'class' => $form_classes, |
| 136 | - 'action' => esc_url_raw( $form_action ), |
|
| 136 | + 'action' => esc_url_raw($form_action), |
|
| 137 | 137 | 'data-id' => $args['id_prefix'], |
| 138 | 138 | ); |
| 139 | 139 | |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | * @param array $form_html_tags Array of form html tags. |
| 146 | 146 | * @param Give_Donate_Form $form Form object. |
| 147 | 147 | */ |
| 148 | - $form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form ); |
|
| 148 | + $form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form); |
|
| 149 | 149 | ?> |
| 150 | - <form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post"> |
|
| 150 | + <form <?php echo give_get_attribute_str($form_html_tags); ?> method="post"> |
|
| 151 | 151 | <!-- The following field is for robots only, invisible to humans: --> |
| 152 | 152 | <span class="give-hidden" style="display: none !important;"> |
| 153 | 153 | <label for="give-form-honeypot-<?php echo $form_id; ?>"></label> |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param array $args An array of form arguments. |
| 166 | 166 | * @param Give_Donate_Form $form Form object. |
| 167 | 167 | */ |
| 168 | - do_action( 'give_donation_form_top', $form->ID, $args, $form ); |
|
| 168 | + do_action('give_donation_form_top', $form->ID, $args, $form); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Fires while outputting donation form, for payment gateway fields. |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param array $args An array of form arguments. |
| 177 | 177 | * @param Give_Donate_Form $form Form object. |
| 178 | 178 | */ |
| 179 | - do_action( 'give_payment_mode_select', $form->ID, $args, $form ); |
|
| 179 | + do_action('give_payment_mode_select', $form->ID, $args, $form); |
|
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * Fires while outputting donation form, after all other fields. |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param array $args An array of form arguments. |
| 188 | 188 | * @param Give_Donate_Form $form Form object. |
| 189 | 189 | */ |
| 190 | - do_action( 'give_donation_form_bottom', $form->ID, $args, $form ); |
|
| 190 | + do_action('give_donation_form_bottom', $form->ID, $args, $form); |
|
| 191 | 191 | |
| 192 | 192 | ?> |
| 193 | 193 | </form> |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | * @param array $args An array of form arguments. |
| 203 | 203 | * @param Give_Donate_Form $form Form object. |
| 204 | 204 | */ |
| 205 | - do_action( 'give_post_form', $form->ID, $args, $form ); |
|
| 205 | + do_action('give_post_form', $form->ID, $args, $form); |
|
| 206 | 206 | |
| 207 | 207 | } |
| 208 | 208 | ?> |
| 209 | 209 | |
| 210 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 210 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 211 | 211 | <?php |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | * @param int $form_id The form ID. |
| 219 | 219 | * @param array $args An array of form arguments. |
| 220 | 220 | */ |
| 221 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 221 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 222 | 222 | |
| 223 | 223 | $final_output = ob_get_clean(); |
| 224 | - $count ++; |
|
| 224 | + $count++; |
|
| 225 | 225 | |
| 226 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 226 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @return string |
| 242 | 242 | */ |
| 243 | -function give_show_purchase_form( $form_id, $args ) { |
|
| 243 | +function give_show_purchase_form($form_id, $args) { |
|
| 244 | 244 | |
| 245 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 245 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 246 | 246 | |
| 247 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 247 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 248 | 248 | $form_id = $_POST['give_form_id']; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -253,33 +253,33 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_payment_fields_top', $form_id ); |
|
| 256 | + do_action('give_payment_fields_top', $form_id); |
|
| 257 | 257 | |
| 258 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 258 | + if (give_can_checkout() && isset($form_id)) { |
|
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | 261 | * Fires while displaying donation form, before registration login. |
| 262 | 262 | * |
| 263 | 263 | * @since 1.7 |
| 264 | 264 | */ |
| 265 | - do_action( 'give_donation_form_before_register_login', $form_id, $args ); |
|
| 265 | + do_action('give_donation_form_before_register_login', $form_id, $args); |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * Fire when register/login form fields render. |
| 269 | 269 | * |
| 270 | 270 | * @since 1.7 |
| 271 | 271 | */ |
| 272 | - do_action( 'give_donation_form_register_login_fields', $form_id, $args ); |
|
| 272 | + do_action('give_donation_form_register_login_fields', $form_id, $args); |
|
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * Fire when credit card form fields render. |
| 276 | 276 | * |
| 277 | 277 | * @since 1.7 |
| 278 | 278 | */ |
| 279 | - do_action( 'give_donation_form_before_cc_form', $form_id, $args ); |
|
| 279 | + do_action('give_donation_form_before_cc_form', $form_id, $args); |
|
| 280 | 280 | |
| 281 | 281 | // Load the credit card form and allow gateways to load their own if they wish. |
| 282 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 282 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 285 | 285 | * |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( "give_{$payment_mode}_cc_form", $form_id, $args ); |
|
| 290 | + do_action("give_{$payment_mode}_cc_form", $form_id, $args); |
|
| 291 | 291 | } else { |
| 292 | 292 | /** |
| 293 | 293 | * Fires while displaying donation form, credit card form fields. |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * |
| 297 | 297 | * @param int $form_id The form ID. |
| 298 | 298 | */ |
| 299 | - do_action( 'give_cc_form', $form_id, $args ); |
|
| 299 | + do_action('give_cc_form', $form_id, $args); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @since 1.7 |
| 306 | 306 | */ |
| 307 | - do_action( 'give_donation_form_after_cc_form', $form_id, $args ); |
|
| 307 | + do_action('give_donation_form_after_cc_form', $form_id, $args); |
|
| 308 | 308 | |
| 309 | 309 | } else { |
| 310 | 310 | /** |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 315 | + do_action('give_donation_form_no_access', $form_id); |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | * |
| 322 | 322 | * @since 1.7 |
| 323 | 323 | */ |
| 324 | - do_action( 'give_payment_fields_bottom', $form_id, $args ); |
|
| 324 | + do_action('give_payment_fields_bottom', $form_id, $args); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | -add_action( 'give_donation_form', 'give_show_purchase_form', 10, 2 ); |
|
| 327 | +add_action('give_donation_form', 'give_show_purchase_form', 10, 2); |
|
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * Give Show Login/Register Form Fields. |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | * |
| 336 | 336 | * @return void |
| 337 | 337 | */ |
| 338 | -function give_show_register_login_fields( $form_id ) { |
|
| 338 | +function give_show_register_login_fields($form_id) { |
|
| 339 | 339 | |
| 340 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 340 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 341 | 341 | |
| 342 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 342 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 343 | 343 | ?> |
| 344 | 344 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 345 | 345 | <?php |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | * |
| 349 | 349 | * @since 1.7 |
| 350 | 350 | */ |
| 351 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 351 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 352 | 352 | ?> |
| 353 | 353 | </div> |
| 354 | 354 | <?php |
| 355 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 355 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 356 | 356 | ?> |
| 357 | 357 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 358 | 358 | <?php |
@@ -361,23 +361,23 @@ discard block |
||
| 361 | 361 | * |
| 362 | 362 | * @since 1.7 |
| 363 | 363 | */ |
| 364 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 364 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 365 | 365 | ?> |
| 366 | 366 | </div> |
| 367 | 367 | <?php |
| 368 | 368 | endif; |
| 369 | 369 | |
| 370 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 370 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 371 | 371 | /** |
| 372 | 372 | * Fire when user info render. |
| 373 | 373 | * |
| 374 | 374 | * @since 1.7 |
| 375 | 375 | */ |
| 376 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 376 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 380 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * Donation Amount Field. |
@@ -392,21 +392,21 @@ discard block |
||
| 392 | 392 | * |
| 393 | 393 | * @return void |
| 394 | 394 | */ |
| 395 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 395 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 396 | 396 | |
| 397 | 397 | $give_options = give_get_settings(); |
| 398 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 399 | - $allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 400 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 401 | - $symbol = give_currency_symbol( give_get_currency( $form_id, $args ) ); |
|
| 402 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 398 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 399 | + $allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 400 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 401 | + $symbol = give_currency_symbol(give_get_currency($form_id, $args)); |
|
| 402 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 403 | 403 | $default_amount = give_format_amount( |
| 404 | - give_get_default_form_amount( $form_id ), array( |
|
| 404 | + give_get_default_form_amount($form_id), array( |
|
| 405 | 405 | 'sanitize' => false, |
| 406 | - 'currency' => give_get_currency( $form_id ), |
|
| 406 | + 'currency' => give_get_currency($form_id), |
|
| 407 | 407 | ) |
| 408 | 408 | ); |
| 409 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 409 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | 412 | * Fires while displaying donation form, before donation level fields. |
@@ -416,23 +416,23 @@ discard block |
||
| 416 | 416 | * @param int $form_id The form ID. |
| 417 | 417 | * @param array $args An array of form arguments. |
| 418 | 418 | */ |
| 419 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 419 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 420 | 420 | |
| 421 | 421 | // Set Price, No Custom Amount Allowed means hidden price field. |
| 422 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 422 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 423 | 423 | ?> |
| 424 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 424 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 425 | 425 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 426 | 426 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 427 | 427 | <div class="set-price give-donation-amount form-row-wide"> |
| 428 | 428 | <?php |
| 429 | - if ( 'before' === $currency_position ) { |
|
| 429 | + if ('before' === $currency_position) { |
|
| 430 | 430 | echo $currency_output; |
| 431 | 431 | } |
| 432 | 432 | ?> |
| 433 | 433 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 434 | 434 | <?php |
| 435 | - if ( 'after' === $currency_position ) { |
|
| 435 | + if ('after' === $currency_position) { |
|
| 436 | 436 | echo $currency_output; |
| 437 | 437 | } |
| 438 | 438 | ?> |
@@ -444,15 +444,15 @@ discard block |
||
| 444 | 444 | <div class="give-total-wrap"> |
| 445 | 445 | <div class="give-donation-amount form-row-wide"> |
| 446 | 446 | <?php |
| 447 | - if ( 'before' === $currency_position ) { |
|
| 447 | + if ('before' === $currency_position) { |
|
| 448 | 448 | echo $currency_output; |
| 449 | 449 | } |
| 450 | 450 | ?> |
| 451 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 451 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 452 | 452 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 453 | 453 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 454 | 454 | <?php |
| 455 | - if ( 'after' === $currency_position ) { |
|
| 455 | + if ('after' === $currency_position) { |
|
| 456 | 456 | echo $currency_output; |
| 457 | 457 | } |
| 458 | 458 | ?> |
@@ -469,18 +469,18 @@ discard block |
||
| 469 | 469 | * @param int $form_id The form ID. |
| 470 | 470 | * @param array $args An array of form arguments. |
| 471 | 471 | */ |
| 472 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 472 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 473 | 473 | |
| 474 | 474 | // Custom Amount Text |
| 475 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 475 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { |
|
| 476 | 476 | ?> |
| 477 | 477 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 478 | 478 | <?php |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | // Output Variable Pricing Levels. |
| 482 | - if ( $variable_pricing ) { |
|
| 483 | - give_output_levels( $form_id ); |
|
| 482 | + if ($variable_pricing) { |
|
| 483 | + give_output_levels($form_id); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -491,10 +491,10 @@ discard block |
||
| 491 | 491 | * @param int $form_id The form ID. |
| 492 | 492 | * @param array $args An array of form arguments. |
| 493 | 493 | */ |
| 494 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 494 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | -add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 497 | +add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 498 | 498 | |
| 499 | 499 | /** |
| 500 | 500 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * |
| 506 | 506 | * @return string Donation levels. |
| 507 | 507 | */ |
| 508 | -function give_output_levels( $form_id ) { |
|
| 508 | +function give_output_levels($form_id) { |
|
| 509 | 509 | |
| 510 | 510 | /** |
| 511 | 511 | * Filter the variable pricing |
@@ -517,30 +517,30 @@ discard block |
||
| 517 | 517 | * @param array $prices Array of variable prices. |
| 518 | 518 | * @param int $form Form ID. |
| 519 | 519 | */ |
| 520 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 520 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 521 | 521 | |
| 522 | - $display_style = give_get_meta( $form_id, '_give_display_style', true ); |
|
| 523 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 524 | - $custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 522 | + $display_style = give_get_meta($form_id, '_give_display_style', true); |
|
| 523 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 524 | + $custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true); |
|
| 525 | 525 | |
| 526 | - if ( empty( $custom_amount_text ) ) { |
|
| 527 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 526 | + if (empty($custom_amount_text)) { |
|
| 527 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | $output = ''; |
| 531 | 531 | |
| 532 | - switch ( $display_style ) { |
|
| 532 | + switch ($display_style) { |
|
| 533 | 533 | case 'buttons': |
| 534 | 534 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 535 | 535 | |
| 536 | - foreach ( $prices as $price ) { |
|
| 537 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
| 538 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 536 | + foreach ($prices as $price) { |
|
| 537 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
| 538 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.(give_is_default_level_id($price) ? 'give-default-level' : ''), $form_id, $price); |
|
| 539 | 539 | |
| 540 | 540 | $formatted_amount = give_format_amount( |
| 541 | 541 | $price['_give_amount'], array( |
| 542 | 542 | 'sanitize' => false, |
| 543 | - 'currency' => give_get_currency( $form_id ), |
|
| 543 | + 'currency' => give_get_currency($form_id), |
|
| 544 | 544 | ) |
| 545 | 545 | ); |
| 546 | 546 | |
@@ -549,15 +549,15 @@ discard block |
||
| 549 | 549 | $price['_give_id']['level_id'], |
| 550 | 550 | $level_classes, |
| 551 | 551 | $formatted_amount, |
| 552 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
| 552 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
| 553 | 553 | $level_text |
| 554 | 554 | ); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | // Custom Amount. |
| 558 | 558 | if ( |
| 559 | - give_is_setting_enabled( $custom_amount ) |
|
| 560 | - && ! empty( $custom_amount_text ) |
|
| 559 | + give_is_setting_enabled($custom_amount) |
|
| 560 | + && ! empty($custom_amount_text) |
|
| 561 | 561 | ) { |
| 562 | 562 | |
| 563 | 563 | $output .= sprintf( |
@@ -573,14 +573,14 @@ discard block |
||
| 573 | 573 | case 'radios': |
| 574 | 574 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 575 | 575 | |
| 576 | - foreach ( $prices as $price ) { |
|
| 577 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
| 578 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 576 | + foreach ($prices as $price) { |
|
| 577 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
| 578 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, $price); |
|
| 579 | 579 | |
| 580 | 580 | $formatted_amount = give_format_amount( |
| 581 | 581 | $price['_give_amount'], array( |
| 582 | 582 | 'sanitize' => false, |
| 583 | - 'currency' => give_get_currency( $form_id ), |
|
| 583 | + 'currency' => give_get_currency($form_id), |
|
| 584 | 584 | ) |
| 585 | 585 | ); |
| 586 | 586 | |
@@ -589,16 +589,16 @@ discard block |
||
| 589 | 589 | $price['_give_id']['level_id'], |
| 590 | 590 | $level_classes, |
| 591 | 591 | $formatted_amount, |
| 592 | - ( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ), |
|
| 593 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
| 592 | + (give_is_default_level_id($price) ? 'checked="checked"' : ''), |
|
| 593 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
| 594 | 594 | $level_text |
| 595 | 595 | ); |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | // Custom Amount. |
| 599 | 599 | if ( |
| 600 | - give_is_setting_enabled( $custom_amount ) |
|
| 601 | - && ! empty( $custom_amount_text ) |
|
| 600 | + give_is_setting_enabled($custom_amount) |
|
| 601 | + && ! empty($custom_amount_text) |
|
| 602 | 602 | ) { |
| 603 | 603 | $output .= sprintf( |
| 604 | 604 | '<li><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"><label for="give-radio-level-custom">%1$s</label></li>', |
@@ -611,21 +611,21 @@ discard block |
||
| 611 | 611 | break; |
| 612 | 612 | |
| 613 | 613 | case 'dropdown': |
| 614 | - $output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 615 | - $output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 614 | + $output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 615 | + $output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 616 | 616 | |
| 617 | 617 | // first loop through prices. |
| 618 | - foreach ( $prices as $price ) { |
|
| 619 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
|
| 618 | + foreach ($prices as $price) { |
|
| 619 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))), $form_id, $price); |
|
| 620 | 620 | $level_classes = apply_filters( |
| 621 | - 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, |
|
| 621 | + 'give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].(give_is_default_level_id($price) ? ' give-default-level' : ''), $form_id, |
|
| 622 | 622 | $price |
| 623 | 623 | ); |
| 624 | 624 | |
| 625 | 625 | $formatted_amount = give_format_amount( |
| 626 | 626 | $price['_give_amount'], array( |
| 627 | 627 | 'sanitize' => false, |
| 628 | - 'currency' => give_get_currency( $form_id ), |
|
| 628 | + 'currency' => give_get_currency($form_id), |
|
| 629 | 629 | ) |
| 630 | 630 | ); |
| 631 | 631 | |
@@ -634,14 +634,14 @@ discard block |
||
| 634 | 634 | $price['_give_id']['level_id'], |
| 635 | 635 | $level_classes, |
| 636 | 636 | $formatted_amount, |
| 637 | - ( give_is_default_level_id( $price ) ? 'selected="selected"' : '' ), |
|
| 638 | - array_key_exists( '_give_default', $price ) ? 1 : 0, |
|
| 637 | + (give_is_default_level_id($price) ? 'selected="selected"' : ''), |
|
| 638 | + array_key_exists('_give_default', $price) ? 1 : 0, |
|
| 639 | 639 | $level_text |
| 640 | 640 | ); |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | // Custom Amount. |
| 644 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 644 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 645 | 645 | $output .= sprintf( |
| 646 | 646 | '<option data-price-id="custom" class="give-donation-level-custom" value="custom">%1$s</option>', |
| 647 | 647 | $custom_amount_text |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | break; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 656 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -668,27 +668,27 @@ discard block |
||
| 668 | 668 | * |
| 669 | 669 | * @return string Checkout button. |
| 670 | 670 | */ |
| 671 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 671 | +function give_display_checkout_button($form_id, $args) { |
|
| 672 | 672 | |
| 673 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 673 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 674 | 674 | ? $args['display_style'] |
| 675 | - : give_get_meta( $form_id, '_give_payment_display', true ); |
|
| 675 | + : give_get_meta($form_id, '_give_payment_display', true); |
|
| 676 | 676 | |
| 677 | - if ( 'button' === $display_option ) { |
|
| 677 | + if ('button' === $display_option) { |
|
| 678 | 678 | $display_option = 'modal'; |
| 679 | - } elseif ( $display_option === 'onpage' ) { |
|
| 679 | + } elseif ($display_option === 'onpage') { |
|
| 680 | 680 | return ''; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $display_label_field = give_get_meta( $form_id, '_give_reveal_label', true ); |
|
| 684 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 683 | + $display_label_field = give_get_meta($form_id, '_give_reveal_label', true); |
|
| 684 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 685 | 685 | |
| 686 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 686 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 687 | 687 | |
| 688 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 688 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 691 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 692 | 692 | |
| 693 | 693 | /** |
| 694 | 694 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -701,53 +701,53 @@ discard block |
||
| 701 | 701 | * |
| 702 | 702 | * @return void |
| 703 | 703 | */ |
| 704 | -function give_user_info_fields( $form_id ) { |
|
| 704 | +function give_user_info_fields($form_id) { |
|
| 705 | 705 | |
| 706 | 706 | // Get user info. |
| 707 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 708 | - $title = ! empty( $give_user_info['give_title'] ) ? $give_user_info['give_title'] : ''; |
|
| 709 | - $first_name = ! empty( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; |
|
| 710 | - $last_name = ! empty( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; |
|
| 711 | - $company_name = ! empty( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : ''; |
|
| 712 | - $email = ! empty( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; |
|
| 713 | - $title_prefixes = give_get_name_title_prefixes( $form_id ); |
|
| 707 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 708 | + $title = ! empty($give_user_info['give_title']) ? $give_user_info['give_title'] : ''; |
|
| 709 | + $first_name = ! empty($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; |
|
| 710 | + $last_name = ! empty($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; |
|
| 711 | + $company_name = ! empty($give_user_info['company_name']) ? $give_user_info['company_name'] : ''; |
|
| 712 | + $email = ! empty($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; |
|
| 713 | + $title_prefixes = give_get_name_title_prefixes($form_id); |
|
| 714 | 714 | |
| 715 | 715 | /** |
| 716 | 716 | * Fire before user personal information fields |
| 717 | 717 | * |
| 718 | 718 | * @since 1.7 |
| 719 | 719 | */ |
| 720 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 720 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 721 | 721 | |
| 722 | 722 | $title_prefix_classes = ''; |
| 723 | - if ( give_is_name_title_prefix_enabled( $form_id ) ) { |
|
| 723 | + if (give_is_name_title_prefix_enabled($form_id)) { |
|
| 724 | 724 | $title_prefix_classes = 'give-title-prefix-wrap'; |
| 725 | 725 | } |
| 726 | 726 | ?> |
| 727 | - <fieldset id="give_checkout_user_info" class="<?php echo esc_html( $title_prefix_classes ); ?>"> |
|
| 727 | + <fieldset id="give_checkout_user_info" class="<?php echo esc_html($title_prefix_classes); ?>"> |
|
| 728 | 728 | <legend> |
| 729 | - <?php echo esc_html( apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ) ); ?> |
|
| 729 | + <?php echo esc_html(apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give'))); ?> |
|
| 730 | 730 | </legend> |
| 731 | 731 | |
| 732 | - <?php if ( give_is_name_title_prefix_enabled( $form_id ) && is_array( $title_prefixes ) && count( $title_prefixes ) > 0 ) { ?> |
|
| 732 | + <?php if (give_is_name_title_prefix_enabled($form_id) && is_array($title_prefixes) && count($title_prefixes) > 0) { ?> |
|
| 733 | 733 | <p id="give-title-wrap" class="form-row form-row-title form-row-responsive"> |
| 734 | 734 | <label class="give-label" for="give-title"> |
| 735 | - <?php esc_attr_e( 'Title', 'give' ); ?> |
|
| 736 | - <?php if ( give_field_is_required( 'give_title', $form_id ) ) : ?> |
|
| 735 | + <?php esc_attr_e('Title', 'give'); ?> |
|
| 736 | + <?php if (give_field_is_required('give_title', $form_id)) : ?> |
|
| 737 | 737 | <span class="give-required-indicator">*</span> |
| 738 | 738 | <?php endif ?> |
| 739 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
| 739 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
| 740 | 740 | </label> |
| 741 | 741 | <select |
| 742 | 742 | class="give-input required" |
| 743 | 743 | type="text" |
| 744 | 744 | name="give_title" |
| 745 | 745 | id="give-title" |
| 746 | - <?php echo( give_field_is_required( 'give_title', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 746 | + <?php echo(give_field_is_required('give_title', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 747 | 747 | > |
| 748 | - <?php foreach ( $title_prefixes as $key => $value ) { ?> |
|
| 748 | + <?php foreach ($title_prefixes as $key => $value) { ?> |
|
| 749 | 749 | <option |
| 750 | - value="<?php echo esc_html( $value ); ?>" <?php selected( $value, $title, true ); ?>><?php echo esc_html( $value ); ?></option> |
|
| 750 | + value="<?php echo esc_html($value); ?>" <?php selected($value, $title, true); ?>><?php echo esc_html($value); ?></option> |
|
| 751 | 751 | <?php } ?> |
| 752 | 752 | </select> |
| 753 | 753 | </p> |
@@ -755,63 +755,63 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 757 | 757 | <label class="give-label" for="give-first"> |
| 758 | - <?php esc_attr_e( 'First Name', 'give' ); ?> |
|
| 759 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 758 | + <?php esc_attr_e('First Name', 'give'); ?> |
|
| 759 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 760 | 760 | <span class="give-required-indicator">*</span> |
| 761 | 761 | <?php endif ?> |
| 762 | - <?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?> |
|
| 762 | + <?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?> |
|
| 763 | 763 | </label> |
| 764 | 764 | <input |
| 765 | 765 | class="give-input required" |
| 766 | 766 | type="text" |
| 767 | 767 | name="give_first" |
| 768 | 768 | autocomplete="given-name" |
| 769 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 769 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 770 | 770 | id="give-first" |
| 771 | - value="<?php echo esc_html( $first_name ); ?>" |
|
| 772 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 771 | + value="<?php echo esc_html($first_name); ?>" |
|
| 772 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 773 | 773 | /> |
| 774 | 774 | </p> |
| 775 | 775 | |
| 776 | 776 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 777 | 777 | <label class="give-label" for="give-last"> |
| 778 | - <?php esc_attr_e( 'Last Name', 'give' ); ?> |
|
| 779 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 778 | + <?php esc_attr_e('Last Name', 'give'); ?> |
|
| 779 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 780 | 780 | <span class="give-required-indicator">*</span> |
| 781 | 781 | <?php endif ?> |
| 782 | - <?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?> |
|
| 782 | + <?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?> |
|
| 783 | 783 | </label> |
| 784 | 784 | |
| 785 | 785 | <input |
| 786 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 786 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 787 | 787 | type="text" |
| 788 | 788 | name="give_last" |
| 789 | 789 | autocomplete="family-name" |
| 790 | 790 | id="give-last" |
| 791 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 792 | - value="<?php echo esc_html( $last_name ); ?>" |
|
| 793 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 791 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 792 | + value="<?php echo esc_html($last_name); ?>" |
|
| 793 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 794 | 794 | /> |
| 795 | 795 | </p> |
| 796 | 796 | |
| 797 | - <?php if ( give_is_company_field_enabled( $form_id ) ) : ?> |
|
| 798 | - <?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?> |
|
| 797 | + <?php if (give_is_company_field_enabled($form_id)) : ?> |
|
| 798 | + <?php $give_company = give_field_is_required('give_company_name', $form_id); ?> |
|
| 799 | 799 | <p id="give-company-wrap" class="form-row form-row-wide"> |
| 800 | 800 | <label class="give-label" for="give-company"> |
| 801 | - <?php esc_attr_e( 'Company Name', 'give' ); ?> |
|
| 802 | - <?php if ( $give_company ) : ?> |
|
| 801 | + <?php esc_attr_e('Company Name', 'give'); ?> |
|
| 802 | + <?php if ($give_company) : ?> |
|
| 803 | 803 | <span class="give-required-indicator">*</span> |
| 804 | 804 | <?php endif; ?> |
| 805 | - <?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?> |
|
| 805 | + <?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?> |
|
| 806 | 806 | </label> |
| 807 | 807 | <input |
| 808 | - class="give-input<?php echo( $give_company ? ' required' : '' ); ?>" |
|
| 808 | + class="give-input<?php echo($give_company ? ' required' : ''); ?>" |
|
| 809 | 809 | type="text" |
| 810 | 810 | name="give_company_name" |
| 811 | - placeholder="<?php esc_attr_e( 'Company Name', 'give' ); ?>" |
|
| 811 | + placeholder="<?php esc_attr_e('Company Name', 'give'); ?>" |
|
| 812 | 812 | id="give-company" |
| 813 | - value="<?php echo esc_html( $company_name ); ?>" |
|
| 814 | - <?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?> |
|
| 813 | + value="<?php echo esc_html($company_name); ?>" |
|
| 814 | + <?php echo($give_company ? ' required aria-required="true" ' : ''); ?> |
|
| 815 | 815 | /> |
| 816 | 816 | </p> |
| 817 | 817 | <?php endif ?> |
@@ -822,68 +822,68 @@ discard block |
||
| 822 | 822 | * |
| 823 | 823 | * @since 1.7 |
| 824 | 824 | */ |
| 825 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 825 | + do_action('give_donation_form_before_email', $form_id); |
|
| 826 | 826 | ?> |
| 827 | 827 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 828 | 828 | <label class="give-label" for="give-email"> |
| 829 | - <?php esc_attr_e( 'Email Address', 'give' ); ?> |
|
| 830 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 829 | + <?php esc_attr_e('Email Address', 'give'); ?> |
|
| 830 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 831 | 831 | <span class="give-required-indicator">*</span> |
| 832 | 832 | <?php } ?> |
| 833 | - <?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?> |
|
| 833 | + <?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?> |
|
| 834 | 834 | </label> |
| 835 | 835 | <input |
| 836 | 836 | class="give-input required" |
| 837 | 837 | type="email" |
| 838 | 838 | name="give_email" |
| 839 | 839 | autocomplete="email" |
| 840 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 840 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 841 | 841 | id="give-email" |
| 842 | - value="<?php echo esc_html( $email ); ?>" |
|
| 843 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 842 | + value="<?php echo esc_html($email); ?>" |
|
| 843 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 844 | 844 | /> |
| 845 | 845 | |
| 846 | 846 | </p> |
| 847 | 847 | |
| 848 | - <?php if ( give_is_anonymous_donation_field_enabled( $form_id ) ) : ?> |
|
| 849 | - <?php $is_anonymous_donation = isset( $_POST['give_anonymous_donation'] ) ? absint( $_POST['give_anonymous_donation'] ) : 0; ?> |
|
| 848 | + <?php if (give_is_anonymous_donation_field_enabled($form_id)) : ?> |
|
| 849 | + <?php $is_anonymous_donation = isset($_POST['give_anonymous_donation']) ? absint($_POST['give_anonymous_donation']) : 0; ?> |
|
| 850 | 850 | <p id="give-anonymous-donation-wrap" class="form-row form-row-wide"> |
| 851 | 851 | <label class="give-label" for="give-anonymous-donation"> |
| 852 | 852 | <input |
| 853 | 853 | type="checkbox" |
| 854 | - class="give-input<?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required' : '' ); ?>" |
|
| 854 | + class="give-input<?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required' : ''); ?>" |
|
| 855 | 855 | name="give_anonymous_donation" |
| 856 | 856 | id="give-anonymous-donation" |
| 857 | 857 | value="1" |
| 858 | - <?php echo( give_field_is_required( 'give_anonymous_donation', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 859 | - <?php checked( 1, $is_anonymous_donation ); ?> |
|
| 858 | + <?php echo(give_field_is_required('give_anonymous_donation', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 859 | + <?php checked(1, $is_anonymous_donation); ?> |
|
| 860 | 860 | > |
| 861 | - <?php _e( 'Make this an anonymous donation', 'give' ); ?> |
|
| 862 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
| 861 | + <?php _e('Make this an anonymous donation', 'give'); ?> |
|
| 862 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
| 863 | 863 | <span class="give-required-indicator">*</span> |
| 864 | 864 | <?php } ?> |
| 865 | - <?php echo Give()->tooltips->render_help( esc_html__( 'Would you like to prevent this donation from being displayed publicy?', 'give' ) ); ?> |
|
| 865 | + <?php echo Give()->tooltips->render_help(esc_html__('Would you like to prevent this donation from being displayed publicy?', 'give')); ?> |
|
| 866 | 866 | </label> |
| 867 | 867 | </p> |
| 868 | 868 | <?php endif; ?> |
| 869 | 869 | |
| 870 | - <?php if ( give_is_donor_comment_field_enabled( $form_id ) ) : ?> |
|
| 870 | + <?php if (give_is_donor_comment_field_enabled($form_id)) : ?> |
|
| 871 | 871 | <p id="give-comment-wrap" class="form-row form-row-wide"> |
| 872 | 872 | <label class="give-label" for="give-comment"> |
| 873 | - <?php _e( 'Comment', 'give' ); ?> |
|
| 874 | - <?php if ( give_field_is_required( 'give_comment', $form_id ) ) { ?> |
|
| 873 | + <?php _e('Comment', 'give'); ?> |
|
| 874 | + <?php if (give_field_is_required('give_comment', $form_id)) { ?> |
|
| 875 | 875 | <span class="give-required-indicator">*</span> |
| 876 | 876 | <?php } ?> |
| 877 | - <?php echo Give()->tooltips->render_help( __( 'Would you like to add a comment to this donation?', 'give' ) ); ?> |
|
| 877 | + <?php echo Give()->tooltips->render_help(__('Would you like to add a comment to this donation?', 'give')); ?> |
|
| 878 | 878 | </label> |
| 879 | 879 | |
| 880 | 880 | <textarea |
| 881 | - class="give-input<?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required' : '' ); ?>" |
|
| 881 | + class="give-input<?php echo(give_field_is_required('give_comment', $form_id) ? ' required' : ''); ?>" |
|
| 882 | 882 | name="give_comment" |
| 883 | - placeholder="<?php _e( 'Leave a comment', 'give' ); ?>" |
|
| 883 | + placeholder="<?php _e('Leave a comment', 'give'); ?>" |
|
| 884 | 884 | id="give-comment" |
| 885 | - <?php echo( give_field_is_required( 'give_comment', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 886 | - ><?php echo isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : ''; ?></textarea> |
|
| 885 | + <?php echo(give_field_is_required('give_comment', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 886 | + ><?php echo isset($_POST['give_comment']) ? give_clean($_POST['give_comment']) : ''; ?></textarea> |
|
| 887 | 887 | |
| 888 | 888 | </p> |
| 889 | 889 | <?php endif; ?> |
@@ -893,14 +893,14 @@ discard block |
||
| 893 | 893 | * |
| 894 | 894 | * @since 1.7 |
| 895 | 895 | */ |
| 896 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 896 | + do_action('give_donation_form_after_email', $form_id); |
|
| 897 | 897 | |
| 898 | 898 | /** |
| 899 | 899 | * Fire after personal email field |
| 900 | 900 | * |
| 901 | 901 | * @since 1.7 |
| 902 | 902 | */ |
| 903 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 903 | + do_action('give_donation_form_user_info', $form_id); |
|
| 904 | 904 | ?> |
| 905 | 905 | </fieldset> |
| 906 | 906 | <?php |
@@ -909,11 +909,11 @@ discard block |
||
| 909 | 909 | * |
| 910 | 910 | * @since 1.7 |
| 911 | 911 | */ |
| 912 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 912 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 913 | 913 | } |
| 914 | 914 | |
| 915 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 916 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 915 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 916 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 917 | 917 | |
| 918 | 918 | /** |
| 919 | 919 | * Renders the credit card info form. |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | * |
| 925 | 925 | * @return void |
| 926 | 926 | */ |
| 927 | -function give_get_cc_form( $form_id ) { |
|
| 927 | +function give_get_cc_form($form_id) { |
|
| 928 | 928 | |
| 929 | 929 | ob_start(); |
| 930 | 930 | |
@@ -935,50 +935,50 @@ discard block |
||
| 935 | 935 | * |
| 936 | 936 | * @param int $form_id The form ID. |
| 937 | 937 | */ |
| 938 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 938 | + do_action('give_before_cc_fields', $form_id); |
|
| 939 | 939 | ?> |
| 940 | 940 | <fieldset id="give_cc_fields-<?php echo $form_id; ?>" class="give-do-validate"> |
| 941 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 942 | - <?php if ( is_ssl() ) : ?> |
|
| 941 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 942 | + <?php if (is_ssl()) : ?> |
|
| 943 | 943 | <div id="give_secure_site_wrapper-<?php echo $form_id; ?>"> |
| 944 | 944 | <span class="give-icon padlock"></span> |
| 945 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 945 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 946 | 946 | </div> |
| 947 | 947 | <?php endif; ?> |
| 948 | 948 | <p id="give-card-number-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 949 | 949 | <label for="card_number-<?php echo $form_id; ?>" class="give-label"> |
| 950 | - <?php _e( 'Card Number', 'give' ); ?> |
|
| 950 | + <?php _e('Card Number', 'give'); ?> |
|
| 951 | 951 | <span class="give-required-indicator">*</span> |
| 952 | - <?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?> |
|
| 952 | + <?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?> |
|
| 953 | 953 | <span class="card-type"></span> |
| 954 | 954 | </label> |
| 955 | 955 | |
| 956 | 956 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id; ?>" |
| 957 | - class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" |
|
| 957 | + class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" |
|
| 958 | 958 | required aria-required="true"/> |
| 959 | 959 | </p> |
| 960 | 960 | |
| 961 | 961 | <p id="give-card-cvc-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-responsive"> |
| 962 | 962 | <label for="card_cvc-<?php echo $form_id; ?>" class="give-label"> |
| 963 | - <?php _e( 'CVC', 'give' ); ?> |
|
| 963 | + <?php _e('CVC', 'give'); ?> |
|
| 964 | 964 | <span class="give-required-indicator">*</span> |
| 965 | - <?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?> |
|
| 965 | + <?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?> |
|
| 966 | 966 | </label> |
| 967 | 967 | |
| 968 | 968 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id; ?>" |
| 969 | - class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" |
|
| 969 | + class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" |
|
| 970 | 970 | required aria-required="true"/> |
| 971 | 971 | </p> |
| 972 | 972 | |
| 973 | 973 | <p id="give-card-name-wrap-<?php echo $form_id; ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 974 | 974 | <label for="card_name-<?php echo $form_id; ?>" class="give-label"> |
| 975 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
| 975 | + <?php _e('Name on the Card', 'give'); ?> |
|
| 976 | 976 | <span class="give-required-indicator">*</span> |
| 977 | - <?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?> |
|
| 977 | + <?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?> |
|
| 978 | 978 | </label> |
| 979 | 979 | |
| 980 | 980 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id; ?>" |
| 981 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 981 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 982 | 982 | required aria-required="true"/> |
| 983 | 983 | </p> |
| 984 | 984 | <?php |
@@ -989,13 +989,13 @@ discard block |
||
| 989 | 989 | * |
| 990 | 990 | * @param int $form_id The form ID. |
| 991 | 991 | */ |
| 992 | - do_action( 'give_before_cc_expiration' ); |
|
| 992 | + do_action('give_before_cc_expiration'); |
|
| 993 | 993 | ?> |
| 994 | 994 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 995 | 995 | <label for="card_expiry-<?php echo $form_id; ?>" class="give-label"> |
| 996 | - <?php _e( 'Expiration', 'give' ); ?> |
|
| 996 | + <?php _e('Expiration', 'give'); ?> |
|
| 997 | 997 | <span class="give-required-indicator">*</span> |
| 998 | - <?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?> |
|
| 998 | + <?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?> |
|
| 999 | 999 | </label> |
| 1000 | 1000 | |
| 1001 | 1001 | <input type="hidden" id="card_exp_month-<?php echo $form_id; ?>" name="card_exp_month" |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | class="card-expiry-year"/> |
| 1005 | 1005 | |
| 1006 | 1006 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id; ?>" |
| 1007 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 1007 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 1008 | 1008 | required aria-required="true"/> |
| 1009 | 1009 | </p> |
| 1010 | 1010 | <?php |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | * |
| 1016 | 1016 | * @param int $form_id The form ID. |
| 1017 | 1017 | */ |
| 1018 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 1018 | + do_action('give_after_cc_expiration', $form_id); |
|
| 1019 | 1019 | ?> |
| 1020 | 1020 | </fieldset> |
| 1021 | 1021 | <?php |
@@ -1026,12 +1026,12 @@ discard block |
||
| 1026 | 1026 | * |
| 1027 | 1027 | * @param int $form_id The form ID. |
| 1028 | 1028 | */ |
| 1029 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 1029 | + do_action('give_after_cc_fields', $form_id); |
|
| 1030 | 1030 | |
| 1031 | 1031 | echo ob_get_clean(); |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 1034 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 1035 | 1035 | |
| 1036 | 1036 | /** |
| 1037 | 1037 | * Outputs the default credit card address fields. |
@@ -1042,20 +1042,20 @@ discard block |
||
| 1042 | 1042 | * |
| 1043 | 1043 | * @return void |
| 1044 | 1044 | */ |
| 1045 | -function give_default_cc_address_fields( $form_id ) { |
|
| 1045 | +function give_default_cc_address_fields($form_id) { |
|
| 1046 | 1046 | // Get user info. |
| 1047 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 1047 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 1048 | 1048 | |
| 1049 | 1049 | $logged_in = is_user_logged_in(); |
| 1050 | 1050 | |
| 1051 | - if ( $logged_in ) { |
|
| 1052 | - $user_address = give_get_donor_address( get_current_user_id() ); |
|
| 1051 | + if ($logged_in) { |
|
| 1052 | + $user_address = give_get_donor_address(get_current_user_id()); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | ob_start(); |
| 1056 | 1056 | ?> |
| 1057 | 1057 | <fieldset id="give_cc_address" class="cc-address"> |
| 1058 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 1058 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 1059 | 1059 | <?php |
| 1060 | 1060 | /** |
| 1061 | 1061 | * Fires while rendering credit card billing form, before address fields. |
@@ -1064,36 +1064,36 @@ discard block |
||
| 1064 | 1064 | * |
| 1065 | 1065 | * @param int $form_id The form ID. |
| 1066 | 1066 | */ |
| 1067 | - do_action( 'give_cc_billing_top' ); |
|
| 1067 | + do_action('give_cc_billing_top'); |
|
| 1068 | 1068 | |
| 1069 | 1069 | // For Country. |
| 1070 | 1070 | $selected_country = give_get_country(); |
| 1071 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1071 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1072 | 1072 | $selected_country = $give_user_info['billing_country']; |
| 1073 | 1073 | } |
| 1074 | 1074 | $countries = give_get_country_list(); |
| 1075 | 1075 | |
| 1076 | 1076 | // For state. |
| 1077 | 1077 | $selected_state = ''; |
| 1078 | - if ( $selected_country === give_get_country() ) { |
|
| 1078 | + if ($selected_country === give_get_country()) { |
|
| 1079 | 1079 | // Get default selected state by admin. |
| 1080 | 1080 | $selected_state = give_get_state(); |
| 1081 | 1081 | } |
| 1082 | 1082 | // Get the last payment made by user states. |
| 1083 | - if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) { |
|
| 1083 | + if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) { |
|
| 1084 | 1084 | $selected_state = $give_user_info['card_state']; |
| 1085 | 1085 | } |
| 1086 | 1086 | // Get the country code. |
| 1087 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1087 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1088 | 1088 | $selected_country = $give_user_info['billing_country']; |
| 1089 | 1089 | } |
| 1090 | - $label = __( 'State', 'give' ); |
|
| 1090 | + $label = __('State', 'give'); |
|
| 1091 | 1091 | $states_label = give_get_states_label(); |
| 1092 | 1092 | // Check if $country code exists in the array key for states label. |
| 1093 | - if ( array_key_exists( $selected_country, $states_label ) ) { |
|
| 1094 | - $label = $states_label[ $selected_country ]; |
|
| 1093 | + if (array_key_exists($selected_country, $states_label)) { |
|
| 1094 | + $label = $states_label[$selected_country]; |
|
| 1095 | 1095 | } |
| 1096 | - $states = give_get_states( $selected_country ); |
|
| 1096 | + $states = give_get_states($selected_country); |
|
| 1097 | 1097 | // Get the country list that do not have any states init. |
| 1098 | 1098 | $no_states_country = give_no_states_country_list(); |
| 1099 | 1099 | // Get the country list that does not require states. |
@@ -1101,24 +1101,24 @@ discard block |
||
| 1101 | 1101 | ?> |
| 1102 | 1102 | <p id="give-card-country-wrap" class="form-row form-row-wide"> |
| 1103 | 1103 | <label for="billing_country" class="give-label"> |
| 1104 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 1105 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 1104 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 1105 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 1106 | 1106 | <span class="give-required-indicator">*</span> |
| 1107 | 1107 | <?php endif; ?> |
| 1108 | 1108 | <span class="give-tooltip give-icon give-icon-question" |
| 1109 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 1109 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 1110 | 1110 | </label> |
| 1111 | 1111 | |
| 1112 | 1112 | <select |
| 1113 | 1113 | name="billing_country" |
| 1114 | 1114 | autocomplete="country-name" |
| 1115 | 1115 | id="billing_country" |
| 1116 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 1117 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 1116 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 1117 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 1118 | 1118 | > |
| 1119 | 1119 | <?php |
| 1120 | - foreach ( $countries as $country_code => $country ) { |
|
| 1121 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1120 | + foreach ($countries as $country_code => $country) { |
|
| 1121 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1122 | 1122 | } |
| 1123 | 1123 | ?> |
| 1124 | 1124 | </select> |
@@ -1126,13 +1126,13 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 1128 | 1128 | <label for="card_address" class="give-label"> |
| 1129 | - <?php _e( 'Address 1', 'give' ); ?> |
|
| 1129 | + <?php _e('Address 1', 'give'); ?> |
|
| 1130 | 1130 | <?php |
| 1131 | - if ( give_field_is_required( 'card_address', $form_id ) ) : |
|
| 1131 | + if (give_field_is_required('card_address', $form_id)) : |
|
| 1132 | 1132 | ?> |
| 1133 | 1133 | <span class="give-required-indicator">*</span> |
| 1134 | 1134 | <?php endif; ?> |
| 1135 | - <?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?> |
|
| 1135 | + <?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?> |
|
| 1136 | 1136 | </label> |
| 1137 | 1137 | |
| 1138 | 1138 | <input |
@@ -1140,20 +1140,20 @@ discard block |
||
| 1140 | 1140 | id="card_address" |
| 1141 | 1141 | name="card_address" |
| 1142 | 1142 | autocomplete="address-line1" |
| 1143 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 1144 | - placeholder="<?php _e( 'Address line 1', 'give' ); ?>" |
|
| 1145 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 1146 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 1143 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 1144 | + placeholder="<?php _e('Address line 1', 'give'); ?>" |
|
| 1145 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 1146 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 1147 | 1147 | /> |
| 1148 | 1148 | </p> |
| 1149 | 1149 | |
| 1150 | 1150 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 1151 | 1151 | <label for="card_address_2" class="give-label"> |
| 1152 | - <?php _e( 'Address 2', 'give' ); ?> |
|
| 1153 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 1152 | + <?php _e('Address 2', 'give'); ?> |
|
| 1153 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 1154 | 1154 | <span class="give-required-indicator">*</span> |
| 1155 | 1155 | <?php endif; ?> |
| 1156 | - <?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?> |
|
| 1156 | + <?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?> |
|
| 1157 | 1157 | </label> |
| 1158 | 1158 | |
| 1159 | 1159 | <input |
@@ -1161,59 +1161,59 @@ discard block |
||
| 1161 | 1161 | id="card_address_2" |
| 1162 | 1162 | name="card_address_2" |
| 1163 | 1163 | autocomplete="address-line2" |
| 1164 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 1165 | - placeholder="<?php _e( 'Address line 2', 'give' ); ?>" |
|
| 1166 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 1167 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 1164 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 1165 | + placeholder="<?php _e('Address line 2', 'give'); ?>" |
|
| 1166 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 1167 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 1168 | 1168 | /> |
| 1169 | 1169 | </p> |
| 1170 | 1170 | |
| 1171 | 1171 | <p id="give-card-city-wrap" class="form-row form-row-wide"> |
| 1172 | 1172 | <label for="card_city" class="give-label"> |
| 1173 | - <?php _e( 'City', 'give' ); ?> |
|
| 1174 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 1173 | + <?php _e('City', 'give'); ?> |
|
| 1174 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 1175 | 1175 | <span class="give-required-indicator">*</span> |
| 1176 | 1176 | <?php endif; ?> |
| 1177 | - <?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?> |
|
| 1177 | + <?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?> |
|
| 1178 | 1178 | </label> |
| 1179 | 1179 | <input |
| 1180 | 1180 | type="text" |
| 1181 | 1181 | id="card_city" |
| 1182 | 1182 | name="card_city" |
| 1183 | 1183 | autocomplete="address-level3" |
| 1184 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 1185 | - placeholder="<?php _e( 'City', 'give' ); ?>" |
|
| 1186 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 1187 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 1184 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 1185 | + placeholder="<?php _e('City', 'give'); ?>" |
|
| 1186 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 1187 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 1188 | 1188 | /> |
| 1189 | 1189 | </p> |
| 1190 | 1190 | |
| 1191 | 1191 | <p id="give-card-state-wrap" |
| 1192 | - class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> "> |
|
| 1192 | + class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> "> |
|
| 1193 | 1193 | <label for="card_state" class="give-label"> |
| 1194 | 1194 | <span class="state-label-text"><?php echo $label; ?></span> |
| 1195 | 1195 | <?php |
| 1196 | - if ( give_field_is_required( 'card_state', $form_id ) ) : |
|
| 1196 | + if (give_field_is_required('card_state', $form_id)) : |
|
| 1197 | 1197 | ?> |
| 1198 | 1198 | <span |
| 1199 | - class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ); ?> ">*</span> |
|
| 1199 | + class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : ''); ?> ">*</span> |
|
| 1200 | 1200 | <?php endif; ?> |
| 1201 | 1201 | <span class="give-tooltip give-icon give-icon-question" |
| 1202 | - data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span> |
|
| 1202 | + data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span> |
|
| 1203 | 1203 | </label> |
| 1204 | 1204 | <?php |
| 1205 | 1205 | |
| 1206 | - if ( ! empty( $states ) ) : |
|
| 1206 | + if ( ! empty($states)) : |
|
| 1207 | 1207 | ?> |
| 1208 | 1208 | <select |
| 1209 | 1209 | name="card_state" |
| 1210 | 1210 | autocomplete="address-level4" |
| 1211 | 1211 | id="card_state" |
| 1212 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1213 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1212 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1213 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1214 | 1214 | <?php |
| 1215 | - foreach ( $states as $state_code => $state ) { |
|
| 1216 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1215 | + foreach ($states as $state_code => $state) { |
|
| 1216 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | ?> |
| 1219 | 1219 | </select> |
@@ -1225,11 +1225,11 @@ discard block |
||
| 1225 | 1225 | |
| 1226 | 1226 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 1227 | 1227 | <label for="card_zip" class="give-label"> |
| 1228 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
| 1229 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 1228 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
| 1229 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 1230 | 1230 | <span class="give-required-indicator">*</span> |
| 1231 | 1231 | <?php endif; ?> |
| 1232 | - <?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?> |
|
| 1232 | + <?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?> |
|
| 1233 | 1233 | </label> |
| 1234 | 1234 | |
| 1235 | 1235 | <input |
@@ -1238,10 +1238,10 @@ discard block |
||
| 1238 | 1238 | id="card_zip" |
| 1239 | 1239 | name="card_zip" |
| 1240 | 1240 | autocomplete="postal-code" |
| 1241 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 1242 | - placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 1243 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 1244 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 1241 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 1242 | + placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" |
|
| 1243 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 1244 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 1245 | 1245 | /> |
| 1246 | 1246 | </p> |
| 1247 | 1247 | <?php |
@@ -1252,14 +1252,14 @@ discard block |
||
| 1252 | 1252 | * |
| 1253 | 1253 | * @param int $form_id The form ID. |
| 1254 | 1254 | */ |
| 1255 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1255 | + do_action('give_cc_billing_bottom'); |
|
| 1256 | 1256 | ?> |
| 1257 | 1257 | </fieldset> |
| 1258 | 1258 | <?php |
| 1259 | 1259 | echo ob_get_clean(); |
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1262 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1263 | 1263 | |
| 1264 | 1264 | |
| 1265 | 1265 | /** |
@@ -1272,15 +1272,15 @@ discard block |
||
| 1272 | 1272 | * |
| 1273 | 1273 | * @return string |
| 1274 | 1274 | */ |
| 1275 | -function give_get_register_fields( $form_id ) { |
|
| 1275 | +function give_get_register_fields($form_id) { |
|
| 1276 | 1276 | |
| 1277 | 1277 | global $user_ID; |
| 1278 | 1278 | |
| 1279 | - if ( is_user_logged_in() ) { |
|
| 1280 | - $user_data = get_userdata( $user_ID ); |
|
| 1279 | + if (is_user_logged_in()) { |
|
| 1280 | + $user_data = get_userdata($user_ID); |
|
| 1281 | 1281 | } |
| 1282 | 1282 | |
| 1283 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1283 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1284 | 1284 | |
| 1285 | 1285 | ob_start(); |
| 1286 | 1286 | ?> |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | * |
| 1295 | 1295 | * @param int $form_id The form ID. |
| 1296 | 1296 | */ |
| 1297 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1297 | + do_action('give_register_fields_before', $form_id); |
|
| 1298 | 1298 | ?> |
| 1299 | 1299 | |
| 1300 | 1300 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
@@ -1306,25 +1306,25 @@ discard block |
||
| 1306 | 1306 | * |
| 1307 | 1307 | * @param int $form_id The form ID. |
| 1308 | 1308 | */ |
| 1309 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1309 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1310 | 1310 | |
| 1311 | - $class = ( 'registration' === $show_register_form ) ? 'form-row-wide' : 'form-row-first'; |
|
| 1311 | + $class = ('registration' === $show_register_form) ? 'form-row-wide' : 'form-row-first'; |
|
| 1312 | 1312 | ?> |
| 1313 | 1313 | <div id="give-create-account-wrap-<?php echo $form_id; ?>" |
| 1314 | - class="form-row <?php echo esc_attr( $class ); ?> form-row-responsive"> |
|
| 1314 | + class="form-row <?php echo esc_attr($class); ?> form-row-responsive"> |
|
| 1315 | 1315 | <label for="give-create-account-<?php echo $form_id; ?>"> |
| 1316 | 1316 | <?php |
| 1317 | 1317 | // Add attributes to checkbox, if Guest Checkout is disabled. |
| 1318 | - $is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
| 1319 | - $id = 'give-create-account-' . $form_id; |
|
| 1320 | - if ( ! give_is_setting_enabled( $is_guest_checkout ) ) { |
|
| 1318 | + $is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true); |
|
| 1319 | + $id = 'give-create-account-'.$form_id; |
|
| 1320 | + if ( ! give_is_setting_enabled($is_guest_checkout)) { |
|
| 1321 | 1321 | echo Give()->tooltips->render( |
| 1322 | 1322 | array( |
| 1323 | 1323 | 'tag_content' => sprintf( |
| 1324 | 1324 | '<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />', |
| 1325 | 1325 | $id |
| 1326 | 1326 | ), |
| 1327 | - 'label' => __( 'Registration is required to donate.', 'give' ), |
|
| 1327 | + 'label' => __('Registration is required to donate.', 'give'), |
|
| 1328 | 1328 | ) |
| 1329 | 1329 | ); |
| 1330 | 1330 | } else { |
@@ -1334,22 +1334,22 @@ discard block |
||
| 1334 | 1334 | <?php |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | - _e( 'Create an account', 'give' ); |
|
| 1338 | - echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); |
|
| 1337 | + _e('Create an account', 'give'); |
|
| 1338 | + echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); |
|
| 1339 | 1339 | echo str_replace( |
| 1340 | 1340 | '/>', |
| 1341 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
| 1342 | - give_get_nonce_field( "give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false ) |
|
| 1341 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
| 1342 | + give_get_nonce_field("give_form_create_user_nonce_{$form_id}", 'give-form-user-register-hash', false) |
|
| 1343 | 1343 | ); |
| 1344 | 1344 | ?> |
| 1345 | 1345 | </label> |
| 1346 | 1346 | </div> |
| 1347 | 1347 | |
| 1348 | - <?php if ( 'both' === $show_register_form ) { ?> |
|
| 1348 | + <?php if ('both' === $show_register_form) { ?> |
|
| 1349 | 1349 | <div class="give-login-account-wrap form-row form-row-last form-row-responsive"> |
| 1350 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1351 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1352 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1350 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1351 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1352 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1353 | 1353 | </p> |
| 1354 | 1354 | <p class="give-loading-text"> |
| 1355 | 1355 | <span class="give-loading-animation"></span> |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | * |
| 1366 | 1366 | * @param int $form_id The form ID. |
| 1367 | 1367 | */ |
| 1368 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1368 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1369 | 1369 | ?> |
| 1370 | 1370 | </fieldset> |
| 1371 | 1371 | |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | * |
| 1378 | 1378 | * @param int $form_id The form ID. |
| 1379 | 1379 | */ |
| 1380 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1380 | + do_action('give_register_fields_after', $form_id); |
|
| 1381 | 1381 | ?> |
| 1382 | 1382 | |
| 1383 | 1383 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | * |
| 1389 | 1389 | * @since 1.7 |
| 1390 | 1390 | */ |
| 1391 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1391 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1392 | 1392 | ?> |
| 1393 | 1393 | |
| 1394 | 1394 | </fieldset> |
@@ -1396,7 +1396,7 @@ discard block |
||
| 1396 | 1396 | echo ob_get_clean(); |
| 1397 | 1397 | } |
| 1398 | 1398 | |
| 1399 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1399 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1400 | 1400 | |
| 1401 | 1401 | /** |
| 1402 | 1402 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1409,32 +1409,32 @@ discard block |
||
| 1409 | 1409 | * |
| 1410 | 1410 | * @return string |
| 1411 | 1411 | */ |
| 1412 | -function give_get_login_fields( $form_id ) { |
|
| 1412 | +function give_get_login_fields($form_id) { |
|
| 1413 | 1413 | |
| 1414 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1415 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1414 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1415 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1416 | 1416 | |
| 1417 | 1417 | ob_start(); |
| 1418 | 1418 | ?> |
| 1419 | 1419 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1420 | 1420 | <legend> |
| 1421 | 1421 | <?php |
| 1422 | - echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
| 1423 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1424 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
| 1422 | + echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
| 1423 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1424 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
| 1425 | 1425 | } |
| 1426 | 1426 | ?> |
| 1427 | 1427 | </legend> |
| 1428 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1428 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1429 | 1429 | <p class="give-new-account-link"> |
| 1430 | - <?php _e( 'Don\'t have an account?', 'give' ); ?> |
|
| 1431 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1430 | + <?php _e('Don\'t have an account?', 'give'); ?> |
|
| 1431 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1432 | 1432 | data-action="give_checkout_register"> |
| 1433 | 1433 | <?php |
| 1434 | - if ( give_logged_in_only( $form_id ) ) { |
|
| 1435 | - _e( 'Register as a part of your donation »', 'give' ); |
|
| 1434 | + if (give_logged_in_only($form_id)) { |
|
| 1435 | + _e('Register as a part of your donation »', 'give'); |
|
| 1436 | 1436 | } else { |
| 1437 | - _e( 'Register or donate as a guest »', 'give' ); |
|
| 1437 | + _e('Register or donate as a guest »', 'give'); |
|
| 1438 | 1438 | } |
| 1439 | 1439 | ?> |
| 1440 | 1440 | </a> |
@@ -1451,41 +1451,41 @@ discard block |
||
| 1451 | 1451 | * |
| 1452 | 1452 | * @param int $form_id The form ID. |
| 1453 | 1453 | */ |
| 1454 | - do_action( 'give_donation_form_login_fields_before', $form_id ); |
|
| 1454 | + do_action('give_donation_form_login_fields_before', $form_id); |
|
| 1455 | 1455 | ?> |
| 1456 | 1456 | <div class="give-user-login-fields-container"> |
| 1457 | 1457 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1458 | 1458 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1459 | - <?php _e( 'Username', 'give' ); ?> |
|
| 1460 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1459 | + <?php _e('Username', 'give'); ?> |
|
| 1460 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1461 | 1461 | <span class="give-required-indicator">*</span> |
| 1462 | 1462 | <?php } ?> |
| 1463 | 1463 | </label> |
| 1464 | 1464 | |
| 1465 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1465 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1466 | 1466 | type="text" |
| 1467 | 1467 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1468 | - placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1468 | + placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1469 | 1469 | </div> |
| 1470 | 1470 | |
| 1471 | 1471 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1472 | 1472 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1473 | 1473 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1474 | - <?php _e( 'Password', 'give' ); ?> |
|
| 1475 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1474 | + <?php _e('Password', 'give'); ?> |
|
| 1475 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1476 | 1476 | <span class="give-required-indicator">*</span> |
| 1477 | 1477 | <?php } ?> |
| 1478 | 1478 | </label> |
| 1479 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1479 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1480 | 1480 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1481 | - placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1481 | + placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1482 | 1482 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1483 | 1483 | </div> |
| 1484 | 1484 | |
| 1485 | 1485 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1486 | 1486 | <span class="give-forgot-password "> |
| 1487 | 1487 | <a href="<?php echo wp_lostpassword_url(); ?>" |
| 1488 | - target="_blank"><?php _e( 'Reset Password', 'give' ); ?></a> |
|
| 1488 | + target="_blank"><?php _e('Reset Password', 'give'); ?></a> |
|
| 1489 | 1489 | </span> |
| 1490 | 1490 | </div> |
| 1491 | 1491 | </div> |
@@ -1493,11 +1493,11 @@ discard block |
||
| 1493 | 1493 | |
| 1494 | 1494 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1495 | 1495 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1496 | - value="<?php _e( 'Login', 'give' ); ?>"/> |
|
| 1497 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1496 | + value="<?php _e('Login', 'give'); ?>"/> |
|
| 1497 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1498 | 1498 | <input type="button" data-action="give_cancel_login" |
| 1499 | 1499 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1500 | - value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
| 1500 | + value="<?php _e('Cancel', 'give'); ?>"/> |
|
| 1501 | 1501 | <?php } ?> |
| 1502 | 1502 | <span class="give-loading-animation"></span> |
| 1503 | 1503 | </div> |
@@ -1509,14 +1509,14 @@ discard block |
||
| 1509 | 1509 | * |
| 1510 | 1510 | * @param int $form_id The form ID. |
| 1511 | 1511 | */ |
| 1512 | - do_action( 'give_donation_form_login_fields_after', $form_id ); |
|
| 1512 | + do_action('give_donation_form_login_fields_after', $form_id); |
|
| 1513 | 1513 | ?> |
| 1514 | 1514 | </fieldset><!--end #give-login-fields--> |
| 1515 | 1515 | <?php |
| 1516 | 1516 | echo ob_get_clean(); |
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1519 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1520 | 1520 | |
| 1521 | 1521 | /** |
| 1522 | 1522 | * Payment Mode Select. |
@@ -1532,10 +1532,10 @@ discard block |
||
| 1532 | 1532 | * |
| 1533 | 1533 | * @return void |
| 1534 | 1534 | */ |
| 1535 | -function give_payment_mode_select( $form_id, $args ) { |
|
| 1535 | +function give_payment_mode_select($form_id, $args) { |
|
| 1536 | 1536 | |
| 1537 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1538 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
| 1537 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1538 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
| 1539 | 1539 | |
| 1540 | 1540 | /** |
| 1541 | 1541 | * Fires while selecting payment gateways, before the fields. |
@@ -1544,12 +1544,12 @@ discard block |
||
| 1544 | 1544 | * |
| 1545 | 1545 | * @param int $form_id The form ID. |
| 1546 | 1546 | */ |
| 1547 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1547 | + do_action('give_payment_mode_top', $form_id); |
|
| 1548 | 1548 | ?> |
| 1549 | 1549 | |
| 1550 | 1550 | <fieldset id="give-payment-mode-select" |
| 1551 | 1551 | <?php |
| 1552 | - if ( count( $gateways ) <= 1 ) { |
|
| 1552 | + if (count($gateways) <= 1) { |
|
| 1553 | 1553 | echo 'style="display: none;"'; |
| 1554 | 1554 | } |
| 1555 | 1555 | ?> |
@@ -1562,10 +1562,10 @@ discard block |
||
| 1562 | 1562 | * |
| 1563 | 1563 | * @param int $form_id The form ID. |
| 1564 | 1564 | */ |
| 1565 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1565 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1566 | 1566 | ?> |
| 1567 | 1567 | <legend |
| 1568 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1568 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1569 | 1569 | <span class="give-loading-text"><span |
| 1570 | 1570 | class="give-loading-animation"></span> |
| 1571 | 1571 | </span> |
@@ -1578,38 +1578,37 @@ discard block |
||
| 1578 | 1578 | * |
| 1579 | 1579 | * @since 1.7 |
| 1580 | 1580 | */ |
| 1581 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1581 | + do_action('give_payment_mode_before_gateways') |
|
| 1582 | 1582 | ?> |
| 1583 | 1583 | <ul id="give-gateway-radio-list"> |
| 1584 | 1584 | <?php |
| 1585 | 1585 | /** |
| 1586 | 1586 | * Loop through the active payment gateways. |
| 1587 | 1587 | */ |
| 1588 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1588 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1589 | 1589 | $give_settings = give_get_settings(); |
| 1590 | - $gateways_label = array_key_exists( 'gateways_label', $give_settings ) ? |
|
| 1591 | - $give_settings['gateways_label'] : |
|
| 1592 | - array(); |
|
| 1590 | + $gateways_label = array_key_exists('gateways_label', $give_settings) ? |
|
| 1591 | + $give_settings['gateways_label'] : array(); |
|
| 1593 | 1592 | |
| 1594 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1593 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1595 | 1594 | // Determine the default gateway. |
| 1596 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1595 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1597 | 1596 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; |
| 1598 | 1597 | ?> |
| 1599 | 1598 | <li<?php echo $checked_class; ?>> |
| 1600 | 1599 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1601 | - id="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
| 1602 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1600 | + id="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
| 1601 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1603 | 1602 | |
| 1604 | 1603 | <?php |
| 1605 | 1604 | $label = $gateway['checkout_label']; |
| 1606 | - if ( ! empty( $gateways_label[ $gateway_id ] ) ) { |
|
| 1607 | - $label = $gateways_label[ $gateway_id ]; |
|
| 1605 | + if ( ! empty($gateways_label[$gateway_id])) { |
|
| 1606 | + $label = $gateways_label[$gateway_id]; |
|
| 1608 | 1607 | } |
| 1609 | 1608 | ?> |
| 1610 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id . '-' . $id_prefix ); ?>" |
|
| 1609 | + <label for="give-gateway-<?php echo esc_attr($gateway_id.'-'.$id_prefix); ?>" |
|
| 1611 | 1610 | class="give-gateway-option" |
| 1612 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label> |
|
| 1611 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label> |
|
| 1613 | 1612 | </li> |
| 1614 | 1613 | <?php |
| 1615 | 1614 | endforeach; |
@@ -1621,7 +1620,7 @@ discard block |
||
| 1621 | 1620 | * |
| 1622 | 1621 | * @since 1.7 |
| 1623 | 1622 | */ |
| 1624 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1623 | + do_action('give_payment_mode_after_gateways'); |
|
| 1625 | 1624 | ?> |
| 1626 | 1625 | </div> |
| 1627 | 1626 | <?php |
@@ -1632,7 +1631,7 @@ discard block |
||
| 1632 | 1631 | * |
| 1633 | 1632 | * @param int $form_id The form ID. |
| 1634 | 1633 | */ |
| 1635 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1634 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1636 | 1635 | ?> |
| 1637 | 1636 | </fieldset> |
| 1638 | 1637 | |
@@ -1644,7 +1643,7 @@ discard block |
||
| 1644 | 1643 | * |
| 1645 | 1644 | * @param int $form_id The form ID. |
| 1646 | 1645 | */ |
| 1647 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1646 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1648 | 1647 | ?> |
| 1649 | 1648 | |
| 1650 | 1649 | <div id="give_purchase_form_wrap"> |
@@ -1655,7 +1654,7 @@ discard block |
||
| 1655 | 1654 | * |
| 1656 | 1655 | * @since 1.7 |
| 1657 | 1656 | */ |
| 1658 | - do_action( 'give_donation_form', $form_id, $args ); |
|
| 1657 | + do_action('give_donation_form', $form_id, $args); |
|
| 1659 | 1658 | ?> |
| 1660 | 1659 | |
| 1661 | 1660 | </div> |
@@ -1666,10 +1665,10 @@ discard block |
||
| 1666 | 1665 | * |
| 1667 | 1666 | * @since 1.7 |
| 1668 | 1667 | */ |
| 1669 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1668 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1670 | 1669 | } |
| 1671 | 1670 | |
| 1672 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select', 10, 2 ); |
|
| 1671 | +add_action('give_payment_mode_select', 'give_payment_mode_select', 10, 2); |
|
| 1673 | 1672 | |
| 1674 | 1673 | /** |
| 1675 | 1674 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1682,31 +1681,31 @@ discard block |
||
| 1682 | 1681 | * |
| 1683 | 1682 | * @return bool |
| 1684 | 1683 | */ |
| 1685 | -function give_terms_agreement( $form_id ) { |
|
| 1686 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
| 1684 | +function give_terms_agreement($form_id) { |
|
| 1685 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
| 1687 | 1686 | |
| 1688 | 1687 | // Bailout if per form and global term and conditions is not setup. |
| 1689 | 1688 | if ( |
| 1690 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1691 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1689 | + give_is_setting_enabled($form_option, 'global') |
|
| 1690 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1692 | 1691 | ) { |
| 1693 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1694 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1695 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1692 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1693 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1694 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1696 | 1695 | |
| 1697 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1698 | - $label = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1699 | - $terms = give_get_meta( $form_id, '_give_agree_text', true ); |
|
| 1700 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1696 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1697 | + $label = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1698 | + $terms = give_get_meta($form_id, '_give_agree_text', true); |
|
| 1699 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1701 | 1700 | |
| 1702 | 1701 | } else { |
| 1703 | 1702 | return false; |
| 1704 | 1703 | } |
| 1705 | 1704 | |
| 1706 | 1705 | // Bailout: Check if term and conditions text is empty or not. |
| 1707 | - if ( empty( $terms ) ) { |
|
| 1708 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1709 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1706 | + if (empty($terms)) { |
|
| 1707 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1708 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1710 | 1709 | } |
| 1711 | 1710 | |
| 1712 | 1711 | return false; |
@@ -1717,11 +1716,11 @@ discard block |
||
| 1717 | 1716 | * |
| 1718 | 1717 | * @since 2.1.5 |
| 1719 | 1718 | */ |
| 1720 | - $terms = apply_filters( 'give_the_term_content', wpautop( do_shortcode( $terms ) ), $terms, $form_id ); |
|
| 1719 | + $terms = apply_filters('give_the_term_content', wpautop(do_shortcode($terms)), $terms, $form_id); |
|
| 1721 | 1720 | |
| 1722 | 1721 | ?> |
| 1723 | 1722 | <fieldset id="give_terms_agreement"> |
| 1724 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1723 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1725 | 1724 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1726 | 1725 | <?php |
| 1727 | 1726 | /** |
@@ -1729,7 +1728,7 @@ discard block |
||
| 1729 | 1728 | * |
| 1730 | 1729 | * @since 1.0 |
| 1731 | 1730 | */ |
| 1732 | - do_action( 'give_before_terms' ); |
|
| 1731 | + do_action('give_before_terms'); |
|
| 1733 | 1732 | |
| 1734 | 1733 | echo $terms; |
| 1735 | 1734 | /** |
@@ -1737,14 +1736,14 @@ discard block |
||
| 1737 | 1736 | * |
| 1738 | 1737 | * @since 1.0 |
| 1739 | 1738 | */ |
| 1740 | - do_action( 'give_after_terms' ); |
|
| 1739 | + do_action('give_after_terms'); |
|
| 1741 | 1740 | ?> |
| 1742 | 1741 | </div> |
| 1743 | 1742 | <div id="give_show_terms"> |
| 1744 | 1743 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1745 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1744 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1746 | 1745 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1747 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1746 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1748 | 1747 | </div> |
| 1749 | 1748 | |
| 1750 | 1749 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1755,7 +1754,7 @@ discard block |
||
| 1755 | 1754 | <?php |
| 1756 | 1755 | } |
| 1757 | 1756 | |
| 1758 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1757 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1759 | 1758 | |
| 1760 | 1759 | /** |
| 1761 | 1760 | * Checkout Final Total. |
@@ -1768,14 +1767,13 @@ discard block |
||
| 1768 | 1767 | * |
| 1769 | 1768 | * @return void |
| 1770 | 1769 | */ |
| 1771 | -function give_checkout_final_total( $form_id ) { |
|
| 1770 | +function give_checkout_final_total($form_id) { |
|
| 1772 | 1771 | |
| 1773 | - $total = isset( $_POST['give_total'] ) ? |
|
| 1774 | - apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) : |
|
| 1775 | - give_get_default_form_amount( $form_id ); |
|
| 1772 | + $total = isset($_POST['give_total']) ? |
|
| 1773 | + apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id); |
|
| 1776 | 1774 | |
| 1777 | 1775 | // Only proceed if give_total available. |
| 1778 | - if ( empty( $total ) ) { |
|
| 1776 | + if (empty($total)) { |
|
| 1779 | 1777 | return; |
| 1780 | 1778 | } |
| 1781 | 1779 | ?> |
@@ -1786,21 +1784,21 @@ discard block |
||
| 1786 | 1784 | * |
| 1787 | 1785 | * @since 2.0.5 |
| 1788 | 1786 | */ |
| 1789 | - do_action( 'give_donation_final_total_label_before', $form_id ); |
|
| 1787 | + do_action('give_donation_final_total_label_before', $form_id); |
|
| 1790 | 1788 | ?> |
| 1791 | 1789 | <span class="give-donation-total-label"> |
| 1792 | - <?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?> |
|
| 1790 | + <?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?> |
|
| 1793 | 1791 | </span> |
| 1794 | 1792 | <span class="give-final-total-amount" |
| 1795 | - data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>"> |
|
| 1793 | + data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>"> |
|
| 1796 | 1794 | <?php |
| 1797 | 1795 | echo give_currency_filter( |
| 1798 | 1796 | give_format_amount( |
| 1799 | 1797 | $total, array( |
| 1800 | 1798 | 'sanitize' => false, |
| 1801 | - 'currency' => give_get_currency( $form_id ), |
|
| 1799 | + 'currency' => give_get_currency($form_id), |
|
| 1802 | 1800 | ) |
| 1803 | - ), array( 'currency_code' => give_get_currency( $form_id ) ) |
|
| 1801 | + ), array('currency_code' => give_get_currency($form_id)) |
|
| 1804 | 1802 | ); |
| 1805 | 1803 | ?> |
| 1806 | 1804 | </span> |
@@ -1810,13 +1808,13 @@ discard block |
||
| 1810 | 1808 | * |
| 1811 | 1809 | * @since 2.0.5 |
| 1812 | 1810 | */ |
| 1813 | - do_action( 'give_donation_final_total_label_after', $form_id ); |
|
| 1811 | + do_action('give_donation_final_total_label_after', $form_id); |
|
| 1814 | 1812 | ?> |
| 1815 | 1813 | </p> |
| 1816 | 1814 | <?php |
| 1817 | 1815 | } |
| 1818 | 1816 | |
| 1819 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1817 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1820 | 1818 | |
| 1821 | 1819 | /** |
| 1822 | 1820 | * Renders the Checkout Submit section. |
@@ -1828,7 +1826,7 @@ discard block |
||
| 1828 | 1826 | * |
| 1829 | 1827 | * @return void |
| 1830 | 1828 | */ |
| 1831 | -function give_checkout_submit( $form_id, $args ) { |
|
| 1829 | +function give_checkout_submit($form_id, $args) { |
|
| 1832 | 1830 | ?> |
| 1833 | 1831 | <fieldset id="give_purchase_submit" class="give-donation-submit"> |
| 1834 | 1832 | <?php |
@@ -1837,24 +1835,24 @@ discard block |
||
| 1837 | 1835 | * |
| 1838 | 1836 | * @since 1.7 |
| 1839 | 1837 | */ |
| 1840 | - do_action( 'give_donation_form_before_submit', $form_id, $args ); |
|
| 1838 | + do_action('give_donation_form_before_submit', $form_id, $args); |
|
| 1841 | 1839 | |
| 1842 | - give_checkout_hidden_fields( $form_id ); |
|
| 1840 | + give_checkout_hidden_fields($form_id); |
|
| 1843 | 1841 | |
| 1844 | - echo give_get_donation_form_submit_button( $form_id ); |
|
| 1842 | + echo give_get_donation_form_submit_button($form_id); |
|
| 1845 | 1843 | |
| 1846 | 1844 | /** |
| 1847 | 1845 | * Fire after donation form submit. |
| 1848 | 1846 | * |
| 1849 | 1847 | * @since 1.7 |
| 1850 | 1848 | */ |
| 1851 | - do_action( 'give_donation_form_after_submit', $form_id, $args ); |
|
| 1849 | + do_action('give_donation_form_after_submit', $form_id, $args); |
|
| 1852 | 1850 | ?> |
| 1853 | 1851 | </fieldset> |
| 1854 | 1852 | <?php |
| 1855 | 1853 | } |
| 1856 | 1854 | |
| 1857 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2 ); |
|
| 1855 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999, 2); |
|
| 1858 | 1856 | |
| 1859 | 1857 | /** |
| 1860 | 1858 | * Give Donation form submit button. |
@@ -1865,10 +1863,10 @@ discard block |
||
| 1865 | 1863 | * |
| 1866 | 1864 | * @return string |
| 1867 | 1865 | */ |
| 1868 | -function give_get_donation_form_submit_button( $form_id ) { |
|
| 1866 | +function give_get_donation_form_submit_button($form_id) { |
|
| 1869 | 1867 | |
| 1870 | - $display_label_field = give_get_meta( $form_id, '_give_checkout_label', true ); |
|
| 1871 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1868 | + $display_label_field = give_get_meta($form_id, '_give_checkout_label', true); |
|
| 1869 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1872 | 1870 | ob_start(); |
| 1873 | 1871 | ?> |
| 1874 | 1872 | <div class="give-submit-button-wrap give-clearfix"> |
@@ -1877,7 +1875,7 @@ discard block |
||
| 1877 | 1875 | <span class="give-loading-animation"></span> |
| 1878 | 1876 | </div> |
| 1879 | 1877 | <?php |
| 1880 | - return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id ); |
|
| 1878 | + return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id); |
|
| 1881 | 1879 | } |
| 1882 | 1880 | |
| 1883 | 1881 | /** |
@@ -1892,7 +1890,7 @@ discard block |
||
| 1892 | 1890 | * |
| 1893 | 1891 | * @return mixed |
| 1894 | 1892 | */ |
| 1895 | -function give_show_goal_progress( $form_id, $args = array() ) { |
|
| 1893 | +function give_show_goal_progress($form_id, $args = array()) { |
|
| 1896 | 1894 | |
| 1897 | 1895 | ob_start(); |
| 1898 | 1896 | give_get_template( |
@@ -1907,12 +1905,12 @@ discard block |
||
| 1907 | 1905 | * |
| 1908 | 1906 | * @since 2.0 |
| 1909 | 1907 | */ |
| 1910 | - echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args ); |
|
| 1908 | + echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args); |
|
| 1911 | 1909 | |
| 1912 | 1910 | return true; |
| 1913 | 1911 | } |
| 1914 | 1912 | |
| 1915 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1913 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1916 | 1914 | |
| 1917 | 1915 | /** |
| 1918 | 1916 | * Show Give Totals Progress. |
@@ -1924,10 +1922,10 @@ discard block |
||
| 1924 | 1922 | * |
| 1925 | 1923 | * @return mixed |
| 1926 | 1924 | */ |
| 1927 | -function give_show_goal_totals_progress( $total, $total_goal ) { |
|
| 1925 | +function give_show_goal_totals_progress($total, $total_goal) { |
|
| 1928 | 1926 | |
| 1929 | 1927 | // Bail out if total goal is set as an array. |
| 1930 | - if ( isset( $total_goal ) && is_array( $total_goal ) ) { |
|
| 1928 | + if (isset($total_goal) && is_array($total_goal)) { |
|
| 1931 | 1929 | return false; |
| 1932 | 1930 | } |
| 1933 | 1931 | |
@@ -1939,12 +1937,12 @@ discard block |
||
| 1939 | 1937 | ) |
| 1940 | 1938 | ); |
| 1941 | 1939 | |
| 1942 | - echo apply_filters( 'give_total_progress_output', ob_get_clean() ); |
|
| 1940 | + echo apply_filters('give_total_progress_output', ob_get_clean()); |
|
| 1943 | 1941 | |
| 1944 | 1942 | return true; |
| 1945 | 1943 | } |
| 1946 | 1944 | |
| 1947 | -add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 ); |
|
| 1945 | +add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2); |
|
| 1948 | 1946 | |
| 1949 | 1947 | /** |
| 1950 | 1948 | * Get form content position. |
@@ -1956,10 +1954,10 @@ discard block |
||
| 1956 | 1954 | * |
| 1957 | 1955 | * @return mixed|string |
| 1958 | 1956 | */ |
| 1959 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1957 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1960 | 1958 | $show_content = ''; |
| 1961 | 1959 | |
| 1962 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1960 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1963 | 1961 | // Content positions. |
| 1964 | 1962 | $content_placement = array( |
| 1965 | 1963 | 'above' => 'give_pre_form', |
@@ -1967,18 +1965,18 @@ discard block |
||
| 1967 | 1965 | ); |
| 1968 | 1966 | |
| 1969 | 1967 | // Check if content position already decoded. |
| 1970 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1968 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1971 | 1969 | return $args['show_content']; |
| 1972 | 1970 | } |
| 1973 | 1971 | |
| 1974 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1972 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1975 | 1973 | |
| 1976 | - } elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1977 | - $show_content = give_get_meta( $form_id, '_give_content_placement', true ); |
|
| 1974 | + } elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) { |
|
| 1975 | + $show_content = give_get_meta($form_id, '_give_content_placement', true); |
|
| 1978 | 1976 | |
| 1979 | - } elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1977 | + } elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) { |
|
| 1980 | 1978 | // Backward compatibility for _give_content_option for v18. |
| 1981 | - $show_content = give_get_meta( $form_id, '_give_content_option', true ); |
|
| 1979 | + $show_content = give_get_meta($form_id, '_give_content_option', true); |
|
| 1982 | 1980 | } |
| 1983 | 1981 | |
| 1984 | 1982 | return $show_content; |
@@ -1994,20 +1992,20 @@ discard block |
||
| 1994 | 1992 | * |
| 1995 | 1993 | * @return void|bool |
| 1996 | 1994 | */ |
| 1997 | -function give_form_content( $form_id, $args ) { |
|
| 1995 | +function give_form_content($form_id, $args) { |
|
| 1998 | 1996 | |
| 1999 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1997 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 2000 | 1998 | |
| 2001 | 1999 | // Bailout. |
| 2002 | - if ( empty( $show_content ) ) { |
|
| 2000 | + if (empty($show_content)) { |
|
| 2003 | 2001 | return false; |
| 2004 | 2002 | } |
| 2005 | 2003 | |
| 2006 | 2004 | // Add action according to value. |
| 2007 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 2005 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 2008 | 2006 | } |
| 2009 | 2007 | |
| 2010 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 2008 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 2011 | 2009 | |
| 2012 | 2010 | /** |
| 2013 | 2011 | * Renders Post Form Content. |
@@ -2021,14 +2019,14 @@ discard block |
||
| 2021 | 2019 | * |
| 2022 | 2020 | * @return void |
| 2023 | 2021 | */ |
| 2024 | -function give_form_display_content( $form_id, $args ) { |
|
| 2025 | - $content = give_get_meta( $form_id, '_give_form_content', true ); |
|
| 2026 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 2022 | +function give_form_display_content($form_id, $args) { |
|
| 2023 | + $content = give_get_meta($form_id, '_give_form_content', true); |
|
| 2024 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 2027 | 2025 | |
| 2028 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 2029 | - $content = apply_filters( 'the_content', $content ); |
|
| 2026 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 2027 | + $content = apply_filters('the_content', $content); |
|
| 2030 | 2028 | } else { |
| 2031 | - $content = wpautop( do_shortcode( $content ) ); |
|
| 2029 | + $content = wpautop(do_shortcode($content)); |
|
| 2032 | 2030 | } |
| 2033 | 2031 | |
| 2034 | 2032 | $output = sprintf( |
@@ -2047,11 +2045,11 @@ discard block |
||
| 2047 | 2045 | * @param int $form_id |
| 2048 | 2046 | * @param array $args |
| 2049 | 2047 | */ |
| 2050 | - echo apply_filters( 'give_form_content_output', $output, $form_id, $args ); |
|
| 2048 | + echo apply_filters('give_form_content_output', $output, $form_id, $args); |
|
| 2051 | 2049 | |
| 2052 | 2050 | // remove action to prevent content output on addition forms on page. |
| 2053 | 2051 | // @see: https://github.com/WordImpress/Give/issues/634. |
| 2054 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 2052 | + remove_action($show_content, 'give_form_display_content'); |
|
| 2055 | 2053 | } |
| 2056 | 2054 | |
| 2057 | 2055 | /** |
@@ -2063,7 +2061,7 @@ discard block |
||
| 2063 | 2061 | * |
| 2064 | 2062 | * @return void |
| 2065 | 2063 | */ |
| 2066 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 2064 | +function give_checkout_hidden_fields($form_id) { |
|
| 2067 | 2065 | |
| 2068 | 2066 | /** |
| 2069 | 2067 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -2072,14 +2070,14 @@ discard block |
||
| 2072 | 2070 | * |
| 2073 | 2071 | * @param int $form_id The form ID. |
| 2074 | 2072 | */ |
| 2075 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 2073 | + do_action('give_hidden_fields_before', $form_id); |
|
| 2076 | 2074 | |
| 2077 | - if ( is_user_logged_in() ) { |
|
| 2075 | + if (is_user_logged_in()) { |
|
| 2078 | 2076 | ?> |
| 2079 | 2077 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 2080 | 2078 | <?php } ?> |
| 2081 | 2079 | <input type="hidden" name="give_action" value="purchase"/> |
| 2082 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 2080 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 2083 | 2081 | <?php |
| 2084 | 2082 | /** |
| 2085 | 2083 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -2088,7 +2086,7 @@ discard block |
||
| 2088 | 2086 | * |
| 2089 | 2087 | * @param int $form_id The form ID. |
| 2090 | 2088 | */ |
| 2091 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 2089 | + do_action('give_hidden_fields_after', $form_id); |
|
| 2092 | 2090 | |
| 2093 | 2091 | } |
| 2094 | 2092 | |
@@ -2103,20 +2101,20 @@ discard block |
||
| 2103 | 2101 | * |
| 2104 | 2102 | * @return string $content Filtered content. |
| 2105 | 2103 | */ |
| 2106 | -function give_filter_success_page_content( $content ) { |
|
| 2104 | +function give_filter_success_page_content($content) { |
|
| 2107 | 2105 | |
| 2108 | 2106 | $give_options = give_get_settings(); |
| 2109 | 2107 | |
| 2110 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 2111 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 2112 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 2108 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 2109 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 2110 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 2113 | 2111 | } |
| 2114 | 2112 | } |
| 2115 | 2113 | |
| 2116 | 2114 | return $content; |
| 2117 | 2115 | } |
| 2118 | 2116 | |
| 2119 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 2117 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 2120 | 2118 | |
| 2121 | 2119 | /** |
| 2122 | 2120 | * Test Mode Frontend Warning. |
@@ -2127,12 +2125,12 @@ discard block |
||
| 2127 | 2125 | */ |
| 2128 | 2126 | function give_test_mode_frontend_warning() { |
| 2129 | 2127 | |
| 2130 | - if ( give_is_test_mode() ) { |
|
| 2131 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 2128 | + if (give_is_test_mode()) { |
|
| 2129 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 2132 | 2130 | } |
| 2133 | 2131 | } |
| 2134 | 2132 | |
| 2135 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 2133 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 2136 | 2134 | |
| 2137 | 2135 | /** |
| 2138 | 2136 | * Members-only Form. |
@@ -2146,21 +2144,21 @@ discard block |
||
| 2146 | 2144 | * |
| 2147 | 2145 | * @return string |
| 2148 | 2146 | */ |
| 2149 | -function give_members_only_form( $final_output, $args ) { |
|
| 2147 | +function give_members_only_form($final_output, $args) { |
|
| 2150 | 2148 | |
| 2151 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 2149 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 2152 | 2150 | |
| 2153 | 2151 | // Sanity Check: Must have form_id & not be logged in. |
| 2154 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 2152 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 2155 | 2153 | return $final_output; |
| 2156 | 2154 | } |
| 2157 | 2155 | |
| 2158 | 2156 | // Logged in only and Register / Login set to none. |
| 2159 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 2157 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 2160 | 2158 | |
| 2161 | - $final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 2159 | + $final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 2162 | 2160 | |
| 2163 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 2161 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 2164 | 2162 | |
| 2165 | 2163 | } |
| 2166 | 2164 | |
@@ -2168,7 +2166,7 @@ discard block |
||
| 2168 | 2166 | |
| 2169 | 2167 | } |
| 2170 | 2168 | |
| 2171 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 2169 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
| 2172 | 2170 | |
| 2173 | 2171 | |
| 2174 | 2172 | /** |
@@ -2180,40 +2178,40 @@ discard block |
||
| 2180 | 2178 | * @param array $args |
| 2181 | 2179 | * @param Give_Donate_Form $form |
| 2182 | 2180 | */ |
| 2183 | -function __give_form_add_donation_hidden_field( $form_id, $args, $form ) { |
|
| 2184 | - $id_prefix = ! empty( $args['id_prefix'] ) ? $args['id_prefix'] : ''; |
|
| 2181 | +function __give_form_add_donation_hidden_field($form_id, $args, $form) { |
|
| 2182 | + $id_prefix = ! empty($args['id_prefix']) ? $args['id_prefix'] : ''; |
|
| 2185 | 2183 | ?> |
| 2186 | 2184 | <input type="hidden" name="give-form-id-prefix" value="<?php echo $id_prefix; ?>"/> |
| 2187 | - <input type="hidden" name="give-form-id" value="<?php echo intval( $form_id ); ?>"/> |
|
| 2188 | - <input type="hidden" name="give-form-title" value="<?php echo esc_html( $form->post_title ); ?>"/> |
|
| 2189 | - <input type="hidden" name="give-current-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
| 2190 | - <input type="hidden" name="give-form-url" value="<?php echo esc_url( give_get_current_page_url() ); ?>"/> |
|
| 2185 | + <input type="hidden" name="give-form-id" value="<?php echo intval($form_id); ?>"/> |
|
| 2186 | + <input type="hidden" name="give-form-title" value="<?php echo esc_html($form->post_title); ?>"/> |
|
| 2187 | + <input type="hidden" name="give-current-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
| 2188 | + <input type="hidden" name="give-form-url" value="<?php echo esc_url(give_get_current_page_url()); ?>"/> |
|
| 2191 | 2189 | <?php |
| 2192 | 2190 | // Get the custom option amount. |
| 2193 | - $custom_amount = give_get_meta( $form_id, '_give_custom_amount', true ); |
|
| 2191 | + $custom_amount = give_get_meta($form_id, '_give_custom_amount', true); |
|
| 2194 | 2192 | |
| 2195 | 2193 | // If custom amount enabled. |
| 2196 | - if ( give_is_setting_enabled( $custom_amount ) ) { |
|
| 2194 | + if (give_is_setting_enabled($custom_amount)) { |
|
| 2197 | 2195 | ?> |
| 2198 | 2196 | <input type="hidden" name="give-form-minimum" |
| 2199 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/> |
|
| 2197 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/> |
|
| 2200 | 2198 | <input type="hidden" name="give-form-maximum" |
| 2201 | - value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/> |
|
| 2199 | + value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/> |
|
| 2202 | 2200 | <?php |
| 2203 | 2201 | } |
| 2204 | 2202 | |
| 2205 | 2203 | // WP nonce field. |
| 2206 | 2204 | echo str_replace( |
| 2207 | 2205 | '/>', |
| 2208 | - 'data-time="' . time() . '" data-nonce-life="' . give_get_nonce_life() . '"/>', |
|
| 2209 | - give_get_nonce_field( "give_donation_form_nonce_{$form_id}", 'give-form-hash', false ) |
|
| 2206 | + 'data-time="'.time().'" data-nonce-life="'.give_get_nonce_life().'"/>', |
|
| 2207 | + give_get_nonce_field("give_donation_form_nonce_{$form_id}", 'give-form-hash', false) |
|
| 2210 | 2208 | ); |
| 2211 | 2209 | |
| 2212 | 2210 | // Price ID hidden field for variable (multi-level) donation forms. |
| 2213 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 2211 | + if (give_has_variable_prices($form_id)) { |
|
| 2214 | 2212 | // Get the default price ID. |
| 2215 | - $default_price = give_form_get_default_level( $form_id ); |
|
| 2216 | - $price_id = isset( $default_price['_give_id']['level_id'] ) ? $default_price['_give_id']['level_id'] : 0; |
|
| 2213 | + $default_price = give_form_get_default_level($form_id); |
|
| 2214 | + $price_id = isset($default_price['_give_id']['level_id']) ? $default_price['_give_id']['level_id'] : 0; |
|
| 2217 | 2215 | |
| 2218 | 2216 | echo sprintf( |
| 2219 | 2217 | '<input type="hidden" name="give-price-id" value="%s"/>', |
@@ -2222,7 +2220,7 @@ discard block |
||
| 2222 | 2220 | } |
| 2223 | 2221 | } |
| 2224 | 2222 | |
| 2225 | -add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 ); |
|
| 2223 | +add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3); |
|
| 2226 | 2224 | |
| 2227 | 2225 | /** |
| 2228 | 2226 | * Add currency settings on donation form. |
@@ -2234,20 +2232,20 @@ discard block |
||
| 2234 | 2232 | * |
| 2235 | 2233 | * @return array |
| 2236 | 2234 | */ |
| 2237 | -function __give_form_add_currency_settings( $form_html_tags, $form ) { |
|
| 2238 | - $form_currency = give_get_currency( $form->ID ); |
|
| 2239 | - $currency_settings = give_get_currency_formatting_settings( $form_currency ); |
|
| 2235 | +function __give_form_add_currency_settings($form_html_tags, $form) { |
|
| 2236 | + $form_currency = give_get_currency($form->ID); |
|
| 2237 | + $currency_settings = give_get_currency_formatting_settings($form_currency); |
|
| 2240 | 2238 | |
| 2241 | 2239 | // Check if currency exist. |
| 2242 | - if ( empty( $currency_settings ) ) { |
|
| 2240 | + if (empty($currency_settings)) { |
|
| 2243 | 2241 | return $form_html_tags; |
| 2244 | 2242 | } |
| 2245 | 2243 | |
| 2246 | - $form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency ); |
|
| 2244 | + $form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency); |
|
| 2247 | 2245 | $form_html_tags['data-currency_code'] = $form_currency; |
| 2248 | 2246 | |
| 2249 | - if ( ! empty( $currency_settings ) ) { |
|
| 2250 | - foreach ( $currency_settings as $key => $value ) { |
|
| 2247 | + if ( ! empty($currency_settings)) { |
|
| 2248 | + foreach ($currency_settings as $key => $value) { |
|
| 2251 | 2249 | $form_html_tags["data-{$key}"] = $value; |
| 2252 | 2250 | } |
| 2253 | 2251 | } |
@@ -2255,7 +2253,7 @@ discard block |
||
| 2255 | 2253 | return $form_html_tags; |
| 2256 | 2254 | } |
| 2257 | 2255 | |
| 2258 | -add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 ); |
|
| 2256 | +add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2); |
|
| 2259 | 2257 | |
| 2260 | 2258 | /** |
| 2261 | 2259 | * Adds classes to progress bar container. |
@@ -2266,7 +2264,7 @@ discard block |
||
| 2266 | 2264 | * |
| 2267 | 2265 | * @return string |
| 2268 | 2266 | */ |
| 2269 | -function add_give_goal_progress_class( $class_goal ) { |
|
| 2267 | +function add_give_goal_progress_class($class_goal) { |
|
| 2270 | 2268 | $class_goal = 'progress progress-striped active'; |
| 2271 | 2269 | |
| 2272 | 2270 | return $class_goal; |
@@ -2281,7 +2279,7 @@ discard block |
||
| 2281 | 2279 | * |
| 2282 | 2280 | * @return string |
| 2283 | 2281 | */ |
| 2284 | -function add_give_goal_progress_bar_class( $class_bar ) { |
|
| 2282 | +function add_give_goal_progress_bar_class($class_bar) { |
|
| 2285 | 2283 | $class_bar = 'bar'; |
| 2286 | 2284 | |
| 2287 | 2285 | return $class_bar; |
@@ -2298,12 +2296,12 @@ discard block |
||
| 2298 | 2296 | * |
| 2299 | 2297 | * @return array |
| 2300 | 2298 | */ |
| 2301 | -function add_class_for_form_grid( $class, $id, $args ) { |
|
| 2299 | +function add_class_for_form_grid($class, $id, $args) { |
|
| 2302 | 2300 | $class[] = 'give-form-grid-wrap'; |
| 2303 | 2301 | |
| 2304 | - foreach ( $class as $index => $item ) { |
|
| 2305 | - if ( false !== strpos( $item, 'give-display-' ) ) { |
|
| 2306 | - unset( $class[ $index ] ); |
|
| 2302 | + foreach ($class as $index => $item) { |
|
| 2303 | + if (false !== strpos($item, 'give-display-')) { |
|
| 2304 | + unset($class[$index]); |
|
| 2307 | 2305 | } |
| 2308 | 2306 | } |
| 2309 | 2307 | |
@@ -2319,7 +2317,7 @@ discard block |
||
| 2319 | 2317 | * |
| 2320 | 2318 | * @since 2.1 |
| 2321 | 2319 | */ |
| 2322 | -function give_is_form_grid_page_hidden_field( $id, $args, $form ) { |
|
| 2320 | +function give_is_form_grid_page_hidden_field($id, $args, $form) { |
|
| 2323 | 2321 | echo '<input type="hidden" name="is-form-grid" value="true" />'; |
| 2324 | 2322 | } |
| 2325 | 2323 | |
@@ -2334,18 +2332,18 @@ discard block |
||
| 2334 | 2332 | * @since 2.1 |
| 2335 | 2333 | * @return string |
| 2336 | 2334 | */ |
| 2337 | -function give_redirect_and_popup_form( $redirect, $args ) { |
|
| 2335 | +function give_redirect_and_popup_form($redirect, $args) { |
|
| 2338 | 2336 | |
| 2339 | 2337 | // Check the page has Form Grid. |
| 2340 | - $is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : ''; |
|
| 2338 | + $is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : ''; |
|
| 2341 | 2339 | |
| 2342 | - if ( 'true' === $is_form_grid ) { |
|
| 2340 | + if ('true' === $is_form_grid) { |
|
| 2343 | 2341 | |
| 2344 | - $payment_mode = give_clean( $_POST['payment-mode'] ); |
|
| 2342 | + $payment_mode = give_clean($_POST['payment-mode']); |
|
| 2345 | 2343 | $form_id = $args['form-id']; |
| 2346 | 2344 | |
| 2347 | 2345 | // Get the URL without Query parameters. |
| 2348 | - $redirect = strtok( $redirect, '?' ); |
|
| 2346 | + $redirect = strtok($redirect, '?'); |
|
| 2349 | 2347 | |
| 2350 | 2348 | // Add query parameters 'form-id' and 'payment-mode'. |
| 2351 | 2349 | $redirect = add_query_arg( |
@@ -2360,4 +2358,4 @@ discard block |
||
| 2360 | 2358 | return $redirect; |
| 2361 | 2359 | } |
| 2362 | 2360 | |
| 2363 | -add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 ); |
|
| 2361 | +add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2); |
|